Aave v2
Resources
Architecture
Pool
The main entry point into the Aave Protocol. Most interactions with Aave will happen via the Pool, including:
deposit()
borrow()
repay()
setUserUseReserveAsCollateral()
withdraw()
flashloan()
liquidationCall()
PoolAddressesProvider
The main addresses register of the protocol, for particular markets. The latest contract addresses should be retrieved from this contract by making the appropriate calls.
PoolAddressesProviderRegistry
Contains a list of active PoolAddressesProvider addresses, for different markets.
aTokens
The yield-generating, tokenized representation of supplies used throughout the Aave protocol. They implement most of the standard EIP-20/ERC20 token methods with slight modifications, as well as Aave-specific methods including:
scaledBalanceOf()
getScaledUserBalanceAndSupply()
scaledTotalSupply()
All aTokens also implement EIP-2612, which via the permit() function enables single transaction approve + actions.
Variable Debt Tokens
The tokenized borrow positions used throughout the Aave protocol. Most of the standard EIP-20/ERC20 methods are disabled since debt tokens are non-transferrable.
Supporting Contracts
The following contracts should generally not be interacted with directly, but are used throughout the Aave Protocol via contract calls.
PoolCollateralManager
Using delegatecall via the Pool contract, the PoolCollateralManager implements actions involving the management of collateral in the protocol, including:
liquidationCall()
This function should only be called via the main Pool contract.
Pool Configurator
Provides configuration functions for the Pool contracts. It has a number of important functions, such as:
Activates / Deactivates reserves
Enables / Disables borrowing for a reserve
Enables / Disables using a reserve as collateral
Enables / Disables stable rate borrowing for a reserve
Freezes / Unfreezes reserves
Updates a reserve's Loan to Value
Updates a reserve's liquidation threshold
Updates a reserve's liquidation bonus
Updates a reserve's decimals
Updates a reserve's interest rate strategy address
Activates / Deactivates all functions of a Pool in emergencies
For all of the above functions, relevant events are emitted to the blockchain. Anyone can monitor these changes to know when values have been modified or added/removed.
Interest Rate Strategy
Holds the information needed to calculate and update the interest rates of specific reserves. Each contract stores the optimized base curves using the corresponding parameters of each currency. The parameters for the optimized base curves are:
baseVariableBorrowRate
variableRateSlope1
variableRateSlope2
stableRateSlope1
stableRateSlope2
The interest rates are calculated depending on the available liquidity and the total borrowed amount.