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

Price rises quadratically. Early buyers get a near-zero price (flat starting region); late buyers pay a steeper premium. This is the curve type LaunchLab defaults to (curve_type = 0).

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 = 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:
LaunchLab caps iterations at ~10 and reverts with 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:
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, the equality is approximate; the “slop” is absorbed into the rounding of 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

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

(Units: decimals need to be tracked carefully; the example is illustrative.)

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).