Automated Market Makers (AMMs)
No buyers, no sellers, no order book — just two piles of tokens and one stubborn equation. That equation runs most of decentralized trading. Take it apart.
How decentralized exchanges price a trade with no order book and no counterparty — just a pool and a formula. The constant-product invariant x·y=k, liquidity pools and LP tokens, slippage and price impact, and the impermanent loss that decides whether providing liquidity actually pays.
Order books need someone selling before you can buy — beautiful on a fast server, hopeless on a blockchain where every order update is a slow, pricey transaction and nobody runs the matching engine. So decentralized exchanges tossed the order book and replaced it with two piles of tokens and one stubborn equation that prices every trade automatically. That’s an Automated Market Maker (AMM), the engine under nearly all on-chain trading.
This topic takes the machine apart bolt by bolt:
- Why AMMs exist — how trading-against-a-pool differs from trading-against-a-person, and why blockchains forced the switch.
- The constant-product formula x·y=k — the one equation that sets every price, and why a trade just walks the pool along a curve.
- Liquidity providers & LP tokens — what it means to seed a pool, what your LP token represents, and how fees accrue to your share.
- Slippage & price impact — why a big trade gets a worse price, and what “slippage tolerance” actually protects you from.
- Impermanent loss — the concept that trips up every new LP, the closed-form that predicts it, and the honest accounting of when providing liquidity beats just holding.
By the end, “I swapped on Uniswap” stops being magic and becomes arithmetic you can do yourself — a core intermediate rung on the DeFi ladder.
In this topic
- 1 What an AMM Is: Trading Against a Pool, Not a Person Why decentralized exchanges ditched the order book. How an Automated Market Maker prices trades against a pool of two tokens — no counterparty, no matching engine, always on. 8 min
- 2 The Constant-Product Formula: x · y = k The one equation that prices every AMM trade. How x·y=k turns two token reserves into a price, why a swap walks the pool along a curve, the 0.3% fee, and a fully worked swap. 9 min
- 3 Liquidity Pools and LP Tokens: Becoming the Market How to provide liquidity to an AMM: depositing both tokens in ratio, the LP tokens you get as a receipt, your pool share, and how trading fees accrue to you. 8 min
- 4 Slippage and Price Impact: Why Big Trades Pay More Why a large AMM swap gets a worse price than the quote — price impact on the constant-product curve, the difference from slippage, pool depth, slippage tolerance, and sandwich attacks. 8 min
- 5 Impermanent Loss: The LP's Hidden Cost Why a liquidity provider can end up with less than if they'd just held — impermanent loss explained, the constant-product IL formula, worked examples, and when fees make LPing worth it. 9 min
- 6 Final Exam: The AMM Stress Test A graded, locked capstone exam spanning every AMM lesson — order-book-vs-pool, the constant-product formula, liquidity provision and LP tokens, slippage and price impact, and impermanent loss. 15 min
Mark course as finished
Done with every lesson? Lock it in — your progress is saved on this device.