Research Summary: Liquidity risks in the decentralized finance protocol Aave

靈界偵探 Cupid Sie 謝銘峰
12 min readNov 19, 2021

TL;DR

AAVE is a Protocol for Loanable Funds, a lending protocol in the decentralized finance ecosystem that contains enormous liquidity. Their model uses multiple token asset pairs as collateral for loans, and safeguards staked assets using an economic model that uses incentives and variable parameters to reach “a [trustless] optimal equilibrium and overcollateralization.” Under certain conditions, however, there can be signs of illiquidity. This paper proposes a game theoretical hypothesis to analyze the behavior of Aave participants to various incentives.

  1. Potential points of failure during a bear market are evaluated.
  2. Mechanisms for migration of illiquidity in the Aave protocol are examined.
  3. Diversification of assets in the safety module is proposed to increase the efficiency of the safety module and decrease the risk of illiquidity in the protocol.

The paper shows that even during a sudden market drop like Red Wednesday, the Aave protocol model still held up without activating the safety module.

Citation

  • Gudgeon, L., Werner, S., Perez, D., & Knottenbelt, W. J. (2020, October). Defi protocols for loanable funds: Interest rates, liquidity and market efficiency. In Proceedings of the 2nd ACM Conference on Advances in Financial Technologies (pp. 92–112).
  • Cirikka, S. (2021). Liquidity risks in the decentralized finance protocol Aave.
  • Bartoletti, M., Chiang, J. H. Y., & Lluch-Lafuente, A. (2020). Sok: Lending pools in decentralized finance. arXiv preprint arXiv:2012.13230.
  • Klages-Mundt, A., & Minca, A. (2020). While stability lasts: A stochastic model of stablecoins. arXiv preprint arXiv:2004.01304.
  • Aave white paper (2020)
  • Aave safety model document (2021)

Link

Core Research Question

  • How can we mitigate liquidity risks in the Aave platform?

Background

  • Protocols for Loanable Funds (PLFs): Are protocols that facilitate lending between participants. PLFs use pools to act as the lending market for participants, as opposed to keeping track of transactions in an orderbook. In these pools participants can deposit assets and earn interest, or they can borrow from the pool, paying interest. These pools are implemented as smart contracts, which are Turing complete programs running on the blockchain.
  • Lending Pool (LPs): Financial applications which create a market of crypto-asset loans, providing incentive mechanisms to equilibrate the market.
  • Collateral: Tokens which can be seized if a user does not adequately repay a loan.
  • Collateralization: The ratio of deposited collateral value over the borrower’s total loan value.
  • Liquidation: When user A’s collateralization falls below a minimum threshold it is undercollateralized: here, a user B can repay a fraction of A’s loan, in return for a discounted amount of A’s collateral seized by B.
  • LP-minted token: Liquidity providers can provide their tokens to the lending pool and receive an LP-minted token in return. This token can be staked into a yield optimization protocol such as Yearn.finance or can determine the appropriate levels of collateralization based on token prices given by the price oracle as LP-minted token collateral.
  • Flash loan: A flash loan is an instant loan with one condition — it must be repaid within a single Ethereum block, which is mined in intervals of roughly 13 seconds. These loans require no upfront collateral and happen almost instantly. They are smart contracts capable of interacting with other smart contracts that have been deployed on the network protocol. A borrower can request funds from Aave, but they must pay back those funds, and a 0.09% fee, within the same block. If the borrower doesn’t do this, the entire transaction is cancelled, so that no funds were ever borrowed.
  • Flash loan attack: A smart contract exploit where an attacker takes out a flash loan from a DeFi protocol, uses the capital they’ve borrowed, and pays it back in the same transaction. For example, a flash attack might use borrowed funds to spike the price of an asset, sell those assets, and use the profits to repay the interest on their loans.
  • Flash loan risk: A flash loan has to be repaid to the protocol in its entirety in the same transaction. The size of flash loans can, theoretically, entail the entire pool. By creating large imbalances with a sizable flash loan, one can profit from these self-created imbalances through arbitrage.
  • Illiquid state: A state in which one is not able to borrow or redeem their deposited assets.
  • Bank run: A bank run occurs when many clients withdraw their money from a bank, because they believe the bank may cease to function in the near future.
  • Agent: The trader or contract who wants to make a profit.
  • Agents’ behaviors: The agents would try to execute the best profitable transaction, such as a flash loan, borrow funds and lend different tokens as interest rate arbitrage.
  • Liquidation threshold: A liquidation threshold refers to the percentage at which a loan is defined as undercollateralized.
  • Safety module: It’s a mechanism-locked AAVE token that will be used as a mitigation tool to prevent an illiquid state.
  • Oracles: Provide data and information from off-blockchain sources to on-blockchain smart contracts with verification and randomness. They also provide service level agreement contracts to ensure the information is both equal and fair.
  • Deflationary spirals: Deflationary spirals occur when many users attempt to withdraw their assets from the protocol at once. This can trigger collateral illiquidity, and if users then reduce the price of their assets to liquidate them, it can cause other users to attempt to withdraw their assets, putting further downward pressure on prices.

Summary

  • This paper uses the term Protocol for Loanable Funds (PLFs) to examine markets that suddenly suffer a big price drop, such as Red Wednesday between 11 May 2021 and 23 May 2021, when ETH’s price fell by about 43%, and AAVE lost about 46%. In this situation a deflationary spiral may occur, which might have caused an illiquid state and activated the safety module selling stakeholders’ AAVE tokens to mitigate illiquid state.
  • This paper analyzes liquidity risks and makes three points:
  1. A game theoretic model of agent behaviour in PLFs (used on Aave) is given.

2. A theoretical deflationary spiral is presented.

3. Aave’s safety module is empirically analyzed.

Every market pool has its own parameters such as liquidation threshold and interest rate per pool. If a trading pair pool has very few borrowers and a very high amount of deposits, resulting in very low borrow interest rates and vice versa, the variable borrow rate vbi is given by:

  • R0 is the base rate.
  • Rslope1 the multiplier below optimal utilization.
  • Rslope2 the multiplier above optimal utilization.
  • U is the current rate.
  • Uoptimal is the optimal utilization rate.

Equation 1 shows that the borrow rate vbi is equal to two conditions set per market pool:

  1. If current rate (U) is lower than (Uoptimal) then (R0) + (U) / (Uoptimal) *(Rslope1).
  2. If current rate (U) is higher than(Uoptimal) then (R0) +(Rslope1) + ( (U) — (Uoptimal)) / (1 — (Uoptimal)) *(Rslope2)

Condition 2 is more risky than condition 1 because it is a higher borrowed fund and has lower collateral at the market pool.

Figure 1 Overview of the Aave protocol

Aave mechanism shown in Figure 1. First, every market pool in Aave protocol is getting the price feed of the associated asset from Chainlink. Second, agents interact with each market pool through functions such as deposit, redeem, borrow, and repay. Third, agents’ collateral may liquidate because the value of collateral is less than the liquidation threshold. Fourth, agents who stake AAVE in the safety module may share in the profit and risk of the Aave protocol.

Method

Aave protocol model focuses on how to prevent an illiquid state and defines three terms: pools, agents and the health of the PLF. This paper outlines variables in Tables 1 and 2, and then makes a connection between the variables and the notable entities in a PLF. The model is based-on the Aave white paper and A stochastic model of stablecoins. This model gives the methodology to formalize agent incentives and strategies.

Tabel 1 Model variables

Tabel 2 Agent actions

Definition 1 is to define the utilization of each market pool. For any pool pli (pool i), its utilization at time t, i.e the fraction between total loans of the pool, tbi(total borrowed for pool i), and the deposits of the market, tdi(total deposited for pool i), is calculated as:

Definition 2 is to define the health factor ratio of each agent. For any agent i(ai), its health factor, i.e the ratio between the sum of its deposited assets multipled by a diminishing factor (liquidation threshold) divided by the sum of its outstanding borrows, is calculated as:

With this equation you can quickly know the health of any agent in a PLF. Whenever an agent’s health factor(hi) < 1, their deposited collateral may be liquidated by any other agent.

To calculate the parameters would require initialization at t = 0, for all agents, assets and pools, and all the parameters noted in Table 1. Subsequently, at every t:

1. Chainlink provides the value of each asset.

2. Aave updates the assets’ values.

3. Each agent chooses a strategy (Table 2).

4. Aave updates the market’s parameters.

In equation 4, there is an assumption that agents are presumed to be economically rational agents, wishing to maximize their total assets, so the agent will choose the strategy which maximizes:

i.e. the sum of all deposited assets of agent i into pool j (ai, dj) multiplied by the price of the asset j (pj) plus the earned interest on this deposit ((ai, dj)*dpij) minus the interest that has to be paid for any outstanding loans ((ai, dj)*vbij). In this equation, the variable interest rate is used to calculate the profit instead of a stable interest rate.

Definition 3 is to define market illiquid state. A market is liquid if any amount of assets can be traded at any time during market hours. The trades should also be able to be completed rapidly and with minimum loss of value at competitive prices. An illiquid state occurs, when one is not able to borrow or redeem their deposited assets. Preventing illiquidity is done through incentives.

Potential Illiquidity state can show itself in two conditions:

  1. If Asset i (ci) utilization ratio for pool (uit) is close to or equal to 1, then some agents will not be able to borrow additional assets as total deposits for pool i (tdi) are loaned out.
  2. If the utilization ratio for pool (uit) is greater than 1. ,it may result in some agents being unable to redeem their collateral assets. They may also be unable to borrow additional assets or withdraw assets. Condition 2 carries more risks than Condition 1 and is similar to a bank run.

If both potential illiquidity state conditions are reached, the potential deflationary spiral would result in constant depreciation of the deposited collateral. The price given by the Chainlink oracle network to the protocol at t + 1 is less than the price given at t, namely pi,t > pi,t+1. For example, The ETH price suddenly drops 20%, then the agent who used ETH as collateral, needs more collateral to supplant the 20% drop in ETH, but the price given by Chainlink at t + 1 second is less than 20% of the price.

There is another situation that would happen when both of the two potential illiquidity state conditions are reached. It is called depreciation, which means your collateral asset is valued at a discounted price. At t = x, Chainlink will report pi,x, which by above assumption is less than pi,x−1. This means that net worth of agent j is worth less, in terms of deposited assets than that of agent i into pool j (aj, di) multiply price of asset i (pi).

Depending on different situations the agent would choose a strategy such as liquidate the loan, redeem, and borrow etc., shown in Table 2, this will result in the increasing depreciation of the asset i (ci) in relation to the agent’s collateral. For example, when an oracle price of a token suddenly drops a larger price amount on a single pair, it may cause the collateral rate to be higher than the usual rate. This situation means that the value of the collateral pool suddenly decreases. A vicious cycle is created which reinforces itself causing a deflationary spiral.

Figure 2. A deflationary spiral is aggravated through liquidations and withdrawal of liquidity.

If this vicious cycle in Figure 2 is upheld for long enough, it can cause a state of under collateralization , in which total borrowed i > total deposited i (tbi > tdi). This means that the loans are not fully backed up by the underlying collateral. If this happens, some ome participants will not be able to redeem their assets as there is no asset in the pool to be redeemed. The debtors have no incentive to pay their outstanding loans. There are several potential factors which can make the situation even worse:

  1. Participants of the protocol can vote on protocol wide parameters with their governance tokens. Since a high amount of the liquidity and governance tokens are in the hands of a few addresses, voting is biased.
  2. If the health factor of the agent drops even more than the point of under collateralization then liquidations actually push the protocol and agent even more into bankruptcy, which is counterproductive.
  3. A high utilization ratio is seen in the historical data of Aave. For example DAI in Figure 3 utilization ratios are also seen in other PLFs. This shows that protocol incentives are not always sufficient to reach optimal utilization.
Figure 3. Historic utilization in the DAI pool.

AAVE designed a token economy stake incentive to prevent participants from unstaking in times of downfall periods called the safety module. The stakeholder benefits by earning interest on their staked AAVE. But, they also bear the risk that their AAVE could be slashed to provide liquidity, if outstanding debts are at risk of becoming unprofitable at liquidation. The protocol has set up a cooldown of 10 days after which one can unstake their AAVE from the safety module.

Figure 4. Architecture of AAVE safety module

Source: AAVE safety module

Observations

  1. Equation 4, the assumption that agents are presumed to be economically rational agents, wishing to maximize their total assets, still holds with the addition of the safety module. Even during Red Wednesday, an agent has incentive to stake AAVE assets and earn interest in order to maximize their profit. Unstaking is however always a possibility. Simulated runs from PLFs become illiquid in as little as 19 days and since the AAVE cooldown period is 10 days, agents could unstake their assets just when the protocol needs them the most.
  2. The correlation of AAVE with the underlying protocol is highly positive (0.77) with Ethereum, and ETH is the most used collateral in the protocol (84.9%). This means that the asset meant to function as backup collateral in times of prolonged deflation of the collateral, will actually drop in conjunction with said collateral.

Results

  • This paper gave a taxonomy of PLFs and ways to measure and provide the best incentives to motivate agents to participate. Using this model, PLF has to find a balance between competitive returns and the safety of assets. Even during Red Wednesday, when there was a larger than normal amount of liquidation, illiquidity didn’t occur.
  • When the AAVE protocol is liquid, outstanding debt can be provided to everyone, but when a described deflationary spiral occurs, agent strategies can lead to an illiquid state and the inability to provide lending services. This paper describes a model that can examine the illiquid state.

Discussion & Key Takeaways

  • Diversification of assets in the safety module. . The AAVE asset used as reserve in this safety module is strongly correlated with Ethereum (0.77), the collateral used the most in AAVE (%84.9). Is it possible to stake multiple tokens as the future of the safety module mechanism?
  • Should AAVE tokens be available to be borrowed and lent from AAVE protocol? Currently, they aren’t available for either.
Figrue 5 AAVE tokens borrowed and lent as of 2021/8/2.

Implications & Follow-ups

  • Future AAVE safety models could reserve multiple assets as vault mechanisms to prevent deflationary spirals and doing so may also encourage more participants to stake AAVE tokens.

Applicability

  • AAVE would add to AMM market, which will support liquidity provider (LP) tokens to lend or borrow funds from others in the future. The PLFs model could examine the Liquidity Provider tokens in the model variable shown in Table 1 and Table 2.
  • This model has created health factors that can check a DeFi protocol’s ability to verify the liquidity risks of a protocol’s associated borrow and lending pools.

--

--

靈界偵探 Cupid Sie 謝銘峰

Blockchain Researcher@SuDo Research Labs | Computer Science Ph.D. Candidate@NTU |受害者@FTX https://linktr.ee/siemingfon