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.
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 | Meaning |
|---|---|
curve_type | 0 = constant-product (virtual-reserves), 1 = fixed-price, 2 = linear-price. |
base_supply_max | Total base tokens the curve can ever mint. |
base_supply_graduation | Base tokens that must be sold to reach graduation. Usually 0.8 × base_supply_max; the remaining 20% becomes the post-graduation pool’s initial LP. |
quote_reserve_target | Quote amount that triggers graduation. Derived at Initialize from the curve params + base_supply_graduation. |
virtual_base / virtual_quote | Virtual-reserve seeds for the constant-product curve. |
migrate_type | Selects the graduation target: AMM v4 vs CPMM. See instructions. |
fees.buy_numerator / buy_denominator | Buy-side fee, e.g. 100 / 10_000 = 1.00%. |
fees.sell_numerator / sell_denominator | Sell-side fee. Often same as buy. |
fees.protocol_share, fees.creator_share, fees.lp_share | Split of the above, summing to denominator. |
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 literally the CPMM (or AMM v4) curve post-graduation, so the graduation 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.9⇒s ≈ 6.22e6base 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.9 gives roughly ∆s ≈ 0.4e6 — a ~15× 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. - Newton solves for “buy exact quote” and “sell exact quote” iterate in
u128fixed-point with a configurable max iteration count (default 10). Failure mode isNotConverged— rare outside of near-graduation edge cases.
Handoff to CPMM
WhenGraduate fires:
cpmm_initial_price is price(base_sold) mechanically (it is the marginal curve price at the moment of handoff). The CPMM pool opens at exactly that price, so an observer switching from the curve UI to the CPMM UI sees no jump.
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


