Skip to main content
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 function p(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.
Bonding curves are the standard launch mechanism when the issuing entity does not want to pre-seed an AMM pool with collateral.

Generic pricing formulas

For any continuous price function p(s): Spot price at supply s:
Cost to buy supply from s_0 to s_1 (with s_1 > s_0):
where 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:
(Symmetry: buying and selling across the same interval exchanges the same collateral — modulo fees.) Average price for the buy:

Common curve families

Linear

Price rises proportionally with supply. Used for “steady” launches where the issuer wants a predictable, moderate markup over the lifetime.

Quadratic

(For the un-normalized p(s) = k · s², drop the S_max²: P(s) = (k/3) · s³. Pick one convention and stay in it — the worked example below uses the normalized form throughout.) Price rises quadratically. Early buyers get a near-zero price (flat starting region); late buyers pay a steeper premium.
LaunchLab does not implement a quadratic price curve. Its three curve types are 0 = ConstantProduct (the default), 1 = FixedPrice and 2 = LinearPrice. The closest shape to this section is LinearPrice, whose price is p(s) = a·s and whose cost is therefore quadratic. This section is kept as the general treatment of a polynomial curve.

Virtual-reserves CPMM (Pump-style)

The curve is a standard CPMM with a pretend initial quote reserve V_q:
Spot price:
Cost to move from s_0 to s_1:
This variant has the elegant property that at graduation (where 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 = 0 (ConstantProduct) — the default, and the only type with live configs today.

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:
This is the general numerical recipe, not LaunchLab’s implementation. LaunchLab has no Newton solver and no NotConverged error — none of its three curves needs one. The constant-product curve inverts in closed form, the fixed-price curve is a division, and the linear-price curve’s quadratic cost inverts with a square root. Even the quadratic-price case above has the exact closed form s₁ = ∛(s₀³ + 3·cost/k), which is what the snippet uses as its initializer.

Fee integration

Fees are applied on top of the curve cost, not inside it. On buy:
On sell:
The LP portion of the fee is retained in 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):
Once quote_vault ≥ quote_to_graduate, the Graduate instruction creates a CPMM pool with:
For the virtual-reserves curve, by construction:
For the quadratic this equality does not hold: the integrated average price sits strictly above the marginal price, so the CPMM opens above p(S_graduate) by a fixed factor (see the worked example). Only the constant-product / virtual-reserves curve — the one LaunchLab actually runs — is price-continuous at handoff.

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

10 units of quote per base unit.

Cost of the first buy of 1e6 base

With 1% fee:

Graduation threshold

Price at graduation

Post-graduation CPMM reserves

That is not p(8e8) = 25.6 — it is exactly 4/3 of it. For any quadratic-price curve the integrated average is p(s)/3 · s / s, so cost(0,s)/s = p(s)/3 · ... works out to 4/3 · p(s) once the remaining supply is 1 − 0.8. The quadratic handoff is therefore not price-continuous. Only the constant-product / virtual-reserves curve has the exact-equality property described above; a quadratic launch shows a step at graduation.

Pointers

Sources:
  • Raydium LaunchLab program source (quadratic + virtual-reserves curve implementations).
  • Bancor white paper (linear bonding curves, historical).
  • Pump.fun public post-mortems (virtual-reserves variant).