Full lesson
Arcadia
Arcadia is a Proof-of-Performance Capital Protocol where traders earn capital by proving skill, and investors allocate based on verified results.
What it does
From the project README:
Arcadia is a devnet-stage Solana protocol for allocating investor capital to traders using verifiable performance history, risk scoring, share-based vaults, and profile-owned venue custody.
- Original
- Molten-Labs/Arcadia
- SuperStack fork
- Blockchains/Arcadia @
e7117b2 - Stars
- 1
- Last push (original)
- 2026-10-04
- Languages
- TypeScript, Rust, CSS, PLpgSQL, JavaScript, Dockerfile
- Detected stack
- @solana/kitAnchorweb3.js
- Categories
- Other
- Licence
- MIT
Architecture
343 source files. By extension: .tsx ×130, .ts ×118, .rs ×94, .js ×1.
| Top-level directory | Source files |
|---|---|
app | 194 |
server-rs | 76 |
arcadia_vault | 62 |
docs | 10 |
.railway | 1 |
On-chain programs: arcadia_vault/programs/arcadia_vault, arcadia_vault/programs/mock_venue
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/arcadia/. 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.
arcadia_vault/programs/arcadia_vault/src/instructions/record_trade.rs L1–24 @ e7117b2 · MIT · originaluse anchor_lang::prelude::*; use crate::{ checked_add_u64, checked_sub_u64, drawdown_floor_nav, nav_bearing_assets, nav_per_share, realized_pnl, token::profile_signer_seeds, token::transfer_checked_accounts, token::transfer_checked_accounts_with_signer, token::Mint, token::Token, token::TokenAccount, trade_notional_cap, ArcadiaError, PlatformConfig, TradeClosed, TraderProfile, MAX_NOTIONAL_BPS, PLATFORM_SEED, PROFILE_SEED, PROFILE_STATUS_ACTIVE,}; #[derive(Accounts)]pub struct RecordTrade<'info> { pub trader: Signer<'info>, pub oracle_authority: Signer<'info>, #[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = oracle_authority, has_one = treasury_token, has_one = base_mint)] pub config: Account<'info, PlatformConfig>, #[account( mut, seeds = [PROFILE_SEED, profile.trader.as_ref()], bump = profile.bump, has_one = trader, has_one = base_mint, has_one = vault_token, constraint = profile.status == PROFILE_STATUS_ACTIVE @ ArcadiaError::VaultNotActive- Line 4
checked_add_u64, checked_sub_u64, drawdown_floor_nav, nav_bearing_assets, nav_per_share,: Uses checked arithmetic so overflow fails instead of wrapping. - Line 5
realized_pnl, token::profile_signer_seeds, token::transfer_checked_accounts,: A checked token transfer, which also verifies the mint and decimals. - Line 5
realized_pnl, token::profile_signer_seeds, token::transfer_checked_accounts,: An SPL token transfer through the Token Program. - Line 13
pub trader: Signer<'info>,: Requires this account to have signed the transaction. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = oracle_authority, has_one: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = oracle_authority, has_one: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = oracle_authority, has_one: Checks that a stored pubkey field matches the passed account.
arcadia_vault/programs/arcadia_vault/src/instructions/trader_withdraw_profit.rs L1–24 @ e7117b2 · MIT · originaluse anchor_lang::prelude::*; use crate::{ checked_sub_u64, nav_bearing_assets, token::{ profile_signer_seeds, transfer_checked_accounts_with_signer, Mint, Token, TokenAccount, }, ArcadiaError, ProfitWithdrawn, TraderProfile, PROFILE_SEED, PROFILE_STATUS_ACTIVE, PROFILE_STATUS_HALTED,}; #[derive(Accounts)]pub struct TraderWithdrawProfit<'info> { pub trader: Signer<'info>, #[account( mut, seeds = [PROFILE_SEED, profile.trader.as_ref()], bump = profile.bump, has_one = trader, has_one = base_mint, has_one = vault_token, constraint = profile.status == PROFILE_STATUS_ACTIVE || profile.status == PROFILE_STATUS_HALTED @ ArcadiaError::VaultNotActive )]- Line 4
checked_sub_u64, nav_bearing_assets,: Uses checked arithmetic so overflow fails instead of wrapping. - Line 6
profile_signer_seeds, transfer_checked_accounts_with_signer, Mint, Token, TokenAccount,: A checked token transfer, which also verifies the mint and decimals. - Line 14
pub trader: Signer<'info>,: Requires this account to have signed the transaction. - Line 17
seeds = [PROFILE_SEED, profile.trader.as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 18
bump = profile.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 19
has_one = trader,: Checks that a stored pubkey field matches the passed account.
arcadia_vault/programs/arcadia_vault/src/instructions/velocity_custody.rs L193–216 @ e7117b2 · MIT · original let custody = &mut ctx.accounts.custody; custody.profile = profile_key; custody.velocity_user = ctx.accounts.velocity_user.key(); custody.velocity_user_stats = ctx.accounts.velocity_user_stats.key(); custody.orchestrator = orchestrator; custody.deployed_collateral = 0; custody.bump = ctx.bumps.custody; emit!(VelocityCustodyInitialized { profile: profile_key, velocity_user: custody.velocity_user, velocity_user_stats: custody.velocity_user_stats, orchestrator, ts: Clock::get()?.unix_timestamp, }); Ok(())} #[derive(Accounts)]pub struct UpdateVelocityOrchestrator<'info> { pub admin: Signer<'info>, #[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = admin)] pub config: Account<'info, PlatformConfig>,- Line 199
custody.bump = ctx.bumps.custody;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 201
emit!(VelocityCustodyInitialized {: Emits an Anchor event that clients can parse from the logs. - Line 206
ts: Clock::get()?.unix_timestamp,: Reads on-chain time from the Clock sysvar. - Line 214
pub admin: Signer<'info>,: Requires this account to have signed the transaction. - Line 215
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = admin)]: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 215
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = admin)]: Checks that a stored pubkey field matches the passed account.
arcadia_vault/programs/arcadia_vault/src/instructions/settle.rs L1–24 @ e7117b2 · MIT · originaluse anchor_lang::prelude::*; use crate::{ checked_add_u64, checked_sub_u64, fee_from_bps, nav_per_share, profit_assets, token::{ profile_signer_seeds, transfer_checked_accounts_with_signer, Mint, Token, TokenAccount, }, ArcadiaError, PlatformConfig, Settled, TraderProfile, PLATFORM_SEED, PROFILE_SEED, PROFILE_STATUS_ACTIVE, PROFILE_STATUS_HALTED,}; #[derive(Accounts)]pub struct Settle<'info> { pub caller: Signer<'info>, #[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = base_mint, has_one = treasury_token)] pub config: Account<'info, PlatformConfig>, #[account( mut, seeds = [PROFILE_SEED, profile.trader.as_ref()], bump = profile.bump, has_one = base_mint, has_one = vault_token, constraint = profile.status == PROFILE_STATUS_ACTIVE || profile.status == PROFILE_STATUS_HALTED @ ArcadiaError::VaultNotActive- Line 4
checked_add_u64, checked_sub_u64, fee_from_bps, nav_per_share, profit_assets,: Uses checked arithmetic so overflow fails instead of wrapping. - Line 6
profile_signer_seeds, transfer_checked_accounts_with_signer, Mint, Token, TokenAccount,: A checked token transfer, which also verifies the mint and decimals. - Line 14
pub caller: Signer<'info>,: Requires this account to have signed the transaction. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = base_mint, has_one = trea: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = base_mint, has_one = trea: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 15
#[account(seeds = [PLATFORM_SEED], bump = config.bump, has_one = base_mint, has_one = trea: Checks that a stored pubkey field matches the passed account.
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 |
|---|---|---|
server-rs/execution-worker | npm run dev | tsx watch src/index.ts |
server-rs/execution-worker | npm run start | tsx src/index.ts |
server-rs/execution-worker | npm run test | tsx --test src/*.test.ts |
app | npm run dev | vite |
app | npm run start | vite preview |
app | npm run build | vite build |
app | npm run test | NODE_ENV=test vitest run |
app | npm run lint | eslint . |
arcadia_vault | npm run lint | prettier */*.js "*/**/*{.js,.ts}" --check |
arcadia_vault | anchor build | compile programs and generate IDLs |
arcadia_vault | anchor test | local validator + test suite |
arcadia_vault | anchor run test | cargo test -- --test-threads=1 --nocapture |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Cross-Program Invocations (CPIs)