Automated market maker (AMM)
Automated market maker (AMM): An automated market maker (AMM) is a smart contract that lets you swap tokens against a pool of liquidity instead of matching with another trader. A formula sets the price from the ratio of tokens in the pool, so trades can happen at any time without an order book.
How an AMM sets prices
Many AMMs use a constant product formula: the quantity of token A multiplied by the quantity of token B stays the same. When you buy token A, you add token B to the pool and remove token A, so A becomes scarcer in the pool and its price rises. Larger trades move the ratio more, which is called slippage.
Liquidity providers and impermanent loss
Liquidity providers deposit pairs of tokens into the pool and earn a share of trading fees. If the prices of the two tokens move apart, providers can end up with less value than if they had simply held the tokens. This is known as impermanent loss.
AMM vs order book
An order book matches buy and sell orders placed at chosen prices, as on most centralised exchanges. An AMM has no orders; traders swap against the pool and the formula sets the price.
Frequently asked questions
Who sets the price on an AMM?
The pool formula does, based on the balance of tokens. Arbitrage traders keep it close to prices on other markets.
Is providing liquidity to an AMM risk free?
No. Providers face impermanent loss, smart contract risk and token price risk.