How AMMs Replaced Order Books (And Why That Matters)
If you've ever swapped tokens on Uniswap, Aerodrome, or any decentralized exchange, you've used an automated market maker. Instead of matching your buy order with someone else's sell order, the DEX traded you against a pool of funds—and a pricing formula did the rest.
That pool? It's filled by regular people depositing their tokens. The formula? Simple math that adjusts prices based on supply and demand. No order books, no market makers, no middlemen.
This model changed crypto trading fundamentally. Uniswap alone has processed over $1.5 trillion in lifetime volume, and AMMs now power most onchain trading activity. They work 24/7, support any token pair someone cares to create, and let anyone become a liquidity provider.
The tradeoff: AMMs introduce concepts like slippage and impermanent loss that don't exist in traditional trading. Understanding these mechanics helps you trade smarter and evaluate whether providing liquidity actually makes sense for your situation.
Why Crypto Needed a Different Trading Model
Traditional exchanges use order books. Buyers post bids, sellers post asks, and trades execute when prices overlap. This works great for liquid markets like stocks or Bitcoin on Coinbase—professional market makers keep spreads tight and ensure you can always buy or sell.
But order books struggle onchain:
- Gas costs kill efficiency. Every order placement and cancellation costs gas. On Ethereum mainnet, maintaining an order book would be prohibitively expensive.
- Niche tokens lack liquidity. Without dedicated market makers, obscure tokens would have no tradable market at all.
- Coordination is hard. Someone needs to match orders, and that someone becomes a central point of failure.
AMMs sidestep all of this. Instead of matching individual orders, they use liquidity pools where users swap against pooled funds. Prices adjust algorithmically based on what you buy or sell. No order matching required.
| Feature | Order Books | AMMs |
|---|---|---|
| Liquidity source | Individual buyers/sellers | Pooled funds from LPs |
| Pricing | Bids and asks | Algorithmic formula (x·y=k) |
| Trade execution | Match orders | Instant swap with pool |
| Who earns fees | Exchange/market makers | Liquidity providers |
| Best for | High-volume pairs | Any token, 24/7 |
This shift enabled DeFi's growth. Projects could launch tokens with immediate tradability by seeding a liquidity pool. No need to convince Coinbase to list them or pay market makers to quote prices.
How Liquidity Pools Actually Work
A liquidity pool is a smart contract holding two tokens. For an ETH/USDC pool, providers deposit both assets—say $10,000 of ETH and $10,000 of USDC. The pool now has reserves to facilitate trades between those tokens.
When you swap, here's what happens:
- You send ETH to the pool
- The pool's formula calculates how much USDC you should receive
- You get USDC back, minus a small fee (usually 0.05–1%)
- The pool's token ratio changes, shifting the price for the next trade
That fee gets distributed to liquidity providers proportionally. If you contributed 2% of a pool's total liquidity, you earn 2% of all trading fees generated.
In exchange for depositing, providers receive LP tokens—ERC-20 tokens representing their pool share. These LP tokens are tradable and can be used as collateral in other DeFi protocols. When you want to withdraw, you burn your LP tokens and receive your proportional share of the pool's current reserves plus accumulated fees.
Deeper pools = better trades. A $10 million pool handles large swaps with minimal price movement. A $100,000 pool gets wrecked by the same trade. This is why popular pairs attract more liquidity—providers chase trading volume, and traders prefer low slippage.
The Constant Product Formula: x·y=k
Most AMMs use a deceptively simple pricing formula: x · y = k
- x = quantity of Token A in the pool
- y = quantity of Token B in the pool
- k = a constant that must stay the same after every trade
Here's how it works in practice:
Imagine a pool with 100 ETH and 300,000 USDC. The constant k = 100 × 300,000 = 30,000,000.
Current price: 300,000 ÷ 100 = 3,000 USDC per ETH.
Now someone buys ETH by depositing 30,000 USDC:
- Pool now has 330,000 USDC
- To maintain k = 30,000,000, ETH must equal: 30,000,000 ÷ 330,000 = 90.9 ETH
- Pool went from 100 ETH to 90.9 ETH
- Buyer received 9.1 ETH for their 30,000 USDC
- Effective price: ~3,297 USDC per ETH
Notice the price jumped from $3,000 to $3,297 from a single trade. That's not manipulation—it's the formula doing exactly what it's designed to do. Removing ETH makes remaining ETH scarcer, driving up its price.
This mechanism has a clever property: you can never completely drain a pool. As you buy more of one token, the price rises asymptotically toward infinity. The last ETH in that pool would cost an infinite amount of USDC.
Slippage: Why Big Trades Cost More
Slippage is the gap between the price you expected and what you actually paid. It happens because your trade changes the pool's ratio, which changes the price mid-execution.
Small trades barely move the needle. Swap $1,000 in a $10 million pool and you'll see maybe 0.01% slippage—negligible.
Large trades are different. Swap $1 million in that same pool and you might face 5–10% slippage. Each additional token you buy gets progressively more expensive as you deplete the pool.
Managing slippage:
- Set slippage tolerance in your DEX interface. 0.5% is standard for major pairs. Illiquid tokens might need 3–5%.
- Check price impact before confirming. The DEX shows you how much your trade will move the price.
- Use deeper pools. More liquidity = less slippage.
- Split large trades. On Base where gas costs are cheap, breaking a big swap into smaller chunks can save money.
Warning: Setting very high slippage tolerance (10%+) opens you to sandwich attacks, where bots front-run your trade to profit from the price movement you create. Stick to the minimum tolerance needed for execution.
How Liquidity Providers Earn
LPs make money three ways:
1. Trading fees
Every swap pays a fee—typically 0.05% to 1%—that gets added to the pool's reserves. Your LP tokens represent a claim on a slightly larger pie after each trade.
If a pool does $1 million in daily volume at 0.3% fees, that's $3,000/day distributed to LPs. In a $10 million pool, that's roughly 11% APR from fees alone.
2. LP token appreciation
As fees compound, your LP tokens become worth more. You can also use them as collateral in lending protocols or stake them for additional rewards.
3. Protocol incentives
Many DEXs distribute their native tokens to liquidity providers. On Base, Aerodrome's ve(3,3) model lets users lock AERO tokens to vote on which pools receive emissions. Incentivized pools can offer 20–50%+ APR during growth phases—though this rate inevitably declines as more liquidity enters.
The catch: high APRs attract capital, which dilutes returns. A pool showing 100% APR today might drop to 15% in a month as LPs pile in. And headline APRs rarely account for the biggest risk LPs face.
Impermanent Loss: The Hidden Cost
Impermanent loss is what happens when the tokens you deposited change in price relative to each other. It's called "impermanent" because the loss only crystallizes when you withdraw—if prices return to your entry point, the loss disappears.
Here's the mechanism:
You deposit 1 ETH and 3,000 USDC when ETH = $3,000. Total value: $6,000.
ETH doubles to $6,000. If you'd just held your tokens, you'd have:
- 1 ETH × $6,000 = $6,000
- 3,000 USDC = $3,000
- Total: $9,000
But the pool rebalanced as traders bought ETH. Your share is now roughly 0.7 ETH and 4,200 USDC:
- 0.7 ETH × $6,000 = $4,200
- 4,200 USDC = $4,200
- Total: $8,400
You're up $2,400 from your starting point—but you "lost" $600 compared to just holding. That's impermanent loss.
The math gets worse with bigger moves:
| Price change | Impermanent loss |
|---|---|
| 1.25x | 0.6% |
| 1.5x | 2% |
| 2x | 5.7% |
| 3x | 13.4% |
| 5x | 25.5% |
These percentages are losses compared to holding, before accounting for fees earned. If your pool generates 10% in fees but you suffer 15% impermanent loss, you'd have been better off just holding.
Three ways to manage impermanent loss:
- LP correlated pairs. ETH/stETH or USDC/USDT barely diverge, so impermanent loss stays near zero.
- Target high-volume pools. More trading volume means more fees to offset losses.
- Keep time horizons short. LPing during range-bound markets captures fees with minimal price risk.
For a deeper dive into the math and strategies, see our guide on how AMMs work.
Different AMM Designs
Not all AMMs use the same formula. Different curves optimize for different use cases.
Constant Product (Uniswap v2)
The classic x·y=k. Works for any token pair, requires no active management, but capital efficiency is poor—most liquidity sits unused at extreme prices.
Stable Swap (Curve)
Optimized for assets that should trade near 1:1, like stablecoins or ETH/stETH. The curve is much flatter around the peg, enabling massive swaps with minimal slippage. But if the peg breaks, losses compound quickly.
Concentrated Liquidity (Uniswap v3)
LPs choose custom price ranges for their capital. Instead of spreading liquidity from $0 to infinity, you might concentrate it between $3,000–$4,000 for ETH. Your capital acts like 10x more liquidity within that range.
The tradeoff: if prices exit your range, you stop earning fees and your position converts entirely to the underperforming asset. Active management becomes mandatory.
Weighted Pools (Balancer)
Allow custom ratios beyond 50/50. An 80/20 BTC/ETH pool gives you more BTC exposure while still earning trading fees. Multi-asset pools can hold 4–8 different tokens.
How DEX Routers Find Better Prices
When you swap on a modern DEX, you rarely interact with a single pool. Aggregators like 1inch check prices across multiple DEXs and route your trade through whatever path gives you the best outcome.
Your 10 ETH → obscure token swap might actually execute as:
- 6 ETH → USDC via Uniswap
- USDC → Token via Aerodrome
- 4 ETH → Token directly via a smaller DEX
The router handles all of this automatically. You set your slippage tolerance, and it optimizes the path.
On Base's low-fee environment, splitting trades across many pools becomes economically viable. The same optimization on Ethereum mainnet might cost more in gas than it saves in slippage.
Risks Beyond Impermanent Loss
Smart contract risk. Pools run on code, and code can have bugs. Even audited protocols occasionally get exploited. Stick to established DEXs with years of track record.
Rug pulls. New token projects can drain liquidity pools or exploit backdoors in their token contracts. Check if liquidity is locked before LPing unknown tokens.
Incentive cliffs. That 40% APR might drop to 5% when token emissions decrease. Late entrants chasing high yields often lose money when incentives dry up.
Exit liquidity. During market crashes, everyone wants to withdraw simultaneously. Pool prices can detach from market prices, and concentrated liquidity positions may become impossible to exit cleanly.
When to Trade vs. When to LP
Trade on AMMs when:
- You need instant execution for any token pair
- You want to avoid KYC or centralized custody
- The token isn't listed on centralized exchanges
- You're comfortable setting appropriate slippage tolerance
Provide liquidity when:
- You're fine holding both tokens long-term anyway
- The pair has meaningful volume relative to TVL (1%+ daily turnover)
- You understand impermanent loss for your specific tokens
- Fees + incentives justify the complexity vs. just holding
Skip LPing when:
- You strongly believe one token will outperform the other
- Pool volume is negligible (fees won't cover impermanent loss)
- You're chasing APRs without understanding token emission schedules
- You can't afford to lose your deposit in a contract exploit
Key Takeaways
AMMs replaced order books with liquidity pools and algorithmic pricing. The constant product formula (x·y=k) automatically adjusts prices based on trades, creating 24/7 markets for any token pair.
Liquidity providers earn fees by depositing paired assets, but impermanent loss can eat those gains if token prices diverge significantly. Different AMM designs—constant product, stable swap, concentrated liquidity—optimize for different use cases and risk profiles.
Before trading: check pool depth, set reasonable slippage tolerance, and verify the price matches external sources.
Before LPing: calculate potential impermanent loss at various price scenarios, verify the contract is audited, and have a clear exit strategy.
Quick checklist for traders:
- Pool TVL > $1M for major pairs
- Price impact shown is acceptable
- Slippage tolerance set (0.5–1% for liquid pairs)
- Pool price roughly matches CoinGecko/CMC
Quick checklist for LPs:
- Willing to hold both tokens regardless of price movement
- Pool volume/TVL ratio > 0.5% daily
- Calculated impermanent loss at 2x and 3x price moves
- Contract is audited, protocol has 6+ months of operation
- Exit strategy defined: time horizon and loss limits
AMMs democratized crypto trading and market making. But they're tools with specific tradeoffs—understanding those tradeoffs helps you use them without getting burned.