What it is
An automated market maker (AMM) is a smart contract that holds a pool of two or more assets and prices trades using a deterministic formula instead of matching individual buy and sell orders. Anyone can deposit assets into the pool to become a liquidity provider (LP) and earn a cut of trading fees, and anyone can trade against the pool at any time — there's always a counterparty because the formula itself is the counterparty.
How it works
- Liquidity providers deposit a pair (or set) of assets into a pool — e.g., ETH and USDC — receiving LP tokens that represent their share.
- The pool's price is derived from a formula over its reserves. The most common is the constant-product formula (x·y=k), where the price shifts automatically as the ratio of the two reserves changes.
- A trader who wants to swap sends in asset A; the contract computes how much of asset B to release so that the formula's invariant (like x·y=k) still holds, then executes the swap atomically.
- Every trade shifts the reserve ratio, so the price moves against the trader as the trade gets larger — this "slippage" scales with trade size relative to pool depth.
- Each trade pays a small fee (commonly 0.05%–1%), which accrues into the pool and is shared pro-rata among LPs when they withdraw.
- Arbitrageurs continuously trade against the pool whenever its price diverges from the external market price, pulling the pool price back into line — this is what keeps AMM prices accurate, but it's also a direct transfer of value from LPs to arbitrageurs (impermanent loss).
- Variants change the formula or its shape: concentrated liquidity lets LPs park funds only within a chosen price range for higher fee density; bonding curves used elsewhere in the Atlas apply the same idea to new-asset issuance rather than two-sided trading.
Why designers use it
- Provides guaranteed, continuous liquidity with no need for a professional market maker or order-book infrastructure — anyone can supply capital.
- Fully permissionless and composable: any contract can call the pool to swap, price an asset, or route a trade, making it a base primitive for the rest of DeFi.
- Price discovery happens transparently on-chain, verifiable by anyone, with no off-chain matching engine to trust.
- Passive, path-independent fee income for LPs make it accessible to non-professional liquidity providers, deepening on-chain liquidity broadly.
Failure modes
- Impermanent loss: when the external price of one pooled asset moves a lot relative to the other, arbitrageurs profit at the LP's expense, and LPs can end up worse off than simply holding the assets.
- Thin pools suffer high slippage, making large trades expensive and inviting sandwich attacks, where a bot buys ahead of a victim's trade and sells right after.
- Constant-product pools price everything continuously, including during oracle-manipulation windows, letting an attacker with a flash loan temporarily distort the pool price and drain a protocol that reads that price as an oracle.
- Concentrated-liquidity positions can go entirely "out of range," earning zero fees and holding only the depreciating asset until someone actively rebalances.
- Low-fee-tier pools can attract volume without attracting enough LP depth, causing spirals where thin liquidity produces bad prices which further discourages liquidity.
What to check before using it
- Model impermanent loss for your specific asset pair and volatility profile before advertising this as a "safe yield" to LPs.
- Never use a spot AMM price as an on-chain oracle without time-weighting (TWAP) or an external oracle feed — it's a well-known manipulation vector.
- Check what fee tier and formula variant fit your asset's expected volume and volatility — concentrated liquidity rewards active management, plain constant-product does not.
- Stress-test slippage at the trade sizes you expect; a pool that looks fine for $1k swaps may be unusable for $1M ones.
- Confirm LP token / position withdrawal and fee-accrual logic has been audited — pooled-fund contracts are the most attacked category in DeFi.