Advanced Topics · DeFi, NFTs & Advanced Trading

Liquidity Pools & AMMs

22 minLesson 42 of 52

How does Uniswap have instant trades with no order book? Liquidity pools. Instead of buyers/sellers matching, you trade against a pool of tokens. Revolutionary, but complex. Let's break it down.

What is a Liquidity Pool?

Liquidity pool = smart contract holding two tokens. Anyone can trade against it. Liquidity providers earn fees.

ETH/USDC Pool

Pool contains: → 1,000 ETH ($2M) → 2,000,000 USDC ($2M) → Total: $4M liquidity Trader wants to buy ETH: → Deposits USDC into pool → Gets ETH out → Pool rebalances automatically → Price adjusts based on ratio

How AMMs Work

AMM = Automated Market Maker. Uses formula to determine price. Most common: x × y = k

x × y = k Formula

Pool: 1,000 ETH × 2,000,000 USDC = 2,000,000,000 (k) Buy 10 ETH: → New: 990 ETH × ? USDC = 2,000,000,000 → Solve: ? = 2,020,202 USDC → You pay: 20,202 USDC for 10 ETH → Price: $2,020 per ETH (vs $2,000 before) Buying increases price Selling decreases price Automatic!

Becoming a Liquidity Provider

LP Example

Add liquidity: → Deposit $10,000: $5k ETH + $5k USDC → Get LP tokens representing your share → Earn 0.3% of all trades → Plus token rewards (sometimes) APY: 10-50% (varies) Risk: Impermanent loss if prices diverge

Concentrated Liquidity (Advanced)

Uniswap V3 lets you concentrate liquidity in price ranges for higher returns.

Key takeaways

  • Liquidity pools = token pairs in smart contracts
  • AMMs use math formulas (x × y = k)
  • Trade instantly without order books
  • LPs earn trading fees
  • Risk: impermanent loss
  • Need both tokens to provide liquidity

Knowledge check

Test what you just learned

  1. 1. AMM pricing formula?

  2. 2. LPs earn from?

  3. 3. To add liquidity, you need?