bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 2쪽 중 1쪽
Protocol Whitepaper
V1.0
wow@aave.com
January 2020
Abstract
This document describes the definitions and theory behind the Aave Protocol explaining the different aspects
of the implementation.
Contents
1 Introduction 1
1.1 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Formal Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Protocol Architecture 5
2.1 Lending Pool Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Lending Pool Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Lending Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Lending Pool Configurator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 Interest Rate Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.6 Governance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 The LendingPool Contract 8
3.1 Deposit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Redeem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Borrow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Repay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.5 Swap Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 Liquidation Call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.7 Flash Loans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.8 Tokenization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.8.1 Limitations of the tokenization model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Stable Rate Theory 17
4.1 Lending Rate Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.2 Current Stable Borrow Rate Rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.3 Limitations on Stable Rate Positions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.4 Stable Rate Rebalancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.5 The Rebalancing Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Conclusion 21
1 Introduction
The birth of the Aave Protocol marks Aave’s shift from a decentralized P2P lending strategy (direct loan relationship
between lenders and borrowers, like in ETHLend) to a pool-based strategy. Lenders provide liquidity by depositing
cryptocurrencies in a pool contract. Simultaneously, in the same contract, the pooled funds can be borrowed by
placing a collateral. Loans do not need to be individually matched, instead they rely on the pooled funds, as well as
the amounts borrowed and their collateral. This enables instant loans with characteristics based on the state of the
pool. A simplified scheme of the protocol is presented in figure 1 below.
Figure 1: The Aave Protocol
The interest rate for both borrowers and lenders is decided algorithmically:
• For borrowers, it depends on the cost of money - the amount of funds available in the pool at a specific time.
As funds are borrowed from the pool, the amount of funds available decreases which raises the interest rate.
• For lenders, this interest rate corresponds to the earn rate, with the algorithm safeguarding a liquidity reserve
to guarantee withdrawals at any time.
1.1 Basic Concepts
Figure 2: Lending Pool Basics
At the heart of a lending pool is the concept of reserve: every pool holds reserves in multiple currencies, with
the total amount in Ethereum defined as total liquidity . A reserve accepts deposits from lenders. Users can
1
borrow these funds , granted that they lock a greater value as collateral, which backs the borrow position.
Specific currencies in the pooled reserves can be configured as collateral or not for borrow positions, only low risk
tokens should be considered. The amount one can borrow depends on the currencies deposited still available in the
reserves. Every reserve has a specific Loan-T o-V alue (L TV), calculated as the weighted average of the different
LTVs of the currencies composing the collateral, where the weight for each LTV is the equivalent amount of the
collateral in ETH ; figure 3 shows an example of parameters.
Every borrow position can be opened with a stable or variable rate . Borrows have infinite duration, and there is
no repayment schedule: partial or full repayments can be made anytime.
Figure 3: Lending Pool Parameters
In case of price fluctuations, a borrow position might be liquidated. A liquidation event happens when the price of
the collateral drops below the threshold, LQ, called liquidation threshold . Reaching this ratio channels a liquida-
tion bonus , which incentivizes liquidators to buy the collateral at a discounted price. Every reserve has a specific
liquidation threshold, following the same approach as for the LTV. Calculation of the average liquidation thresholdLaQ
is performed dynamically, using the weighted average of the liquidation thresholds of the collateral’s underlying assets.
At any point in time, a borrow position is characterized by its health factor Hf, a function for the total col-
lateral and the total borrows which determines if a loan is undercollateralized:
Hf =
T otalCollateralET H ∗LaQ
T otalBorrowsET H +T otalF eesET H when Hf < 1, a loan is considered undercollateralized and can be liquidated
Further details on liquidation can be found in section 3.6.
2
1.2 Formal Definitions
V ariable Description
T , current times-
tamp
Current number of seconds defined by block.timestamp.
Tl, last updated
timestamp
Timestamp of the last update of the reserve data. Tl is updated every time a
borrow, deposit, redeem, repay, swap or liquidation event occurs.
∆T , delta time ∆T = T− Tl
Tyear, seconds Number of seconds in a year. Tyear = 31536000
∆Tyear, yearly pe-
riod
∆Tyear = ∆TTyear
Lt, total liquidity Total amount of liquidity available in the reserve. The decimals of this value
depend on the decimals of the currency.
Bs, total stable bor-
rows
Total amount of liquidity borrowed at a stable rate. The decimals of this value
depend on the decimals of the currency.
Bv, total variable
borrows
Total amount of liquidity borrowed at a variable rate. The decimals of this value
depend on the decimals of the currency.
Bt, total borrows Total amount of liquidity borrowed. The deci-
mals of this value depend on the decimals of the
currency.
Bt = Bs + Bv
U , utilization rate Representing the utilization of the deposited
funds.
U =
0, if Lt = 0
Bt
Lt , if Lt > 0
Uoptimal, target uti-
lization rate
The utilization rate targeted by the model, beyond the variable interest rate rises
sharply.
Rv0 , base variable
borrow rate
Constant for Bt = 0. Expressed in ray.
Rslope1, interest rate
slope below Uoptimal
Constant representing the scaling of the interest rate versus the utilization, when
U < U optimal. Expressed in ray.
Rslope2, interest rate
slope above Uoptimal
Constant representing the scaling of the interest rate versus the utilization, when
U≥ Uoptimal. Expressed in ray.
Rv, variable borrow
rate
Rv =
Rv0 + UUoptimal Rslope1, if U≤ Uoptimal
Rv0 + Rslope1 + U −Uoptimal1−Uoptimal Rslope2, if U > U optimal
Rs, stable rate Implemented in section 4.2. Expressed in ray.
Mr, average market
lending rate
Base stable borrow rate, defined for i platforms
with P ri the lending rate and P vi the borrowing
volume. Expressed in ray.
Mr =
∑n
i=1 P ir P iv∑n
i=1 P iv
3
V ariable Description
Rtsa, average stable
rate borrow rate
When a stable borrow of amount Bnew is issued
at rate Rs:
Rtsa = BsRt−1sa +BnewRsBs+Bnew
When a user repays an amount Bx at stable rate
Rsx:
Rtsa =
0, if Bs− Bx = 0
BsRt−1sa −BxRsx
Bs−Bx , if Bs− Bx > 0
Check the methods decreaseTotalBorrowsStableAndUpdateAverageRate()
and increaseTotalBorrowsStableAndUpdateAverageRate(). Expressed in ray.
RO, overall borrow
rate
Overall borrow rate of the reserve, calculated as
the weighted average between the total variable
borrows Bv and the total stable borrows Bs.
RO =
0, if Bt = 0
BvRv+BsRsa
Bt , if Bt > 0
Rl, current liquidity
rate
Function of the overall borrow rate RO and the
utilization rate U.
Rl = ROU
C ti , cumulated liq-
uidity index
Interest cumulated by the reserve during the time
interval ∆T , updated whenever a borrow, deposit,
repay, redeem, swap, liquidation event occurs.
C ti = (Rl∆Tyear + 1)C t−1i
C0i = 1× 1027 = 1 ray
I tn, reserve normal-
ized income
Ongoing interest cumulated by the reserve. I tn = (Rl∆Tyear + 1)C t−1i
Btvc, cumulated vari-
able borrow index
Interest cumulated by the variable borrows Bv, at
rate Rv, updated whenever a borrow, deposit, repay,
redeem, swap, liquidation event occurs.
Btvc = (1 + RvTyear )∆Tx Bt−1vc
B0vc = 1× 1027 = 1 ray
Btvcx, user cumu-
lated variable bor-
row index
Variable borrow index of the specific user, stored
when a user opens a variable borrow position.
Btvcx = Btvc
Bx, user principal
borrow balance
Balance stored when a user opens a borrow position. In case of multiple borrows,
the compounded interest is cumulated each time and it becomes the new principal
borrow balance.
Bxc, user com-
pounded borrow
balance
Principal Bx plus the cumulated interests.
For a variable position: Bxc = BvcBvcx (1 + RvTyear )∆Tx Bx
For a stable position: Bxc = (1 + RsTyear )∆Tx Bx
Hf , health factor when Hf < 1, a loan is considered undercollater-
alized and can be liquidated
Hf =
T otalCollateralET H ∗LaQ
Bt+T otalF eesET H
4
2 Protocol Architecture
The current implementation of the protocol is as follows:
Figure 4: Protocol Architecture
2.1 Lending Pool Core
The LendingPoolCore contract is the center of the protocol, it:
• holds the state of every reserve and all the assets deposited,
• handles the basic logic (cumulation of the indexes, calculation of the interest rates...).
2.2 Lending Pool Data Provider
The LendingPoolDataProvider contract performs calculations on a higher layer of abstraction than theLendingPoolCore
and provides data for the LendingPool; specifically:
• Calculates the ETH equivalent a user’s balances (Borrow Balance, Collateral Balance, Liquidity Balance) to
assess how much a user is allowed to borrow and the health factor.
• Aggregates data from the LendingPoolCore to provide high level information to the LendingPool.
• Calculate of the Average Loan to Value and Average Liquidation Ratio.
5
2.3 Lending Pool
The LendingPool contract uses the LendingPoolCore and LendingPoolDataProvider to interact with the reserves
through the actions:
• Deposit
• Redeem
• Borrow
• Repay
• Rate swap
• Liquidation
• Flash loan
One of the advanced features implemented in the LendingPool contract is the tokenization of the lending position.
When a user deposits in a specific reserve, he receives a corresponding amount of aT okens, tokens that map the
liquidity deposited and accrue the interests of the deposited underlying assets. Atokens are minted upon deposit,
their value increases until they are burned on redeem or liquidated. Whenever a user opens a borrow position, the
tokens used as collateral are locked and cannot be transferred. Further details on the tokenization are in section 3.8.
2.4 Lending Pool Configurator
The LendingPoolConfigurator provides main configuration functions for LendingPool and LendingPoolCore:
• Reserve initialization
• Reserve configuration
• Enable/disable borrowing on a reserve
• Enable/disable the usage of a specific reserve as collateral.
The LendingPoolConfigurator contract will be integrated in Aave Protocol governance.
2.5 Interest Rate Strategy
The InterestRateStrategy contract holds the information needed to update the interest rates of a specific reserve
and implements the update of the interest rates. Every reserve has a specific InterestRateStrategy contract.
Specifically, within the base strategy contract DefaultReserveInterestRateStrategy the following are defined:
• Base variable borrow rate Rv0
• Interest rate slope below optimal utilisation Rslope1
• Interest rate slope beyond optimal utilisation Rslope2
The current variable borrow rate is:
Rv =
{
Rv0 + UUoptimal Rslope1, if U≤ Uoptimal
Rv0 + Rslope1 + U −Uoptimal1−Uoptimal Rslope2, if U > U optimal
This interest rate model allows for calibration of key interest rates:
• At U = 0, Rv = Rv0
• At U = Uoptimal, Rv = Rv0 + Rslope1
• Above Uoptimal, the interest rate rises sharply to take into account the cost of capital.
The stable borrow rate follows the same model described in section 4.2.
6
2.6 Governance
The rights of the protocol are controlled by the LEND token. Initially, the Aave Protocol will be launched with
a decentralized on-chain governance based on the DAOStack framework which will evolve to a fully autonomous
protocol. On-chain implies all votes are binding: actions that follow a vote are hard-coded and must be executed.
To understand the scope of the governance it’s important to make the distinction:
• The Aave Protocol is bound to evolve and will allow the creation of multiple lending pools with segregated
liquidity, parameters, permissions, and type of assets.
• The Aave Lending Pool is the first pool of the Aave protocol until the Pool Factory Update is released and
anyone can create their own pool.
Within the Aave Protocol, the governance will take place at two level :
1. The Protocol’s Governance voting is weighted by LEND for decisions related to protocol parameters and
upgrades of the smart contract. It can be compared to MakerDAO’s governance where stakeholders vote on
current and future parameters of the protocol.
2. The Pool’s Governance where your vote is weighted based on your share of pool liquidity expressed in
aTokens. The votes cover pool specific parameters such as assets used as collateral or to be borrowed.
Each Pool will have its own governance, under the umbrella of the Protocol’s Governance.
More details on the Governance will be published in a Governance Proposal to the community.
7
3 The LendingPool Contract
The actions implemented within LendingPool allow users to interact with the reserve. All the actions follow this
specific sequence:
Figure 5: The LendingPool Contract
8
3.1 Deposit
The deposit action is the simplest one and does not have any particular state check. The sequence of action is:
Figure 6: Deposit funds
9
3.2 Redeem
The redeem action allows users to exchange an amount of aTokens for the underlying asset. The actual amount
to redeem is calculated using the aToken/underlying exchange rate Ei in section 3.8. The action is defined as follows:
Figure 7: Redeem funds
10
3.3 Borrow
The borrow action transfers to the user a specific amount of underlying asset, in exchange of a collateral that remains
locked. The flow of action can be described as follows:
Figure 8: Borrow funds
11
3.4 Repay
The repay action allows the user to repay completely or partially the borrowed amount plus the origination fee and
the accrued interest.
Figure 9: Repay a loan
12
3.5 Swap Rate
The swap rate action allows a user with a borrow in progress to swap between variable and stable borrow rate.
Figure 10: Swap Rate
13
3.6 Liquidation Call
The liquidationcall contract allows any external actor to purchase part of a collateral at a discounted price. In
case of a liquidation event, a maximum of 50% of the loan can be liquidated, which will bring the health factor back
above 1.
Figure 11: Liquidation
14
3.7 Flash Loans
The flash loan action will allow users to borrow from the reserves within a single transaction, as long as the user
returns more liquidity that has been taken.
Figure 12: Flash Loan
Flash loans temporarily transfer the funds to a smart contract that respects the IFlashLoanEnabledContract.sol
interface. The address of the contract is a parameter of the action. After the funds are transferred, the method
executeOperation() is executed on the external contract. The contract can do whatever action is needed with the
borrowed funds. After the method executeOperation() is completed, a check is performed to verify that the funds
plus fee have been returned to the LendingPool contract. The fee is then accrued to the reserve, and the state of
the reserve is updated. If less funds than what was borrowed have been returned to the reserve, the transaction is
reverted.
15
3.8 Tokenization
The Aave protocol implements a tokenization strategy for liquidity providers. Upon deposit, the depositor receives a
corresponding amount of derivative tokens, called Aave Tokens (aTokens for short) that map 1:1 the underlying
assets. The balance of aTokens of every depositor grows over time, driven by the perpetual accrual of interest of
deposits. aTokens are fully ERC20 compliant.
aTokens also natively implement the concept of interest rate redirection. Indeed, the value accrued over time by
the borrowers’ interest rate payments is distinct from the principal value. Once there is a balance of aTokens, the
accrued value can be redirected to any address, effectively splitting the balance and the generated interest. We call
the continuous flow of accumulated interest over time the interest stream .
To implement this tokenization strategy, Aave introduced the following concepts in the aToken contract:
1. User x balance index I tx: Is the value of the reserve normalized income I tx at the moment of execution of
the last action by the user.
2. Principal balance Bp: Is the balance stored in the balances mapping of the ERC20 aToken contract. The
principal balance gets updated on every action that the user executes on the aToken contract (deposit, redeem,
transfer, liquidation, interest rate redirection)
3. Redirection address Ar: When a user decides to redirect his interest stream to another address, a new
redirection address Ar is provided. If no redirection of the interest stream is performed, Ar is 0
4. Redirected Balance Bxr : Whenever a user redirects his interest stream, the balance of user redirecting is
added to the redirected balance Br of the address specified by Br. Defined as follows:
Bxr = ∑X Bp
Where X is the set of users redirecting the interest stream to the user x
The redirected balance decreases whenever a user x0∈ X redeems or transfers his aTokens to another user
that is not redirecting to x.
5. Current balance Bc: Is the balance returned by the balanceOf() function of the aToken contract. Defined
as follows:
Bxc =
0, if Bxp = 0 and Bxr = 0
Bxp + Bxr ( InIx− 1), if Ar <> 0
Bxp InIx + Bxr ( InIx− 1), if Ar = 0
3.8.1 Limitations of the tokenization model
The described tokenization model has many advantages compared to the widely used, exchange rate based approach,
but also some drawbacks, specifically:
1. It’s impossible to transfer the whole balance at once: Given the perpetual accrual of the interest rate,
there is no way to specify the exact amount to transfer, since the interest will keep accruing even while the
transfer transaction is being confirmed. This means that having exactly 0 balance after a transfer is impossible,
rather, a very small balance (dust balance) will be left to the from account executing the transfer. Note that
this could have been avoided by adding specific logic to handle this particular edge case, but this would have
meant adding a non standard behavior to the ERC20 transfer function, and for this reason we avoided it. Even
though this is not a re프로젝트로 돌아가기