Contracts
15
8 contracts · 7 libraries · 3 outside
Flows
5
Supply · Borrow · Repay · Liquidation · Flash loan
Source
2/15
Source for 2 of 15 · BUSL-1.1
Pinned
v3.5.0
1 repo · commit 25115b2
Pooled lending market: suppliers earn interest through aTokens, borrowers take variable-rate loans against collateral, unhealthy positions are liquidated.
One Pool per market holds the books for every reserve (asset). The Pool itself is thin: each action is delegated to an external logic library (SupplyLogic, BorrowLogic, LiquidationLogic, FlashLoanLogic) that runs on the Pool's storage. Liquidity sits in each reserve's aToken; debt is a non-transferable VariableDebtToken. Interest accrues through two indexes per reserve (liquidity and variable borrow), moved forward on every action. Prices come from AaveOracle; roles from ACLManager; addresses of everything from PoolAddressesProvider.
LendingEthereum and EVM L2s
Entry
Logic
Tokens
Config and prices
Outside
Poolabstract
Main entry point. Every user action starts here: supply, withdraw, borrow, repay, liquidationCall, flashLoan. It reads the reserve and user books from its storage and delegates the work to the logic libraries. Deployed behind a proxy; PoolInstance is the concrete implementation.
63 entry points69 functions14 storage16 eventsPool.sol:39
Inherits Multicall, IPool, PoolStorage, VersionedInitializable
Deposit an asset, receive aTokens that grow with interest.
Supplier starts
Approves the Pool for the asset, then calls supply(asset, amount, onBehalfOf, referralCode).
SupplyLogic.executeSupply
Runs by DELEGATECALL, so every write lands in the Pool's storage.
SupplyLogic.sol:41 on GitHubReserveLogic.updateState
Accrues interest since the last action: moves the liquidity and variable borrow indexes to now and books the treasury's share.
ReserveLogic.sol:85 on GitHubValidationLogic.validateSupply
Amount not zero; reserve active, not paused, not frozen; supply cap not exceeded; onBehalfOf is not the aToken itself.
ValidationLogic.sol:65 on GitHubReserveLogic.updateInterestRatesAndVirtualBalance
Adds the amount to the reserve's virtual balance and asks the rate strategy for new rates.
ReserveLogic.sol:130 on GitHubIERC20.transferFrom
The underlying moves from the supplier straight into the aToken contract, which holds the reserve's liquidity.
AToken.mint
Mints the amount divided by the liquidity index (scaled balance) to onBehalfOf.
AToken.sol:64 on GitHubValidationLogic.validateAutomaticUseAsCollateral
On a first supply, decides whether the asset is switched on as collateral automatically (an isolated asset only when the supplier holds the isolated collateral supplier role).
ValidationLogic.sol:600 on GitHubPool emit Supply
Emits Supply(reserve, user, onBehalfOf, amount, referralCode).
IPool.sol:21 on GitHub0/23 checked
Mapped: the Pool, its configurator and logic libraries, both tokens, registry, roles, oracle and rate strategy. Not mapped: periphery (rewards, gateways, data providers, StataToken), GHO, governance.
forge Version: 1.5.1-stable