Defi LEnding and Borrowing

 

Instructors:           Andreas Park & Zissis Poulos
 

 

Pool-based lending principles

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

Token Accounting:
tracking ownership

Compound

AAVE

Token Accounting: TWO Types

  • track ownership of pool holdings with receipt tokens
  • continuous updating of wallet balances

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

token accounting

Compound

  • deposit: add \(q_0\) units of \(A\)-tokens into a  pool that contains \(Q_0$\)
  • assume:  \(Q^c_0\)  units of the  $cA$-receipt tokens outstanding already
  • User receives  \(q^c\) receipt \[  \frac{q^c}{Q_0^c+q^c}=\frac{q_0}{Q_0+q_0}.\]
  • Exchange rate: \(z_t=\frac{Q_t}{Q_t^c}\)  of \(A\) to \(cA\)-tokens.
  • Interest accrues so that pool contains \(Q_T>Q_t\) of the \(A\) token after time \(T\)
  • When withdrawing, users sends \(q^c\) tokens to the contract
  • Receives \(q_T>q_0\) of the \(A\)-token at exchange rate \(z_t>z_0\) where \[q_{T}=Q^c \times z_{T}\]

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)

AAVE

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)
  • token accounting done by continuous updating of token balance

token accounting

Aave

  • User makes a deposit continuously receives "a-tokens"
  • Supply:
    • \(Q_0\) units of an asset \(A\) token to the Aave pool obtains  
    • \(Q_0\) units of \(aA\)-tokens
  • balance updates continuously (\to\) claim on more \(aA\) tokens
  • To withdraw after \(T\) interest periods: sends  her \(Q_T\) \(aA\)-tokens to the contract, where
    \[Q_T= Q_0\prod_{t=1}^{T}{(1+r_t)}\]
  • \(t\) measured in blocks
  • \(r_t=\) interest allocated per block \(t\)

Liquidity Mining

Flash Loans

common theme in DeFi: jumping between dApps

  • Assume 
    • 1 ETH = 200 DAI
    • ​supplied 100 ETH in Compound
    • borrowed 10,000 DAI to lever up and purchase an additional 50 ETH
    • \(\to\) also supplied to Compound
    • Borrow interest rate in DAI
      • Compound: 15%
      • Aave: 5%.
  • ​Can you refinance your borrowing?

dapp-linking

Defi is like real "high" finance

Source: Harvey, Ramachandran, and Santoro (2020)

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

Commercial Paper/T-Bill like securities

YIELD Protocol

  • basic idea: zero-coupon loans
  • You have:
    • target asset
    • collateral
    • y-token trading at discount price 
  • examples: yDAI
  • expires in 1 year
  • price: $.92
  • backed by ETH
  • buying = you earn 8/92 cents=8.7% RoR

YIELD example

1 ETH = 150 DAI
collateralization ratio 125%

seller

buyer

Assumptions

supplies 1 ETH collateral today

mints (=borrows) 100 yDAI to be repaid in 1 year

y

receives 92 DAI today

pays 92 DAI today

y

receives 100 yDAI

repays loan with 100 DAI

deposits yDAI and receives 100 DAI

YIELD example: scenarios

seller

buyer

Scenario 1: ETH \(\ge\)125 DAI

deposits 100 yDAI

withdraws 100 DAI

receives balance of 1 ETH - 100 DAI

What does the seller own (ignore keeper fee)?

  • 92 Dai (the loan)
  • 0.2 ETH x price(ETH)=25 DAI (assume price=125)

seller

buyer

Scenario 2: ETH falls to <125 DAI

keeper

closes undercollateralized position \(\to\) sells 0.8 ETH for 100 DAI

receives 100 DAI early

receives balance
of 0.2 ETH

@financeUTM

andreas.park@rotman.utoronto.ca

slides.com/ap248

sites.google.com/site/parkandreas/

youtube.com/user/andreaspark2812/

Blockchain 2: DeFi Lending 2023

By Andreas Park

Blockchain 2: DeFi Lending 2023

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

  • 1,220