DeFi Terms
DeFi Terms:
-
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:
-
-
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)
- Calculation:
-
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)
- Calculation:
-
Order Size
- States:
- Fulfilled, Pending, or Failed
- States:
-
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
-
Long
- Buying first, selling later
-
Short
- Selling first, buying later
B. Price Movements Agnostic
- Flat
Strategies to Minimize Price Movements:
- Hedged position
- Leveraged
- Unleveraged
- Arbitrage
- Options
- Rights or obligations tied to:
- Price movement
- Date
- Rights or obligations tied to:
- Margin positions
- Borrowing funds against existing assets
-
-
-
Flow
-
User Orders:
-
Order Properties:
- Size
- Order size changes affecting user position
-
-
-
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?
-
-
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
-
Loan Underwater
- Reference: YouTube Shorts
-
Insolvent Liquidation
-
Questions:
- Keeper's role in liquidation?
- Impact of reorgs/block stuffing attacks?
- Are keepers encoded in smart contracts?
-
-
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.
-
Oracles
- TWAP Oracles
Questions to Ponder:
- 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
- What happens if the contract returns less than the specified length?
- All data returned is written to memory
- Extra memory is left unchanged