Architecture

One Anchor program (programs/pledge, Anchor 0.31.1, local id 6yFu2aPK5A7Wke42JxoLFmiUBeAKbijqEMnF3pTavQpa) owns every account below. There is no server in the money path; the website and app only read accounts and build transactions.

Accounts

AccountSeedsHolds
Config"config"launch constants: PLEDGE mint, burn pools, waiver size; burn counters
Campaign"campaign", creator, id (u64 LE)goal, bonus terms, window, totals, status
Vault"vault", campaignone SPL token account per campaign: the bonus deposit and every pledge
Pledge"pledge", campaign, backerone per backer per campaign: amount, early amount
Waiver vault"waiver", campaignPLEDGE locked by the creator for a fee-free raise
Fee vault"fees", mintprotocol fees in that mint, owned by the burn PDA
Burn authority"burn"PDA with no data; owns the fee vaults and the bought account
Bought"bought"PLEDGE bought by the crank, burned in the same call

Campaign fields

pub struct Campaign {
    pub creator: Pubkey,
    pub mint: Pubkey,
    pub id: u64,
    pub goal: u64,
    pub bonus_bps: u16,       // refund bonus per early unit, basis points
    pub bonus_deposit: u64,   // locked at creation
    pub early_cap: u64,       // most early pledging the deposit can pay on
    pub start: i64,
    pub early_end: i64,       // pledges strictly before this earn the bonus
    pub deadline: i64,
    pub total_pledged: u64,
    pub early_pledged: u64,
    pub bonus_owed: u64,      // what a failure pays on top of refunds
    pub open_pledges: u32,
    pub status: Status,       // Open, Succeeded, Failed
    pub creator_paid: bool,
    pub waiver_locked: u64,
    pub fee_paid: u64,
    pub bump: u8,
    pub vault_bump: u8,
    pub uri: String,          // up to 200 bytes
}

Mints

Campaigns raise in exactly two mints, both on the classic SPL Token program: USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v) and wrapped SOL (So11111111111111111111111111111111111111112). USDC and SOL never mix in one campaign. PLEDGE itself may be SPL Token or Token-2022.

Components

flowchart LR
  App[Web app /app] -->|builds transactions| Program
  App -->|reads accounts via /api/rpc| RPC[Solana RPC]
  Program --> Vault[Campaign vaults]
  Program --> Fees[Fee vaults per mint]
  Crank[Anyone: crank_burn] --> Program
  Program -->|swap| Raydium[Raydium CP-Swap PLEDGE pools]
  Program -->|burn| PLEDGE[PLEDGE mint]

Compute units

Measured on a local validator: create_campaign 34,754; pledge 17,018; settle 8,568; claim_backer 12,260; claim_creator 9,169; close_campaign 8,297; crank_burn about 65,000.