Sol.College

Full lesson

Futstar-official

Match momentum trading and football market

What it does

From the project README:

Futstar revolutionizes sports engagement by enabling real-time momentum trading during live football matches on the Solana blockchain.
Original
Bach-TG/Futstar-official
SuperStack fork
Blockchains/Futstar-official @ 21205ff
Stars
0
Last push (original)
2025-12-13
Languages
Jupyter Notebook, Python, TypeScript, Rust, Dockerfile, JavaScript
Detected stack
Anchorsolana-pyweb3.js
Categories
DeFi
Licence
MIT

Architecture

119 source files. By extension: .py ×116, .rs ×1, .tsx ×1, .ts ×1.

Top-level directorySource files
backend117
contracts1
frontend1

On-chain programs: contracts/programs/momentum-trading

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/futstar-official/. 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.

Bach-TG/Futstar-official · contracts/programs/momentum-trading/src/lib.rs L73–96 @ 21205ff · MIT · original
        msg!("Long position opened: {} SOL at momentum index {}",              amount as f64 / 1e9 as f64,              position.entry_momentum_index);                Ok(())    }     /// Open a short position (bet on momentum decrease)    pub fn open_short_position(        ctx: Context<OpenPosition>,        amount: u64,        window_duration: i64,    ) -> Result<()> {        let position = &mut ctx.accounts.trading_position;        let pool = &mut ctx.accounts.momentum_pool;        let clock = Clock::get()?;                require!(pool.is_active, TradingError::PoolNotActive);        require!(amount > 0, TradingError::InvalidAmount);                // Transfer tokens from user to pool        token::transfer(            CpiContext::new(                ctx.accounts.token_program.to_account_info(),
  1. Line 73 msg!("Long position opened: {} SOL at momentum index {}",: Logs to the program log, which is visible in explorers and the test output.
  2. Line 88 let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar.
  3. Line 90 require!(pool.is_active, TradingError::PoolNotActive);: An explicit validation that aborts the instruction with an error.
  4. Line 94 token::transfer(: An SPL token transfer through the Token Program.
  5. Line 95 CpiContext::new(: Makes a cross-program invocation into another program.

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 devconcurrently "npm run dev:backend" "npm run dev:frontend"
.npm run buildnpm run build:contracts && npm run build:frontend
.npm run testnpm run test:contracts && npm run test:backend
frontendnpm run startexpo start
frontendnpm run testjest
frontendnpm run linteslint . --ext .js,.jsx,.ts,.tsx
contractsanchor buildcompile programs and generate IDLs
contractsanchor testlocal validator + test suite
contractsanchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts

What you could build from it

Used in lessons