BTB Finance for agents

Protocols / Lending

Aave V2

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.

On-chainEVM4 contractsWebsite · Docs

get_protocol({ "protocol": "aave-v2" })

Risks an agent should know

What an agent can do

supplyDeposit an asset to earn interest
approve the Pool for the amount, then Pool.deposit(asset, amount, onBehalfOf, 0); aTokens are minted to onBehalfOf
withdrawWithdraw a supplied asset
Pool.withdraw(asset, amount, to); pass type(uint256).max to withdraw the full balance
borrowBorrow against collateral
check getUserAccountData(user).healthFactor first, then Pool.borrow(asset, amount, 2, 0, onBehalfOf) for variable rate (or 1 for stable where enabled)
repayRepay a borrow
approve 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 collateral
Pool.setUserUseReserveAsCollateral(asset, true or false)
check-positionRead collateral, debt and health factor
Pool.getUserAccountData(user); healthFactor below 1e18 means liquidatable

Contracts

ethereum · chain id 1

ContractAddressKey functionsTry
LendingPool (Ethereum main market)
pool · proxy
0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9
source
writedeposit(address,uint256,address,uint16)
writewithdraw(address,uint256,address)
writeborrow(address,uint256,uint256,uint16,address)
writerepay(address,uint256,uint256,address)
writesetUserUseReserveAsCollateral(address,bool)
writeswapBorrowRateMode(address,uint256)
readgetUserAccountData(address)
readgetReserveData(address)
+1 more via get_protocol
Full ABI
AaveProtocolDataProvider (Ethereum)
other
0x057835Ad21a177dbdd3090bB1CAE03EaCF78Fc6d
source
readgetAllReservesTokens()
readgetUserReserveData(address,address)
readgetReserveConfigurationData(address)
Full ABI

avalanche · chain id 43114

ContractAddressKey functionsTry
LendingPool (Avalanche main market)
pool · proxy
0x4F01AeD16D97E3aB5ab2B501154DC9bb0F1A5A2C
source
writedeposit(address,uint256,address,uint16)
writewithdraw(address,uint256,address)
writeborrow(address,uint256,uint256,uint16,address)
writerepay(address,uint256,uint256,address)
readgetUserAccountData(address)
Full ABI

polygon · chain id 137

ContractAddressKey functionsTry
LendingPool (Polygon main market)
pool · proxy
0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf
source
writedeposit(address,uint256,address,uint16)
writewithdraw(address,uint256,address)
writeborrow(address,uint256,uint256,uint16,address)
writerepay(address,uint256,uint256,address)
readgetUserAccountData(address)
Full ABI

Notes

Addresses come from Aave's bgd-labs address book (AaveV2Ethereum.sol, AaveV2Avalanche.sol, AaveV2Polygon.sol), which links each address to its block explorer page. On Ethereum, the pool proxy, its implementation (0x02D84abD89Ee9DB409572f19B6e1596c301F3c81, verified on Sourcify, source of the function signatures above) and the data provider were checked on chain. The Avalanche and Polygon pool proxies and data providers have code on chain, but their implementations were not checked on Sourcify, so their function lists assume the same V2 interface as Ethereum. The pool proxies are upgradeable, so read the current Pool from the LendingPoolAddressesProvider (Ethereum 0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5, Avalanche 0xb6A86025F0FE1862B372cb0ca18CE3EDe02A318f, Polygon 0xd05e3E715d945B59290df0ae8eF85c1BdB684744) if you need to confirm the address at run time.

Sources

Researched 2026-11-28. Addresses are copied from the official sources above; check them before moving large amounts.