Onchain Atlas

Automated Market Maker

A smart contract that always quotes a price and lets anyone trade against a shared pool of funds, replacing human market makers and order books with a fixed math formula.

Also called: AMM · constant-function market maker · liquidity pool

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

  1. Liquidity providers deposit a pair (or set) of assets into a pool — e.g., ETH and USDC — receiving LP tokens that represent their share.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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).
  7. 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.

Experiments that used it · 6

Shown oldest first, so you can watch the design evolve.

Bancor
The first on-chain automated market maker: a bonding-curve 'smart token' protocol that pioneered continuous, contract-native liquidity before Uniswap, later famous for its (ultimately paused) single-sided impermanent-loss protection.
2017 technically successful commercially unsuccessful
Augur
The first decentralized prediction market on Ethereum, using a REP-token dispute/forking oracle to resolve real-world event outcomes without a trusted operator.
2018 technically successful commercially unsuccessful
Thales
Synthetix spin-out that turned deprecated binary options into fully collateralized UP/DOWN 'positional markets' and an onchain sports AMM (Overtime), before absorbing itself into the Overtime brand in 2025.
2021 partial success
Sudoswap
A minimal, fully on-chain automated market maker for NFTs that priced ERC721/ERC1155 tokens along customizable bonding curves and popularized royalty-optional, low-fee NFT trading.
2022 technically successful commercially unsuccessful
MetaDAO
The first live onchain futarchy, where prediction markets on a token's price — not token-holder votes — decide governance proposals, later pivoting into a futarchy-governed token launchpad on Solana.
2023 ongoing
Meteora Dynamic Bonding Curve
Meteora's permissionless, configurable bonding-curve launch protocol on Solana that graduates tokens into a real AMM pool once a funding threshold is hit.
2025 ongoing