DeFi Primitives
Module 1 of DeFi
What Is DeFi?
DeFi = Decentralized Finance
Financial services built on blockchain without traditional intermediaries:
- No banks
- No brokers
- No centralized exchanges
- 24/7/365 operation
- Permissionless access
"Be your own bank" — but actually.
The DeFi Stack
┌─────────────────────────────────────┐
│ AGGREGATORS & FRONTENDS │ User interfaces
├─────────────────────────────────────┤
│ YIELD OPTIMIZERS │ Auto-compound, strategies
├─────────────────────────────────────┤
│ DERIVATIVES │ Options, perps, synthetics
├─────────────────────────────────────┤
│ LENDING/BORROWING │ Aave, Compound
├─────────────────────────────────────┤
│ DECENTRALIZED EXCHANGES │ Uniswap, Curve
├─────────────────────────────────────┤
│ STABLECOINS │ USDC, DAI, USDT
├─────────────────────────────────────┤
│ BASE LAYER (Ethereum, L2s) │ Settlement
└─────────────────────────────────────┘
Each layer builds on the ones below. This is composability.
Primitive 1: Stablecoins
Tokens pegged to stable assets (usually $1 USD).
Types
| Type | Examples | Mechanism | Trade-off |
|---|---|---|---|
| Fiat-backed | USDC, USDT | Reserves in bank | Centralized, censurable |
| Crypto-backed | DAI | Over-collateralized loans | Capital inefficient |
| Algorithmic | FRAX | Partial collateral + algo | Risk of de-peg |
Why They Matter
Stablecoins are DeFi's foundation:
- Unit of account
- Medium of exchange
- Escape crypto volatility
- On-ramp from TradFi
Primitive 2: Decentralized Exchanges (DEXs)
Trade without intermediaries.
Order Book vs AMM
| Order Book (Traditional) | AMM (DeFi) |
|---|---|
| Buyers/sellers post orders | Liquidity pools |
| Market makers needed | Anyone provides liquidity |
| Complex, gas-intensive | Simple, gas-efficient |
| Examples: dYdX, Serum | Examples: Uniswap, Curve |
How AMMs Work
Liquidity providers deposit token pairs:
Pool: 100 ETH + 200,000 USDC
Price = 200,000 / 100 = $2,000/ETH
Buy 1 ETH:
New pool: 99 ETH + 202,020 USDC
Paid: 2,020 USDC (includes slippage)
Key Protocols
| Protocol | Specialty |
|---|---|
| Uniswap | General purpose AMM |
| Curve | Stablecoin/pegged assets |
| Balancer | Multi-asset pools |
| SushiSwap | Uniswap fork + extras |
Primitive 3: Lending & Borrowing
Earn yield or access leverage without selling.
How It Works
Suppliers:
- Deposit assets (ETH, USDC, etc.)
- Receive interest-bearing tokens
- Earn yield from borrowers
Borrowers:
- Deposit collateral
- Borrow against it (typically 50-80% LTV)
- Pay interest
- Liquidated if collateral ratio falls
Key Protocols
| Protocol | TVL | Key Feature |
|---|---|---|
| Aave | $10B+ | Flash loans, multiple markets |
| Compound | $2B+ | cTokens, governance |
| MakerDAO | $8B+ | DAI stablecoin |
Liquidations
If collateral value drops too much:
Deposit: $10,000 ETH
Borrow: $6,000 USDC (60% LTV)
Liquidation threshold: 80% LTV
If ETH drops to $7,500 value:
LTV = 6,000 / 7,500 = 80% → LIQUIDATED
Liquidator repays debt, takes collateral at discount
Primitive 4: Derivatives
Synthetic exposure to assets or events.
Types
| Derivative | Description | Examples |
|---|---|---|
| Perpetual Swaps | Futures without expiry | dYdX, GMX |
| Options | Right to buy/sell | Dopex, Lyra |
| Synthetics | Tokens tracking any asset | Synthetix |
| Prediction Markets | Bet on outcomes | Polymarket |
Perpetual Swaps
Most popular DeFi derivative:
- No expiry date
- Funding rate keeps price aligned
- High leverage (up to 100x)
- $100B+ daily volume
Primitive 5: Yield Aggregators
Automatically optimize yield across protocols.
How They Work
1. User deposits asset
2. Protocol finds best yield opportunity
3. Auto-compounds rewards
4. Socializes gas costs
Example:
Without aggregator: 10% APY, manual claims
With aggregator: 12% APY (compounding), no effort
Key Protocols
| Protocol | Strategy |
|---|---|
| Yearn | Multi-strategy vaults |
| Convex | Curve yield boosting |
| Beefy | Cross-chain yield |
DeFi Composability
The magic of DeFi: protocols interact seamlessly.
Example: Yield Farming Loop
1. Deposit ETH as collateral (Aave)
2. Borrow stablecoins (Aave)
3. Provide liquidity (Curve)
4. Stake LP tokens (Convex)
5. Earn:
- Aave deposit interest
- Curve trading fees
- CRV rewards
- CVX rewards
All in one transaction with flash loans!
Risks in DeFi
Smart Contract Risk
Code bugs = lost funds. Major hacks:
- The DAO ($60M, 2016)
- Wormhole ($320M, 2022)
- Ronin ($625M, 2022)
Oracle Risk
Price feeds can be manipulated.
Liquidation Risk
Volatility can trigger cascading liquidations.
Regulatory Risk
Uncertain legal status in many jurisdictions.
Rug Pulls
Anonymous teams can steal funds.
DeFi vs TradFi
| Aspect | TradFi | DeFi |
|---|---|---|
| Access | Permissioned | Permissionless |
| Hours | Business hours | 24/7/365 |
| Settlement | T+2 days | Seconds/minutes |
| Custody | Counterparty | Self-custody |
| Transparency | Opaque | Fully auditable |
| Composability | Siloed | Interoperable |
| Innovation | Slow (regulation) | Fast (open source) |
Key Takeaways
- Stablecoins are foundational — DeFi's unit of account
- AMMs replaced order books — democratized market making
- Lending enables leverage — capital efficiency
- Derivatives add sophistication — hedging, speculation
- Composability is the superpower — protocols build on each other
- Risks are real — smart contract bugs, liquidations, hacks
Questions to Consider
- Can DeFi ever be as safe as TradFi?
- What happens when a major stablecoin de-pegs?
- Is over-collateralization sustainable long-term?
- How will regulation affect DeFi?