Skip to main content
DeFi

Automated Market Makers (AMMs) Explained

Pomegra Learn

Automated Market Makers (AMMs) Explained

Introduction

Traditional exchanges rely on order books—buyers and sellers place bids and asks, and trades execute when prices match. This model works well on centralized platforms, but decentralized exchanges (DEXs) face a critical problem: without a central authority to maintain order books, who ensures liquidity is available for traders?

Automated Market Makers (AMMs) solved this problem by fundamentally changing how trades happen on blockchain. Instead of matching buyers with sellers, AMMs use mathematical formulas and liquidity pools to enable peer-to-contract trading. This innovation unlocked the explosive growth of decentralized finance and changed how digital assets are exchanged forever.

In this article, you'll learn how AMMs work, why they're revolutionary, and how they compare to traditional market-making approaches.

What Is an Automated Market Maker?

An Automated Market Maker is a smart contract that holds reserves of two or more tokens and uses a mathematical formula to determine prices and execute swaps. Rather than relying on counterparties or central market makers, AMMs enable anyone to trade by interacting with a pool of liquidity.

The core innovation: liquidity providers (LPs) deposit equal values of two tokens into a smart contract, and traders swap against this pool without needing a matching buyer or seller.

How Traditional Markets Work

In a traditional order book exchange:

  • Alice wants to sell 1 BTC for $50,000
  • Bob wants to buy 1 BTC for $50,000
  • The exchange matches them; the trade executes

Without enough buyers or sellers at the desired price, there's a liquidity gap—trades may not execute, or only at unfavorable prices (wide bid-ask spreads).

How AMMs Work

With an AMM:

  • Liquidity providers deposit 100 ETH and $300,000 USDC into a pool
  • Alice sends the AMM 10 ETH
  • The smart contract calculates the fair price using its formula
  • The contract sends Alice approximately 30,000 USDC
  • No matching buyer required—the pool's balance changed, and the trade executed

The beauty of this model: liquidity is always available, as long as there's capital in the pool.

The Constant Product Formula

The most widely used AMM formula is the constant product formula, popularized by Uniswap:

x × y = k

Where:

  • x = reserve of token A
  • y = reserve of token B
  • k = constant product (never changes)

How It Works

Imagine a pool with:

  • 100 ETH (x)
  • 300,000 USDC (y)
  • k = 100 × 300,000 = 30,000,000

A trader wants to buy 10 ETH. The contract must maintain the constant product:

  1. New reserve of ETH: 100 - 10 = 90
  2. Solve for new USDC reserve: 90 × y = 30,000,000
  3. y = 333,333.33 USDC
  4. USDC deposited: 333,333.33 - 300,000 = 33,333.33

So the trader pays 33,333.33 USDC for 10 ETH, or 3,333.33 USDC per ETH—higher than the initial price of 3,000 USDC/ETH.

The Price Impact

The further a trade moves the ratio away from equilibrium, the worse the price. This creates a slippage curve that discourages massive trades and protects the pool from dramatic price manipulation.

Key Advantages of AMMs

1. Permissionless Liquidity

Anyone can deposit tokens and become a liquidity provider. No approval process, no credit requirements—just approve the smart contract and deposit.

2. Always Available

Unlike order books, AMMs never "run out" of liquidity (until the pool is depleted). Trades execute 24/7 without waiting for a matching order.

3. Decentralized

No central authority controls the pool. The smart contract enforces the rules, and the mechanism is transparent and auditable.

4. Efficient for Smaller Amounts

For retail traders and small to medium trades, AMMs eliminate the friction of matching engines and counterparty risk.

5. Capital Efficiency Innovations

Modern AMMs like Uniswap v3 introduced concentrated liquidity, allowing LPs to earn higher fees by providing capital in specific price ranges rather than across the entire curve.

Key Disadvantages and Trade-offs

1. Impermanent Loss

When the price of one token in the pool diverges significantly from when the LP deposited it, the LP may end up with fewer dollars than if they'd simply held the tokens. This is called impermanent loss and is one of the most important concepts for LPs to understand.

2. Price Slippage

Large trades experience significant slippage due to the constant product formula. A trader swapping a massive amount of token A may get a significantly worse price than a small trade.

3. Less Efficient Than Order Books

Market-making on traditional exchanges is more efficient in terms of capital use. An AMM ties up capital across the entire price curve; order books concentrate liquidity where traders actually want to trade.

4. Oracle Risk

Some AMMs and DeFi protocols that integrate with AMMs rely on AMM prices as price oracles. If a pool is small, prices can be manipulated, creating cascading risks in the DeFi ecosystem.

How AMMs Compare to Traditional Market Makers

FeatureAMMTraditional Market MakerOrder Book Exchange
Liquidity provisionPermissionlessLicensed firmsAny market participant
Price discoveryFormula-basedHuman judgmentSupply and demand
Capital efficiencyLowerHigherHighest
Trading frictionSlippage curveSpreadsBid-ask spreads
24/7 availabilityYesDependsYes (for crypto)
Regulatory oversightMinimalHeavyRegulated

Types of AMMs

Constant Product (x × y = k)

The original and most popular model. Used by Uniswap, Sushiswap, and many others.

Constant Sum (x + y = k)

Offers zero slippage but exposes LPs to unbounded loss risk. Rarely used in practice.

Constant Mean

Generalizes constant product to allow multiple token pools with weighted assets. Used by Balancer.

Hybrid AMMs

Curve Finance pioneered hybrid AMMs that combine constant product and constant sum approaches for stablecoin pairs, offering lower slippage when prices are aligned.

The Role of Liquidity Providers

Liquidity providers are the foundation of every AMM. They deposit equal values of two tokens and earn a portion of trading fees in return. In exchange, they accept:

  • Fee income: Typically 0.01% to 1% per swap
  • Impermanent loss risk: The hazard of holding a losing position due to price divergence

More on liquidity provision and yield strategies can be found in Providing Liquidity for Yield and Yield Farming Strategies in DeFi.

AMMs and the DeFi Ecosystem

AMMs are the backbone of decentralized finance. They power:

  • DEXs like Uniswap and Sushiswap
  • Yield farming platforms that reward LPs with governance tokens
  • Lending protocols that use AMM prices as oracles
  • Derivative protocols that bootstrap liquidity with AMM pricing

The DEX Basics Explained article covers DEXs more broadly, while Uniswap Architecture Deep Dive explores the most successful AMM implementation in detail.

Real-World Impact

Since Uniswap launched in November 2018, AMMs have:

  • Enabled billions of dollars in decentralized trading volume
  • Provided LP yield opportunities that traditional markets never offered
  • Democratized market-making by removing barriers to entry
  • Exposed fundamental design trade-offs between capital efficiency and simplicity

Major DeFi incidents—including flash loan attacks and oracle price manipulation—have emerged precisely because AMMs create new attack surfaces. Understanding these risks is essential for anyone using or providing liquidity to AMMs.

Looking Forward

AMM design continues to evolve. Innovations include:

  • Concentrated liquidity: Uniswap v3 allows LPs to set custom price ranges
  • Cross-chain AMMs: Bridged assets and multi-chain liquidity pools
  • Intent-based AMMs: Alternative mechanisms that better match traders with the best prices

Key Takeaways

  • AMMs replace order books with formulas: Trades execute against liquidity pools, not matching counterparties
  • The constant product formula (x × y = k) is the most common AMM mechanism
  • Permissionless and always available: AMMs opened trading to anyone and eliminated liquidity gaps
  • Slippage and impermanent loss are the primary trade-offs LPs accept
  • AMMs are foundational to DeFi: Nearly every DeFi protocol depends on or uses AMM liquidity

External Resources

For deeper understanding of AMM mechanics and market design, see:

Next Steps

Now that you understand how AMMs work, explore Uniswap Architecture Deep Dive to see the most successful AMM implementation in practice.