On-Chain Audit Details
Explore verified entrypoints, security checks, state diagrams, and rules of the TicketFi Solana smart contracts.
Powered by Switchboard Randomness
TicketFi integrates Switchboard's TEE-secured oracle network for verifiable, tamper-proof randomness on draw execution. No validator can predict or manipulate the winner — not even Switchboard itself.
ProofOn-Chain Proof
Switchboard VRF — Draw Execution Flow
Commit-reveal pattern ensuring no party can predict or manipulate the winner.
Draw Initiated
Admin triggers commit_draw. SOL / USDC vault is locked. Randomness account is committed to a specific Solana slothash. No outcome is known yet.
TEE Randomness
Switchboard oracle nodes generate a verifiable random value inside a Trusted Execution Environment. A cryptographic VRF proof is attached — tamper-proof by design.
Winner Settled
Admin calls settle_draw. Program reads vrf_result % max_tickets, verifies winner PDA on-chain, and distributes SOL / USDC / physical prizes.
Why commit-reveal? SOL or USDC is locked at commit time — before the random value exists. This prevents selective revelation attacks where a losing party could refuse to reveal an unfavorable result.
Audited Integrations by Room Category
Each room category uses specific on-chain instructions and external protocol adapters.
Solana Rooms (SOL)
Direct native SOL ticket purchasing via System Program transfer. Winner draws trigger atomic escrow release directly to the winner's wallet.
Bitcoin Rooms (cbBTC)
Escrows USDC ticket entry fees. Draw settlements trigger an automatic Jupiter DEX swap from USDC to Coinbase Wrapped BTC (cbBTC) disbursed directly.
Gold Bars Category (RWA)
Supports various gold bar weights (1 oz, 10 oz, 100 oz, etc.) and reputable mints (Perth Mint, PAMP Suisse, Valcambi) held securely in partner custody. Draw winners receive digital RWA claim tickets redeemable for physical delivery or vault custody.
Gold Coins Category (RWA)
Encompasses a wide range of legal tender gold bullion coins (e.g., American Gold Eagles, Canadian Maple Leafs, Krugerrands, Austrian Philharmonics) in various denominations, weights, and grading standards.
Silver Coins Category (RWA)
Covers numerous physical silver coin categories (American Silver Eagles, Canadian Silver Maple Leafs, Britannia, and private mint silver rounds). Automatic generation of secure shipping tickets post-draw linked to the winning ticket PDA.
Luxury Watches & Pokémon
Graded Pokemon packs and unworn luxury timepieces (Premier/Classic Watch boxes). Integrates Courtyard vaulting and physical shipping metadata on-chain.
TicketFi Event Contract
Handles the logic for initializing rooms, escrowing ticket entry fees (in native SOL or USDC), buying tickets as PDAs, drawing verifiable winners on-chain via Switchboard VRF, and distributing the designated Room Prize (SOL, cbBTC, or tokenized physical RWAs like Gold, Silver, watches, and cards) to the winner, and platform fees to treasury and staking accounts.
Solana Anchor program compiles using strict type boundaries. All state variables utilize signed validation paths preventing parameter injection.
On-Chain Data Flow Diagram
Understanding the PDA accounts tree and state changes in TicketFi.
PlatformConfig PDA
Admin defines the global state: deployer address and destination Treasury Wallet.
RaffleRoom PDA
Admin spawns a room using numerical `room_id` seeds. Creates vault PDA to collect SOL/USDC entry fees.
Entry PDAs
Users pay SOL or USDC to the room vault. Each entry generates a sequential PDA saving the buyer's key.
CPI Distribution
Random seed resolves winner index. Winner gets the Room Prize (SOL, cbBTC, or tokenized physical RWAs), Treasury & Stakers receive platform fees, vault is emptied.
Core Program Security Mechanisms
Key defensive validation patterns built directly into the on-chain Anchor code.
PDA Seeds Validation
Every ticket and room account is locked behind a strict PDA derivation. For example, tickets use `['ticket', room_key, ticket_index]`, which prevents users from fake ticketing or re-submitting keys.
Switchboard VRF Randomness
Winner draws are secured by Switchboard's TEE-secured oracle network using Verifiable Random Functions (VRF). Each draw result ships with a cryptographic proof verifiable on-chain, making manipulation by validators or any third party mathematically impossible.
Multi-Currency & RWA Escrow
Supports native SOL and SPL USDC ticket sales. Escrows entry fees safely, mapping room payouts directly to target assets including cbBTC auto-swaps and physical RWA custody redemptions.
Deterministic Winner PDA Proof
During distribution, the program recalculates the ticket PDA address of the winner index on-chain and requires a match, verifying that the winner account was a real participant.
Platform Pause Mechanism
An admin global configuration check on every ticket purchase allows pausing ticket sales globally in case of unexpected network situations.
On-Chain Instructions / Entrypoint Inspector
Click on any function to view parameters, required accounts, logic description, and security validations.
