Documentation Index
Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
Use this file to discover all available pages before exploring further.
This page derives the general bonding-curve mathematics. For LaunchLab’s specific implementation, see
products/launchlab/bonding-curve. The derivations are given in continuous form; the on-chain code implements the discrete analog in fixed-point arithmetic.What a bonding curve is
A bonding curve is a deterministic price functionp(s) that relates the price of a token to the amount currently in circulation (s for “supply sold”). Buyers purchase by sending collateral to the contract; the contract emits new token units at the marginal price dictated by the curve. Sellers return token units and receive the integrated refund.
Two key properties compared to a CPMM pool:
- No counterparty needed. The issuing contract is the market maker; liquidity exists by fiat.
- Monotonic price. Price rises with every net-buy and falls with every net-sell.
Generic pricing formulas
For any continuous price functionp(s):
Spot price at supply s:
s_0 to s_1 (with s_1 > s_0):
P(s) = ∫ p(s) ds is the curve’s antiderivative. Geometrically, cost is the area under p between s_0 and s_1.
Proceeds from selling supply back from s_1 to s_0:
Common curve families
Linear
Quadratic
curve_type = 0).
Virtual-reserves CPMM (Pump-style)
The curve is a standard CPMM with a pretend initial quote reserveV_q:
s_0 to s_1:
s = S_graduate), the marginal price equals the opening price of the downstream CPMM pool seeded with reserves (S_max − S_graduate, V_q + cost(0, S_graduate)). Handoff is seamless. LaunchLab exposes this as curve_type = 1.
Discrete implementation
On-chain,s and cost are both integers (smallest-denomination units). The continuous integral cost(s_0, s_1) is computed directly from the closed form whenever one exists (linear, quadratic). For curves without a closed-form inverse (quadratic, given cost, find s_1), Newton iteration is used:
NotConverged if the residual is still above tolerance. In practice this only triggers near the domain’s extremities; production swaps converge in 2–3 iterations.
Fee integration
Fees are applied on top of the curve cost, not inside it. On buy:quote_vault and effectively makes the curve stiffer for later buyers — the reserve grows without issuing more supply. The protocol and creator portions are tracked in separate counters for later sweep.
Graduation threshold
A curve “graduates” when it has received enough collateral to seed an external AMM pool at a price matching the current curve price. For a quadratic curve with parameters(k, S_max, S_graduate):
quote_vault ≥ quote_to_graduate, the Graduate instruction creates a CPMM pool with:
S_graduate (typically 0.8 · S_max) and the surplus collateral from the final threshold-crossing buy.
Impermanence vs a CPMM pool
A pure bonding-curve launch has no impermanence in the Uniswap sense: there is no “other side” of the market to rebalance against. The curve issues supply on demand, and the only “LP” is the contract itself. Post-graduation, the resulting CPMM pool behaves like any other CPMM pool — if the LP was not burned, they are subject to the usual impermanent-loss dynamics. This is why the burn post-graduation policy is dominant in public launches: it keeps the pool permanent and removes any LP-withdrawal-driven price shocks.Worked example
Curve: quadratic,k = 40, S_max = 1e9, S_graduate = 0.8 · S_max = 8e8. Buy fee 1%.
Price at s = 5e8
Cost of the first buy of 1e6 base
Graduation threshold
Price at graduation
Post-graduation CPMM reserves
Pointers
products/launchlab/bonding-curve— the on-chain LaunchLab implementation of these formulas.products/launchlab/instructions—Buy,Sell,Graduateaccount-level specs.algorithms/constant-product— what the post-graduation CPMM does with the reserves.
- Raydium LaunchLab program source (quadratic + virtual-reserves curve implementations).
- Bancor white paper (linear bonding curves, historical).
- Pump.fun public post-mortems (virtual-reserves variant).


