Sep 28 , 2020

DeFi Terms

DeFi Terms:

  1. AMMs (Automated Market Makers)

    • Automated Liquidity Management

    • Intermediate entities between:

          a) Liquidity providers

          b) Traders

    Pros:

        a) AMMs do not have a bid-ask spread

        b) AMMs can act as an oracle

        c) AMMs are highly gas efficient compared to order books

    Cons:

        a) Price instability as even small orders move the price in AMMs

        b) Vulnerability to price manipulation since Sandwich attacks are largely unavoidable in AMMs

        c) Impermanent Loss to LPs

    Formula:

    𝒳𝒴 ≤ 𝒳′𝒴′

    - Here 𝒳′ and 𝒴′ are the token balances of the pool after the trade and 𝒳 and 𝒴 token balances of the pool before the trade.
    - This guarantees that the pool’s asset holdings can only stay the same or increase.
    - Most pools enforce some kind of a fee. Not only should the product of the balances increase, but it should increase by at least a certain amount to account for a fee.
  2. Long

    • Calculation:
      • Profit: (Current value of the position - Entry value of the position)
      • Formula: (Position's size in tokens * Current market price) - (Position's size in tokens * Average entry price)
  3. Short

    • Calculation:
      • Profit: (Entry value of the position - Current value of the position)
      • Formula: (Position's size in tokens * Average entry price) - (Position's size in tokens * Current market price)
  4. Order Size

    • States:
      • Fulfilled, Pending, or Failed
  5. Position Size

    • Position STATES:

          A. Profitability:

              1. Winning/Profitable         2. Losing/Unprofitable         3. Breakeven

          B. Holding:

              1. Long term         2. Short term

          C. Risk:         1. High         2. Low

          D. Leverages

              1. Over-leverage

              2. Hedged

          E. Realization

              1. Realized

                  - Closed positions             - Profit/loss already incurred

              2. Unrealized

                  - Open positions             - Profit/loss not known

    • Position TYPES: A. Price Movements Impacted

      1. Long

        • Buying first, selling later
      2. Short

        • Selling first, buying later

      B. Price Movements Agnostic

      1. Flat

      Strategies to Minimize Price Movements:

      1. Hedged position
      2. Leveraged
      3. Unleveraged
      4. Arbitrage
      5. Options
        • Rights or obligations tied to:
          • Price movement
          • Date
      6. Margin positions
        • Borrowing funds against existing assets
  6. Flow

    • User Orders:

      • Order Properties:

        • Size
        • Order size changes affecting user position
  7. Collateral Price

    • The fair market value of the assets used to secure a loan

    • Questions:

      • Who determines collateral price?
      • Its origin/source?
      • Frequency of obtaining this price?
  8. Collateralization Ratio

    • The collateralization ratio is the collateral value of the loan divided by the value of the loan.
    • Checkout CREAM FINANCE
    • Case study: yUSD manipulation
  9. Loan Underwater

  10. Insolvent Liquidation

    • Questions:

      • Keeper's role in liquidation?
      • Impact of reorgs/block stuffing attacks?
      • Are keepers encoded in smart contracts?
  11. Stablecoin Depeg

    • A cryptocurrency whose value is tied to the value of an underlying asset, such as another currency or resource — becomes worth less or more than its pegged asset.
  12. Oracles

    • TWAP Oracles

Questions to Ponder:

  1. What happens if the contract returns more than the specified length?
    • All memory up to the length is overwritten with return data
    • Extra data is truncated
  2. What happens if the contract returns less than the specified length?
    • All data returned is written to memory
    • Extra memory is left unchanged

Thanks for reading! If you want to see future content, you can follow me on Twitter or get connected over at LinkedIn.


Support My Content

If you find my content helpful, consider supporting a humanitarian cause (building homes for elderly people in rural Terai region of Nepal) that I am planning with your donation:

Ethereum (ETH)

0xb0b1B20062DA9Dd7BaA4D5b088DF49dbe4b46fF2

Thank you for your support!