Borrow

Compound V2 Action Plugin - Borrow

Description

The borrow function transfers an asset from the protocol to the user, and creates a borrow balance which begins accumulating interest based on the Borrow Rate for the asset.

Method

borrow(uint256)

Input Parameters

NamePlugin TypeSolidity TypeDescription

to

FctAddress

address

cToken address

Method Parameters

NamePlugin TypeSolidity TypeDescription

borrowAmount

FctValue

uint256

Borrowed amount

Returned Values

NamePlugin TypeSolidity TypeDescription

result

FctValue

uint256

If result is 0 - success

Example

Example with initParams

const borrow = new CompoundV2.actions.Borrow({
   chainId: 1,
   initParams: {
     to: "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC
     methodParams: {
       borrowAmount: "100000"
     }
   }
})

Example without initParams

const borrow = new CompoundV2.actions.Borrow({ chainId: 1 })

borrow.input.set({
    to: "0x39AA39c021dfbaE8faC545936693aC917d5E7563", // cUSDC
    methodParams: {
      borrowAmount: "100000"
    }
})

Learn more

Learn more about Compound V2 borrow method here

Last updated