Automated Market Maker (AMM)
Algorithm-based trading mechanism that provides liquidity through mathematical formulas
What is an Automated Market Maker?
An Automated Market Maker (AMM) is a type of decentralized exchange protocol that uses mathematical formulas to price assets instead of traditional order books. AMMs allow anyone to trade tokens by interacting with liquidity pools—smart contracts holding reserves of token pairs—rather than matching individual buy and sell orders.
AMMs revolutionized DeFi by solving the liquidity problem: instead of requiring active traders to provide orders, anyone can deposit assets and earn fees while algorithms handle price discovery.
How AMMs Work
The Basic Mechanism
Traditional exchange:
- Buyers post bid prices
- Sellers post ask prices
- Orders matched when prices meet
- Requires active market makers
AMM approach:
- Liquidity providers deposit token pairs
- Algorithm determines exchange rate
- Traders swap against the pool
- Price adjusts based on reserves
Constant Product Formula
Most common AMM formula (Uniswap):
x * y = k Where:
- x = reserve of token A
- y = reserve of token B
- k = constant (the product)
When you buy token A:
- You add token B to pool
- Remove token A from pool
- k must stay constant
- Price adjusts automatically
Price Discovery
How prices emerge:
- Large trades move price more
- Arbitrageurs align with external markets
- Supply and demand reflected in reserves
- Market forces maintain accuracy
AMM Variants
Constant Product (x*y=k)
Uniswap v2 style:
- Simple and robust
- Works for any pair
- Higher slippage for large trades
- Most widely used
Constant Sum (x+y=k)
Fixed rate:
- No price impact
- Good for stablecoins (in theory)
- Vulnerable to depletion
- Rarely used alone
StableSwap (Curve)
Optimized for similar assets:
- Flatter curve for stablecoins
- Lower slippage for pegged assets
- Combines constant product and sum
- Dominant for stable-to-stable
Concentrated Liquidity (Uniswap v3)
Capital efficient:
- LPs choose price ranges
- Liquidity focused where needed
- Higher returns possible
- More complex management
Weighted Pools (Balancer)
Flexible ratios:
- Pools with multiple tokens
- Custom weights (not just 50/50)
- Index fund-like behavior
- Portfolio management
Liquidity Provision
How to Provide Liquidity
Becoming an LP:
- Deposit equal value of both tokens
- Receive LP tokens representing share
- Earn portion of trading fees
- Redeem LP tokens to withdraw
Earning Fees
LP compensation:
- Trade fees (typically 0.3%)
- Distributed proportional to share
- Compounds automatically
- Additional token incentives common
Impermanent Loss
The main LP risk:
When deposited assets change in relative price:
- LP position worth less than holding
- “Impermanent” if price returns
- Becomes permanent on withdrawal
- Must be offset by trading fees
Example:
- Deposit 1 ETH + 1000 USDC
- ETH doubles to $2000
- Withdrawal worth less than holding 1 ETH + 1000 USDC
Major AMM Protocols
Uniswap
Pioneer and leader:
- Invented modern AMM
- V2 (constant product) and V3 (concentrated)
- Dominant Ethereum DEX
- Multi-chain expansion
Curve Finance
Stablecoin specialist:
- Optimized for pegged assets
- Lowest slippage for stables
- veTokenomics model
- Deep liquidity
Balancer
Flexible pools:
- Multi-token pools
- Weighted portfolios
- Boosted pools
- Protocol infrastructure
PancakeSwap
BNB Chain leader:
- Uniswap fork
- Dominant on BSC
- Lottery and farming
- Multi-chain now
Raydium
Solana DEX:
- Combines AMM and order book
- High-speed trading
- Serum integration
- Concentrated liquidity
AMM vs. Order Books
| Aspect | AMM | Order Book |
|---|---|---|
| Liquidity | Passive pools | Active market makers |
| Availability | 24/7 automatic | Depends on makers |
| Price Discovery | Formula-based | Order matching |
| Capital Efficiency | Lower (traditional) | Higher |
| Complexity | Simpler | More complex |
Technical Considerations
Slippage
Price impact of trades:
- Large trades relative to pool = more slippage
- Set slippage tolerance
- May fail if exceeded
- MEV extraction possible
Front-Running
MEV vulnerability:
- Pending transactions visible
- Bots can sandwich trades
- User gets worse price
- Mitigation through private mempools
Flash Loans
AMM manipulation risk:
- Borrow, manipulate price, profit
- Oracle attacks possible
- Time-weighted prices help
- Protocol design consideration
Evolution of AMMs
First Generation
Basic constant product:
- Uniswap v1, v2
- Simple pools
- High slippage for large trades
- Capital inefficient
Second Generation
Specialized curves:
- Curve for stables
- Balancer for portfolios
- Better capital efficiency
- Use-case optimization
Third Generation
Concentrated liquidity:
- Uniswap v3
- LPs choose ranges
- Much better efficiency
- More complex management
Future Directions
Emerging innovations:
- Dynamic fees
- MEV protection
- Cross-chain AMMs
- Intent-based trading
Conclusion
Automated Market Makers transformed decentralized trading from theoretical curiosity to practical reality. By replacing order books with mathematical formulas and liquidity pools, AMMs solved the bootstrapping problem that plagued early DEXs. While impermanent loss and MEV remain challenges, AMMs continue evolving—making decentralized token exchange accessible, permissionless, and increasingly efficient.