Cobo Agentic Wallet
Aave V3 Lending

Aave V3 Lending

Supply assets to Aave V3 to earn interest, or deposit collateral to borrow.

CategoryDeFi
ChainsBASE_ETHETHMATICSETH
C
Cobo· Author
27 views·63 uses

Overview

Supply assets to Aave V3 to earn interest, or deposit collateral to borrow.

Facts

aave_v3_pool (BASE_ETH): 0xA238Dd80C259a72e81d7e4664a9801593F98d1c5
aave_v3_pool (ETH): 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2
aave_v3_pool (MATIC): 0x794a61358D6845594F94dc1DB02A252b5b4814aD
aave_v3_pool (SETH): 0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951
data_provider (BASE_ETH): 0xd82a47fdebB5bf5329b09441C3DaB4b1c1C9F879
data_provider (ETH): 0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3
data_provider (MATIC): 0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654
data_provider (SETH): 0x927F584d4321C1dCcBf5e2902368124b02419a1e
target_in: aave_v3_pool + token contract
interest rate mode: 2 = variable (stable rate deprecated in V3)

Aave V3 Pool:

solidity
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:

solidity
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.

solidity
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 operations
isFrozen = true → new supply/borrow blocked; withdraw/repay still allowed
borrowingEnabled = false → borrow will revert

### 2 · Supply / borrow caps

data_provider.getReserveCaps(asset).

solidity
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.

solidity
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:

1.Check allowance(agentAddress, pool) on token contract; skip approve if allowance >= amount
2.approve(pool, amount) on token contract
3.supply(token, amount, onBehalfOf: agentAddress, 0) on Pool

Withdraw — 1 tx:

1.withdraw(token, amount, to: agentAddress) on Pool — pass type(uint256).max to withdraw full balance

Borrow — 1 tx:

(Requires prior collateral supply. Run Preflight Check 1 for borrowingEnabled and Check 2 for borrow cap first.)

1.borrow(token, amount, 2, 0, agentAddress) on Pool — interestRateMode=2 (variable)

Repay — up to 2 tx:

1.Check allowance(agentAddress, pool) on token contract; skip approve if allowance >= amount
2.approve(pool, amount) on token contract
3.repay(token, amount, 2, agentAddress) on Pool — pass type(uint256).max to repay full debt

Policy Controls

Check allowance before approve: If allowance(agentAddress, pool) >= amount, skip the approve tx entirely.
Approve target is the token contract, not the Aave Pool: Call approve on the token address; approving the pool address directly will have no effect.
USDT allowance reset (ETH mainnet): USDT requires setting allowance to 0 before a new non-zero value. Pattern: approve(pool, 0)approve(pool, amount).
Approve must confirm before supply: Supply reverts if approve is unconfirmed.
Variable rates: APY changes with pool utilization; never assume fixed rate.
Utilization risk: Near 100% utilization may temporarily block withdrawals.
Policy denial: Parse reason (per-tx limit vs daily cap); retry with compliant params.
Not applicable for: tokens not listed in the Aave V3 pool on the target chain
Testnet: No real value; use Aave's Sepolia faucet/market assets, not Circle Sepolia USDC or standard Sepolia WETH9. Asset address mismatch: Aave Sepolia pool supports Aave test assets (0x94a9...E4C8 USDC, 0xC558...9a3c WETH). Using Circle Sepolia USDC (0x1c7D...7238) or standard Sepolia WETH9 (0xfFf9...D6B14) will not match the listed reserves.
Partial reference: use web search for unlisted tokens, contracts, parameters, or up-to-date addresses

References

Docs: https://aave.com/docs/llms.txt — Aave V3 Pool ABI, supply/borrow/withdraw flow, aToken accounting, asset configs per chain.