Borrow

Aave V2 Action Plugin - Borrow

Description

Borrows amount of asset with interestRateMode, sending the amount to msg.sender, with the debt being incurred by onBehalfOf.

Method

borrow(address, uint256, uint256, uint16, address)

Input Parameters

No required parameters.

Method Parameters

NamePlugin TypeDescription

asset

FctAddress

Address of the underlying asset

amount

FctValue

Amount to be borrowed

interestRateMode

FctValue

The type of borrow debt. Stable - 1 Variable - 2

referralCode (optional)

FctValue16

No longer supported by Aave. 0 by default

onBehalfOf

FctAddress

Address of user who will incur the debt

Returned Values

No returned values

Example

Example with initParams

const borrow = new AaveV2.actions.Borrow({
   chainId: 1,
   initParams: {
     methodParams: {
       asset: "0x...",
       amount: "100000000",
       interestRateMode: "1",
       onBehalfOf: "0x..."
     }
   }
})

Example without initParams

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

borrow.input.set({
    methodParams: {
       asset: "0x...",
       amount: "100000000",
       interestRateMode: "1",
       onBehalfOf: "0x..."
    }
})

Learn more

Learn more about Aave V2 borrow function here

Last updated