An automated market maker (AMM) is a fundamental decentralized exchange (DEX) protocol that allows for the seamless, permissionless trading of digital assets.
Unlike traditional financial exchanges that rely on a centralized order book to match buyers and sellers, AMMs use mathematical formulas and liquidity pools to facilitate trades. This innovation is a cornerstone of decentralized finance (DeFi), enabling 24/7 trading without the need for intermediaries or professional market makers to provide liquidity. In an AMM environment, you are not trading against another person; instead, you are interacting with a smart contract that holds a reserve of tokens.
How Does an AMM Work?
The mechanics of an AMM revolve around liquidity pools—crowdsourced collections of tokens locked in a smart contract. To maintain a balance between assets and determine their market price, most AMMs use a specific formula, most famously the constant product formula: x * y = k. In this equation, "x" and "y" represent the quantity of two different tokens in the pool, and "k" is a fixed constant. When a trader wants to buy token X, they must add token Y to the pool, which shifts the ratio of assets. The smart contract automatically adjusts the price to ensure that the product (k) remains the same. This ensures that the pool always has liquidity, regardless of how large a trade is, though larger trades in small pools can result in significant slippage.
Liquidity Pools and Liquidity Providers Explained
Liquidity does not appear out of thin air; it is provided by users known as Liquidity Providers (LPs). Anyone can become an LP by depositing an equal value of two tokens into a pool. In exchange for providing this capital, LPs earn a portion of the trading fees generated by the pool, proportional to their share of the total liquidity. When an LP deposits funds, they receive "LP tokens," which act as a receipt and can be redeemed later to withdraw their original assets plus any accumulated rewards.
Impermanent Loss: The Key Risk for LPs
While earning trading fees is attractive, LPs face a unique risk known as impermanent loss. This occurs when the market price of the deposited assets changes significantly compared to when they were first added to the pool. Because the AMM formula relies on internal ratios, it may lag behind external market prices, creating arbitrage opportunities. Arbitrageurs will trade against the pool until the price aligns with the wider market, often leaving the LP with more of the lower-value asset and less of the higher-value asset than if they had simply held the tokens in a wallet. The loss is "impermanent" because it only becomes permanent if the LP withdraws their funds while the prices are still diverged.
Popular AMM Protocols
The DeFi ecosystem is home to several prominent AMM designs. Uniswap pioneered the constant product model on Ethereum and remains the most liquid DEX. Curve Finance specialized in "stableswaps," using a modified formula to minimize slippage for assets of similar value, like stablecoins. Meanwhile, Balancer introduced multi-asset pools that function like automated index funds. These protocols continue to evolve, introducing features like concentrated liquidity to improve capital efficiency and reduce risks for participants.