Glossary

Automated Market Maker (AMM)

A smart contract that provides liquidity for token swaps using mathematical formulas instead of traditional order books.

Key Takeaways

  • An automated market maker (AMM) replaces traditional order books with smart contracts that hold token reserves and price trades algorithmically, enabling permissionless trading on decentralized exchanges.
  • The constant product formula (x * y = k) ensures liquidity is always available at any price point, but impermanent loss means liquidity providers can underperform simple buy-and-hold strategies when prices diverge.
  • AMM designs have evolved rapidly: from Uniswap V1's basic pools (2018) to concentrated liquidity (2021) and hook-based architectures (2025), with growing relevance for stablecoin trading and Bitcoin DeFi.

What Is an Automated Market Maker?

An automated market maker (AMM) is a type of decentralized exchange protocol that uses mathematical formulas and trustless smart contracts to determine the price of assets and facilitate trades. Instead of matching buyers with sellers through an order book (the model used by centralized exchanges), an AMM lets users trade directly against a pool of tokens locked in a smart contract.

The concept emerged in 2016 when Vitalik Buterin proposed the idea of an on-chain automated market maker. Bancor Protocol launched the first implementation in June 2017, and Uniswap V1 popularized the model when it launched on Ethereum in November 2018. Today, AMMs are the dominant trading mechanism in decentralized finance, with Uniswap alone having processed over $3.4 trillion in cumulative trading volume.

The key innovation is that anyone can become a liquidity provider by depositing tokens into a pool. In return, they earn a share of trading fees proportional to their contribution. This replaces the role of professional market makers in traditional finance with an open, permissionless system.

How It Works

At its core, an AMM maintains a pool of two (or more) tokens inside a smart contract. A mathematical formula governs the relationship between the token reserves and determines the price for each trade. The most widely used formula is the constant product function.

The Constant Product Formula

The constant product formula, used by Uniswap V1 and V2, is expressed as:

x * y = k

where:
  x = quantity of Token A in the pool
  y = quantity of Token B in the pool
  k = a constant that must remain unchanged after every trade

When a trader deposits Token A into the pool, the contract calculates how much Token B to release so that the product of the two reserves still equals k. The effective price is the ratio of reserves (y / x), which shifts with every trade.

Consider a pool containing 10 ETH and 10,000 USDC, giving k = 100,000. A trader who deposits 1 ETH expects 1,000 USDC at the current ratio, but the pool must maintain k = 100,000 with 11 ETH. That means y = 100,000 / 11 = 9,091 USDC must remain, so the trader receives approximately 909 USDC. The difference between the expected and actual amount is called slippage, and it increases with larger trades relative to pool size.

// Before trade
pool = { tokenA: 10 ETH, tokenB: 10000 USDC }
k = 10 * 10000 = 100000

// Trader deposits 1 ETH
newTokenA = 10 + 1 = 11
newTokenB = 100000 / 11 = 9090.91

// Trader receives
output = 10000 - 9090.91 = 909.09 USDC
// Effective price: 909.09 USDC per ETH (vs. 1000 spot)

Liquidity Providers

Liquidity providers (LPs) deposit equal value of both tokens into the pool. In return, they receive LP tokens representing their proportional share. When traders swap against the pool, a fee (typically 0.3% on Uniswap V2) is deducted from each trade and added to the pool reserves. LPs can redeem their LP tokens at any time for the underlying assets plus their accumulated share of fees.

AMM Variants

Different AMM designs optimize for different use cases:

VariantFormulaBest For
Constant Productx * y = kGeneral-purpose token pairs
StableSwap (Curve)Hybrid constant-sum / constant-productStablecoin and pegged asset pairs
Concentrated Liquidity (Uniswap V3)x * y = k within custom price rangesCapital-efficient positions
Weighted Pools (Balancer)Product of (reserve_i ^ weight_i) = kMulti-token portfolios with custom ratios

Curve Finance's StableSwap invariant is particularly important for stablecoin trading. Near the equilibrium price, the curve behaves like a constant-sum function (near-zero slippage for like-valued assets). As imbalance grows, it transitions toward constant-product behavior to prevent pool drainage. An amplification coefficient controls the sensitivity of this transition. This design makes Curve the dominant venue for large stablecoin swaps, with over $1.7 billion in total value locked.

Uniswap V3's concentrated liquidity lets LPs allocate capital to specific price ranges rather than spreading it from zero to infinity. Within a chosen range, the position acts like a much deeper pool, achieving up to 4,000x capital efficiency improvement for tightly pegged pairs. The trade-off is that LPs earn zero fees when the price moves outside their selected range.

The Evolution of AMMs

YearMilestone
2017Bancor launches the first on-chain AMM
2018Uniswap V1 launches with ETH-paired constant product pools
2020Curve Finance launches StableSwap for pegged assets; Balancer introduces weighted multi-token pools; Uniswap V2 adds ERC-20/ERC-20 pairs and flash swaps
2021Uniswap V3 introduces concentrated liquidity with custom price ranges
2025Uniswap V4 launches with hooks (smart contract plugins), singleton contract architecture, and flash accounting via EIP-1153 transient storage

Uniswap V4, which launched in January 2025, represents a major architectural shift. Its hook system lets developers attach custom logic to pool events (swaps, liquidity changes, donations), enabling dynamic fees, on-chain limit orders, and automated LP strategies. The singleton contract design stores all pools in one contract, reducing pool creation gas costs by approximately 99%.

Use Cases

Stablecoin Trading

AMMs are the backbone of on-chain stablecoin markets. Curve's StableSwap pools enable traders to swap millions of dollars between stablecoins like USDC, USDT, and DAI with minimal slippage. This is critical for stablecoin arbitrage, where traders help maintain pegs by exploiting small price differences across venues. For a deeper look at how different stablecoins maintain their pegs, see the stablecoin peg mechanisms comparison.

Decentralized Token Exchanges

AMMs enable permissionless trading of any token pair without requiring a centralized intermediary. Anyone can create a pool for a new token, providing instant market access. This is especially important for long-tail assets that would never get listed on centralized exchanges.

Cross-Chain and Bitcoin DeFi

Protocols like THORChain use AMM mechanics for native cross-chain swaps, enabling users to trade BTC for ETH or other assets without wrapping or bridging. On Bitcoin Layer 2 networks, AMMs are expanding Bitcoin's programmability beyond simple transfers. For an overview of how Layer 2 solutions like Spark extend Bitcoin's capabilities, see the Bitcoin Layer 2 comparison. The growth of stablecoins on Bitcoin is creating new demand for AMM-style liquidity on Bitcoin-native infrastructure.

Yield Generation

LPs earn trading fees proportional to their share of the pool. In high-volume pools, annualized returns from fees alone can be substantial. Many protocols add token incentives on top of trading fees, though these reward structures carry their own risks. The fee-based yield from AMMs differs from stablecoin yield strategies, which typically derive returns from lending or treasury backing rather than trading activity.

Price Discovery

AMM pool ratios serve as on-chain price references. Protocols use time-weighted average prices (TWAPs) derived from AMM pools as oracle feeds. Uniswap V2 introduced built-in TWAP oracles, and V3 improved their granularity. However, reliance on AMM-derived prices introduces oracle manipulation risks, particularly for pools with shallow liquidity.

Risks and Considerations

Impermanent Loss

Impermanent loss is the most fundamental risk for LPs. When the price ratio between deposited tokens changes, the AMM rebalances the position by effectively selling the appreciating asset and buying the depreciating one. The result: an LP's position can be worth less than if they had simply held the tokens.

Price ChangeImpermanent Loss
1.25x~0.6%
1.5x~2.0%
2x~5.7%
3x~13.4%
5x~25.5%

The loss is called "impermanent" because it reverses if prices return to their original ratio. In practice, if an LP withdraws at a new price ratio, the loss becomes permanent. Trading fees may or may not offset impermanent loss, depending on volume relative to volatility. Concentrated liquidity positions amplify both fee earnings and impermanent loss.

Smart Contract Risk

AMM pools hold user funds in smart contracts. Bugs, reentrancy vulnerabilities, or unaudited code can lead to total loss of pooled assets. Even well-established protocols are not immune: Balancer suffered a security exploit in November 2025 that contributed to the closure of Balancer Labs in March 2026. Uniswap V4 underwent nine independent audits before launch, reflecting the high stakes of securing AMM contracts.

Front-Running and MEV

Because AMM trades are visible in the mempool before confirmation, they are vulnerable to front-running and sandwich attacks. In a sandwich attack, a bot detects a pending swap, places a buy order before it and a sell order after, profiting from the price impact. Over $550 million is extracted annually from Ethereum users via maximal extractable value (MEV) as of 2026. Mitigations include private transaction channels, MEV-aware routing services, and strict slippage limits.

Oracle Manipulation

Protocols that derive prices from AMM pool ratios are vulnerable to flash loan attacks that temporarily distort reserves. An attacker can borrow a large amount, manipulate a pool's price ratio, exploit a dependent protocol, and repay the loan in a single transaction. Time-weighted average prices (TWAPs) averaged over 30+ minutes mitigate this, but shallow pools remain susceptible to sustained oracle manipulation.

Pool Drainage and Rug Pulls

Because AMM pool creation is permissionless, malicious actors can create pools with worthless tokens, attract liquidity, then drain value by selling their holdings or exploiting token contract backdoors. Traders should verify token contracts and pool depth before swapping, especially for newly created pairs.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.