Bonding-curve pools
How a launched token's pool prices trades, with a worked reading of the formula.
On this page
The idea#
A pool holds two reserves: tokens and the quote asset the token is priced in. Anyone can buy tokens by paying quote asset, or sell tokens to get quote asset back. The price follows the ratio of the reserves, so it rises as people buy and falls as they sell.
At launch the pool also has a virtual quote reserve: a number added to the real quote reserve when computing prices, which sets the starting price without anyone depositing it. The price is
price = (quote reserve + virtual quote) / token reserve
How a trade is computed#
The pool keeps the product of its two effective reserves from falling. For a buy of dx quote asset:
- The fee is taken from
dx(see Fees and graduation). - The output is
floor(token reserve × net / (effective quote reserve + net)), wherenetisdxminus the fee. - The pool's token reserve falls by the output and its quote reserve rises by
dxminus the protocol's share of the fee.
A sell works the other way: gross proceeds are computed from the tokens paid in, the fee is subtracted, and the pool pays out the rest. Rounding always favours the pool.
Properties that are tested#
- The product never decreases after fees.
- A round trip (buy then sell) never profits, and strictly loses when the fee is above zero.
- Splitting a buy into pieces never beats a single buy.
- The token supply adds up: curve supply equals circulating plus the pool reserve plus tokens burned.
- Every holder can always exit while the pool is on the curve.
- A refused trade leaves the pool and its state root unchanged.
These are the results of tests (24,000 seeded operations plus 9,000 compared against a reference model), not proofs.
A quote is a snapshot#
A quote describes the pool state at one sequence number. It includes the output, fees, the price before and after, the price impact (including the fee) and whether the trade would graduate the pool. It is not a price guarantee. Your wallet checks that the pool state it quoted from matches the market root in the newest header it verified.
What is public about a pool#
The launch parameters, phase, graduation progress, reserves, accumulated protocol fees, tokens burned, circulating supply, the count of trades (not of traders) and the price. See Indexer API for the fields.