AMM
Automated market maker: a smart contract that prices tokens via a mathematical formula over pool reserves instead of matching limit orders on an order book.
Aliases: automated market maker, constant product market maker
AMM (Automated Market Maker) is the core pricing model behind most DEXs. Instead of matching buyers and sellers through an order book, an AMM holds token reserves in a pool and prices each trade algorithmically as a function of those reserves.
The constant-product formula
The best-known variant is the constant product market maker (CPMM), used by Uniswap V2 and most TON DEXs. The invariant is:
x * y = k
Where x is the reserve of the first token, y is the reserve of the second, and k is a constant that must not decrease on swaps (with fees, k actually drifts up slightly). The instantaneous price is the reserve ratio: one TON costs y / x USDT.
When a trader sends Δx TON in and pulls Δy USDT out, the contract solves for Δy so the invariant holds:
(x + Δx_after_fee) * (y - Δy) = k
The larger Δx is relative to x, the more the price moves — that movement is slippage. Small trades barely budge the price; large trades eat a noticeable chunk of the output.
AMM vs order book
| Aspect | Order book | AMM |
|---|---|---|
| Who sets the price | Market makers via limit orders | A formula over reserves |
| Minimum liquidity | Depends on book density | Any non-zero reserves |
| On-chain cost | Heavy — frequent cancels | One swap, one transaction |
| Slippage on large trades | Steps through book levels | Smooth along a curve |
| Friendly to passive LPs | Hard — requires order management | Trivial — deposit and forget |
On-chain order books were expensive on most networks, which is why AMMs took off as a substitute. TON has cheap gas but still defaulted to AMMs because they are simpler for passive LPs and easier for aggregators to route through.
Evolution: CPMM to CLMM
CPMM spreads liquidity evenly across the entire infinite price curve. That is simple but capital-inefficient: if TON/USDT trades in a 2.5–3.5 USDT band, liquidity priced at 0 or 100 USDT is useless.
CLMM (concentrated liquidity market maker), introduced in Uniswap V3, lets a provider pick a price range in which their liquidity is active. The same capital provides much deeper liquidity inside that band, but requires active management: if price leaves the range, the LP stops earning fees and ends up on one side of the pair.
Most pools on TON still use classic CPMM (STON.fi, DeDust). Concentrated liquidity exists but is less prevalent — Bidask and a few specific DeDust pools are the main examples.
Stable AMMs
For stable-stable pairs like USDT/USDC, CPMM is inefficient: a tiny price difference on two roughly equal “dollars” still produces noticeable slippage. Modified curves like Curve’s StableSwap stay almost flat near the 1:1 point and only steepen sharply on a strong imbalance. TON has stable-pair pools of this kind on DeDust and STON.fi.
What matters for users
- On small trades the difference between an AMM and an order book is barely visible.
- On large trades a deep AMM beats a thin order book but loses to a deep CEX book.
- Always compare quotes after slippage, not against the headline mid-price on a dashboard.