The most common AMM design uses one elegant rule: the constant product formula, written x · y = k. Understand it once and slippage, price impact and liquidity all click into place.
The rule
A pool holds two tokens — say ETH (x) and USDC (y). Their quantities multiplied together give a constant, k, that the pool keeps unchanged through every trade. The price at any moment is just the ratio of the two reserves.
A worked example
Imagine a pool with 100 ETH and 200,000 USDC:
- k = 100 × 200,000 = 20,000,000
- Current price = 200,000 ÷ 100 = 2,000 USDC per ETH
Now you buy 1 ETH. Afterwards the pool must still satisfy x · y = k:
- New ETH reserve = 99
- New USDC reserve = 20,000,000 ÷ 99 ≈ 202,020
- So you paid ≈ 2,020 USDC for 1 ETH — not 2,000.
That extra ~20 USDC is price impact: your own purchase nudged the ratio, and therefore the price, against you.
Why bigger trades hurt more
The curve isn't a straight line. A tiny trade barely moves the ratio; a large trade relative to the pool moves it sharply, so each extra unit gets more expensive. Buy 10 ETH from that same pool and the average price climbs well above 2,020.
Why pool depth matters
A deeper pool — say 10,000 ETH and 20,000,000 USDC — has the same starting price but a far larger k, so the same 1 ETH purchase barely moves it. This is exactly why liquidity matters to you as a trader: deep pools give you a price close to the quote; thin pools punish you. Newer designs like Uniswap v3's concentrated liquidity make pools effectively deeper around the current price, but the principle is unchanged.
- Trading a large size through a shallow pool and being shocked by the average price.
- Reading the quoted (pre-trade) price as the price you'll get on a big order.
- Ignoring pool depth when a token lists in several pools of different sizes.