Aave V2

Lending & Borrowing.

AaveV2-v1 connector triggers methods like deposit, withdraw, borrow, payback, enableCollateral, swapBorrowRateMode.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate AVAX.
  • use -1 or dsa.maxValue for the maximum amount in function.
  • If not sure about the arguments getId and setId, pass 0.

Deposit

Deposit a token to Aave v2 for lending / collaterization.

spells.add({
  connector: "AAVE-V2-A",
  method: "deposit",
  args: [token, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to deposit.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount of the token to deposit. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens deposited.

Withdraw

Withdraw deposited token from Aave v2

spells.add({
  connector: "AAVE-V2-A",
  method: "withdraw",
  args: [token, amt, getId, setId]
});
Parameter Type Description
token address The address of the token to withdraw.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount of the token to withdraw. (For max: `uint256(-1)`)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens withdrawn.

Borrow

Borrow a token using Aave v2

spells.add({
  connector: "AAVE-V2-A",
  method: "borrow",
  args: [token, amt, rateMode, getId, setId]
});
Parameter Type Description
token address The address of the token to borrow.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount of the token to borrow.
rateMode uint256 The type of borrow debt. (For Stable: 1, Variable: 2)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens borrowed.

Payback

Payback debt owed.

spells.add({
  connector: "AAVE-V2-A",
  method: "payback",
  args: [token, amt, rateMode, getId, setId]
});
Parameter Type Description
token address The address of the token to payback.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
amt uint256 The amount of the token to payback. (For max: `uint256(-1)`)
rateMode uint256 The type of debt paying back. (For Stable: 1, Variable: 2)
getId uint256 ID to retrieve amt.
setId uint256 ID stores the amount of tokens paid back.

EnableCollateral

Enable an array of tokens as collateral

spells.add({
  connector: "AAVE-V2-A",
  method: "enableCollateral",
  args: [tokens]
});
Parameter Type Description
tokens address[] Array of tokens to enable collateral

SwapBorrowRateMode

Swaps user borrow rate mode between variable and stable

spells.add({
  connector: "AAVE-V2-A",
  method: "swapBorrowRateMode",
  args: [token, rateMode]
});
Parameter Type Description
token address The address of the token to swap borrow rate.(For AVAX: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
rateMode uint Desired borrow rate mode. (Stable = 1, Variable = 2)

If you still can't find something you're looking for or have any questions, ask them at our developers community on Discord or simply send an Email.

Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.