On-Chain Audit Details
Explore verified entrypoints, security checks, state diagrams, and rules of the LootX Solana smart contracts.
Powered by Switchboard Randomness
LootX 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.
LootX 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, Memecoins or tokenized RWAs like Pokémon cards and luxury watches) to the winner, and platform fees to treasury and holder reward distribution.
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 LootX.
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 designated Room Prize (SOL, cbBTC, Memecoins, or tokenized RWAs), Treasury & Holders 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 & Asset Escrow
Supports native SOL and SPL USDC ticket sales. Escrows entry fees safely, mapping room payouts directly to target assets including SOL, cbBTC, Memecoins (ANSEM, CATE, FAPCOIN, MEMESTOCK, CASHCAT) and tokenized RWAs.
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.

