Skip to main content
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. Every new Initialize, InitializeV2, and InitializeWithToken2022 call must set migrate_type = 1 (CPSWAP). Any attempt to initialize a new AMM v4-bound pool returns MigrateTypeNotMatch. amm_creator_fee_on only selects whether the resulting CPMM creator fee applies to the quote token or both tokens; it does not select the target program. MigrateToAmm remains callable for an existing PoolState that was initialized with migrate_type = 0 before this restriction. The release does not rewrite existing pool state or remove the legacy instruction.

Initialize

Create a new launch. Arguments
Accounts (abridged) Preconditions
  • quote_mint ∈ launch_config.allowed_quote_mints.
  • base_supply_graduation ≤ base_supply_max.
  • Fee parameters pass launch_config.max_*_fee_rate checks.
  • open_time ≥ now − slop (SDK enforces ≥ now; program tolerates slight backdating).
  • curve_type is recognized.
Postconditions
  • base_mint has supply = base_supply_max, all in base_vault.
  • base_mint.mint_authority = launch_authority, freeze_authority = None.
  • LaunchState initialized with status = Active, base_sold = 0, quote_reserve_real = 0.
  • quote_reserve_target computed from curve params + base_supply_graduation + buy_numerator (approximately).
Common errorsInvalidQuoteMint, FeeRateTooHigh, InvalidCurveParams, MathOverflow.

Buy (canonical variant: BuyExactIn)

User provides a fixed quote_in; the curve computes base_out. Arguments
Accounts Preconditions
  • launch_state.status == Active.
  • now ≥ open_time.
  • user_quote_ata.balance ≥ quote_in.
  • quote_in > 0.
Effect
  1. Split quote_in into quote_in_after_fee and the fee parts.
  2. Newton-solve the curve for base_out given the post-fee quote.
  3. require(base_out ≥ minimum_base_out) else revert ExceededSlippage.
  4. Move quote_in user → vault. Move base_out vault → user.
  5. Update base_sold += base_out, quote_reserve_real += quote_in_after_fee × (lp_share / total_share).
  6. Update fee counters (protocol_fees_quote, creator_fees_quote).
  7. state_data.num_buys += 1.
  8. If quote_reserve_real ≥ quote_reserve_target after the update, the SDK typically chains a Graduate ix in the same transaction. The program does not auto-graduate inside Buy — a subsequent Graduate is required.

BuyExactOut

User specifies the exact base_out; program computes quote_in. Arguments
Same accounts as 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_sold below 0 (redundant with the above given accounting is consistent).
  • Launch is Active.
Effect — symmetrical to Buy. base_sold decreases, quote_reserve_real decreases. Fees still accrue.

MigrateToAmm / MigrateToCpswap

Graduate a launch into a tradeable pool once the curve has hit total_quote_fund_raising. New launches are CPMM-only. MigrateToAmm is retained for existing pools whose stored migrate_type is 0. Who signs
  • MigrateToAmm — the migrate_to_amm_wallet recorded on the binding GlobalConfig.
  • MigrateToCpswap — the migrate_to_cpswap_wallet recorded on the binding GlobalConfig.
These wallets are typically held by the Raydium-operated graduation crank; in practice graduation lands seconds after the threshold is crossed, regardless of who triggered the final buy. Arguments MigrateToAmm takes three (mainly OpenBook market parameters that the program forwards to AMM v4):
MigrateToCpswap takes none. Effect (common to both)
  1. Verify pool_state.status == Migrate (i.e., quote_reserve_target has been reached). Otherwise revert with PoolMigrated (status was already Migrated) or PoolFunding (still in funding).
  2. Verify pool_state.migrate_type matches the instruction (0 for AMM, 1 for CPMM). Otherwise revert with MigrateTypeNotMatch.
  3. Compute the post-graduation reserves:
    • base_amount_out = base_vault.amount − vesting_schedule.total_locked_amount
    • quote_amount_out = quote_vault.amount − quote_protocol_fee − migrate_fee − platform_fee
  4. CPI into the target program (AMM v4 Initialize2 or CPMM InitializeWithPermission) with those reserves to create the post-graduation pool.
  5. For CPMM migrations executed after the 2026-08-17 upgrade, combine platform_scale + creator_scale into one platform-owned locked-LP share and mint at most one Fee Key NFT to platform_nft_wallet. Burn the burn_scale remainder. Before the upgrade, creator_scale was locked separately and its Fee Key went to the token creator. Completed historical migrations are not modified. For legacy AMM v4 graduation, the LP disposition follows that instruction’s existing flow.
  6. Revoke base_mint.mint_authority (set to None).
  7. Flip pool_state.status = Migrated, set vesting_schedule.start_time = block_time + cliff_period.
PostconditionsBuyExactIn, 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 errorsPoolFunding, PoolMigrated, MigrateTypeNotMatch, InvalidCpSwapConfig, MathOverflow.

CPMM migration remaining accounts

Clients building MigrateToCpswap must use these fixed remaining_accounts indices: The instruction requires at least ten remaining accounts on the upgraded path. The support-mint accounts are read-only CPI inputs. Derive both addresses even when the mint has no initialized support record. Older builders that still append creator-lock accounts or omit indices 8–9 must be updated.

Platform GlobalConfig allowlist

PlatformConfig.restrict_global_config controls the check:
  • 0: the platform accepts any otherwise-valid GlobalConfig; no allow account is required.
  • 1: Initialize, InitializeV2, and InitializeWithToken2022 must include the matching PlatformAllowConfig anywhere in remaining_accounts.
The platform admin creates or closes the PDA with CreatePlatformAllowConfig and ClosePlatformAllowConfig. Its seeds are [b"platform_allow_config", platform_config, global_config]. The former admin-managed PlatformGlobalAccess instructions and PDA are retired.

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:

State-change matrix

Where to go next

Sources: