The Aave Protocol contracts are open source and all source code can be found on Github. An overview of the contracts is below, with more details for developers in the following pages.
LendingPoolCore contract holds the state of every reserve and all assets deposited, as well as the basic logic (e.g. calculations using the stored data).
(Not shown in above diagram) The
LendingPoolAddressesProvider is a global addresses register of the protocol. This contract is immutable and the address will never change. For more information, see the Address Provider section of the documentation.
LendingPoolDataProvider contract performs calculations and provides data for the
LendingPool contract, specifically:
Calculates the ETH equivalent of a user's balance to assess the borrow limit of a user and the health factor of their positions.
Aggregates data from
LendingPoolCore to provide high level information to the
Calculates the Average Loan to Value and Average Liquidation Ratio.
LendingPool contract uses both the
LendingPoolDataProvider to interact with the reserves. This is the main contract developers should interface with. See the
LendingPool section of the documentation.
LendingPool also manages the tokenization of users' lending position via aTokens.
LendingPoolConfigurator contract provides configuration functions for the
LendingPoolCore contracts. It also has a number of important functions:
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.
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.
The contract is owned by the
LendingPoolManager, as defined in the
InterestRateStrategy contract holds the information needed to calculate and update the interest rates of specific reserves.
Each contract stores the optimised base curves using the corresponding parameters of each currency. This means that there is a mathematical function which determines the interest rate of each asset pool, with the interest rate changing based on the amount of borrowed funds and the total liquidity (i.e. utilisation) of the asset pool. For more information, see the Whitepaper, section 2.5.
The parameters for the optimised base curves are:
The interest rates are calculated depending on the available liquidity and the total borrowed amount.