Docs · Trading the curve
Guides

Trading the curve

Each launch trades against a constant-product curve with a virtual (phantom) quote reserve V. The phantom reserve sets the opening price; it is not real money and can never be withdrawn.

The curve

V   = phantom quote reserve
X0  = total supply
A   = sellable allocation = X0 / 7 × 5   (71.43% of supply)
k   = V × X0

state: q = real quote reserve, s = tokens sold
(V + q) × (X0 − s) = k
price = (V + q)² / k
Moment Market cap
Launch V (4,000 USDC by default)
Graduation about 12.25 × V

The curve completes when s reaches A, which is when q reaches 2.5 × V.

Buying

The trade fee and creator tax are taken from the quote you pay, then the rest buys tokens:

fee      = floor(gross × trade_fee_bps / 10000)
tax      = floor(gross × creator_tax_bps / 10000)
net      = gross − fee − tax
tokens   = (X0 − s) − ceil(k / (V + q + net))

The buy that crosses the allocation is capped: it receives exactly the remaining tokens and pays only for them. Compute: about 53k CU.

Selling

gross    = (V + q) − ceil(k / (X0 − s + tokens))
fee, tax = taken from gross, as above
you get  = gross − fee − tax

A sale is rejected with CurveComplete once the curve has sold its whole allocation. Compute: about 32k CU.

Rounding

All maths is integer u128 with rounding in the program's favour. Quubits' interface reproduces the same maths with bigint, so the quote you see matches the program to the last base unit.

Slippage

Every buy carries min_tokens_out and every sell carries min_quote_out. If the curve moves past your limit before your transaction lands, the program rejects it with SlippageExceeded and nothing is charged except the network fee.