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:
base_out:
s:
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:
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:
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:
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.
s = 0): 0 (pure quadratic starts at zero).
Price at 50% sold (s = 500_000_000):
s = 800_000_000):
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 the6.827e9above is in ⇒s ≈ 9.06e7base tokens bought. - 1% fee (
0.1 USDC) split: lp0.06, creator0.02, protocol0.02. The lp share stays inquote_vault; the other two route to their respective accrual counters.
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 everyBuy:
lp_shareis left inquote_vault. This is what makes the effective curve tighter (more quote reserve against the same base supply).protocol_shareincrementsLaunchState.state_data.protocol_fees_quote.creator_shareincrementsLaunchState.state_data.creator_fees_quote.
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
NotConvergederror.
Handoff to CPMM
WhenGraduate fires:
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
products/launchlab/accounts— theLaunchStatefields storing these parameters.products/launchlab/instructions—Buy,Sell,Graduateaccount lists.algorithms/constant-product— the CPMM math the post-graduation pool uses.
- Raydium SDK v2
LaunchLabmodule - Raydium LaunchLab program source

