Title Text

Digital currencies & Blockchain

Lecture 10

 

  • Decentralized Finance
     
  • Legal & Tech issues

Content

  • Completely Transparent

    • Blockchain

    • Open-Source 

  • Eliminates Middlemen

  • Trust-minimizing

  • Open and permissionless

  • Composable

  • Allows unprecedented automatization

    • algorithmic finance

    • programmable money

  • Allows things that have not been possible before

    • Stablecoin with no counterparty risk

    • Flash loans

Advandatges

  • Smart Contract Risk
    • Buggy code --> loss of $ 
  • Design flaws
    • Within a dapp
    • When interacting with other dapps
    • Unintended Consequences
  • Legal risks
    • Who is held accountable?
    • Accessing Dapps via Interface vs. Raw contract
    • Fitting into existing legal framework vs. rethinking the legacy frameworks

Risks

  • Token Function
    • Used for Governance vs collateral vs currency
       
  • Properly aligns incentives across stakeholders
     
  • The mechanism to maintain scarcity
    • disinflationary vs deflationary vs burned
       
  • The mechanism to generate value
     
  • The mechanism to generate network effects

CryptoEconomics Evaluation

  • artificial shortage
    • buyback and burn (Binance)
  • profit-sharing (securities!)
  • running the platform infrastructure
    • receiving fees (Renprotocol)
  • network effect (Ethereum)
  • decentralized governance (Decred, MakerDAO)
  • ownership rights (NFTs, STOs)
  • PoS with slashing (Cosmos)
  • forced token utility
    • In-app currency (Celsius -- hard to do)

 

Things that accruve value

Dai - How

 

  • First, ETH is turned into “wrapped ETH” (WETH), which is simply an ERC20 wrapping around ETH. This “tokenizes” ETH so it can be used like any other ERC20 token.
     
  • Next, WETH is turned into “pooled ETH” (PETH), which means it joins a large pool of Ethereum that is the collateral for all Dai created.
     
  • Once you have PETH, you can create a “collateralized debt position” (CDP), which locks up your PETH and allows you to draw Dai against your collateral, which is PETH.As you draw out Dai, the ratio of debt in the CDP increases. There is a debt limit that sets a maximum amount of Dai you can draw against your CDP. Once you have Dai, you can spend or trade it freely like any other ERC20 token.

Dai - Why

  • You need a loan, and have an asset (ETH) to use as collateral for your loan
     
  • You believe ETH is going up in value. You can use your CDP to buy ETH on margin — you lock up your ETH in a CDP, draw Dai against it, use the Dai to buy more ETH on an exchange, and then use that ETH to further increase the size of your CDP.--> without any third-party or centralized authority
     
  • The demand for Dai drives the price above $1 USD. When this occurs, you can create Dai then immediately sell it on an exchange for greater than $1 USD. This is essentially free money, and is one of the mechanisms the Maker system uses to keep Dai pegged to $1 USD. Dai being worth over $1 USD encourages more Dai to be created.

Dai - Peg Mechanism

  • If Dai < $1 USD, CDP owners can pay down their debt at a cheaper price!
    • fe. CDP with $1000 in ETH --> draw out 500 Dai to close the position --> pay back 500 Dai (paying debt destroys Dai).
       
  • If Dai < $1 USD, then buy cheaper DAI (fe 0.99 USD) --> pay off debt with a 1% discount == free money — $500 loan (500 Dai) --> 500 Dai for $495 (0.99 * 500 = 495, a 1% discount)
  • --> demand for Dai increases its price, until it approaches $1 USD.
    If Dai stays below $1, CDP owners continue to pay down debt and remove Dai from the system.

     
  • --> When Dai goes above $1 USD, Dai is created to feed the demand. It is this push and pull, creation and destruction, supply and demand which ensures that Dai always matches the $1 USD peg.

Value accrued in MKR

Dai - Taking a loan

1. Deposit ETH to Metamask

2. Wrap ETH --> WETH (via Dai.makerdao.com)

3.Exchange it for PETH (pool eth), used for collateral

4. Create CDP (the loan)

5. Lock your PETH collateral

6. Mint new DAI (max. 60% of collateral)

7. Exchange DAI for ETH at Oasis DEX

8. Send ETH to any exchange and get EUR, BTC etc.

Dai - Repaing a loan

1. Get some ETH

2. Exchange it for DAI (which you owe) and MKR (for governance fee) on Oasis DEX

3. Return DAI to the smart contract and pay the fee in MKR

4. You cancel CDP smart contract

5. Unlock your PETH

6. Exchange PETH for WETH

7. Unwrap WETH --> ETH

8. You have your ETH back

Uniswap

Uniswap is a fully decentralized on-chain protocol for token exchange on Ethereum that uses liquidity pools (AMM) instead of order books. Anyone can quickly swap between ETH and any ERC20 token or earn fees by supplying any amount of liquidity. And anyone can create a market (i.e., liquidity pool) by supplying an equal value of ETH and an ERC20 token.

 

Uniswap allows only one market per ERC20 token. The market creator sets the exchange rate, which shifts through trading due to Uniswap’s “constant product market maker” mechanism. When trading reduces one side of the pair’s liquidity relative to the other, the price changes. This creates arbitrage opportunities, encouraging more trading.

Uniswap II.

Uniswap III.

Yearn Finance

- is a decentralized ecosystem of aggregators that utilize lending services such as Aave, Compound, Dydx, and Fulcrum to optimize your token lending. When you deposit your tokens to yearn.finance, they are converted to yTokens, which are periodically rebalanced to choose the most profitable lending service(s).

 

YFI, yearn.finance's governance token, is distributed only to users who provide liquidity with certain yTokens. 

Compound

Compound is an algorithmic money market protocol on Ethereum that lets users earn interest or borrow assets against collateral. Anyone can supply assets to Compound’s liquidity pool and immediately begin earning continuously-compounding interest. Rates adjust automatically based on supply and demand.
 

Supplied asset balances are represented by cTokens: representations of the underlying asset that earn interest and serve as collateral. Users can borrow up to 50-75% of their cTokens’ value, depending on the quality of the underlying asset. Users can add or remove funds at any time, but if their debt becomes undercollateralized, anyone can liquidate; a 5% discount on liquidated assets serves as incentive for liquidators.

  • 0x/AirSwap - set of open smart contracts for exchange of Ethereum based tokens. Developers can leverage these tools to create ‘relayers, --> essentially application interfaces that allow users to trade in a decentralized manner.
    -->off-chain order books with on-chain settlement

     

    Augur/Gnosis - decentralized prediction market around any event . --> ‘wisdom of the crowd’ --> great hedging tools. anyone can create a market for around $40 USD and trade outcome shares for a few dollars in fees --> global risk allocation much more efficient

    dy/dx -  creation, issuance, and trading of decentralized derivatives for ERC20 tokens
     

    {Set} Protocol - indexing and collateralized baskets of ERC20 tokens of ERC20 tokens
     

    Dharma -  protocol for debt tokenization in form of ERC20 token. What this means is that anyone can leverage their development tools and smart contracts to originate, underwrite, issue, and administer debt agreements without a central third party.

Key DeFi sources

1. DeFipulse.com --> metrics based on Total value Locked (TCL)

 

2. Zapper.fi --> Easy interface for multiple protocols

 

3. Duneanalytics.com --> on-chain data from various protocols

 

 

Legal Issues

  • Old vs. New Financial world - which one will bend?
    • ​How to apply financial regulations on decentralized protocols?

       
  • Accessing service via GUI vs Smart contract
     
  • How to settle discrepancies between the state of smart contract and state of the physical world (off-chain assets)
     
  • The legal status/classification of governance tokens?
     
  • How to account for staking/lending/airdrops/forks? 

 

Tech Issues

  • Scaling
    • ETH 2.0 - Will sharding break composability?
    • Layer Two tech
       
  • UX
    • Gas fees
       
  • Security
    • Hacks and bugs happen too often

 

Exam - 22.12 17:00

  • Bitcoin protocol, inner working, and transactions
  • BTC vs ETH differences
  • Consensual Algorithms (PoW, PoS..)
  • Ethereum protocol
  • Smart contracts
  • Blockchain mechanism and differences
  • Altcoin differences
  • Basic understanding of DeFi protocols

 

Conceptual understanding of:

Reading:

How to DeFi (Book) - chapters 2, 3, 5

Coinstory.tech

- Book on the evolution of crypto
 

- Interviews with thought leaders
 

- Regular newsletter
 

- More to come!

UNI - L10

By David Stancel

Loading comments...

More from David Stancel