$ ./tech

How it works

An Anchor program, three instructions, and one trick: derive the vault's authority from the NFT mint so the locked tokens travel with the NFT through every transfer.

# the program

  program      anchor on solana mainnet
  language     rust
  cluster      mainnet
  upgradeable  yes  (initialize gated to upgrade authority only)
  token        $wFOX  — EemkMtJSHEmp8VzZu9DgLQuYPEjkbPsvM8hVGhndpump

# three instructions

initialize(bank, mint)

One shot. The deployer initializes the singleton bank PDA with the $wFOX mint address. Gated by Anchor ProgramData upgrade authority constraint. No one but the deployer can call it.

wrap_fox(tier_index)

  inputs   caller signs + nft_mint keypair signs
  effects  1. checked transfer: 1M $wFOX from caller → vault PDA
           2. init nft_mint, mint 1 to caller's ATA
           3. CPI: CreateMetadataAccountV3 + CreateMasterEditionV3
           4. CPI: VerifySizedCollectionItem  (joins the MCC)
           5. init FoxAsset PDA (records tier, wrapped_at, nft_mint)
           6. bank.total_wrapped += 1

unwrap_fox(tier_index)

  preconds caller holds 1 of this NFT in their ATA
  effects  1. checked transfer: 1M $wFOX from vault → caller
           2. close vault  (rent refunded to caller)
           3. burn NFT, close NFT mint + ATA
           4. close FoxAsset  (rent refunded)
           5. tier_index pushed to bank.free_tiers  (LIFO)

# the vault trick

The entire product hinges on one PDA derivation:

  vault.authority = PDA(["vault", nft_mint])

The vault's authority is derived from the NFT mint address — not the wrapping wallet. When the Fox NFT trades on Magic Eden / Tensor, the new owner immediately controls the vault via the program. Locked tokens are atomically bound to the NFT.

# PDAs at a glance

  ["bank"]                         FoxBank  (singleton: mint, counters, free_tiers)
  ["fox", tier_le]                 FoxAsset (per-fox record)
  ["nft_mint", total_wrapped_le]   nft mint address
  ["vault", nft_mint]              vault authority  ← the key trick
  ["collection_authority"]         MCC update authority

# Token2022

$wFOX is a Token2022 mint (pump.fun standard). The program accepts both classic SPL and Token2022 via Anchor's InterfaceAccount + transfer_checked. No transfer fee, no transfer hook, no permanent delegate.

# royalty

Every wrapped Fox NFT carries a 5% (500 bps) secondary sale royalty pointing at the onchain royalty treasury. Magic Eden / Tensor honor seller_fee_basis_points regardless of creator verification status.

Reproducibility: the program ships with a verifiable build via solana-verify. The .so deployed to mainnet matches the source commit byte for byte.