aave
Installation
SKILL.md
Aave V3
Aave V3 is the dominant on-chain lending protocol. Users supply assets to earn yield and borrow against collateral. The protocol runs on Ethereum, Arbitrum, Optimism, Base, Polygon, and other EVM chains with identical interfaces. All interaction goes through the IPool contract.
What You Probably Got Wrong
LLMs confuse V2 and V3 constantly. V3 has different interfaces, different addresses, and different behavior. These corrections are non-negotiable.
- V3 is not V2 — different interfaces everywhere — V2 uses
LendingPoolwithdeposit(). V3 usesPoolwithsupply(). The function signatures, events, and return types differ. If you seeILendingPoolordeposit(), you are writing V2 code. Stop. - aTokens rebase — balance changes every block —
aToken.balanceOf(user)increases each block as interest accrues. This is not a transfer. Do not try to track balances with Transfer events alone. UsebalanceOf()at read time orscaledBalanceOf()for the underlying non-rebasing amount. - Stable rate borrowing is deprecated on most markets — Aave governance disabled stable rate borrows on Ethereum mainnet and most L2 deployments. Use
VARIABLE_RATE = 2for theinterestRateModeparameter. PassingSTABLE_RATE = 1will revert on markets where it is disabled. - Health factor is 18-decimal fixed point, not a percentage —
getUserAccountData()returnshealthFactoras auint256with 18 decimals. A health factor of1e18means liquidation threshold. Below1e18= liquidatable. Do not divide by 100. - Flash loan fee is 0.05% on V3, not 0.09% — V3 reduced the default flash loan premium from 0.09% (V2) to 0.05%. The exact fee is configurable per market via governance. Check
FLASHLOAN_PREMIUM_TOTALon the Pool contract. - E-Mode changes collateral/borrow parameters — Enabling E-Mode (Efficiency Mode) overrides LTV, liquidation threshold, and liquidation bonus for assets in the same category (e.g., stablecoins). It does NOT change the underlying asset. Forgetting this causes incorrect health factor calculations.
- Supply caps exist in V3 — V3 introduced per-asset supply and borrow caps.
supply()will revert if the cap is reached. Always checkgetReserveData()forsupplyCapbefore large deposits. - V3 addresses are different per chain AND per market — Ethereum has a "Main" market and a "Lido" market with completely different Pool addresses. Always verify you are targeting the correct market.