Automated Market Maker (AMM)

An automated market maker is a smart contract that algorithmically prices and trades tokens using pooled liquidity instead of order books.

What Is an Automated Market Maker (AMM)?

An automated market maker (AMM) is a type of smart contract protocol that uses mathematical formulas to price assets and facilitate trades, replacing the traditional order book model used by centralized exchanges. Instead of matching individual buy and sell orders, AMMs allow traders to swap tokens directly against a liquidity pool — a pool of tokens locked in a smart contract — with prices determined algorithmically based on the ratio of assets in the pool.

AMMs are the engine behind decentralized exchanges like Uniswap, SushiSwap, Curve, and Balancer. They solved the fundamental bootstrapping problem in decentralized trading: how do you create liquid markets without centralized market makers? The answer was to let anyone become a liquidity provider and let math handle the pricing.

How the Constant Product Formula Works

The most widely used AMM model is the constant product market maker, popularized by Uniswap. It operates on a deceptively simple formula: x * y = k, where x and y represent the quantities of two tokens in the pool, and k is a constant.

When a trader wants to swap Token A for Token B, they deposit Token A into the pool and withdraw Token B. The formula dictates that the product of the two reserves must remain constant after the trade (minus fees). This means as Token A becomes more abundant in the pool, its price relative to Token B decreases, and vice versa.

Consider a pool with 100 ETH and 300,000 USDC (k = 30,000,000). A trader wanting to buy 1 ETH would need to deposit enough USDC to maintain the constant: the new state would be 99 ETH and approximately 303,030 USDC, meaning the trader pays roughly 3,030 USDC for 1 ETH. Larger trades move the price more, which is the mechanism behind slippage in AMM-based exchanges.

Providing Liquidity to AMMs

Anyone can become a liquidity provider (LP) by depositing tokens into an AMM pool. In the standard model, LPs must deposit both tokens in the pool at the current price ratio. In return, they receive LP tokens representing their proportional share of the pool.

LPs earn a portion of the trading fees generated by swaps in their pool. On Uniswap v2, for example, each swap incurs a 0.3% fee that is distributed proportionally to all LPs in the pool. This fee income is the primary incentive for providing liquidity, and pools with high trading volume relative to their size generate the most attractive returns for LPs.

However, providing liquidity carries risks, most notably impermanent loss. When the price of the tokens in a pool diverges from the ratio at which an LP deposited, the value of their position can be less than if they had simply held the tokens. This loss is called "impermanent" because it can reverse if prices return to the original ratio, but it becomes permanent once the LP withdraws.

Evolution of AMM Designs

The constant product formula, while elegant, has significant limitations. It spreads liquidity evenly across all possible prices, from zero to infinity, meaning most of the capital sits at price ranges where trades rarely occur. This capital inefficiency limits the depth available at any specific price point.

Concentrated liquidity, introduced by Uniswap v3, addressed this by allowing LPs to specify a price range within which their capital is active. By concentrating liquidity around the current price, LPs can earn significantly more fees with the same amount of capital. The tradeoff is increased complexity and the risk of the price moving outside the LP's selected range.

Stableswap AMMs like Curve use a different formula optimized for assets that should trade near parity (such as USDC/USDT or different wrapped versions of Bitcoin). The stableswap curve allows very large trades between similar assets with minimal slippage, making these pools essential infrastructure for stablecoin and pegged-asset markets.

Weighted pool AMMs like Balancer generalize the constant product formula to support pools with more than two tokens and non-equal weightings. A pool might hold 80% ETH and 20% USDC instead of the standard 50/50 split, allowing for more flexible portfolio-like structures.

AMMs and the Broader DeFi Ecosystem

AMMs are foundational infrastructure that the rest of DeFi depends on. Lending protocols rely on AMM-based exchanges for liquidations — when a borrower's position becomes undercollateralized, liquidators swap the seized collateral through AMMs to realize its value. Price oracles reference AMM pool prices as one input for determining asset values. Yield farming strategies route through AMMs to harvest and compound rewards.

The permissionless nature of AMMs — anyone can create a pool for any token pair, and anyone can trade or provide liquidity — has made them the primary venue for price discovery of new tokens and the backbone of decentralized trading infrastructure.

Related Terms