Skip to main content
LaunchLab supports three curve shapes selected at Initialize: constant-product (the most common, virtual-reserve form of the standard x · y = k curve), linear-price, and fixed-price. The graduation threshold formula is shared across all three. This page walks through the constant-product math in detail; the linear and fixed forms are summarised at the end.

Parameters stored on LaunchState

Field names in the Rust struct match the PoolState fields described in accounts; units above are conceptual.

Constant-product curve with virtual reserves (curve_type = 0)

The default and most-used curve. Pump-style launches all use this form. The curve pretends there is a virtual quote reserve V_q and a virtual base reserve V_b from the start (stored as virtual_quote and virtual_base on PoolState), so the effective pool looks like a CPMM with those reserves. Buys follow x · y = k math:
solved for base_out:
Effective price at base-sold s:
The same x · y = k invariant LaunchLab applies pre-graduation is then the CPMM curve post-graduation, so the handoff is mechanically seamless: the marginal price at base_sold = base_supply_graduation equals the price the post-graduation pool opens at with (quote_vault, base_vault_remaining) as its reserves.

Fixed-price curve (curve_type = 1)

A flat-price curve. Every buy/sell happens at a constant price, configurable at Initialize:
Useful for fair launches where the team wants uniform pricing for all participants regardless of when they buy. Graduation triggers when base_supply_graduation has been sold (the linear-cost relationship makes quote_reserve_target straightforward to derive).

Linear-price curve (curve_type = 2)

Price increases linearly with base_sold:
Integrated cost:
Quadratic in base_sold — early buyers pay close to zero, late buyers pay substantially more, with the marginal price always rising at a fixed slope. The on-chain implementation lives in curve/linear_price.rs.

Curve-shape comparison

Graduation threshold

quote_reserve_target is computed at Initialize as the quote required to drive base_sold from 0 to base_supply_graduation:
A launch graduates as soon as quote_vault.balance ≥ quote_reserve_target. Because buys come in at discrete sizes, the actual balance at graduation can slightly exceed the target — the surplus becomes extra quote-side liquidity in the resulting CPMM pool.

Worked example — a quadratic launch

Parameters:
  • base_supply_max = 1_000_000_000 (1 billion base tokens, 6 decimals)
  • base_supply_graduation = 800_000_000 (80% sold triggers graduation)
  • k = 40 (price scale)
  • Fees: 1% buy, 1% sell, split lp:creator:protocol = 60:20:20.
Initial price (s = 0): 0 (pure quadratic starts at zero). Price at 50% sold (s = 500_000_000):
Price at graduation (s = 800_000_000):
Quote required to reach graduation (integrated cost):
So ≈ 6.827 quote-native units (in whichever 6-decimal quote mint is configured, e.g. ~6,827 USDC if the quote is USDC). Fee applied on top:
First buy of 10 USDC:
  • Virtual state: s = 0, quote_vault = 0.
  • Subtract fee: quote_after_fee = 10 × 0.99 = 9.9.
  • Solve (40 / (3e18)) × s³ = 9.9e6 — 9.9 USDC in native 6-decimal units, the same units the 6.827e9 above is in ⇒ s ≈ 9.06e7 base tokens bought.
  • 1% fee (0.1 USDC) split: lp 0.06, creator 0.02, protocol 0.02. The lp share stays in quote_vault; the other two route to their respective accrual counters.
Buy at 75% sold (approaching graduation): Same 10 USDC buys far less base now because the curve is steep. Solving at s₀ = 750e6 with quote_in_after_fee = 9.9e6 gives ∆s ≈ 4.4e5 — a ~200× reduction in base per USDC compared to the first buy.

Fee mechanics during the curve phase

On every Buy:
  • lp_share is left in quote_vault. This is what makes the effective curve tighter (more quote reserve against the same base supply).
  • protocol_share increments LaunchState.state_data.protocol_fees_quote.
  • creator_share increments LaunchState.state_data.creator_fees_quote.
On Sell the same split applies but the fee is taken from the outbound quote_out. Both counters are swept via CollectFees (admin or creator, each to their own counter).

Precision

  • Base-side amounts: u64.
  • Quote-side amounts: u64.
  • Intermediate cubes / products: u128.
  • “Buy exact quote” and “sell exact quote” invert in closed form — the constant-product curve algebraically, the fixed-price curve by division, the linear-price curve by a square root. There is no Newton solver in the program, no iteration cap, and no NotConverged error.

Handoff to CPMM

When Graduate fires:
For the constant-product curve — LaunchLab’s default and the only live type — cpmm_initial_price is exactly price(base_sold), the marginal curve price at the moment of handoff, so an observer switching from the curve UI to the CPMM UI sees no jump. For a quadratic-price curve it is not: the integrated average sits above the marginal price (by a factor of 4/3 in the example above), so a step at handoff is expected.

Where to go next

Sources: