
Aave V3 Lending
Supply assets to Aave V3 to earn interest, or deposit collateral to borrow.
Overview
Supply assets to Aave V3 to earn interest, or deposit collateral to borrow.
Facts
0xA238Dd80C259a72e81d7e4664a9801593F98d1c50x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E20x794a61358D6845594F94dc1DB02A252b5b4814aD0x6Ae43d3271ff6888e7Fc43Fd7321a503ff7389510xd82a47fdebB5bf5329b09441C3DaB4b1c1C9F8790x7B4EB56E7CD4b454BA8ff71E4518426369a138a30x69FA688f1Dc47d4B5d8029D5a35FB7a5483106540x927F584d4321C1dCcBf5e2902368124b02419a1eAave V3 Pool:
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;function withdraw(address asset, uint256 amount, address to) external returns (uint256);function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external;function repay(address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf) external returns (uint256);
ERC-20 token:
function approve(address spender, uint256 amount) external returns (bool);function allowance(address owner, address spender) external view returns (uint256);
Preflight Checks
Run all checks via eth_call before supplying or borrowing.
### 1 · Reserve active / frozen status
data_provider.getReserveConfigurationData(asset) on AaveProtocolDataProvider.
function getReserveConfigurationData(address asset) external view returns (uint256 decimals, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen);
isActive = false → reserve deactivated; abort all operationsisFrozen = true → new supply/borrow blocked; withdraw/repay still allowedborrowingEnabled = false → borrow will revert### 2 · Supply / borrow caps
data_provider.getReserveCaps(asset).
function getReserveCaps(address asset) external view returns (uint256 borrowCap, uint256 supplyCap);
supplyCap / borrowCap are in whole token units (no decimals scaling). 0 = uncapped. Check remaining headroom before supplying large amounts.
### 3 · Paused status
isPaused is encoded at bit 60 of the Pool configuration bitmap. Call Pool.getConfiguration(asset) and evaluate (data >> 60) & 1.
function getConfiguration(address asset) external view returns ((uint256 data));
(data >> 60) & 1 == 1 → reserve is paused; all supply/borrow/repay/withdraw ops will revert until unpaused.
Typical Flows
Supply — up to 2 tx:
allowance(agentAddress, pool) on token contract; skip approve if allowance >= amountapprove(pool, amount) on token contractsupply(token, amount, onBehalfOf: agentAddress, 0) on PoolWithdraw — 1 tx:
withdraw(token, amount, to: agentAddress) on Pool — pass type(uint256).max to withdraw full balanceBorrow — 1 tx:
(Requires prior collateral supply. Run Preflight Check 1 for borrowingEnabled and Check 2 for borrow cap first.)
borrow(token, amount, 2, 0, agentAddress) on Pool — interestRateMode=2 (variable)Repay — up to 2 tx:
allowance(agentAddress, pool) on token contract; skip approve if allowance >= amountapprove(pool, amount) on token contractrepay(token, amount, 2, agentAddress) on Pool — pass type(uint256).max to repay full debtPolicy Controls
allowance(agentAddress, pool) >= amount, skip the approve tx entirely.approve on the token address; approving the pool address directly will have no effect.0 before a new non-zero value. Pattern: approve(pool, 0) → approve(pool, amount).0x94a9...E4C8 USDC, 0xC558...9a3c WETH). Using Circle Sepolia USDC (0x1c7D...7238) or standard Sepolia WETH9 (0xfFf9...D6B14) will not match the listed reserves.References
https://aave.com/docs/llms.txt — Aave V3 Pool ABI, supply/borrow/withdraw flow, aToken accounting, asset configs per chain.