Quick answer
An Automated Market Maker (AMM) is a type of decentralised exchange protocol that uses a mathematical formula and pooled liquidity to price and execute token trades, replacing the traditional order book model. The most common AMM formula is x × y = k (constant product), where x and y are the token reserves and k is a constant — prices adjust automatically as trades change the pool's token ratio. Uniswap, Curve, and Balancer are all AMM-based DEXes.
How a traditional exchange works vs an AMM
Traditional exchanges — stock markets, forex platforms, centralised crypto exchanges like Binance — use an order book. Buyers post bids (prices they'll pay), sellers post asks (prices they'll accept), and a matching engine pairs compatible orders. The problem with order books in DeFi is they require many active participants placing and updating orders, which is expensive and slow on a blockchain.
AMMs solve this by replacing the order book with a smart contract holding reserves of two or more tokens (a liquidity pool). Anyone can trade against the pool at any time. The price is not set by supply and demand of orders — it is determined by a mathematical formula based on the ratio of tokens in the pool.
The constant product formula (x × y = k)
Uniswap introduced the dominant AMM model: the constant product formula. If a pool holds x units of Token A and y units of Token B, then x × y must always equal k, a constant. When you buy Token A, you add Token B to the pool and remove Token A — this changes x and y but k stays constant, which means the price of Token A rises as its reserve depletes.
Example: an ETH/USDC pool has 100 ETH and 200,000 USDC. k = 100 × 200,000 = 20,000,000. You want to buy 10 ETH. After you buy, the pool has 90 ETH. To keep k constant: 90 × new_USDC = 20,000,000, so new_USDC = 222,222. You must pay 222,222 − 200,000 = 22,222 USDC for 10 ETH — an average price of $2,222 per ETH (vs the starting $2,000), reflecting price impact.
Price impact is the change in price caused by your own trade. Large trades on shallow pools have high price impact — you receive a worse average price than the quoted spot price. This is why slippage tolerance settings exist on DEX interfaces.
Types of AMM models
Different AMM designs optimise for different use cases. The constant product formula is general-purpose but inefficient for pegged assets. Curve Finance introduced a hybrid formula that combines constant product and constant sum (x + y = k) to concentrate liquidity around the peg — dramatically reducing slippage for stablecoin trades. Balancer extended AMMs to support pools with multiple assets and custom weight ratios.
| AMM Type | Formula | Best for | Example |
|---|---|---|---|
| Constant Product | x × y = k | General token pairs | Uniswap V2 |
| Concentrated Liquidity | Custom ranges | Capital-efficient pairs | Uniswap V3 |
| StableSwap | Hybrid curve | Pegged assets (stablecoins, LSTs) | Curve Finance |
| Weighted Pool | Multi-asset | Index-style portfolios | Balancer |
| Dynamic Fees | Variable fee | Volatile pairs | Uniswap V4 |
Concentrated liquidity (Uniswap V3)
Uniswap V3 (2021) introduced concentrated liquidity — allowing LPs to provide liquidity within a specific price range rather than across the entire 0→∞ price curve. If ETH is trading at $3,000, an LP can provide liquidity only between $2,500 and $3,500. This concentrates their capital in the active range, earning much more in fees per dollar deposited — but also means the position earns nothing if the price moves outside the range.
Concentrated liquidity positions are represented as NFTs rather than fungible ERC-20 tokens because each position has a unique range, making them non-interchangeable.
Risks of AMMs
The main risks of AMM-based DEXes are impermanent loss (for liquidity providers), smart contract risk (bugs in the pool contract), and oracle risk (manipulation of price feeds used by integrated protocols). AMMs themselves don't have counterparty risk or custody risk — funds are always held in smart contracts, not by a company. Traders face slippage and MEV (front-running by bots) as additional concerns.
- Use a DEX aggregator (1inch, Paraswap) for large trades to split across multiple pools and minimise slippage
- Check pool depth before trading — thin pools = high slippage
- Set a slippage tolerance of 0.5–1% for volatile pairs, 0.1% for stablecoin swaps
- Impermanent loss is the main LP risk — understand it before providing liquidity
Frequently asked questions
What is the difference between an AMM and a DEX?
A DEX (decentralised exchange) is the broad category — any exchange that runs without a central operator. An AMM is the mechanism that powers most DEXes. Some DEXes use order books (dYdX, Vertex) rather than AMMs. Saying 'Uniswap is an AMM' and 'Uniswap is a DEX' are both correct — it's an AMM-based DEX.
How do AMM prices stay in line with global market prices?
Arbitrageurs constantly scan for price discrepancies between AMM pools and centralised exchanges. When an AMM's ETH price drifts below the Binance price, arbitrageurs buy ETH on the AMM and sell on Binance, pushing the AMM price up. This arbitrage mechanism keeps AMM prices closely aligned with global market prices, typically within seconds.
Can I lose money trading on an AMM?
Yes. Slippage means you may receive less than expected on large trades. MEV bots can sandwich your trade, extracting value by buying before you and selling after. On very low-liquidity pools, you can receive significantly less than the quoted price. Always check the 'minimum received' field in your DEX interface before confirming a trade.
Why does Curve have lower slippage for stablecoins than Uniswap?
Curve uses a hybrid AMM formula (StableSwap) that combines constant product (x×y=k) and constant sum (x+y=k) mechanics. Near the 1:1 peg, Curve behaves more like a constant sum market, concentrating liquidity around the peg and dramatically reducing slippage for trades between similarly-priced assets like USDC and USDT.
What is Uniswap V4 and how does it differ from V3?
Uniswap V4 (launched 2024) introduces 'hooks' — customisable code that can be attached to liquidity pools to add features like dynamic fees, on-chain limit orders, or custom pricing curves. It also uses a singleton contract (all pools in one contract) to significantly reduce gas costs for multi-hop trades. V4 makes AMMs programmable platforms rather than fixed-function contracts.