Launchpad Program Reference
Complete reference for the Launchpad orchestrator program that manages token launches end-to-end.
Program ID: 8zfW4iLA7JagfotwCn8FT3SpdzUyGQ7CRSzjMwmJyK6F
Framework: Anchor 0.29.0
Account Types
ProtocolConfig
Singleton global protocol configuration.
PDA Seeds: ["cca_protocol"]
Size: 434 bytes (8 discriminator + 426 fields)
| Field | Type | Description |
|---|---|---|
admin | Pubkey | Current admin authority |
pending_admin | Pubkey | Pending admin for 2-step transfer |
treasury | Pubkey | Protocol fee destination account |
protocol_fee_bps | u16 | Protocol fee in basis points (max 10,000) |
paused | bool | Pauses new launch creation |
settlement_paused | bool | Pauses settlement pipeline |
min_auction_duration_slots | u64 | Minimum allowed auction duration |
max_auction_duration_slots | u64 | Maximum allowed auction duration |
min_floor_price | u128 | Minimum allowed floor price (Q96) |
min_total_supply | u64 | Minimum total token supply |
max_total_supply | u64 | Maximum total token supply |
min_auction_bps | u16 | Minimum auction allocation % |
max_auction_bps | u16 | Maximum auction allocation % |
max_team_bps | u16 | Maximum team allocation % |
min_lp_bps | u16 | Minimum LP allocation % |
min_lp_proceeds_bps | u16 | Minimum LP proceeds % |
allowed_quote_mints | [Pubkey; 4] | Whitelist of accepted quote token mints |
num_allowed_quote_mints | u8 | Number of valid entries |
raydium_cpmm_program | Pubkey | Raydium CPMM program ID |
raydium_amm_config | Pubkey | Raydium AMM config account |
emergency_timeout_slots | u64 | Slots after finalization before emergency withdraw |
min_lp_proceeds | u64 | Minimum absolute LP proceeds |
cca_program | Pubkey | CCA V2 program ID |
bump | u8 | PDA bump seed |
LaunchConfig
Per-launch configuration storing all parameters and state.
PDA Seeds: ["cca_launch", creator, launchId (u64 LE)]
Size: 551 bytes (8 discriminator + 543 fields)
| Field | Type | Description |
|---|---|---|
authority | Pubkey | Creator who initiated the launch |
launch_id | u64 | Unique launch identifier per creator |
token_mint | Pubkey | Token-2022 mint created for this launch |
quote_mint | Pubkey | Quote token mint |
auction_config | Pubkey | CCA V2 AuctionConfig account (set in step 3) |
total_supply | u64 | Total token supply |
auction_bps | u16 | % of supply for auction |
lp_bps | u16 | % of supply for LP pool |
team_bps | u16 | % of supply for team |
lp_proceeds_bps | u16 | % of auction proceeds going to LP |
protocol_fee_bps | u16 | Protocol fee snapshot |
settlement_state | SettlementState | Current lifecycle state |
final_clearing_price | u128 | Clearing price from CCA auction (Q96) |
total_proceeds | u64 | Total quote tokens swept from CCA vault |
total_tokens_cleared | u64 | Total base tokens cleared in auction |
raydium_pool | Pubkey | Raydium pool state account |
auction_escrow | Pubkey | Token-2022 escrow for auction tokens |
lp_escrow | Pubkey | Token-2022 escrow for LP tokens |
team_escrow | Pubkey | Token-2022 escrow for team tokens |
proceeds_escrow | Pubkey | SPL Token escrow for quote proceeds |
fee_escrow | Pubkey | System account for Raydium pool creation fee |
created_at | i64 | Unix timestamp of creation |
finalized_at | i64 | Unix timestamp of finalization |
settled_at | i64 | Unix timestamp of settlement |
finalized_slot | u64 | Slot at finalization (for emergency timeout) |
supply_steps_hash | [u8; 32] | SHA-256 hash of supply steps |
bump | u8 | PDA bump seed |
Protocol parameters (protocol_fee_bps, raydium_cpmm_program, cca_program, etc.) are snapshot-copied from ProtocolConfig at launch creation time. Changing protocol config does not retroactively affect existing launches.
PDA Seeds
| PDA | Seeds | Program |
|---|---|---|
| ProtocolConfig | ["cca_protocol"] | Launchpad |
| LaunchConfig | ["cca_launch", creator, launchId LE] | Launchpad |
| TokenMint | ["cca_token_mint", launchConfig] | Launchpad |
| MintAuthority | ["cca_mint_auth", launchConfig] | Launchpad |
| EscrowAuthority | ["cca_launch_auth", launchConfig] | Launchpad |
| AuctionEscrow | ["escrow", launchConfig, "auction"] | Launchpad |
| LpEscrow | ["escrow", launchConfig, "lp"] | Launchpad |
| TeamEscrow | ["escrow", launchConfig, "team"] | Launchpad |
| ProceedsEscrow | ["escrow", launchConfig, "proceeds"] | Launchpad |
| FeeEscrow | ["escrow", launchConfig, "fee"] | Launchpad |
Instructions (16 total)
Admin Instructions (6)
initialize_protocol
Initializes the global protocol configuration. Can only be called once.
| Property | Value |
|---|---|
| Access Control | Any signer (first caller becomes admin) |
| State | Creates ProtocolConfig |
update_protocol_config
Updates all protocol configuration fields. Same arguments as initialize_protocol.
| Property | Value |
|---|---|
| Access Control | Admin only (has_one = admin) |
transfer_admin
Initiates 2-step admin transfer by setting pending_admin.
| Property | Value |
|---|---|
| Access Control | Admin only |
| Argument | new_admin: Pubkey |
accept_admin
Completes the 2-step admin transfer. The pending admin signs to accept.
| Property | Value |
|---|---|
| Access Control | Pending admin only |
set_pause
Pauses or unpauses new launch creation.
| Property | Value |
|---|---|
| Access Control | Admin only |
| Argument | paused: bool |
set_settlement_pause
Pauses or unpauses the settlement pipeline.
| Property | Value |
|---|---|
| Access Control | Admin only |
| Argument | paused: bool |
Launch Creation Instructions (3)
create_launch_step_1
Creates the LaunchConfig account and Token-2022 mint with MetadataPointer extension.
| Property | Value |
|---|---|
| Access Control | Any signer (becomes creator) |
| State Before | None |
| State After | Created |
| CPI Calls | Token-2022: create account, initialize metadata pointer, initialize mint, initialize metadata |
Key Accounts: creator, protocol_config, launch_config (init), token_mint, mint_authority.
Arguments: launch_id, name, symbol, uri, decimals, total_supply, auction_bps, lp_bps, team_bps, lp_proceeds_bps, quote_mint, auction_duration_slots, floor_price, max_bid_price, tick_spacing, auction_block_interval, min_bid_amount, min_new_tick_amount, max_ticks, required_currency_raised, supply_steps.
Validations: Protocol not paused, auction_bps + lp_bps + team_bps == 10000, quote_mint in whitelist, all BPS within protocol ranges.
create_launch_step_2
Creates 5 escrow accounts and mints tokens to the 3 Token-2022 escrows.
| Property | Value |
|---|---|
| Access Control | Creator only |
| State Before | Created |
| State After | EscrowsInitialized |
| CPI Calls | Token-2022: create PDA token accounts (x4), mint_to (x3); System: create_account (fee escrow) |
Token Distribution:
auction_escrow:total_supply * auction_bps / 10000lp_escrow:total_supply * lp_bps / 10000team_escrow: remainder (avoids rounding loss)fee_escrow: 0.15 SOL (Raydium pool creation fee) from creator
initialize_cca_auction
Creates the CCA V2 auction via CPI (5 CPI calls) and transfers auction tokens to CCA vault.
| Property | Value |
|---|---|
| Access Control | Creator only |
| State Before | EscrowsInitialized |
| State After | AuctionReady |
| CPI Calls | CCA V2: initialize_auction, initialize_vaults, initialize_quote_vault, initialize_floor_tick, receive_tokens |
Arguments: auction_id, start_slot, end_slot, claim_slot, supply_steps (must match hash from step 1).
The CCA authority for launchpad-created auctions is the escrowAuthority PDA, NOT the creator's wallet. This is a common source of PDA derivation bugs.
Settlement Instructions (4)
All settlement instructions are permissionless (any signer can call them), enabling keeper bots.
finalize_auction
Reads CCA auction state to verify graduation and records final clearing price.
| Property | Value |
|---|---|
| State Before | AuctionReady or AuctionActive |
| State After | Finalized |
| Condition | slot >= end_slot and currency_raised >= required |
Records final_clearing_price, total_tokens_cleared, finalized_at, finalized_slot.
sweep_to_escrow
Calls CCA V2 sweep_currency to transfer quote tokens from CCA vault to proceeds_escrow.
| Property | Value |
|---|---|
| State Before | Finalized |
| State After | ProceedsSwept |
| CPI Calls | CCA V2: sweep_currency |
Sets total_proceeds from actual escrow balance (authoritative source).
create_raydium_pool
Creates a Raydium CPMM liquidity pool, burns LP tokens, and distributes proceeds.
| Property | Value |
|---|---|
| State Before | ProceedsSwept |
| State After | PoolCreated |
| CPI Calls | SPL Token transfers, Raydium CPMM: initialize, SPL Token: burn |
| Accounts | 31 total (largest instruction) |
Proceeds Distribution:
total_proceeds
-> protocol_fee = total_proceeds * protocol_fee_bps / 10000 -> treasury
-> remaining = total_proceeds - protocol_fee
-> lp_proceeds = remaining * lp_proceeds_bps / 10000 -> Raydium pool
-> creator_proceeds = remaining - lp_proceeds -> creator
LP tokens are permanently burned (liquidity lock).
enable_claims
Transfers team tokens to creator, enables CCA claims, and renounces mint authority.
| Property | Value |
|---|---|
| State Before | PoolCreated |
| State After | Settled |
| CPI Calls | Token-2022: transfer (team tokens), CCA V2: set_claim_slot, Token-2022: set_authority(None) |
After this instruction, no more tokens can ever be minted. Bidders can now claim their filled tokens from CCA V2.
Cancel / Emergency / Recovery (3)
cancel_launch
Cancels a launch before the auction has started. Returns all tokens and lamports to creator.
| Property | Value |
|---|---|
| Access Control | Creator only |
| State Before | Created or EscrowsInitialized |
| State After | Cancelled |
| Condition | If auction initialized, current_slot < start_slot |
emergency_withdraw
Permissionless emergency recovery after settlement stalls. Triggered after timeout.
| Property | Value |
|---|---|
| Access Control | Permissionless (keeper pattern) |
| State Before | Finalized, ProceedsSwept, or PoolCreated |
| State After | EmergencyWithdrawn |
| Condition | slot > finalized_slot + emergency_timeout_slots |
The creator account is NOT a signer -- keepers can trigger on behalf of offline creators. All destination accounts are validated against launch_config.authority.
recover_failed_auction
Recovers tokens from a failed (non-graduated) auction.
| Property | Value |
|---|---|
| Access Control | Permissionless |
| State Before | AuctionReady or AuctionActive |
| State After | FailedRecovery |
| Condition | slot >= end_slot and NOT graduated |
| CPI Calls | CCA V2: sweep_unsold_tokens |
Returns all tokens to creator. Bidders recover quote currency directly from CCA V2 via exit_bid (non-graduated auctions give full refunds).
CPI Patterns
CCA V2 CPI
All CCA V2 CPI calls use manual instruction construction with raw invoke_signed. Discriminators are computed as sha256("global:<snake_case_name>")[..8].
Account discriminator note: CCA V2 uses sha256("account:AuctionConfig"), not sha256("account:CcaAuctionConfig"). The Launchpad's local struct name differs from CCA V2's actual name.
Raydium CPMM CPI
Uses raw invoke_signed to avoid stack overflow from large typed structs. Raydium requires token_0_mint.key() < token_1_mint.key() (canonical ordering by pubkey).
Token-2022 CPI
Token-2022 mints are created with MetadataPointer extension. Only MetadataPointer and TokenMetadata extensions are allowed -- all others are blocked to prevent malicious token behavior.
Error Codes
| Code | Name | Category |
|---|---|---|
| 6000 | ProtocolAlreadyInitialized | Admin |
| 6001 | UnauthorizedAdmin | Admin |
| 6005 | LaunchesPaused | Admin |
| 6006 | SettlementPaused | Admin |
| 6007 | InvalidBpsSum | Launch |
| 6015 | QuoteMintNotAllowed | Launch |
| 6018 | ForbiddenTokenExtensions | Launch |
| 6019 | InvalidSettlementState | State |
| 6023 | AuctionNotEnded | State |
| 6024 | AuctionNotGraduated | State |
| 6035 | ArithmeticOverflow | Math |
| 6038 | MinLpProceedsNotMet | Accounting |
| 6039 | EmergencyTimeoutNotReached | Emergency |
| 6043 | SupplyStepsHashMismatch | Validation |
| 6044 | AuctionGraduated | Recovery |