The Protocol

Contracts overview

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.

Lending Pool Core

The 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).

LendingPoolAddressesProvider

(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.

Lending Pool Data Provider

The 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 LendingPool.

  • Calculates the Average Loan to Value and Average Liquidation Ratio.

Lending Pool

The LendingPool contract uses both the LendingPoolCore and LendingPoolDataProvider to interact with the reserves. This is the main contract developers should interface with. See the LendingPool section of the documentation.

The LendingPool also manages the tokenization of users' lending position via aTokens.

Lending Pool Configurator

The LendingPoolConfigurator contract provides configuration functions for the LendingPool and 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 LendingPoolAddressProvider.

Interest Rate Strategy

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:

  • baseVariableBorrowRate,

  • variableRateSlope1,

  • variableRateSlope2,

  • stableRateSlope1,

  • stableRateSlope2.

The interest rates are calculated depending on the available liquidity and the total borrowed amount.

Every reserve has a specific InterestRateStrategy contract.

aTokens

The aToken contracts are EIP-20 / ERC20 compatible interest bearing tokens, that represent users' lending positions. See the aTokens section of the documentation.

‚Äč