Sol.College

Structure lesson (licence does not allow quoting code)

Surge-Contract

Original
Surge-Swap/Surge-Contract
SuperStack fork
Blockchains/Surge-Contract @ 6bba3a1
Stars
0
Last push (original)
2025-05-15
Languages
Rust, TypeScript
Detected stack
Anchor
Categories
Other
Licence
none detected: code not quoted on Sol.College

Architecture

30 source files. By extension: .rs ×28, .ts ×2.

Top-level directorySource files
programs28
migrations1
tests1

On-chain programs: programs/surge-fut, programs/surge-oracle, programs/surge-variance

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
initialize_volatility_statsInitializeprograms/surge-oracle/src/lib.rs:16
update_volatilityUpdateVolatilityprograms/surge-oracle/src/lib.rs:20
update_volatilityUpdateVolatilityprograms/surge-oracle/src/instructions/update_volatility.rs:31
initialize_volatility_statsInitializeprograms/surge-oracle/src/instructions/initialize.rs:22
mint_tokensMintTokensprograms/surge-fut/src/instructions/mint_tokens.rs:81
update_feeUpdateFeeprograms/surge-fut/src/instructions/update_fee.rs:28
redeem_tokensRedeemTokensprograms/surge-fut/src/instructions/redeem_tokens.rs:77
mint_tokensMintTokensprograms/surge-variance/src/lib.rs:28
redeemRedeemprograms/surge-variance/src/lib.rs:32
mint_tokensMintTokensprograms/surge-variance/src/instructions/mint_tokens.rs:45
redeemRedeemprograms/surge-variance/src/instructions/redeem.rs:49

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
programs/surge-fut/src/instructions/mint_tokens.rsseeds, Program, CpiContext, init_if_needed, transfer, AccountInfo
programs/surge-fut/src/instructions/redeem_tokens.rsseeds, CpiContext, transfer, Program, AccountInfo
programs/surge-variance/src/instructions/redeem.rsseeds, CpiContext, transfer, AccountInfo, Program
programs/surge-variance/src/events.rsPubkey
programs/surge-variance/src/instructions/mint_tokens.rsseeds, CpiContext, Program, transfer
programs/surge-fut/src/instructions/initialize.rsProgram, seeds, init_if_needed, AccountInfo
programs/surge-variance/src/instructions/initialize.rsProgram, CpiContext, seeds, AccountInfo
programs/surge-variance/src/state/market.rsPubkey
tests/surge-oracle.tsProgram, AnchorProvider, Keypair
programs/surge-fut/src/state/oracle.rsPubkey, AccountInfo
programs/surge-oracle/src/instructions/update_volatility.rsseeds, has_one
programs/surge-oracle/src/instructions/initialize.rsseeds, Program

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/surge-contract/. 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 lint
.anchor build
.anchor test
.anchor run close_position
.anchor run init_synthetic_mint
.anchor run open_long_100
.anchor run test
.cargo build
.cargo test

What you could build from it