§ 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.
§ 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.
| Instruction | Caller | Args | Accounts (* signer) | Emits |
|---|---|---|---|---|
initialize_protocol | admin, once | treasury: Pubkey, platform_ops: Pubkey, keeper: Pubkey, is_mainnet: bool, max_credit_per_launch: u64 | admin*, protocol, system_program | — |
fund_credit_pool | anyone | amount: u64 | funder*, protocol, quote_mint, credit_pool, credit_vault, funder_quote | — |
create_launch | creator | name: 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: u16 | creator*, protocol, mint_authority, token_mint*, quote_mint, launch, escrow, stake_vault, rewards_vault, creator_token | LaunchCreated |
commit_bid | bidder, commit window | commitment: [u8;32], deposit: u64 | bidder*, launch, bid, escrow, bidder_quote | BidCommitted |
reveal_bid | anyone with the preimage, reveal window | max_price: u64, bid_amount: u64, salt: [u8;32] | payer*, launch, bidder, bid | BidRevealed |
clear_auction | anyone, after reveal_end | — | cranker*, launch | AuctionCleared |
claim_or_refund | bidder, after clear | stake: bool | bidder*, protocol, launch, bid (closed), token_mint, mint_authority, escrow, bidder_quote, bidder_token, treasury_quote, position, stake_vault, anti_snipe | — |
graduate_and_open_credit | anyone, after clear | — | cranker*, protocol, launch, token_mint, mint_authority, quote_mint, escrow, pool, pool_quote, pool_token, buyback_vault, fee_collector, credit_pool, credit_vault | Graduated (+ FlywheelActivated if credit = 0) |
swap | anyone, live | amount_in: u64, min_amount_out: u64, is_buy: bool | user*, protocol, launch, token_mint, pool, pool_quote, pool_token, fee_collector, user_quote, user_token, anti_snipe | SwapEvent, SniperFlagged |
execute_buyback_drip | anyone, when due | — | cranker*, launch, token_mint, pool, pool_quote, pool_token, buyback_vault | BuybackDrip |
distribute_fees | anyone, live | — | cranker*, protocol, launch, credit_pool, credit_vault, fee_collector, rewards_vault, platform_ops_quote, treasury_quote | FeesDistributed, FlywheelActivated |
stake | holder (not a sniper) | amount: u64 | owner*, launch, position, stake_vault, owner_token, anti_snipe | — |
unstake | holder | amount: u64 | owner*, launch, position, stake_vault, owner_token | — |
claim_rewards | holder (not a sniper) | — | owner*, launch, position, rewards_vault, owner_quote, anti_snipe | — |
Key checks
| Instruction | Rejects with |
|---|---|
create_launch | CreatorAllocationTooHigh (> 200 bps), InvalidAuctionSupply, InvalidCreditBps, InvalidDuration, InvalidDripInterval, InvalidParams (cap < floor × supply) |
commit_bid | CommitWindowClosed, ZeroAmount; one bid PDA per (launch, bidder) |
reveal_bid | RevealWindowNotOpen, RevealWindowClosed, AlreadyRevealed, CommitmentMismatch, InvalidTick, BidExceedsDeposit |
clear_auction | InvalidStatus, AuctionNotEnded |
graduate_and_open_credit | AuctionNotCleared, AlreadyGraduated |
execute_buyback_drip | NotLive, DripNotDue, VaultEmpty |
swap | NotLive, SlippageExceeded, ZeroAmount |
stake / claim_rewards | SniperIneligible, InsufficientStake (unstake) |
§ 8.2Launch status
| u8 | On-chain | API status |
|---|---|---|
| 0 | Open | commit → reveal → clearing (by timestamp) |
| 1 | Cleared | clearing |
| 2 | Failed | failed |
| 3 | Live | live |
| 4 | Flywheel | flywheel |
§ 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
| Account | Seeds |
|---|---|
| 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 |
§ 8.5Events
| Event | Fields |
|---|---|
LaunchCreated | launch, mint, creator, quote_mint |
BidCommitted | launch, bid_count, total_escrowed — aggregates only |
BidRevealed | launch, revealed_count |
AuctionCleared | launch, clearing_price, total_raised, tokens_sold |
Graduated | launch, slot, credit_line |
SwapEvent | launch, trader, is_buy, amount_in, amount_out, fee, slot, is_sniper |
BuybackDrip | launch, quote_spent, tokens_burned, drip_index, next_drip_ts |
FeesDistributed | launch, credit_repay, platform_ops, holders, platform_buyback_burn, treasury, credit_outstanding_after |
FlywheelActivated | launch |
SniperFlagged | launch, wallet, slot |
§ 8.6Errors
| Code | Name |
|---|---|
| 6000 | CreatorAllocationTooHigh |
| 6001 | InvalidAuctionSupply |
| 6002 | InvalidCreditBps |
| 6003 | InvalidDuration |
| 6004 | InvalidDripInterval |
| 6005 | CommitWindowClosed |
| 6006 | RevealWindowNotOpen |
| 6007 | RevealWindowClosed |
| 6008 | CommitmentMismatch |
| 6009 | InvalidTick |
| 6010 | BidExceedsDeposit |
| 6011 | AlreadyRevealed |
| 6012 | AuctionNotEnded |
| 6013 | AuctionNotCleared |
| 6014 | AlreadyClaimed |
| 6015 | AlreadyGraduated |
| 6016 | DripNotDue |
| 6017 | VaultEmpty |
| 6018 | SlippageExceeded |
| 6019 | SniperIneligible |
| 6020 | InsufficientStake |
| 6021 | MathOverflow |
| 6022 | Unauthorized |
| 6023 | InvalidParams |
| 6024 | InvalidStatus |
| 6025 | ZeroAmount |
| 6026 | NotLive |
| 6027 | InvalidAccount |
§ 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.