09 — DeFi (Decentralized Finance)

Financial applications built on smart contracts: AMMs, lending, derivatives, stablecoins, RWA, perpetuals, restaking. Combined TVL: ~US$ 200B (May/2026).


1. Pillars

Category Function Top protocols
DEX (AMM) Spot swaps Uniswap, Curve, Balancer, PancakeSwap, Aerodrome
DEX (orderbook) Order-book trading dYdX, Hyperliquid, Drift, Serum
Lending/Borrowing Collateralized loans Aave, Compound, Morpho, Spark
Derivatives / Perps Perpetual futures Hyperliquid, dYdX, GMX, Vertex, Drift
Stablecoins USD-pegged tokens USDT, USDC, DAI, ENA, FRAX, crvUSD
Liquid staking (LSTs) Liquid ETH/SOL staking Lido, Rocket Pool, Jito
Liquid restaking (LRTs) Liquid EigenLayer staking Ether.fi, Renzo, Puffer
Yield aggregators Passive optimization Yearn, Beefy, Convex, Aura
Bridges Cross-chain LayerZero, Wormhole, Stargate, Across
Oracles Off-chain data Chainlink, Pyth, RedStone, API3
RWA Real-world assets Ondo, Centrifuge, MakerDAO, BlackRock BUIDL
Insurance Smart contract coverage Nexus Mutual, InsurAce
Prediction markets Betting on events Polymarket, Kalshi (US-regulated)
DAOs / Governance On-chain coordination Snapshot, Tally, Aragon, Safe

2. AMMs (Automated Market Makers)

Constant-product (Uniswap v1/v2)

\[x \cdot y = k\]

Pool with \(x\) tokens A + \(y\) tokens B; constant product. Swapping \(\Delta x\) tokens A:

\[\Delta y = y - \frac{k}{x + \Delta x \cdot (1 - \text{fee})}\]

Fee (0.3% Uniswap v2) accrues in the pool, benefiting LPs.

Uniswap v1 (Nov/2018)

  • Hayden Adams (ex-Siemens engineer).
  • ETH ↔ ERC-20 only.
  • 0.3% fee.
  • Hello-world AMM.

Uniswap v2 (May/2020)

  • Token-token pairs (any ERC-20 ↔ any ERC-20).
  • Flash swaps: borrow + return in the same tx.
  • TWAP price oracles built-in.

Uniswap v3 (May/2021)

  • Concentrated liquidity: LPs choose price ranges (capital efficient).
  • Fee tiers: 0.05%, 0.3%, 1% (later 0.01%).
  • Non-fungible LP positions (NFTs).
  • Inspired copies everywhere (PancakeSwap v3, etc.).

Uniswap v4 (Jan/2024)

  • Hooks: pre/post swap callbacks → custom AMM logic per pool.
  • Singleton contract: all pools in one contract. Gas saving.
  • Flash accounting: net deltas instead of intermediate transfers.
  • Hooks enable: dynamic fees, custom oracles, MEV-protection, on-chain limit orders.

Curve

Michael Egorov 2020. Stableswap formula:

\[\sum x_i + (D \prod 1) = ...\text{(invariant blends sum + product)}\]

Optimized for closely-priced assets (USDTUSDCDAI; ETH/stETH). Slippage minimal in the middle of the range, growing outside it.

  • CRV: governance token.
  • veCRV (vote-escrowed): lock CRV to boost rewards + governance weight. Pioneer "ve-tokenomics".
  • Curve Wars: Convex accumulated veCRV → controls emissions → protocols (Frax, Yearn) bid for Convex influence.

Balancer

  • Weighted pools (multi-asset, custom weights).
  • Stable pools (Curve-like).
  • Boosted pools (composable LP).
  • CoW Protocol (related entity): batch auction MEV-resistant.

PancakeSwap

BSC primary (later multi-chain). Uniswap fork. Largest DEX on BSC. Cake token.

Aerodrome (Base)

Velodrome fork on Base. ve(3,3) tokenomics. Top DEX on Base — TVL ~US$ 1B.

SushiSwap

Vampire-attacked Uniswap v2 in Sep/2020. Drama, rollercoaster. Multi-chain, declined.

Maverick, Trader Joe v2.1, Camelot

Concentrated liquidity variations.


3. Stableswap variants

Specialized for stable assets:

  • Curve (above).
  • Saddle: Curve fork (defunct as major).
  • Ellipsis (BSC Curve fork).

4. Orderbook DEX

dYdX

  • v3 (StarkEx L2, 2021–2023): Top decentralized perp DEX initially.
  • v4 (Cosmos appchain, 2023): migrated. Off-chain orderbook + on-chain settle. ~US$ 1B/day volume.

Hyperliquid

  • App-specific L1 (custom HyperBFT consensus).
  • Top decentralized perp DEX 2024-2026. ~US$ 5-10B daily volume.
  • HYPE token TGE Nov/2024.

Drift, Vertex, Serum (legacy)

Solana-based orderbook DEXes.

Aevo

Optimistic rollup focused on options + perps.


5. Lending

Compound (Jun/2018)

  • Pioneer: floating-rate lending pools.
  • COMP token (Jun/2020) initiated liquidity mining = DeFi summer.
  • Compound III (USDC-base) 2022.

Aave (formerly ETHLend)

  • v1 (2020), v2 (2020), v3 (2022).
  • Multi-collateral pools.
  • Flash loans: borrow + repay in 1 tx (no collateral).
  • eMode: same-class assets boosted LTV.
  • Isolation mode for new assets.
  • Multi-chain.

Morpho

  • Morpho Optimizer (legacy): peer-to-peer matching atop Aave/Compound.
  • Morpho Blue (Jan/2024): minimal isolated lending markets, 650 lines code, immutable.
  • MetaMorpho vaults: curated allocations.
  • Top growth DeFi 2024-2025. TVL ~US$ 8B.

Spark (MakerDAO)

Aave fork by MakerDAO/Sky. DAI-centric. SubDAO of the Sky ecosystem.

Others

  • Euler v2 (relaunched after 2023 hack).
  • Silo Finance.
  • Radiant (omnichain lending via LayerZero).
  • Liquity (LUSD stablecoin lending).

6. Stablecoins

Centralized (custodial)

Token Issuer Reserves Dominant chain Marketcap (May/2026)
USDT (Tether) Tether Ltd Mix (treasuries, cash, BTC, etc.) Tron, Ethereum ~US$ 150B
USDC Circle (with Coinbase) Treasuries + cash Ethereum, Solana, Base ~US$ 60B
PYUSD Paxos for PayPal Treasuries + cash Ethereum, Solana ~US$ 1B
FDUSD First Digital Trust Treasuries BSC ~US$ 2B
TUSD TrustToken / Techteryx Treasuries Multi-chain ~US$ 0.5B
USDe (Ethena) Ethena Labs Synthetic delta-neutral (ETH + perps short) Ethereum ~US$ 5B

Crypto-collateralized

Token Protocol Backing
DAI MakerDAO / Sky Multi-collateral (ETH, RWA via private credit, USDC)
USDS Sky (rebrand DAI 2024) Same
crvUSD Curve LLAMMA-AMM liquidations
GHO Aave Multi-collateral debt
LUSD Liquity ETH-only, immutable

Algorithmic / hybrid

Token Mechanism Status
FRAX Hybrid (partial collateral + protocol-controlled value) Active, ~US$ 0.6B
UST (Terra) Algorithmic via LUNA mint/burn DEAD 2022 (US$ 60B collapse)
USDe (Ethena) Delta-neutral synthetic Active, growing

USDe (Ethena) — an interesting case

Guy Young 2023. Synthetic dollar:

  • Holds long ETH spot.
  • Shorts ETH perpetual futures (delta-neutral).
  • Funding rate revenue → yield to sUSDe stakers.
  • Risks: negative funding rate (costs), exchange counterparty (centralized perp venues).

ENA token. ~US$ 5B circulating mid-2026.

Stablecoin GENIUS Act (US, 2025)

Federal framework. Bank-issued stablecoins legitimized. Big banks (JPM, Citi) launching tokens.

Brazil — Drex (CBDC)

Central Bank's Digital Real. Phased rollout 2025-2026. Privacy concerns; regulator-controlled.


7. Liquid Staking (LSTs)

ETH staked via a protocol → liquid wrapped token.

Token Protocol TVL
stETH Lido US$ 30B (30% of all staked ETH)
rETH Rocket Pool ~US$ 4B
cbETH Coinbase ~US$ 2B
wstETH wrapped stETH (rebasing fix) derivative
frxETH Frax ~US$ 1B

Solana LSTs

  • JitoSOL: Jito-Solana validator client + MEV revenue. Top LST on Solana.
  • mSOL: Marinade.
  • bSOL: BlazeStake.

Concerns

  • Lido centralization: 30% threshold debated; Vitalik wrote about ETH staking centralization risks.
  • Slashing risk: pool slashing affects all stakers.
  • Liquidity peg: stETH:ETH peg deviates under stress (May/2022 LUNA stress: 0.94, recovered).

8. Liquid Restaking (LRTs)

Wrapping EigenLayer restaked ETH:

Token Protocol TVL
eETH Ether.fi ~US$ 3B
ezETH Renzo ~US$ 2B
pufETH Puffer ~US$ 1B
rsETH Kelp ~US$ 1B

Risks

  • Recursive leverage: LRT → LP in DeFi → re-collateralized.
  • AVS slashing risk propagates.
  • De-peg events (Jan/2024 ezETH brief de-peg under conditions).

9. Yield aggregators

  • Yearn Finance (YFI): Andre Cronje. Fair-launch 2020 (no premine). Vaults strategically deploy capital.
  • Convex (CVX): Curve gauge bribes + boost.
  • Aura: Convex-style for Balancer.
  • Beefy: cross-chain auto-compounding.
  • Pendle: yield tokenization (split principal + yield).

10. Oracles

Smart contracts can't access off-chain data natively — oracles bridge that.

  • Largest oracle network. Decentralized aggregator.
  • Price feeds: thousands of pairs.
  • VRF: verifiable randomness.
  • Automation (formerly Keepers): scheduled triggers.
  • CCIP: Cross-Chain Interoperability Protocol.
  • LINK token.

Pyth Network

  • Pull oracle: low-latency price feeds. Originally Solana, now multi-chain.
  • Publishers: Jane Street, CBOE, Cumberland, Susquehanna.
  • ~400 price feeds, ~80 chains.

RedStone

  • Modular oracle. On-demand or push.
  • Many integrations in LRT pricing.

API3

  • First-party oracles: data providers run their own nodes (no aggregator middleman).
  • dAPIs.

UMA

  • Optimistic oracle: assert + dispute.
  • Used by Polymarket for resolution.

Others

Tellor, DIA, Band, Nest.


11. RWA (Real-World Assets)

Tokenization of traditional assets. Growing fast 2024-2026.

BlackRock BUIDL (tokenized US Treasury fund)

  • Launched Mar/2024 on Ethereum.
  • US$ 500M+ AUM in 2025.
  • Distributed via Securitize.

Ondo Finance (ONDO)

  • USDY (yield-bearing US Treasury wrapper).
  • OUSG (institutional Treasury).
  • US$ 600M+ AUM.

Centrifuge

  • Real-estate, invoice financing tokenization.
  • Integrated with MakerDAO collateral.

MakerDAO RWA collateral

  • ~50% of DAI collateral in RWA (treasuries, US bank loans).
  • Sky (rebranded MakerDAO 2024) doubling down.

Backed Finance, Securitize, Polymath

Tokenization platforms.

TVL trend

US\( 8B in 2023 → US\) 50B in 2025 → US$ 100B+ expected 2026.


12. Prediction markets

Polymarket

  • Polygon-based.
  • US$ 3.5B+ volume in the 2024 election season.
  • USDC-denominated.
  • UMA optimistic oracle resolution.
  • Banned in the US during the 2022-2024 CFTC settlement; relaunched in the US in 2025 under the Trump admin.

Kalshi

  • US-regulated event exchange (CFTC).
  • Not crypto-native but adjacent. Election markets approved 2024.

Augur (legacy)

Pioneer prediction market 2018. Defunct.


13. Insurance

Nexus Mutual

  • Member-owned mutual.
  • NXM token.
  • Coverages: smart contract, exchange, custody.
  • ~US$ 250M cover total active.

Others

Sherlock, InsurAce, Bridge Mutual, Etherisc.


14. DAO governance

Snapshot

  • Off-chain voting (gasless via signed messages).
  • IPFS-hosted proposals.
  • Quadratic, weighted, delegations.
  • Used by 99% of token-voting DAOs.

Tally

  • On-chain execution (after a Snapshot vote).
  • Governor contract integration.

Safe (Gnosis Safe)

  • Multisig wallet standard.
  • Used by 95% of DAOs for treasury.

Governance models

  • Token-weighted: 1 token = 1 vote. Criticism: plutocracy.
  • Quadratic voting: \(\sqrt{\text{tokens}}\) vote weight. Anti-whale.
  • Delegated: hold tokens, delegate vote (UNI, COMP, AAVE).
  • Conviction voting: longer hold = more weight (1Hive).
  • Optimistic governance: pass unless challenged.

Major DAOs

  • MakerDAO/Sky: complex, sub-DAOs (SparkDAO, etc.).
  • Uniswap DAO: UNI holders. Famously inactive on the fee switch debate.
  • Aave DAO: GHO, V4, deployments.
  • Compound DAO: smaller activity.
  • Optimism Collective: Citizens' House (impact attestations) + Token House (technical).
  • ENS DAO.
  • GitcoinDAO.

Governance attacks

  • Beanstalk (Apr/2022): flash-loan to acquire 67% voting power → drain treasury (US$ 182M).
  • Tornado Cash gov takeover (May/2023).

15. DeFi metrics

TVL (Total Value Locked)

DeFi Llama (defillama.com) is the reference. ~US$ 200B (May/2026). Top chains:

Chain TVL
Ethereum L1 ~US$ 80B
Solana ~US$ 12B
BSC ~US$ 10B
Tron ~US$ 8B (mainly USDT)
Base ~US$ 8B
Arbitrum ~US$ 7B
Bitcoin (BTCFi) ~US$ 5B
Sui ~US$ 3B
Avalanche ~US$ 2B
Others ~US$ 65B

DEX volume

US$ 2-5B/day. Uniswap dominant (40%), followed by Aerodrome, Pancake, Curve.

Perp volume

US$ 8-15B/day. Hyperliquid dominant (50%), dYdX, GMX.

Stablecoin supply

~US$ 250B in 2026. USDT 60%, USDC 25%, the rest 15%.


16. Key Innovations Timeline

Year Innovation Protocol
2017 First DEX EtherDelta, Bancor
2017 First lending ETHLend (later Aave)
2018 First AMM Uniswap v1
2019 Stablecoin DeFi DAI multi-collateral
2020 Yield farming Compound COMP launch
2020 Vampire attack SushiSwap
2020 yToken / vault Yearn
2020 Stableswap Curve
2021 Concentrated liquidity Uniswap v3
2021 ve-tokenomics Curve veCRV; later Velodrome ve(3,3)
2022 Optimistic oracle UMA
2023 Restaking thesis EigenLayer
2024 Hooks (modular AMM) Uniswap v4
2024 Modular lending Morpho Blue
2024 Tokenized treasuries mainstream BlackRock BUIDL
2025 Intent-based DeFi Anoma, Brink, ChainKit

17. DeFi-specific anti-patterns / risks

❌ Oracle manipulation via flash loan (use Chainlink TWAP, not spot). ❌ Reentrancy in lending (CEI pattern mandatory). ❌ Front-running on large swaps (use a private mempool or TWAP execution). ❌ Missing slippage protection. ❌ Persistent unlimited approval (use Permit2 / scoped). ❌ Providing liquidity without understanding impermanent loss. ❌ Recursive LRT staking without understanding slashing exposure. ❌ "100%+ APY" yield with no real source of return (probably Ponzi-token-emission).


18. Tools / dashboards

  • DeFi Llama (TVL, yields, prices).
  • Dune Analytics (custom queries).
  • Token Terminal (revenue, fees).
  • Nansen (on-chain analytics + smart money).
  • Arkham (entity labeling).
  • Etherscan, Basescan, etc. (block explorers).
  • DEXScreener (real-time DEX prices).
  • Zerion, DeBank, Zapper (portfolio dashboards).

19. Cross-reference

  • L1s where DeFi lives: 04-l1-bitcoin.md, 05-l1-ethereum.md, 06-l1-alt.md.
  • L2s scaling DeFi: 07-l2-scaling.md.
  • Smart contracts (languages, patterns): 08-smart-contracts.md.
  • Tokens (governance, vesting): 12-tokenomics.md.
  • DeFi hacks: 14-incidents.md.
  • Regulation (SEC vs DeFi, MiCA): 13-regulation.md.