Automated Market Makers & DEXs
Deep dive into how Automated Market Makers work, the mathematics behind constant product formulas, liquidity provision, and advanced DEX mechanisms.
How AMMs Work
Traditional exchanges use order books where buyers and sellers place limit orders. AMMs replace this with liquidity pools and mathematical formulas. Uniswap's constant product formula: x × y = k, where x and y are the quantities of two tokens and k is a constant. When you buy Token A, you add Token B to the pool and remove Token A — the ratio changes, which changes the price. Larger pools have lower price impact (slippage). Curve uses a modified formula optimized for stable pairs (USDC/USDT) with very low slippage. Uniswap v3 introduced concentrated liquidity — LPs can choose specific price ranges, dramatically improving capital efficiency (up to 4000x). Liquidity providers earn a fee on every trade (typically 0.3%) proportional to their share of the pool.
DEX Comparison
- Uniswap v3: Concentrated liquidity, multiple fee tiers (0.01%, 0.05%, 0.3%, 1%), supports ERC-20 pairs. Dominant DEX by volume
- Curve Finance: Optimized for stable assets — extremely low slippage for stablecoin swaps. CRV token governance and vote-escrow tokenomics
- Balancer: Multi-token pools (up to 8 tokens) with custom weights — enables index fund-like pools. Smart Order Router for best prices
- PancakeSwap (BNB Chain): Uniswap fork on BSC — lower fees, high volume from Binance ecosystem users
- dYdX: Decentralized perpetual futures exchange — order book model (not AMM), leveraged trading up to 20x
- 1inch: DEX aggregator — splits trades across multiple DEXs to find the best price. Essential tool for large trades