Defi LEnding and Borrowing

 

Instructors:           Andreas Park
 

 

Borrowing/Lending & Unit of Account creation

Idea:

  • create fiat money on chain with borrowing
  • mechanism
    • a collateralized loan with ETH in escrow
    • DAO-managed monetary policy (=creation or destruction of tokens)

Sidebar: what is a DAO?

  • DAO=decentralized autonomous organization
  • \(\to\) entity without management
  • governance decided by token holders essentially by vote
  • We'll devote a class to DAO governance

user perspective

4 ETH
(1 ETH = $375)
(Oct 15, 2020)
\(\approx\) $1,500

\(\vdots\)

1,500 DAI
(1 DAI = $1)

formally: this smart contract is a collateralized debt position (CDP)

user perspective

fractional collateral \(\to\) collateralization factor \(=\) 150%

\begin{array}{rcl} &&\textsf{maximal amount of DAI in \$}\\\\ &=&\frac{\textsf{\$ equivalent of ETH in escrow}}{\textsf{collateralization factor}}\\\\ &=&\frac{1,500}{150\%}=\$1,000 \end{array}

total collateral = $1,500

maximum loan = $1000

overcollateralization = $500

actual loan (example) = $500

buffer = $500

user perspective: what happens if the price of ETH rises?

ETH \(\nearrow\) $500

value of ETH collateral = $2,000

maximum loan = $2,000/150%=$1,333

total collateral = $2,000

maximum loan = $1,333

overcollateralization = $667

actual loan (example) = $500

buffer = $500

overcollateralization = $667

new loan capacity= $333

user perspective: what happens if the price of ETH falls?

ETH \(\searrow\) $187.5

value of ETH collateral = $750

maximum loan = $750/150%=$500

total collateral = $750

maximum loan = $500

overcollateralization = $250

actual loan (example) = $500

buffer = $0

for reference: former value of collateral

user perspective: what happens if the price falls & max loan is exceeded?

Maker DAO

ETH \(\searrow\) $150

value of ETH collateral = $600

maximum loan = $600/150%=$400

total collateral = $600

maximum loan = $400

required overcollateralization = $200

actual loan (example) = $500

buffer = -$100

for reference: former value of collateral

\(\Rightarrow\) triggering of liquidation auction by "keeper"

sell 3.33 ETH=$500=500 DAI

repay $500=500 DAI loan

retain incentive

return  remainding ETH to vault owner

Maintaining the Peg: monetary policy

Maker DAO

  • How works:
    • 1 USDC=1.01 DAI
      • use USDC to mint new DAI
        • supply (DAI) \(\nearrow\)
        • price (DAI) \(\searrow\)
    • 1 USDC=0.99 DAI
      • Swap Dai for USDC (more below)
      • demand (DAI) \(\nearrow\)
      • price (DAI) \(\nearrow\)

\(\Rightarrow\) all relies on behavioral assumptions

\(\Rightarrow\) But: there are also real incentives & mechanisms

Maintaining the Peg: monetary policy

Maker DAO

  1. stability fee
     
  2. DAI savings rate (DSR)
     
  3. debt ceiling

borrowers of DAI need to pay interest \(\to\) stability fee

  • if too much minting (=too much DAI) then
  • \(\to\) interest \(\nearrow\) \(\to\) cost of DAI \(\nearrow\)
  • \(\to\) minting \(\searrow\) \(\to\) supply DAI \(\searrow\)

DSR paid on "locked" DAI

  • DAI deposited to specific contract (demand \(\nearrow\))
  • funded by stability fees
  • \(\to\) SF>DSR

total amount of debt (or DAI) outstanding is limited

Sidebar: how is this decided?
\(\to\) special "governance" token MKR

Value locked Oct 27, 2021

Maker DAO

Source: daistats.com (Oct 27, 2021)

Source: daistats.com (Oct 26, 2022)

The March 12, 2020 "BlAck Thursday" Drama

Maker DAO

  • some crypto prices dropped more than 50%
  • cascading liquidations in leveraging platforms
  • network congestion: some liquidations done at near-zero prices
  • collateral shortfall in DAI
  • MakerDAO sold new DAO tokens to collect collateral
  • odd: DAI became riskier but high demand for DAI to trigger liquidations!

PEG stability module (PSM)

Maker DAO

The Problem:

  • in extreme bull/bear runs, the peg may no longer work
  • example: March 2020
    • ETH dropped significantly and suddenly
    • a rush occurred to (a) get out of ETH into save assets and (b) to collect DAI to get keeper fee
    • upward pressure on price of DAI

The Solution:

  • Peg stability module
  •  swap a given collateral type directly for DAI at a fixed rate (no minting/borrowing)
  • like regular vault type with a zero stability fee and a liquidation ratio of 100%
  • accessed through a user-facing smart contract containing the relevant swap functions (no ownership, just straight swap)

Note: In May 2021, ETH prices dropped again by >30% but no drama in DAI

The frontier: DAI loans for real-world assets

Maker DAO

categories and assessment for defi

Our focus

interoperability

inefficiency

centralized control

limited access

opacity

payments
 

/lending
 

  • Lightening Network
  • xDai
  • Makerdao
  • Compound
  • Aave

How does compound finance work?

Lending

Fundamentally, what does a bank do?

  • size intermediation
  • term intermediation
  • risk intermediation

And how is this done?

  • pooling deposits
  • issuing loans based on deposits
  • loan rates based on collateral or credit rating

on blockchain

  • short-term loans
  • pseudo-anonymous

collateral

compound Finance

  • Collateral ratio \(\in[0,90]\)
  • =0 \(\to\) not usable
  • =90 \(\to\) stablecoin
  • post 100 DAI 
  • factor 90
  • \(\to\) for each $1 borrow, deposit $100/90=$1.11
  • can borrow up to $90
  • post 1 ETH=$300 
  • factor 60
  • \(\to\) for each $1 borrowed, deposit $100/60=$1.67
  • can borrow up to $180

Example 1

Example 2

Example 3

  • post 1 ETH=$300 and 100 DAI \(\to\) $400
  • factor 60 and 90
  • \(\to\) for each $1 borrowed, deposit
    $100/(.75\(\cdot\)60+.25\(\cdot\) 90)=$1.48
  • can borrow up to $270

borrowing and lending rates compounded per block

compound Finance

  • Compound escrows tokens
  • must account for % ownership
  • \(\to\) tokenized user share
  • \(\to\) use the c-token
    • cDAI
    • cETH
  • minted/burned based on funds added/removed from underlying
  • seamless movement of these shares (reduced transactions costs!)
  • ability to use the ctokens in other protocols

Tracking ownership - How do you reclaim a deposit?

Tracking ownership - Example

compound Finance

In Compound

translated

new deposit

1,000 DAI

100 cDAI

500 DAI

add 50 new cDAI

Tracking ownership - Example

compound Finance

In Compound

translated

new deposit

1,000 DAI

150 cDAI

500 DAI

1 year later: 10% interest on compound

150 DAI

(same cDAI, ownership shares don't change, just each cDAI is worth more)

(accrues per block per deposit)

Differences to Compound

Aave

  • Aave is the second-largest lending protocol to date
  • has many features that are similar to Compound
  • offers more assets
  • offers flash loans (rate ~7bs)

Dapp composability & Flash loans

1. flash-borrow DAI

5. repay DAI

3. receive ETH

4. convert ETH to DAI

2. liquidate ETH loan with DAI

Loan liquidation opportunity

Blockchain 2: DeFi Lending

By Andreas Park

Blockchain 2: DeFi Lending

This slide deck provides an overview of DeFi protocols. It draws insights from Harvey, Ramachandran, and Santoro (2020) "DeFi and the Future of Finance"

  • 267