General Execution flow

User-facing functions

Most of the core user-facing functions can be called from Pool.sol:

  • supply, withdraw

  • borrow, repay

  • liquidate, etc

We will review these functions within this section and breakdown their logic and workflow to illustrate the inner workings of Aave.

Most functions share a similar structure in their execution flow

  1. cache storage variables

  2. update the state, system-wide (interest accrued)

  3. validate action to be taken against updated system

  4. if validate, change state as per action

  5. update rates, reflective of latest action taken

General execution flow

  • cache -> updateState -> validation -> changeState -> updateRates

Except flashloan:

  • validation -> user payload -> cache -> updateState -> changeState -> updateRates

  • to protect against reentrancy and rate manipulation within the user specified payload

Common functions

cache, updateState and updateRates are common components of almost all state-changing functions within Aave. They will be covered within Common functions, along other repeated functions.

  • cache, updateState, updateRates

  • getFlags, getDecimals

  • getSupplyCap, getBorrowCap

Last updated