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 directory | Source files |
|---|---|
backend | 117 |
contracts | 1 |
frontend | 1 |
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.
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(),- Line 73
msg!("Long position opened: {} SOL at momentum index {}",: Logs to the program log, which is visible in explorers and the test output. - Line 88
let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar. - Line 90
require!(pool.is_active, TradingError::PoolNotActive);: An explicit validation that aborts the instruction with an error. - Line 94
token::transfer(: An SPL token transfer through the Token Program. - 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.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | concurrently "npm run dev:backend" "npm run dev:frontend" |
. | npm run build | npm run build:contracts && npm run build:frontend |
. | npm run test | npm run test:contracts && npm run test:backend |
frontend | npm run start | expo start |
frontend | npm run test | jest |
frontend | npm run lint | eslint . --ext .js,.jsx,.ts,.tsx |
contracts | anchor build | compile programs and generate IDLs |
contracts | anchor test | local validator + test suite |
contracts | anchor run test | yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts |
What you could build from it
- Fork the SuperStack copy and extend it within the DeFi gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)
- Learn the pattern first: SPL Tokens: mints, accounts and transfers