Glossary
What Is an Automated Market Maker (AMM)? How DEX Prices Are Set
Definition
Automated market maker (AMM): An automated market maker is a smart contract that quotes swap prices from a mathematical formula applied to the token reserves in a liquidity pool, instead of matching buyers and sellers.
On this page
An automated market maker (AMM) is a smart contract that prices token swaps using a formula instead of an order book. It holds reserves of two or more tokens in a liquidity pool, and the ratio of those reserves sets the price. If you have ever swapped tokens in a wallet or on a DEX, an AMM probably quoted your rate.
The constant product formula
The best-known AMM design, used by Uniswap, follows x × y = k. Uniswap’s documentation explains that the pool “prices tokens algorithmically using a constant product formula”, where x and y are the reserves and k is an invariant that “must stay constant (or increase) after every trade”.
A simplified worked example, ignoring fees:
| Step | ETH reserve (x) | USDC reserve (y) | k | Implied price |
|---|---|---|---|---|
| Pool starts | 100 | 300,000 | 30,000,000 | 3,000 USDC per ETH |
| You buy 1 ETH | 99 | about 303,030 | 30,000,000 | about 3,061 USDC per ETH |
| You paid | about 3,030 USDC | Average about 3,030 per ETH |
The numbers are illustrative, not market prices. The point is that you paid about 1% above the starting price because your trade was 1% of the pool’s ETH. That gap is price impact.
Price impact vs slippage
These are related but different:
- Price impact is the movement your own trade causes, determined by trade size relative to pool depth.
- Slippage is the difference between the quote you saw and what you actually receive, which includes price impact plus any movement caused by other trades before yours lands.
Your wallet’s slippage tolerance caps the total. If the outcome would be worse than the limit, the transaction reverts, and you still pay the gas fee.
Other AMM designs
| Design | Used for | Effect for traders |
|---|---|---|
| Constant product | General token pairs | Works for any pair; price impact grows with size |
| Stable-swap curves | Stablecoin-to-stablecoin swaps | Very low price impact near the peg |
| Concentrated liquidity | Liquidity providers choose price ranges | Deeper liquidity near the current price |
| Weighted pools | Multi-token pools with custom weights | Index-like exposure |
Uniswap’s documentation notes that fees “are configured by pool and protocol version”, so the fee you pay depends on which pool your route uses.
Why AMMs matter when you pay
Converting before checkout
Swapping a volatile coin into a stablecoin before paying a merchant usually goes through an AMM. For a small, common pair like ETH/USDC on a major network, price impact is typically tiny. For an obscure token, it can be large, and the merchant still expects the full invoice amount.
Stablecoin swaps
Swapping USDT to USDC, or between bridged versions of a stablecoin, uses stable-swap pools designed for near-1:1 rates. If a quote is far from 1:1, check whether one of the coins has lost its peg; see depeg.
Prices are not oracle prices
An AMM’s price comes from its own reserves, not from an outside feed. During fast markets, a thin pool can quote a price well away from major exchanges until arbitrage catches up. Comparing the quote with another source before a large swap is worth the few seconds.
Practical tips
- Check the “price impact” line in the swap preview; above 1% on a common pair suggests a thin route.
- Use the network where the pair is deepest and fees are lowest.
- For larger amounts, split the swap or use an aggregator that routes across pools.
- Leave room for fees so the output still covers the invoice.
- Approve only the amount needed; see revoking token approvals.
For the broader context, see DeFi.
Frequently asked questions
What does x * y = k mean?
Why is the price worse for larger swaps?
Who sets the AMM's price?
Is an AMM the same as a DEX?
Sources
Facts were checked against these pages on the date shown above. Terms change; confirm on the official page before acting. General information, not financial, tax or legal advice. See our methodology.