An AMM is a smart contract that creates a market for token pairs using pooled liquidity and a mathematical formula instead of a traditional order book. Anyone can trade against the pool at any time (24/7, permissionlessly), and anyone can provide liquidity to earn a share of trading fees. Uniswap, Curve, and Balancer are all AMMs.
What Is an Automated Market Maker (AMM)?
3 min read
The short version
An AMM replaces human market makers with math. Instead of a person quoting "I will buy ETH at $2,990 and sell at $3,010," the pool says "the price is whatever the formula calculates based on the ratio of tokens currently in the pool." More buyers than sellers? The formula pushes the price up. It runs 24/7 automatically with no human intervention.
How It Works
The simplest AMM formula (Uniswap V2): x × y = k, where x = amount of token A, y = amount of token B, and k = constant. If someone buys token A (removes A from pool), x decreases, so y must increase (they add token B) to maintain k. The exchange rate at any point = y/x. This creates a smooth price curve. More sophisticated designs: Uniswap V3 uses concentrated liquidity (LPs specify a price range). Curve uses StableSwap (optimized for like-valued assets with lower slippage near peg). Balancer uses weighted pools (80/20, 60/40 ratios instead of always 50/50). LP revenue: every swap pays a fee (0.01%-1%) split proportionally among all LPs in the pool. LPs earn passive income but face impermanent loss risk.
How x*y=k determines the swap price
A pool has 100 ETH and 300,000 USDC. k = 100 × 300,000 = 30,000,000. Current price: 300,000/100 = $3,000/ETH. You want to buy 1 ETH. After your trade: pool has 99 ETH. To maintain k: USDC needed = 30,000,000 / 99 = 303,030. The pool gains 3,030 USDC (you paid this) for 1 ETH. Effective price: $3,030/ETH (1% higher than spot, this is price impact). For the same pool, buying 10 ETH: USDC = 30,000,000 / 90 = 333,333. Cost: $33,333 for 10 ETH = $3,333/ETH average (11% price impact). Larger trades in smaller pools = more slippage. That is why liquidity depth matters.
What People Get Wrong
AMMs always give worse prices than order books
For small trades relative to pool depth, AMMs can offer competitive or better prices (no spread, just the formula). For large trades, order book markets with professional market makers typically offer less price impact. The crossover depends on specific market conditions.
AMMs require active management
Providing liquidity to a basic V2-style pool is passive, deposit and earn fees. Concentrated liquidity (V3) requires active management (adjusting ranges). The distinction matters for your time commitment.
All AMMs use x*y=k
Only Uniswap V2 uses pure constant product. Curve uses a hybrid constant-sum/product formula (flatter curve near equilibrium). Balancer uses weighted geometric mean. Uniswap V3 uses virtual reserves within a concentrated range. Each formula has different properties.
Keep Reading
Sources & Further Reading
- Uniswap V2 Whitepaper
The foundational paper describing constant-product automated market making
- Curve Finance Docs
Documentation for the StableSwap AMM optimized for like-valued assets
Questions People Also Ask
- Who invented the AMM concept?
- Vitalik Buterin proposed on-chain AMMs in 2017 blog posts. Bancor launched the first practical implementation. Uniswap (Hayden Adams, 2018) popularized the constant-product model that dominates today. Curve (2020) optimized for stablecoins. Each iterated on the mathematical foundations.
- How do AMMs get accurate prices?
- They do not rely on external price feeds. Prices emerge from supply/demand within the pool. Arbitrageurs keep AMM prices aligned with the broader market: if the AMM price diverges from Binance, bots instantly trade the difference until prices match. This is MEV but also a market-alignment service.
- Can an AMM run out of one token?
- In a constant-product AMM: mathematically no. As the supply of one token approaches zero, its price approaches infinity (the last ETH in a pool would cost all the USDC in the pool). In practice, one side can become extremely small, making the token effectively unavailable at any reasonable price.