The reserve relationship
A simple constant-product market maker relates two reserves through x multiplied by y equals k. A trade that removes one asset must add enough of the other to satisfy the pool's invariant. This produces a curved exchange rate: buying a larger portion of a reserve becomes progressively more expensive. In an implementation with retained trading fees, the reserve product can increase over time, so constant product describes the pricing relationship rather than a claim that the numerical product never changes.
2 sources for this section
Working through an illustrative swap
Start with 100 units of token A and 1,000 units of token B, giving a product of 100,000. Ignoring fees, a trader adding 10 A leaves 110 A in the pool. Keeping the product constant requires about 909.09 B to remain, so the trader receives about 90.91 B. The starting reserve ratio was ten B per A, but the average execution price is lower because the trade moves along the curve. This difference arises from the trade's size relative to liquidity.
1 source for this section
An invariant is not an external valuation
The formula enforces a reserve relationship; it does not know the asset's fair price on other venues. Arbitrage can move pool ratios toward external prices, and a temporary reserve ratio can be manipulated by trading. An application relying on a pool for valuation therefore needs an appropriate oracle design rather than blindly trusting its current spot ratio. The illustrative arithmetic also omits fees, integer rounding, transfer restrictions, and other implementation details. Those details must be included when calculating the actual outcome of a transaction.
2 sources for this section
The source notesEvidence & further reading3 sources
- Uniswap v2 pricing Uniswap · Primary source · accessed 2026-09-22
- How Uniswap works Uniswap · Primary source · accessed 2026-09-22
- Selecting quality data feeds Chainlink · Primary source · accessed 2026-09-22