crypto
How automated market maker liquidity pools work
Explains how automated market maker pools price trades with the constant product formula, what liquidity providers earn, and the risks they take on.
Constant-product liquidity curve
FigureLiquidity pools are smart contracts that hold token pairs and enable automated market making.
Traditional exchanges rely on well-capitalized market makers quoting bids and offers into an order book. A pool replaces those quotes with a formula: eligible users can deposit the two assets, and the contract prices every trade against its reserves according to fixed rules.
Pools don't eliminate order books; they're a different venue design. Centralized exchanges still run order books, and so do some on-chain protocols. What pools changed is who gets to be the market maker.
A worked trade
Take a pool holding 10 ETH and 30,000 USDC. The constant product formula x * y = k gives k = 300,000, and the implied price is 3,000 USDC per ETH.
Say a trader wants to buy 1 ETH:
- The ETH reserve must fall to 9, so the USDC reserve must rise to 300,000 / 9 ≈ 33,333.
- The trader therefore pays about 3,333 USDC, roughly 11% above the quoted price. That gap is price impact, and it's the direct consequence of trade size relative to pool depth. The same trade in a pool 100x deeper would move the price by roughly 0.1%.
- On top of that, the pool charges a trading fee (0.3% on many early pools, about 10 USDC here), which accrues to liquidity providers.
- Slippage is the difference between the price you saw and the price you settle at, which is why interfaces let you set a slippage limit that reverts the trade if the pool moves first.
After the trade, the pool quotes ETH at about 3,704 USDC, out of line with every other venue. Arbitrageurs close that gap by selling ETH into the pool until its price matches the wider market. Those arbitrage trades are what keep pool prices honest, and they generate more fee income for the pool, but they're also, by definition, trades where the pool sells low or buys high against better-informed flow.
What liquidity providers earn
A liquidity provider's return is fees earned, plus any token incentives, minus what the price moves cost them:
- Impermanent loss: when the two assets' prices diverge, the pool automatically sells the appreciating asset and accumulates the depreciating one, so the LP position underperforms holding the same assets. Withdrawing after the divergence realizes that relative underperformance.
- Loss-versus-rebalancing (LVR): the arbitrage flow described above is a systematic cost because the pool always trades with arbitrageurs at slightly stale prices.
In calm markets with heavy trading volume, fees can outrun these costs. In trending or volatile markets, they often don't.
Pool design and pricing
| Component | Function | Impact |
|---|---|---|
| Token pairs | Trading assets | Define the market |
| LP tokens | Pool accounting | Represent a provider's pool share |
| Trading fees | Fee income | Accrue according to the pool's rules |
| Smart contract | Pool logic | Executes trading and accounting rules |
Other risks
- Smart contract risk: pool contracts hold the funds; a bug or exploit can drain them, and audits reduce but don't remove that risk.
- MEV: large trades can be sandwiched, meaning front-run and back-run by bots, which is another reason slippage limits exist.
- Oracle risk: protocols that price collateral or synthetic assets off pool prices inherit the pool's manipulability; thin pools make cheap oracle attacks.
- Concentrated liquidity: newer pool designs let LPs supply liquidity within chosen price ranges. Fee income per dollar deposited rises, but the position now needs active management, and the exposure per dollar of capital is sharper while the price remains in range. It is not a set-and-forget upgrade.
Concentrated liquidity and newer designs
| Innovation | Description | Trade-off |
|---|---|---|
| Concentrated liquidity | Liquidity focused within price ranges | More fees per dollar, more management and sharper impermanent loss |
| Multi-token pools | Pools supporting more than two tokens | Broader exposure, more complex risk |
| Dynamic fee structures | Fees adjusting to volatility | Potentially better compensation in volatile markets |
The early-2022 tradeoff
As of early 2022, protocol teams were experimenting with real-world assets, privacy features, impermanent-loss mitigation, and cross-chain liquidity. Each experiment added new dependencies to the core pool design, including oracles, bridges, legal claims, or more complex contracts.
The formulas and terminology in this article follow the Uniswap v2 documentation.
For the network, account, wallet, and smart-contract concepts used here, start with Blockchain Foundations.