Sol.College

Structure lesson (licence does not allow quoting code)

Hackathon-Prediction-Market-Solana

Original
clugraphy/Hackathon-Prediction-Market-Solana
SuperStack fork
Blockchains/Hackathon-Prediction-Market-Solana @ 33bc5dd
Stars
0
Last push (original)
2025-10-14
Languages
TypeScript, Rust, Shell, CSS, Makefile, HTML
Detected stack
Anchorweb3.js
Categories
Other
Licence
NOASSERTION: code not quoted on Sol.College

Architecture

55 source files. By extension: .rs ×27, .ts ×14, .tsx ×13, .js ×1.

Top-level directorySource files
programs27
prediction-market-frontend19
lib5
cli3
(root)1

On-chain programs: programs/prediction-market

How it works: instructions and accounts

Each instruction handler and the accounts struct it validates, found by reading the Rust source. Links go to the exact line at the pinned commit.

InstructionAccountsSource
configureConfigureprograms/prediction-market/src/lib.rs:34
nominate_authorityNominateAuthorityprograms/prediction-market/src/lib.rs:40
accept_authorityAcceptAuthorityprograms/prediction-market/src/lib.rs:45
set_steam_oracleSetSteamOracleprograms/prediction-market/src/lib.rs:49
whitelist_initWhitelistInitprograms/prediction-market/src/lib.rs:54
whitelist_add_memberWhitelistAddMemberprograms/prediction-market/src/lib.rs:58
whitelist_remove_memberWhitelistRemoveMemberprograms/prediction-market/src/lib.rs:62
create_marketCreateMarketprograms/prediction-market/src/lib.rs:76
add_liquidityAddLiquidityprograms/prediction-market/src/lib.rs:112
withdraw_liquidityWithdrawLiquidityprograms/prediction-market/src/lib.rs:116

Where the Solana code lives

Source files that import a Solana SDK, ranked by how many Solana APIs they use, with the APIs each one calls. Read them in this order to see how the app talks to the chain.

FileSolana APIs used
lib/scripts.tsPublicKey, findProgramAddressSync, Transaction, Program, Connection, Keypair
prediction-market-frontend/src/components/CreateMarket.tsxTransaction, PublicKey, findProgramAddressSync, ComputeBudgetProgram, sendTransaction, Keypair
cli/scripts.tsPublicKey, findProgramAddressSync, Connection, Transaction, Program, Keypair
programs/prediction-market/src/state/market.rsAccountInfo, Program, Pubkey
cli/debug.tsProgram, PublicKey, getAccountInfo, Connection, Keypair, AnchorProvider
programs/prediction-market/src/utils.rsAccountInfo, transfer, CpiContext, Program, invoke, invoke_signed
programs/prediction-market/src/instructions/market/create_market.rsseeds, CpiContext, Program, invoke, AccountInfo, Pubkey
lib/check-balances-helper.tsPublicKey, Program, Connection, getAssociatedTokenAddress, findProgramAddressSync
programs/prediction-market/src/instructions/market/swap.rsseeds, AccountInfo, Program, CpiContext, init_if_needed
programs/prediction-market/src/events.rsPubkey
programs/prediction-market/src/instructions/market/add_liquidity.rsseeds, transfer, CpiContext, AccountInfo, Program, init_if_needed
prediction-market-frontend/src/contexts/PredictionMarketContext.tsxProgram, signTransaction, AnchorProvider, useConnection, useWallet, PublicKey

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/hackathon-prediction-market-solana/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.

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 test
.npm run lint
prediction-market-frontendnpm run start
prediction-market-frontendnpm run build
prediction-market-frontendnpm run test
.anchor build
.anchor test
.anchor run build
.anchor run test
.cargo build
.cargo test
.make help
.make install
.make build
.make clean
.make deploy

What you could build from it