Aave V2
Resources
Architecture
LendingPool
The main entry point into the Aave Protocol. Most interactions with Aave will happen via the Lending, including:
deposit()borrow()repay()setUser Use Reserve As Collateral() withdraw()flashLoan() liquidationCall()
LendingPoolAddressesProvider
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.
LendingPoolAddressesProviderRegistry
Contains a list of active Lending addresses, for different markets.
aTokens
The yield-generating, tokenized representation of supplies used throughout the Aave protocol. They implement most of the standard ERC-20 token methods with slight modifications, as well as Aave-specific methods including:
scaledBalance Of() getScaled User Balance And Supply() scaledTotal Supply()
All aTokens also implement EIP-2612, which via the permit() function enables single transaction approve + actions.
Debt Tokens
The tokenized borrow positions used throughout the Aave protocol, issued as variable debt tokens and stable debt tokens. Most of the standard ERC-20 methods are disabled since debt tokens are non-transferable.
Supporting Contracts
The following contracts should generally not be interacted with directly, but are used throughout the Aave Protocol via contract calls.
LendingPoolCollateralManager
Using delegatecall via the Lending contract, the Lending implements actions involving the management of collateral in the protocol, including:
liquidationCall()
This function should only be called via the main Lending contract.
LendingPoolConfigurator
Provides configuration functions for the Lending contract. 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:
baseVariable Borrow Rate variableRate Slope1 variableRate Slope2 stableRate Slope1 stableRate Slope2
The interest rates are calculated depending on the available liquidity and the total borrowed amount.