LaunchLab exposes a tight instruction set: six user-facing calls plus a handful of admin primitives. The SDK wraps all of them; this page documents the raw surface for aggregators, monitoring tools, and programs that need CPI.
Instruction inventory
The “ExactIn/ExactOut” split mirrors CPMM’s
SwapBaseInput / SwapBaseOutput — on-chain they are separate instruction discriminators with slightly different rounding.
Graduation path selection. migrate_type is recorded on PoolState at Initialize{V2,WithToken2022} time and determines which of the two graduation instructions can run. Token-2022 launches always migrate to CPMM. SPL Token launches migrate to either AMM v4 or CPMM depending on the amm_creator_fee_on setting:
BothToken→MigrateToAmm→ AMM v4 pool (creator fee can be collected from either side; AMM v4 has no native creator-fee field, so creator fees are taken via the LP-lock NFT mechanism instead).QuoteToken→MigrateToCpswap→ CPMM pool withcreator_fee_on = OnlyQuoteToken(creator continues to earn fees from the CPMM pool through the LaunchLab Fee Key NFT — seeproducts/launchlab/creator-fees).
Initialize
Create a new launch.
Arguments
Preconditions
quote_mint ∈ launch_config.allowed_quote_mints.base_supply_graduation ≤ base_supply_max.- Fee parameters pass
launch_config.max_*_fee_ratechecks. open_time ≥ now − slop(SDK enforces≥ now; program tolerates slight backdating).curve_typeis recognized.
base_minthassupply = base_supply_max, all inbase_vault.base_mint.mint_authority = launch_authority,freeze_authority = None.LaunchStateinitialized withstatus = Active,base_sold = 0,quote_reserve_real = 0.quote_reserve_targetcomputed from curve params +base_supply_graduation+buy_numerator(approximately).
InvalidQuoteMint, FeeRateTooHigh, InvalidCurveParams, MathOverflow.
Buy (canonical variant: BuyExactIn)
User provides a fixed quote_in; the curve computes base_out.
Arguments
Preconditions
launch_state.status == Active.now ≥ open_time.user_quote_ata.balance ≥ quote_in.quote_in > 0.
- Split
quote_inintoquote_in_after_feeand the fee parts. - Newton-solve the curve for
base_outgiven the post-fee quote. require(base_out ≥ minimum_base_out)else revertExceededSlippage.- Move
quote_inuser → vault. Movebase_outvault → user. - Update
base_sold += base_out,quote_reserve_real += quote_in_after_fee × (lp_share / total_share). - Update fee counters (
protocol_fees_quote,creator_fees_quote). state_data.num_buys += 1.- If
quote_reserve_real ≥ quote_reserve_targetafter the update, the SDK typically chains aGraduateix in the same transaction. The program does not auto-graduate insideBuy— a subsequentGraduateis required.
BuyExactOut
User specifies the exact base_out; program computes quote_in.
Arguments
BuyExactIn. Uses the closed-form quadratic integral (or CPMM inverse, for curve_type 1) rather than Newton iteration.
Sell / SellExactIn / SellExactOut
Mirror of Buy. User returns base_in to the curve and receives quote_out. The fee is deducted from quote_out, so the user receives less than the raw integrated proceeds.
Preconditions —
user_base_ata.balance ≥ base_in.- Selling cannot push
base_soldbelow 0 (redundant with the above given accounting is consistent). - Launch is
Active.
Buy. base_sold decreases, quote_reserve_real decreases. Fees still accrue.
MigrateToAmm / MigrateToCpswap
Graduate a launch into a tradeable AMM pool once the curve has hit total_quote_fund_raising. The two instructions correspond to the two graduation targets — AMM v4 and CPMM — and only one of them is valid for any given launch, determined by pool_state.migrate_type (set at Initialize time).
Who signs
MigrateToAmm— themigrate_to_amm_walletrecorded on the bindingGlobalConfig.MigrateToCpswap— themigrate_to_cpswap_walletrecorded on the bindingGlobalConfig.
MigrateToAmm takes three (mainly OpenBook market parameters that the program forwards to AMM v4):
MigrateToCpswap takes none.
Effect (common to both)
- Verify
pool_state.status == Migrate(i.e.,quote_reserve_targethas been reached). Otherwise revert withPoolMigrated(status was alreadyMigrated) orPoolFunding(still in funding). - Verify
pool_state.migrate_typematches the instruction (0for AMM,1for CPMM). Otherwise revert withMigrateTypeNotMatch. - Compute the post-graduation reserves:
base_amount_out = base_vault.amount − vesting_schedule.total_locked_amountquote_amount_out = quote_vault.amount − quote_protocol_fee − migrate_fee − platform_fee
- CPI into the target program (
AMM v4 Initialize2orCPMM InitializeWithPermission) with those reserves to create the post-graduation pool. - Split the resulting LP per the binding
PlatformConfig.{platform_scale, creator_scale, burn_scale}(CPMM only) — one piece minted toplatform_nft_wallet, one to a creator NFT wrapped by the LP-Lock program, one burned via Burn & Earn. For AMM v4 graduation, the LP disposition is governed by AMM v4’s own initialization parameters. - Revoke
base_mint.mint_authority(set toNone). - Flip
pool_state.status = Migrated, setvesting_schedule.start_time = block_time + cliff_period.
BuyExactIn, BuyExactOut, SellExactIn, SellExactOut will reject from this point on with PoolMigrated. The resulting AMM pool is canonical and trades like any other AMM v4 / CPMM pool.
Common errors — PoolFunding, PoolMigrated, MigrateTypeNotMatch, InvalidCpSwapConfig, MathOverflow.
CollectFee
Admin sweep of the protocol’s accrued trade fees on a single launch.
Arguments — none.
Accounts
Effect — transfer
pool_state.quote_protocol_fee from quote_vault to recipient_token_account, then zero the counter. Callable any time after the first buy.
CollectMigrateFee
Admin sweep of the migration fee accumulated at graduation. Same account shape as CollectFee with migrate_fee_owner as the signer (instead of protocol_fee_owner) and pool_state.migrate_fee as the drained counter.
ClaimCreatorFee
Per-creator sweep of accrued creator fees across every launch the creator owns that uses the same quote mint. Drains the per-creator fee vault, not the per-pool one.
Arguments — none.
Accounts
Effect — transfer the entire balance of
creator_fee_vault to recipient_token_account. Reverts with a require-greater-than-zero check if the vault is empty.
ClaimPlatformFee
Per-platform sweep that drains a launch’s quote vault directly. Use this when a platform wants to claim its slice for one specific launch without going through the aggregated platform vault.
Arguments — none.
Accounts
Effect — transfer
pool_state.platform_fee from quote_vault to recipient_token_account, zero the counter.
ClaimPlatformFeeFromVault
Per-platform aggregated sweep. Drains the platform’s per-quote-mint fee vault that accumulates fees from every launch routed through the platform.
Arguments — none.
Accounts
Effect — transfer the full balance of
platform_fee_vault to recipient_token_account. Reverts if the vault is empty.
Vesting and platform-config instructions
These are documented on dedicated pages because each has its own state model:CreateVestingAccount,CreatePlatformVestingAccount,ClaimVestedTokenCreatePlatformConfig,UpdatePlatformConfig,UpdatePlatformCurveParam,RemovePlatformCurveParam,CreatePlatformGlobalAccess,ClosePlatformGlobalAccessCreateConfig,UpdateConfig
State-change matrix
Where to go next
products/launchlab/code-demos— TypeScript examples for each instruction.products/launchlab/accounts— full state shape.reference/error-codes— LaunchLab error enum.
- Raydium SDK v2
LaunchLabmodule - Raydium LaunchLab program source

