
On an order-book venue a price exists because someone is offering it. On an automated market maker nobody offers anything: the price is the result of arithmetic applied to the contents of a pool. That substitution explains almost every surprise traders meet on decentralised exchanges.
The invariant
The classic design keeps the product of the two reserves constant. Uniswap v2’s pair contract enforces it directly in code. Its swap function checks that the balances after a trade, each reduced by a 0.3 percent fee on the input, still multiply to at least the product before the trade, and reverts with the error “UniswapV2: K” if they do not. You can read the line in the published contract source. The fee is not paid to an operator; it stays in the pool and accrues to liquidity providers.
A worked example
Take a hypothetical pool holding 50 ETH and 100,000 units of a dollar stablecoin. The product is 5,000,000, and the pool’s starting price is 2,000 per ETH. Now buy 5 ETH, ignoring the fee for clarity.
- ETH left in the pool: 45.
- Stablecoin the pool must hold to keep the product: 5,000,000 divided by 45, which is about 111,111.
- Stablecoin you pay in: about 11,111, so an average of about 2,222 per ETH.
You bought 10 percent of the pool’s ETH and paid about 11.1 percent above the starting price. Nothing went wrong; that is the curve. The 0.3 percent fee would have been the small part of the cost. The numbers are illustrative, not a market reading.
Why the pool needs arbitrage
A pool does not know what ETH is worth anywhere else; it only knows its own ratio. When the outside price moves, the pool is stale until someone trades against it and keeps the difference. That profit comes from the pool, which is to say from the people who deposited into it. Arbitrage is how the pool stays aligned with the wider market, and liquidity providers pay for it continuously.
That is also where so-called impermanent loss comes from. Because arbitrage rebalances the pool toward the outside price, a provider always ends up holding relatively more of whichever asset did worse. If prices do not return, the loss is permanent. Fees exist to compensate for it, and whether they do over a given period is a calculation, not a hope.
Concentrated liquidity changes the curve, not the principle
Later designs let providers choose a price range for their capital. Inside that range the pool behaves as if it were much deeper, so trades move the price less. Outside it, the position earns nothing and sits entirely in one asset. Providing liquidity becomes an active position with a view attached, and losses can be sharper than in the simple curve.
What a quoted rate leaves out
An interface’s expected rate usually accounts for the curve at the moment you ask. It does not account for other trades that land before yours. That is why you set a slippage tolerance: the worst rate you accept before the transaction reverts. A wide tolerance is an instruction to fill at almost any price, and it is what makes sandwich trades around your order profitable. Our MEV entry and the guide MEV in plain English explain that ordering game.
The Settlement Test
- What settles: the swap is one atomic transaction; reserves, your balances and the fee update together or not at all.
- What it costs: the pool fee, the price impact from the curve, any adverse move between quote and inclusion, and gas on the chain where the pool lives. See the gas and fees page for current readings.
- What breaks: a thin pool turns a modest trade into a large price impact; a wide slippage setting invites front-running; a flaw in the pool contract is not protected by the pricing math.
The practical check
Before a swap, compare your trade size with the pool’s depth rather than comparing fee tiers. A trade that is tiny relative to the pool costs roughly the fee. A trade that is a visible fraction of it costs the fee plus a predictable, often much larger, price impact. If the swap uses a pool’s own price as an input to a lending market, the same arithmetic explains why reading spot prices from small pools is dangerous.
Primary sources
Educational content, human-edited and possibly AI-assisted. It describes how systems work and is not financial, legal or tax advice. Report an error via our corrections page.


