Professional Documents
Culture Documents
Hybrid formula
• Advantages of both approaches
• Liquidity in extreme cases
• Resilience to extreme movements
Lehar and Parlour (2021) focus on constant
product invariant
• I hope you:
1. Had a go at the paper
2. Tried creating your own spread sheet
3. Had a look at my spread sheet
Post trade tokens in pool E T
+ T is token in pool before trade: More token before, more token after
- e is ETH sent to pool: the more e the more you deplete the pools supply of token T
Post trade token balance
+ is the fee: Higher fee reduces purchasing power of trader (ability to deplete tokens)
+ E is ETH in pool before trade: Traders ETH is worth less (lower purchasing power)
Note: You can find my file, “BondingCurveWithFeesLogic_upload,” in LMS
Trader receives tokens
• Trader receives the pool outflow, E T
Derivations in notes
Price for tokens (in eth)
• Trade price (e/t) given by: E T
•
Derivations in notes
Liquidity fee
• Suppose fundamental token value is
• If pool is in equilibrium then
• Liquidity fee is then when setting e to 0
• Decentralized lending
• Over collateralized; in event of default the loan can be recuperated (no need for credit
score).
• Collateralized debt positions (CDP): Creating new tokens using collateral
• Collateralized debt markets:
• Pooled collateralized debt markets
• Peer-to-peer collateralized debt markets
• Under collateralization
Decentralized lending platforms
• We will talk about collateralized debt positions and collateralized
markets
• Collateralized debt positions
• Users “lock” crypto assets in the smart contract to get newly issued tokens
• User keeps market exposure (through their locked asset) and receive a newly
minted (and liquid) asset.
Example: MakerDao
1. User deposits ETH creating a collateralized debt position (CDP)
2. User call contract function to receive DAI and lock their collateral
3. MakerDao requires 150% collateral threshold
𝐶𝑜𝑙𝑙𝑎𝑡𝑒𝑟𝑎𝑙 𝑣𝑎𝑙𝑢𝑒
< 150 %
𝐵𝑜𝑟𝑟𝑜𝑤𝑒𝑑 𝑣𝑎𝑙𝑢𝑒
Example: MakerDao
1. The user pays a fee set by a community of governance token (MKR)
holders
2. Two things can then happen
1. The user returns the DAI and receives their (ETH) collateral
2. The value of the collateral drops below the threshold and is auctioned off
3. MRK holders are rewarded for carrying risk extreme ETH price
movements:
1. Compensation: Interest payments “burn” MRK tokens increasing their value
2. Risk: If ETH falls below certain value, the collateral will not cover the loan and
the protocol will mint and auction off at discounted value reducing the MKR
token value
Lending and borrowing
Liquidity
Collateral
Lender Principal + pool Borrower
interest
• Over-collateralization:
• Collateral staked exceeds loan: Value(collateral) < Value(loan)
• Under-collateralization:
• Loan exceeds collateral staked: Value(collateral) > Value(loan)
• Liquidation:
• If Value(loan) >= Value(collateral) * 150% initiates liquidation of loan
Dollar value of the How far the value of our
•,
Value of borrowed
• Where amount
• The debt position can be liquidated if the health factor falls below 1
• How does Value(collateral), liquidation threshold, and value of debt affect the
risk of liquidation?
How does the threshold relate to the health
factor?
For example, if you have a high liquidation threshold, say 1, then your
health factor stays above (or equal) to 1 if you maintain at least $1
collateral for every $1 borrowed.
if you have a low liquidation threshold, say 0.1, then your health factor
stays above (or equal) to 1 if you keep $10 collateral for every $1
borrowed.
As you will always need at least $1 collateral per $1 debt.
Example: Liquidity threshold 0.8
• Dai/Eth = 2000
2000
1500
1 ETH in collateral with value
$2000
1000 2000
500
1200 Value of Dai loan is $1200
0
Debt Collateral
Q: What is the health factor?
At what collateral value will we face liquidation?
2000
1500
1000 2000
1200
500
0
Debt Collateral
What happens if Dai/Eth drops to 1400?
• Dai/Eth = 1400
2000
1500
1500
1000
1400
1400
1200
500
0
Debt Collateral
Gudgeon et. al. 2021
The liquidator
Liquidator
Here’s
I want a loan!
liquidity
Principal Loan
Liquidity pool
Lender Principal + Collateral Borrower
interest
Here’s
I want a loan!
liquidity
Principal Loan
Liquidity pool
Lender Principal + Collateral Borrower
interest
Let’s focus on
the borrower for
a moment
Lender: deposits crypto to pool for interest
Borrower: borrows from pool and deposits collateral Pricing
Oracle: provides accurate pricing
Liquidator: Liquidates (sells) lender’s collateral Oracle
Over-collateralization
Loan
Liquidity pool
Collateral Borrower
Loan
Liquidity pool
Collateral Borrower
Here’s
I want a loan!
liquidity
Principal Loan
Liquidity pool
Lender Principal + Collateral Borrower
interest
Loan Borrower
Liquidity pool
Collateral Liquidator
• Now the liquidator takes care of repaying the loan, and receives the
collateral
• The liquidator acquires the collateral at a discounted price (5%-15%)
Our situation from before:
• Dai/Eth = 1400
2000
1500
1500
1000
1400
1400
1200
500
0
Debt Collateral
Fixed spread liquidator What does this mean?
• Dai/Eth = 1400
• Close factor (CF) = 0.5
• Liquidation spread = 5% Debt repaid Collateral
2000
by liquidator liquidator receives
2000
1500 1500
Dent phase
End
Tend phase
Start
• Tend phase: At the tend phase liquidators compete on the debt they are
willing to cover. Each bid must exceed the next so that debt bid, .
• Dent phase: When the dent phase ends, the debt that must be repaid is set and
the liquidators compete on the collateral they require. Each bid must be
lower than the previous so that collateral bid,
The example from before
Debt Collateral
Dent phase
End
Tend phase
Start
Result:
Bob pays 1200 of the
debt and receives 1250
Perez et. al. 2021
1. Examine Compound, one of the most widely used protocols for loanable funds (PLFs), from
its conception to September 2020.
2. Analyze participants' behavior and risk-appetite
3. Recent changes in the dynamics of the protocol: Variations of only 3% in an asset's dollar
price can result in over 10m USD becoming liquidable.
4. Liquidators’ efficiency has improved significantly over time, with currently over 70% of
liquidable positions being immediately liquidated (within one block).
5. Discussion on how a false sense of security fostered by a misconception of the stability of
non-custodial stablecoins, increases the overall liquidation risk faced by Compound
participants.
6. Concentration: Despite the increase in number of suppliers and borrowers over time, the total
amount of funds supplied and borrowed remain extremely concentrated among a small set of
participants.
Borrowers and suppliers
• Historical liquidations:
• Black Thursday (March 12, 2020): Global
stock markets suffered the greatest single-
day fall since the 1987 stock market crash
• July 29, 2020: DAI deviating from peg
significantly
• Early September 2020: ETH price dropping
substantially
• Liquidators becoming more efficient:
• 60% of liquidations occur within one block
of collateral becoming liquidable
suggesting bot activity
• 85% liquidations within 2 blocks (half a
minute)
Gudgeon et. al. 2020
1. Lending protocols consist of 76 percent of market shares (April 15th)
2. Feasibility of attacking makerDao’s governance design
3. Create strategy using a two transaction flash loan
4. “Approximately two weeks after we disclosed the attack details,
Maker modified the governance parameters mitigating the attack
vectors.”
5. Create a lending protocol and “stress test” it. Find that drying up
liquidity in a protocol with debt of $400M can become
undercollateralized in 19 days.
Qin et. al. 2021
• Show quantitatively how transaction atomicity increases the arbitrage
revenue.
• Analyze two existing attacks with ROIs beyond 500k%
• Show how malicious adversaries can efficiently maximize an attack
profit and hence damage the DeFi ecosystem further.
• Previously executed attacks can be “boosted” to result in a profit of
829.5k USD and 1.1M USD, respectively, which is a boost of
2.37× and 1.73×, respectively.
Gudgeon et. al. 2020
• Review the methodologies used to set interest rates on three prominent
DeFi PLFs, namely Compound, Aave and dYdX.
• Provide an empirical examination of how these interest rate rules have
behaved since their inception in response to differing degrees of
liquidity
• Investigate the market efficiency and inter-connectedness between
multiple protocols