DeFi
AMM
Automated Market Maker - a decentralized exchange mechanism using mathematical formulas and liquidity pools instead of traditional order books to determine prices and execute trades.
Last updated: January 5, 2025
What is an AMM?
An AMM (Automated Market Maker) is a type of decentralized exchange that uses smart contracts and liquidity pools to enable trading without traditional order books. Instead of matching buyers and sellers, trades occur against pooled liquidity.
How AMMs Work
Liquidity Pools
- Users deposit token pairs
- Pool holds both tokens (e.g., ETH + USDC)
- Traders swap against the pool
- Price determined by formula
Constant Product Formula
Most common AMM formula:
x ร y = k
- x = quantity of token A
- y = quantity of token B
- k = constant product
Price Impact
Larger trades = more price movement:
- Small trade: minimal slippage
- Large trade: significant slippage
- Pool size determines impact
AMM Example
Pool: ETH/USDC
- Pool has: 100 ETH + $300,000 USDC
- k = 100 ร 300,000 = 30,000,000
- Price: $3,000 per ETH
Swap: Buy 1 ETH
After swap:
- ETH: 99 (you took 1)
- USDC must maintain k
- New USDC: 30,000,000 รท 99 = $303,030
- Cost: ~$3,030 (1% slippage)
Types of AMMs
Constant Product (Uniswap v1/v2)
- x ร y = k formula
- Works for any token pair
- Simple, proven
Concentrated Liquidity (Uniswap v3)
- LPs choose price ranges
- More capital efficient
- Complex to manage
Stable Pools (Curve)
- Optimized for similar-value assets
- Lower slippage for stablecoins
- Different curve formula
Hybrid Models
- Combine approaches
- Balance efficiency and flexibility
Popular AMM Protocols
| Protocol | Chain | Type |
|---|---|---|
| Uniswap | Ethereum, L2s | General |
| Curve | Multi-chain | Stablecoins |
| PancakeSwap | BNB Chain | General |
| Raydium | Solana | General |
| Balancer | Ethereum | Weighted pools |
Providing Liquidity
How to Become an LP
- Select pool (e.g., ETH/USDC)
- Deposit equal value of both tokens
- Receive LP tokens as receipt
- Earn trading fees
Earnings
- Percentage of every swap in pool
- Typically 0.3% fee split among LPs
- Proportional to your share
Risks
- Impermanent loss - Token ratio changes
- Smart contract risk - Bugs/hacks
- Token risk - One token may crash
Impermanent Loss
What It Is
Loss compared to just holding the tokens:
- Token prices diverge
- Pool rebalances automatically
- You end up with more of the cheaper token
- Less of the expensive one
Example
Deposit: 1 ETH ($3,000) + $3,000 USDC = $6,000
If ETH doubles to $6,000:
- Just holding: 1 ETH + $3,000 = $9,000
- In pool: ~0.707 ETH + $4,243 = ~$8,485
- Impermanent loss: ~$515 (5.7%)
When Permanent
- You withdraw at unfavorable ratio
- Fees earned may offset loss
- Long-term provision can be profitable
AMM vs Order Book
| Feature | AMM | Order Book |
|---|---|---|
| Liquidity source | Pools | Makers |
| Price discovery | Formula | Bids/asks |
| Always liquid | Yes | Depends |
| Slippage | Predictable | Variable |
| Capital efficiency | Lower | Higher |
AMM in Practice
Trading on AMMs
On DEXs powered by AMMs:
- Connect wallet
- Select tokens to swap
- Set slippage tolerance
- Preview price impact
- Confirm transaction
Considerations
- Check price against centralized exchanges
- Large swaps need larger pools
- Use aggregators for best prices
AMM Innovations
Just-In-Time Liquidity
- MEV bots provide liquidity for single blocks
- Sophisticated market making
Dynamic Fees
- Adjust fees based on volatility
- Better LP protection
Hooks (Uniswap v4)
- Customizable pool logic
- New use cases possible
The Future of AMMs
- More capital efficient designs
- Better impermanent loss protection
- Cross-chain liquidity
- Integration with traditional finance
Ready to Start Trading?
Now that you understand amm, explore the best exchanges to begin your crypto journey.