Aave V2 - Polygon

Lending & Borrowing. AaveV2-v1.1 connector on polygon triggers methods like deposit, withdraw, borrow, payback, paybackOnBehalfOf, enableCollateral, swapBorrowRateMode. You can view details like source code, ABIs on Polygonscan.

  • Use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee to indicate MATIC.
  • 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 MATIC: 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 MATIC: 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 MATIC: 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 MATIC: 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.

PaybackOnBehalfOf

Payback debt owed on behalf os a user.

spells.add({  connector: "AAVE-V2-A",  method: "paybackOnBehalfOf",  args: [token, amt, rateMode, onBehalfOf, 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)
onBehalfOf address Address of user who's debt to repay.
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 MATIC: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)
rateMode uint256 Current 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.