Decentralized Finance
Applications

Instructor:           Andreas Park
 

 

Rotman – Master in Financial Risk Management

Financial Innovation

Application: Issuing and transferring money

Cryptocurrencies vs USD

Cryptocurrency = money?

Can bitcoin or ether replace "fiat" MONEY?

store of value?

unit of account?

method of exchange?

\(\to\) does not require "double coincidence of wants"

\(\to\) don't have to price everything relative to each other

\(\to\) don't have to spend money immediately upon receiving it

BTC, ETH

fiat: USD, EUR

asset (gold)

fee-backed

Seigniorage

Crypto

Traditional

Algorithmic

Collateral-Backed

Taxonomy of Stablecoins

The Impossible Trinity (macroeconomics)

free flow of capital

Control exchange rate

Control interest rate

Basic macroeconomics: you can have TWO out of THREE

Why? The inconvenience of markets ...

unified unit of account: dai

Money

Idea:

  • create fiat money on chain
  • 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

user perspective

Maker DAO

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

Maker DAO

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?

Maker DAO

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?

Maker DAO

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\) liquidation possible by "keeper"

sell 3.33 ETH=$500=500 DAI

repay $500=500 DAI loan

retain incentive

return ETH remainder to pool

Maintaining the Peg: monetary policy

Maker DAO

  • Why works:
    • over-collateralization:
      • ETH expensive relative to DAI \(\to\) issue more DAI
      • supply (DAI) \(\nearrow\)
      • price (DAI) \(\searrow\)
    • market: if ETH \(\searrow\) then:
      • ​ETH cheap relative to DAI
      • 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

Application: asset trading

Note: we are covering trading in a separate set of slides; I am including them here for completeness

The Ugly Truth: token trading and token markets are different from securities trading and markets

Investor

Broker

Venue

Settlement

Exchange

Traditional

Wholeseller

Darkpool

Internalizer

Venue

Settlement

Investor

On chain

Crypto

decentralized exchange

Key Components

Idea:

  • create a way to exchange items on-chain
  • fully decentralized
  • \(\to\) no single controlling entity, or location, everything runs with smart contracts

How do you organize DEX trading?

Atomic swaps

How do you organize DEX trading?

Liquidity?

  • Laissez-faire: Etherdelta or Kyber
    • people submit contracts (limit orders) on-chain
    • system collects info
    • system offers "tools" to trade against standing contracts
  • Hybrid: 0x
    • "dark liquidity"
    • off-chain/sidechain purchase/sale agreements
    • system matches compatible orders and posts on-chain
  • Automated market maker (AMM) (Uniswap)
    • AMM holds assets on both sides
    • offers two-sided quotes (\(\to\) always liquid)
    • prices adjust continuously to demand/supply shifts

How do you organize DEX trading?

automated market maker

Price mechanism:

  • risk-neutral "invariance" pricing
  • at price, contract (AMM) is indifferent between buying and selling
  • \(X=\) contract balance of asset \(A\)
  • \(Y=\) contract balance of asset \(B\)
  • \(k=\) invariance factor
  • key relation \(k=X\times\ Y\)

Prices

  • when you want to sell \(x\le X\) you receive \(y\) that maintains invariance. 
  • implied exchange rate: \(e=\frac{x}{y}\)

How do you organize DEX trading? EXAMPLE

automated market maker

invariant \(k=4\times4=16\) 

Instantaneous exchange rate:

1             =   1

Contract deposit:

How do you organize DEX trading? EXAMPLE

automated market maker

sell 4 DAI for USDC

what price will therefore be quoted?

\begin{array}{rcl} k&=&\#\text{DAI}\times\#\text{USDC}\\ 16&=&(4+4)\times(4-y)\\ y&=&2 \end{array}

how many USDC?

e=x/y~~\to~~e=2

How do you organize DEX trading? EXAMPLE

automated market maker

Problem: large "slippage" (or price impact)

  • imagine: deposit is 100 DAI & USDC:
    • \(k=100\times100=10,000~\to\) for \(x=4\) get \(y=100-10000/104=3.85\)
       
  • imagine: deposit is 10,000 DAI & USDC:
    • \(k=10,000\times10,000=100,000,000~\to\) for \(x=4\) get \(y=10,000-100,000,000/10,004=3.998\)
       
  • ​\(\to\) the more money is in the contracts, the lower the price impact, the more tokens \(y\) you get per token \(x\).

How do you organize DEX trading? other mechanisms

automated market maker

  • anyone can become a liquidity provider when supplying both sides of a pair
     
  • trades carry a fee of 30bps \(\to\) paid to liquidity providers (pooled)
     
  • LPs still face opportunity costs relative to all other assets \(\to\) income must be sufficient

supercool feature

automated market maker

  • establish and sell a new token
     

    • create token
    • deposit token and counterasset (e.g., DAI)
    • \(\to\) opening price
    • \(\to\) new purchases will increase price

  •  

superannoying feature

automated market maker

  • front-running

    • transactions enter mem-pool

    • \(\to\) all visible there

    • arbitrageur make instant-swap trade at higher gas price

      • \(\to\) trade instead of original trade

      • \(to\) reverse to gain slippage from earlier trader

Convenient feature for arbitrage: Flash loans (Flash swaps)

automated market maker

  • take three pairs (ignore that BTC is not directly on Ethereum)

    • BTC-DAI

    • ETH-BTC

    • ETH-DAI

  • three pairs must satisfy non-arbitrage condition
  • e.g. if ETH:DAI =1:100 and BTC:DAI=1:10000 then BTC:ETH=1:100
  • say BTC:ETH=1:200 then
    • borrow (say) 10,000 DAI
    • use DAI to buy  1 BTC
    • sell 1 BTC for 200 ETH and
    • sell 200 ETH for 20000 DAI
    • of which you use 10,000 DAI to repay loan and pocket 10,000
  • Normally, this is hard!
  • But on blockchain you can do all operations in one go
  • \(\to\) no risk of leg of transaction not going through or non-delivery
  • flash (single-block) loans enable this

How does it look?

automated market maker

\(\to\) simply connect with MetaMask (or similar wallet)

Application: Innovative Lending

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

how are the rates determined? - a function

compound Finance

100%

fraction of supplied that's been borrowed

base rate

borrow rate

\textsf{borrow rate}=\textsf{base rate}+\textsf{slope coefficient}\times\textsf{\% borrowed}
\textsf{supply rate}=\textsf{borrow rate}\times\textsf{\% (borrowed}-\textsf{reserve)}

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!)

Tracking ownership

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)

Application: Derivatives

Yearn

derivatives

  • 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=8.7%

Yearn example

derivatives

1 ETH = 300 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

Yearn example: scenarios

derivatives

seller

buyer

Scenario 1: ETH \(\searrow\)100 DAI

keeper

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

receives 100 DAI early

receives balance
of 0.2 ETH

seller

buyer

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

deposits 100 yDAI

withdraws 100 DAI

receives balance of 1 ETH - 100 DAI

what is dydx?

derivatives

main product:
BTC perpetual futures contract

initial margin =
amount of collateral needed to be posted

maintenance margin =
amount of price movement after which collateral needs to be replenished

Source: Harvey, Ramachandran, and Santoro (2020)

Application: Innovative Financing Tools

Cumulative Token sales since Jan 2016

Data: coinschedule

$25B total

$21B in 2018

for comparison: total size of

  • Toronto Stock Exchange: $2,200B

  • Toronto Venture Exchange: $41B

Tokens as Payments: a New Financing Tool?

Preliminary (academic) Research insights: What can (utility) tokens finance that traditional securities cannot? 

can finance projects that otherwise would find no debt or equity funding

enable network effects and new business opportunities

allows entrepreneurs to extract more surplus

can finance projects that otherwise would find no debt or equity funding

Blockchain Tech Stack: Tokens vs Cryptocurrencies


Infrastructure
 

reward
and
internal currency

usage fee
or
incentive


usage fee
 


Service
 


Application
 

Tech Stack Layer

Role of Token

cryptocurrency

Token

Token

Platform Economics

Examples of platform markets

gamers

users

“eyeballs”

cardholders

videogame platform

operating system

portals, newspapers, TV

debit & credit cards

game developers

application developers

advertisers

merchants

buyer

platform

seller

Platform pricing

Source: Jean Tirole's Nobel Lecture

Implications for the platform business model

Source: Jean Tirole's Nobel Lecture

  • account for what each side can bear
  • account for externalities
  • \(\to\) skewed pricing

Simple Example: heterosexual clubbing

assumption: people go clubbing to meet the opposite gender

common problem: imbalance of people from each gender

common solution: differential pricing (including free entry) for one side of the market

Regulation?

Question: is it a must-use arrangement or do people have alternatives?

MFRM: DeFi Applications - Part 4

By Andreas Park

MFRM: DeFi Applications - Part 4

This slide deck briefly discusses and reviews popular DeFi applications for MFRM RSM6313.

  • 418