Sol.College

Full lesson

BumpTrade

What it does

From the project README:

Real-time 3D bumper-car wager arena. **Solana devnet is the default chain**; Robinhood Chain testnet stays supported behind the same chain adapter. Every player stakes 100 free `BUMP` and starts with a balance. Every hit moves balance from the car you hit to you; drop to zero and you are liquidated. At the end, each player is paid `stake x final balance / start balance` from the pot in one transaction. Play is gasless: a player only signs a message, the server relayer pays the gas.
Original
Vamp-Labs/BumpTrade
SuperStack fork
Blockchains/BumpTrade @ a0722a5
Stars
0
Last push (original)
2026-10-11
Languages
TypeScript, Python, Solidity, JavaScript, Rust, CSS
Detected stack
@solana/kitAnchor
Categories
Other
Licence
MIT

Architecture

240 source files. By extension: .ts ×204, .rs ×16, .sol ×11, .py ×9.

Top-level directorySource files
src90
packages60
server43
solana17
contracts14
tools10
indexer5
(root)1

On-chain programs: solana/programs/bump_arena

Dapp: devnet deploy pending

⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/bumptrade/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.

Key code, explained

Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.

Vamp-Labs/BumpTrade · solana/programs/bump_arena/src/instructions/open_match.rs L13–36 @ a0722a5 · MIT · original
    pub operator: Signer<'info>,    #[account(seeds = [CONFIG_SEED], bump = config.bump)]    pub config: Account<'info, Config>,    #[account(address = config.mint)]    pub mint: Account<'info, Mint>,    #[account(init, payer = operator, space = 8 + Match::INIT_SPACE, seeds = [MATCH_SEED, match_id.as_ref()], bump)]    pub match_account: Account<'info, Match>,    #[account(        init,        payer = operator,        seeds = [VAULT_SEED, match_id.as_ref()],        bump,        token::mint = mint,        token::authority = match_account,    )]    pub vault: Account<'info, TokenAccount>,    pub token_program: Program<'info, Token>,    pub system_program: Program<'info, System>,} pub fn handler(ctx: Context<OpenMatch>, match_id: [u8; 32], max_players: u8, join_deadline: i64) -> Result<()> {    let config = &ctx.accounts.config;    require!(!config.paused, BumpError::Paused);    let now = Clock::get()?.unix_timestamp;
  1. Line 13 pub operator: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 14 #[account(seeds = [CONFIG_SEED], bump = config.bump)]: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 14 #[account(seeds = [CONFIG_SEED], bump = config.bump)]: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 18 #[account(init, payer = operator, space = 8 + Match::INIT_SPACE, seeds = [MATCH_SEED, matc: Creates and pays for a new account. Space and payer must be specified.
  5. Line 35 require!(!config.paused, BumpError::Paused);: An explicit validation that aborts the instruction with an error.
  6. Line 36 let now = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar.
Vamp-Labs/BumpTrade · solana/programs/bump_arena/src/instructions/start_match.rs L1–24 @ a0722a5 · MIT · original
use anchor_lang::prelude::*; use crate::constants::*;use crate::error::BumpError;use crate::events::MatchStarted;use crate::state::{Config, Match}; #[derive(Accounts)]#[instruction(match_id: [u8; 32])]pub struct StartMatch<'info> {    #[account(constraint = operator.key() == config.operator @ BumpError::Unauthorized)]    pub operator: Signer<'info>,    #[account(seeds = [CONFIG_SEED], bump = config.bump)]    pub config: Account<'info, Config>,    #[account(mut, seeds = [MATCH_SEED, match_id.as_ref()], bump = match_account.bump)]    pub match_account: Account<'info, Match>,} pub fn handler(ctx: Context<StartMatch>, match_id: [u8; 32]) -> Result<()> {    let m = &mut ctx.accounts.match_account;    require!(m.status == STATUS_OPEN, BumpError::BadStatus);    require!(m.player_count >= 2, BumpError::NotEnoughPlayers);    m.status = STATUS_STARTED;    emit!(MatchStarted { match_id, settle_deadline: m.settle_deadline });
  1. Line 12 pub operator: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 13 #[account(seeds = [CONFIG_SEED], bump = config.bump)]: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 13 #[account(seeds = [CONFIG_SEED], bump = config.bump)]: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 21 require!(m.status == STATUS_OPEN, BumpError::BadStatus);: An explicit validation that aborts the instruction with an error.
  5. Line 24 emit!(MatchStarted { match_id, settle_deadline: m.settle_deadline });: Emits an Anchor event that clients can parse from the logs.
Vamp-Labs/BumpTrade · solana/programs/bump_arena/src/instructions/join_match.rs L25–48 @ a0722a5 · MIT · original
    require!(!ctx.accounts.config.paused, BumpError::Paused);    let now = Clock::get()?.unix_timestamp;    let player = ctx.accounts.player.key();    let m = &mut ctx.accounts.match_account;    require!(m.status == STATUS_OPEN, BumpError::MatchNotOpen);    require!(now <= m.join_deadline, BumpError::JoinClosed);    require!(m.player_count < m.max_players, BumpError::MatchFull);    require!(m.seat_of(&player).is_none(), BumpError::AlreadyJoined);    require!(vehicle_id < VEHICLE_COUNT, BumpError::BadVehicle);     let seat = m.player_count as usize;    m.players[seat] = player;    m.session_keys[seat] = session_key;    m.vehicles[seat] = vehicle_id;    m.player_count += 1;    let stake = m.stake;     token::transfer(        CpiContext::new(            ctx.accounts.token_program.key(),            Transfer {                from: ctx.accounts.player_token.to_account_info(),                to: ctx.accounts.vault.to_account_info(),                authority: ctx.accounts.player.to_account_info(),
  1. Line 25 require!(!ctx.accounts.config.paused, BumpError::Paused);: An explicit validation that aborts the instruction with an error.
  2. Line 26 let now = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar.
  3. Line 40 let stake = m.stake;: Touches staking state: the amount locked and when it was locked.
  4. Line 42 token::transfer(: An SPL token transfer through the Token Program.
  5. Line 43 CpiContext::new(: Makes a cross-program invocation into another program.
Vamp-Labs/BumpTrade · solana/programs/bump_arena/src/instructions.rs L37–56 @ a0722a5 · MIT · original
    let bump = [match_bump];    let seeds: &[&[u8]] = &[MATCH_SEED, match_id.as_ref(), &bump];    token::transfer(        CpiContext::new_with_signer(            Token::id(),            Transfer { from: vault, to: destination, authority: match_account },            &[seeds],        ),        amount,    )} pub fn seat_token_account(info: &AccountInfo, owner: &Pubkey, mint: &Pubkey) -> Result<()> {    require!(info.is_writable && info.owner == &Token::id(), BumpError::BadRemainingAccounts);    let data = info.try_borrow_data()?;    let account = TokenAccount::try_deserialize(&mut &data[..]).map_err(|_| error!(BumpError::BadRemainingAccounts))?;    require_keys_eq!(account.owner, *owner, BumpError::BadRemainingAccounts);    require_keys_eq!(account.mint, *mint, BumpError::BadRemainingAccounts);    Ok(())}
  1. Line 37 let bump = [match_bump];: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  2. Line 39 token::transfer(: An SPL token transfer through the Token Program.
  3. Line 40 CpiContext::new_with_signer(: Makes a CPI signed by a PDA. The signer seeds prove the program controls that address.
  4. Line 50 require!(info.is_writable && info.owner == &Token::id(), BumpError::BadRemainingAccounts);: An explicit validation that aborts the instruction with an error.

How to run, build and test

These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.

DirectoryCommandRuns
.npm run devvite
.npm run buildtsc && vite build
.npm run lintbiome check src packages server indexer
packages/sharednpm run testvitest run --passWithNoTests
packages/sol-clientnpm run testvitest run --passWithNoTests
indexernpm run devponder dev
indexernpm run startponder start
servernpm run devtsx watch src/index.ts
servernpm run starttsx src/index.ts
servernpm run testvitest run --passWithNoTests
solananpm run buildflock /tmp/bump-build.lock env PATH=$HOME/.cargo/bin:$PATH anchor build
contractsnpm run buildforge build && node script/export-abi.mjs
contractsnpm run testforge test
solanaanchor buildcompile programs and generate IDLs
solanaanchor testlocal validator + test suite
solanaanchor run testcargo test -p bump_arena

What you could build from it

Used in lessons