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
ProtocolChainType
UniswapEthereum, L2sGeneral
CurveMulti-chainStablecoins
PancakeSwapBNB ChainGeneral
RaydiumSolanaGeneral
BalancerEthereumWeighted pools

Providing Liquidity

How to Become an LP

  1. Select pool (e.g., ETH/USDC)
  2. Deposit equal value of both tokens
  3. Receive LP tokens as receipt
  4. 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

FeatureAMMOrder Book
Liquidity sourcePoolsMakers
Price discoveryFormulaBids/asks
Always liquidYesDepends
SlippagePredictableVariable
Capital efficiencyLowerHigher

AMM in Practice

Trading on AMMs

On DEXs powered by AMMs:

  1. Connect wallet
  2. Select tokens to swap
  3. Set slippage tolerance
  4. Preview price impact
  5. 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