Program reference

Accounts, fields, instructions, price source, events, SDK.

Reference for the fee_vault program (Anchor). Devnet program id: Gnrawv8PaeCVECyZdvgvg2WytVS9bCMDiRT7PPCJwXf9. Vault layout version 2 (Buyback & Burn fields); the SDK ignores older layouts.

Accounts

accountseedsholds
Config["config"]admin, treasury. The platform fee is a program constant (PLATFORM_FEE_BPS = 1000) copied into each vault at creation.
Vault["vault", mint, creator]identity, rules, lock, accounting (below). SOL quotes live as lamports on the PDA; token quotes in the vault's associated token account for quote_mint.
Buyer["buyer", vault]system-owned signer that fronts buybacks; holds only the cluster's 0-byte rent floor between calls

Vault fields

  • creator, manager, mint, quote_mint, quote_token_program, is_sol
  • verifier: Ed25519 key whose attestations release social escrows
  • platform_fee_bps (1000), treasury_pending
  • lock_until (0 = unlocked; while now < lock_until rules, manager and verifier are frozen; extend-only)
  • sum_buckets (= Σ rule.balance + treasury_pending), carry
  • total_inflow, total_fee, total_paid
  • rules: [Rule; 10], rule_count, rules_updated_at, created_at, buyer_bump

Rule fields

Every rule: kind, bps, balance, total_paid. Kind-specific:

kindfields
Walletwallet; platform + user_id are kept when the rule came from a claimed escrow
Dripmax_mcap_quote (0 = always on), bps_per_period, period_secs (≥ 60), min_holding_quote, epoch state epoch_start, epoch_budget, epoch_paid, cursor
Socialplatform (1 = X, 2 = GitHub), user_id (u64), deadline, fallback_kind (1 wallet, 2 rule), wallet or fallback_rule
Forwardtarget
Buybackmax_mcap_quote, max_impact_bps (1–50), tokens_burned

Instructions

Admin (program config): init_config(treasury), set_treasury, set_admin.

Manager (only while unlocked)

instructionnotes
init_vault(manager, verifier)anyone may create; the payer's wallet becomes the creator seed
set_rules(rules[])validates kinds and parameters, Σ bps = 10 000; existing buckets move to carry
set_manager(manager)
set_verifier(verifier)
lock(until)until > now, until ≥ lock_until, at least one rule

Permissionless cranks

instructionnotes
settle_sol / settle_tokenbooks the inflow: fee to treasury_pending, the rest plus carry by bps; dust to rule 0; Forward rules push into their target
pay_wallet_sol(idx) / pay_wallet_token(idx)whole bucket to the rule's wallet or its associated token account
pay_treasury_sol / pay_treasury_tokentreasury_pending to config.treasury
drip_sol(idx) / drip_token(idx)holders as remaining accounts, [token_account, owner] pairs (SOL) or [token_account, owner, owner_quote_ata] triples, strictly ascending by owner and above the cursor; fails with DripConditionNotMet above the market-cap line
claim_social_sol(idx, expiry) / claim_social_token(idx, expiry)the preceding instruction must be the Ed25519 program verifying the attestation message with vault.verifier; now ≤ expiry; the rule becomes Wallet(recipient)
expire_social(idx)after deadline: Wallet(fallback) or Forward(fallback_rule), bucket moved along
buyback(idx, spend_cap, min_tokens_out, variant)variant 0 curve with SOL quote (buy_exact_sol_in), 1 curve with token quote (buy_exact_quote_in_v3), 2 PumpSwap (buy_exact_quote_in_v2); pump.fun accounts passed as remaining accounts and checked against the vault; fails with BuybackConditionNotMet above the market-cap line, UnexpectedSpend if more than planned left the vault

Price source

Verified by PDA derivation inside the program. Bonding curve ["bonding-curve", mint] (virtual reserves) until migrated, then the canonical pump-amm pool ["pool", 0u16, pool_authority(mint), mint, quote_mint] with quote_reserve = quote_vault − protocol_fees − creator_fees + virtual_quote_reserves and base_reserve = base_vault. mcap = supply × quote_reserve / base_reserve in quote base units; circulating = supply − tokens held by the curve or the pool.

Attestation message

"FEEVAULT_SOCIAL_V1" ‖ vault(32) ‖ rule_idx(1) ‖ platform(1) ‖ user_id(u64 LE) ‖ recipient(32) ‖ expiry(i64 LE)

Signed by vault.verifier, verified through the instructions sysvar: the instruction right before claim_social_* must be the Ed25519 program with exactly this message and that public key.

Events

VaultCreated, RulesSet, Locked, ManagerChanged, VerifierChanged, Settled { inflow, fee }, Paid { rule, to, amount }, TreasuryPaid { amount }, Dripped { rule, holders_paid, amount }, BoughtBack { rule, quote_spent, tokens_burned, mcap_quote, source }, SocialClaimed { rule, recipient, amount }, SocialExpired { rule, amount }. The keeper's indexer decodes these into the token page's history and payouts.

SDK

@fee-vault/sdk (TypeScript, in the repository's sdk/ package) wraps all of the above: program ids and PDAs, instruction builders, account decoding, rule validation mirroring the program, the attestation message and verification, the off-chain price view, verified holder snapshots and event decoding. The web app, the keeper and the verifier all use it.