An automated market maker (AMM) is a set of contracts that holds two tokens and quotes a price by formula. There is no order book and no maker posting quotes: an equation sets the price, and every trade moves the price along the curve that equation describes.
If you have used Uniswap on Ethereum, you have used an AMM. Several AMMs run on Canton. Tradecraft's API documentation, read on 13 Oct 2026, describes its pools as constant-product pools, the design this article walks through; Tradecraft is one of the venues whose pools CCTools' DeFi tab reads live. This article explains the math, the trade-offs you accept when you swap or provide liquidity, and where fees come in. The numbers in the examples are hypothetical; live TVL, volume and APR for Canton pools are on the DeFi tab.
01The Constant-Product Formula
The simplest AMM design holds two token reserves, x and y, and keeps one rule:
x * y = k
The product k stays the same through a swap (before fees). When you sell token X for token Y, you add to the X reserve, and the pool pays out exactly as much Y as keeps the product equal to k.
Why a product? It means the pool can never run out. As the X reserve grows, the Y reserve shrinks toward zero without reaching it, so the price of the last units of Y rises without limit instead of the pool emptying.
This is the design Uniswap V2 popularized in 2020. Uniswap V3 added concentrated liquidity, which lets liquidity providers pick a price range; the core idea, a formula in place of an order book, is the same. Other Canton venues use other designs, including order books, so check which one a venue uses before applying this math to it.
02A Worked Example
Take a hypothetical CC/USDCx pool with 100,000 CC and 15,000 USDCx in reserve. The product k is 1,500,000,000, and the spot price is 15,000 / 100,000 = 0.15 USDCx per CC.
A user sells 1,000 CC. The CC reserve becomes 101,000. To keep k, the USDCx reserve must drop to 1,500,000,000 / 101,000 = 14,851.49, so the user receives 15,000 minus 14,851.49 = 148.51 USDCx. The effective price is about 0.1485 USDCx per CC, about 1% below the spot price.
That gap between the spot price and the price you get is price impact, often called slippage. It grows with the size of the trade relative to the pool. A 1,000 CC trade against a 100,000 CC reserve is 1% of the reserve and gets a price about 1% worse. A 10,000 CC trade against the same pool receives 1,363.64 USDCx, an average of about 0.1364 USDCx per CC, a price about 9% worse. A deeper pool gives a smaller price impact for the same trade.
03Where Fees Come In
AMMs charge a swap fee, and each pool sets its own rate. The fee is taken from the input before the curve math runs: with a 0.30% fee, 99.7% of your input trades, and the rest stays in the pool, growing its reserves and k. (The 0.30% is an example, not a Canton standard.)
That fee is how liquidity providers (LPs) are paid. LPs own a share of the pool, so each swap's fee raises the value of their share slightly.
Not all of a fee always reaches LPs: some designs split it between LPs and the protocol or operator. Where a protocol publishes the split, CCTools computes a pool's APR from the LP's share; where it reports one total, the APR shown is an upper bound for what LPs receive. The APR article explains how each figure on the DeFi tab is computed. That APR is fee income annualized from past volume, and it does not include impermanent loss.
04Impermanent Loss, the Hidden Cost
When you provide liquidity, you hold both tokens in the pool's ratio. When prices move elsewhere, arbitrageurs trade against the pool until its price catches up, and that rebalancing leaves the pool with more of the token that fell and less of the one that rose. The shortfall against simply holding the tokens is impermanent loss (IL).
A hypothetical example: you deposit 100 CC and 15 USDCx when CC is at $0.15, $30 in total. CC then doubles to $0.30 everywhere else. Arbitrageurs buy CC from the pool until its price there reaches $0.30. Your share now holds about 70.71 CC and 21.21 USDCx, worth $42.43. Had you just held 100 CC and 15 USDCx, you would have $45. The $2.57 gap, about 5.7%, is the impermanent loss.
It is called impermanent because if CC returns to $0.15, the position returns to its original split and the gap closes. It becomes permanent when you withdraw at a price away from your entry. A pool of two stablecoins has near-zero IL while both hold their peg; the further the two prices move apart, the larger the IL. The impermanent loss article has the full formula and the breakeven against fees.
05When AMMs Are the Right Tool
AMMs suit swaps of small to medium size in pools that are deep relative to the trade, and providing liquidity in pairs whose prices tend to move together.
They suit less: large trades in shallow pools, where price impact grows quickly, and pairs whose prices move far apart, where impermanent loss can exceed the fees.
An order book works differently: makers post specific sizes at specific prices, and a large order fills against those quotes one level after another. A large order still pays more as it walks the book, so for a large trade, compare each venue's quote or order book for your size on the day.
