BTB
/

Aave V2

Lendingwebsite
The previous generation Aave lending market, still holding funds on Ethereum, Avalanche and Polygon. An agent can supply assets to earn aTokens, withdraw them, borrow against collateral and repay debt. New activity is better done on Aave V3.

What you can do

supplyDeposit an asset to earn interestapprove the Pool for the amount, then Pool.deposit(asset, amount, onBehalfOf, 0); aTokens are minted to onBehalfOf
withdrawWithdraw a supplied assetPool.withdraw(asset, amount, to); pass type(uint256).max to withdraw the full balance
borrowBorrow against collateralcheck getUserAccountData(user).healthFactor first, then Pool.borrow(asset, amount, 2, 0, onBehalfOf) for variable rate (or 1 for stable where enabled)
repayRepay a borrowapprove the Pool for the amount, then Pool.repay(asset, amount, rateMode, onBehalfOf); use type(uint256).max to clear the debt
toggle-collateralEnable or disable a supplied asset as collateralPool.setUserUseReserveAsCollateral(asset, true or false)
check-positionRead collateral, debt and health factorPool.getUserAccountData(user); healthFactor below 1e18 means liquidatable
Aave V2 is the legacy market. Aave points new users to V3, and V2 receives fewer updates. Check the Aave announcements before using it.
Positions can be liquidated if the health factor falls below 1. Keep a margin above 1 and check it after each borrow or price move.
Stable rate borrowing exists on V2 but is only available on some reserves. Check the reserve configuration first.
Aave governance and its guardians can freeze reserves or pause the market.

Contracts

Read any function, or build a write and sign it. Amounts are in base units (1 USDC = 1000000).
LendingPool (Ethereum main market)pool on ethereum0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9
write deposit(address,uint256,address,uint16)
Supply an asset and receive aTokens. Arguments: asset, amount in the token's smallest unit, onBehalfOf, referralCode (0 for none). Approve the Pool for the amount first.
write withdraw(address,uint256,address)
Withdraw a supplied asset. Arguments: asset, amount (type(uint256).max for the full balance), recipient. Reverts if the health factor would drop below 1 while the caller has debt.
write borrow(address,uint256,uint256,uint16,address)
Borrow an asset against collateral. Arguments: asset, amount, interestRateMode (1 for stable, 2 for variable), referralCode, onBehalfOf. Stable mode is only available on reserves where it is enabled. Reverts if the health factor would fall below 1.
write repay(address,uint256,uint256,address)
Repay debt. Arguments: asset, amount (type(uint256).max to repay the full debt), interestRateMode (1 stable, 2 variable), onBehalfOf. Approve the Pool for the amount first.
write setUserUseReserveAsCollateral(address,bool)
Enable or disable a supplied asset as collateral. Disabling reverts if it would push the caller's health factor below 1.
write swapBorrowRateMode(address,uint256)
Switch an existing borrow between stable (1) and variable (2) rate. Arguments: asset, current rate mode (1 or 2) of the debt being switched.
read getUserAccountData(address)
Returns totalCollateralETH, totalDebtETH, availableBorrowsETH, currentLiquidationThreshold, ltv and healthFactor for a user. Values are in ETH with 18 decimals. healthFactor below 1e18 means liquidatable.
read getReserveData(address)
Reserve state for an asset: liquidity and borrow rates, indexes, and the aToken, stable debt token and variable debt token addresses.
read getReservesList()
List of all reserve asset addresses in the market.
AaveProtocolDataProvider (Ethereum)other on ethereum0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d
read getAllReservesTokens()
Returns symbol and address pairs for every reserve. Use it to map symbols to token addresses.
read getUserReserveData(address,address)
A user's supplied and borrowed balances for one asset. Arguments: asset, user.
read getReserveConfigurationData(address)
Risk parameters for an asset: LTV, liquidation threshold, decimals, and whether it is active, frozen or borrowing enabled.
LendingPool (Avalanche main market)pool on avalanche0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C
write deposit(address,uint256,address,uint16)
Supply an asset on Avalanche and receive aTokens. Arguments: asset, amount, onBehalfOf, referralCode (0 for none). Approve the Pool for the amount first.
write withdraw(address,uint256,address)
Withdraw a supplied asset on Avalanche. Arguments: asset, amount (type(uint256).max for full balance), recipient.
write borrow(address,uint256,uint256,uint16,address)
Borrow on Avalanche. Arguments: asset, amount, interestRateMode (1 stable, 2 variable), referralCode, onBehalfOf.
write repay(address,uint256,uint256,address)
Repay debt on Avalanche. Arguments: asset, amount, interestRateMode, onBehalfOf. Approve the Pool for the amount first.
read getUserAccountData(address)
Collateral, debt, borrow capacity and health factor for a user on the Avalanche market. Values use the market's base currency with 18 decimals. healthFactor below 1e18 means liquidatable.
LendingPool (Polygon main market)pool on polygon0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf
write deposit(address,uint256,address,uint16)
Supply an asset on Polygon and receive aTokens. Arguments: asset, amount, onBehalfOf, referralCode (0 for none). Approve the Pool for the amount first.
write withdraw(address,uint256,address)
Withdraw a supplied asset on Polygon. Arguments: asset, amount (type(uint256).max for full balance), recipient.
write borrow(address,uint256,uint256,uint16,address)
Borrow on Polygon. Arguments: asset, amount, interestRateMode (1 stable, 2 variable), referralCode, onBehalfOf.
write repay(address,uint256,uint256,address)
Repay debt on Polygon. Arguments: asset, amount, interestRateMode, onBehalfOf. Approve the Pool for the amount first.
read getUserAccountData(address)
Collateral, debt, borrow capacity and health factor for a user on the Polygon market. Values use the market's base currency with 18 decimals. healthFactor below 1e18 means liquidatable.