§ 08 — Onchain program

sealed_launchpad, the non-custodial mode.

The Anchor program is the roadmap execution mode: every rule on these pages enforced by Solana instead of by Sealed's backend. It is implemented with a full lifecycle test suite, but it is not built or deployed anywhere yet.

On-chain · tests pendingOnchain mode — roadmap

§ 8.1Instructions

Exactly these 14 instructions exist. None moves funds out of buyback_vault except execute_buyback_drip, and the test suite asserts the list.

InstructionCallerArgsAccounts (* signer)Emits
initialize_protocoladmin, oncetreasury: Pubkey, platform_ops: Pubkey, keeper: Pubkey, is_mainnet: bool, max_credit_per_launch: u64admin*, protocol, system_program—
fund_credit_poolanyoneamount: u64funder*, protocol, quote_mint, credit_pool, credit_vault, funder_quote—
create_launchcreatorname: String, ticker: String, uri: String, total_supply: u64 (token atoms), creator_allocation_bps: u16 (≤200), auction_supply_bps: u16 (2000..=6000), credit_bps: u16 (1000..=1500), commit_duration_sec: i64, reveal_duration_sec: i64, floor_price: u64, tick_size: u64, target_raise: u64, clearing_cap: u64, drip_interval_sec: i64 (120..=300), drip_count: u16creator*, protocol, mint_authority, token_mint*, quote_mint, launch, escrow, stake_vault, rewards_vault, creator_tokenLaunchCreated
commit_bidbidder, commit windowcommitment: [u8;32], deposit: u64bidder*, launch, bid, escrow, bidder_quoteBidCommitted
reveal_bidanyone with the preimage, reveal windowmax_price: u64, bid_amount: u64, salt: [u8;32]payer*, launch, bidder, bidBidRevealed
clear_auctionanyone, after reveal_end—cranker*, launchAuctionCleared
claim_or_refundbidder, after clearstake: boolbidder*, protocol, launch, bid (closed), token_mint, mint_authority, escrow, bidder_quote, bidder_token, treasury_quote, position, stake_vault, anti_snipe—
graduate_and_open_creditanyone, after clear—cranker*, protocol, launch, token_mint, mint_authority, quote_mint, escrow, pool, pool_quote, pool_token, buyback_vault, fee_collector, credit_pool, credit_vaultGraduated (+ FlywheelActivated if credit = 0)
swapanyone, liveamount_in: u64, min_amount_out: u64, is_buy: booluser*, protocol, launch, token_mint, pool, pool_quote, pool_token, fee_collector, user_quote, user_token, anti_snipeSwapEvent, SniperFlagged
execute_buyback_dripanyone, when due—cranker*, launch, token_mint, pool, pool_quote, pool_token, buyback_vaultBuybackDrip
distribute_feesanyone, live—cranker*, protocol, launch, credit_pool, credit_vault, fee_collector, rewards_vault, platform_ops_quote, treasury_quoteFeesDistributed, FlywheelActivated
stakeholder (not a sniper)amount: u64owner*, launch, position, stake_vault, owner_token, anti_snipe—
unstakeholderamount: u64owner*, launch, position, stake_vault, owner_token—
claim_rewardsholder (not a sniper)—owner*, launch, position, rewards_vault, owner_quote, anti_snipe—
Args from INSTRUCTIONS in packages/shared/src/program.ts; accounts transcribed from the IDL. The table scrolls sideways on small screens.

Key checks

InstructionRejects with
create_launchCreatorAllocationTooHigh (> 200 bps), InvalidAuctionSupply, InvalidCreditBps, InvalidDuration, InvalidDripInterval, InvalidParams (cap < floor × supply)
commit_bidCommitWindowClosed, ZeroAmount; one bid PDA per (launch, bidder)
reveal_bidRevealWindowNotOpen, RevealWindowClosed, AlreadyRevealed, CommitmentMismatch, InvalidTick, BidExceedsDeposit
clear_auctionInvalidStatus, AuctionNotEnded
graduate_and_open_creditAuctionNotCleared, AlreadyGraduated
execute_buyback_dripNotLive, DripNotDue, VaultEmpty
swapNotLive, SlippageExceeded, ZeroAmount
stake / claim_rewardsSniperIneligible, InsufficientStake (unstake)

§ 8.2Launch status

u8On-chainAPI status
0Opencommit → reveal → clearing (by timestamp)
1Clearedclearing
2Failedfailed
3Livelive
4Flywheelflywheel

§ 8.3Accounts

ProtocolConfig

admin · treasury · platform_ops · keeper · is_mainnet · max_credit_per_launch · launch_count · snipers_blocked · bump

CreditPool

quote_mint · total_deposited · outstanding · total_advanced · total_repaid · vault (token acct PDA) · bump

LaunchAccount

creator · token_mint · quote_mint · status · total_supply · creator_allocation · tokens_for_sale · pool_token_allocation · credit_bps · commit_start_ts · commit_end_ts · reveal_end_ts · floor_price · tick_size · target_raise · clearing_cap · bid_count · revealed_count · total_escrowed · histogram: [u64; 64] · clearing_price · marginal_tick: i16 · fill_rule: u8 · fill_num: u64 · fill_den: u64 · total_raised · tokens_sold · graduation_slot · graduated_ts · credit_line · credit_outstanding · drip_interval_sec · drip_count · drips_executed · next_drip_ts · vault_initial · tokens_burned · fees_collected · reward_per_share: u128 (scaled 1e12) · total_staked · bump

SealedBid

launch · bidder · commitment: [u8;32] · deposit · revealed · max_price · bid_amount · tick: u8 · claimed · bump

Pool

launch · quote_reserve · token_reserve · bump

AntiSnipeEntry

launch · wallet · slot · bump

HolderPosition

launch · owner · staked · reward_debt: u128 · claimed · bump

Program-only fields appended after the contract list: LaunchAccount also stores auction_supply_bps, creator_allocation_bps, pool_quote_seeded, name, ticker, uri; HolderPosition adds unclaimed. AntiSnipeEntry is created by hand inside swap and is not in the IDL accounts list.

§ 8.4PDAs and seeds

AccountSeeds
protocol"protocol"
creditPool"credit_pool", quote_mint
launch"launch", token_mint
bid"bid", launch, bidder
escrow"escrow", launch
vault"buyback_vault", launch
feeCollector"fee_collector", launch
pool"pool", launch
poolQuote"pool_quote", launch
poolToken"pool_token", launch
antiSnipe"anti_snipe", launch, wallet
position"position", launch, owner
rewardsVault"rewards_vault", launch
mintAuthority"mint_authority", launch
creditVault (program-only)"credit_vault", quote_mint
stakeVault (program-only)"stake_vault", launch
SEEDS in constants.ts, byte-identical to constants.rs. Derive them with pdas.* from @sealed/shared.

§ 8.5Events

EventFields
LaunchCreatedlaunch, mint, creator, quote_mint
BidCommittedlaunch, bid_count, total_escrowed — aggregates only
BidRevealedlaunch, revealed_count
AuctionClearedlaunch, clearing_price, total_raised, tokens_sold
Graduatedlaunch, slot, credit_line
SwapEventlaunch, trader, is_buy, amount_in, amount_out, fee, slot, is_sniper
BuybackDriplaunch, quote_spent, tokens_burned, drip_index, next_drip_ts
FeesDistributedlaunch, credit_repay, platform_ops, holders, platform_buyback_burn, treasury, credit_outstanding_after
FlywheelActivatedlaunch
SniperFlaggedlaunch, wallet, slot

§ 8.6Errors

CodeName
6000CreatorAllocationTooHigh
6001InvalidAuctionSupply
6002InvalidCreditBps
6003InvalidDuration
6004InvalidDripInterval
6005CommitWindowClosed
6006RevealWindowNotOpen
6007RevealWindowClosed
6008CommitmentMismatch
6009InvalidTick
6010BidExceedsDeposit
6011AlreadyRevealed
6012AuctionNotEnded
6013AuctionNotCleared
6014AlreadyClaimed
6015AlreadyGraduated
6016DripNotDue
6017VaultEmpty
6018SlippageExceeded
6019SniperIneligible
6020InsufficientStake
6021MathOverflow
6022Unauthorized
6023InvalidParams
6024InvalidStatus
6025ZeroAmount
6026NotLive
6027InvalidAccount
6000–6022 follow PROGRAM_ERRORS in program.ts; 6023–6027 are program-only.

§ 8.7Tests

programs/sealed-launchpad/tests/sealed-launchpad.ts covers: the instruction list (no vault withdraw path), the 2% creator cap, commit and escrow, early and mismatched reveals, uniform clearing against shared computeClearing, winner/loser/non-revealer settlement, a graduation + same-slot buy in one transaction (sniper recorded), drip timing and burn, sniper staking rejection, forged-authority vault withdrawal, 80/20 repayment flipping to Flywheel at zero, staker rewards with zero accrual for the sniper, unstake, and a failed auction with full refunds. math.rs has 14 Rust unit tests. None has been run in this workspace yet: run pnpm anchor:test.