Sol.College

Structure lesson (licence does not allow quoting code)

barn

Manage solana ecosystem grants on-chain

Original
thewuhxyz/barn
SuperStack fork
Blockchains/barn @ 5b7e883
Stars
0
Last push (original)
2024-10-08
Languages
TypeScript, Rust, CSS, Just, JavaScript
Detected stack
AnchorNext.jsweb3.js
Categories
Other
Licence
none detected: code not quoted on Sol.College
Homepage
https://opengrants.thewuh.xyz

Architecture

84 source files. By extension: .tsx ×43, .ts ×27, .rs ×14.

Top-level directorySource files
app55
protocol29

On-chain programs: protocol/programs/barn

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
create_userCreateUserprotocol/programs/barn/src/lib.rs:16
add_projectAddProjectprotocol/programs/barn/src/lib.rs:20
add_grant_programAddGrantProgramprotocol/programs/barn/src/lib.rs:24
award_grantAwardGrantprotocol/programs/barn/src/lib.rs:28
revise_grant_milestoneUpdateGrantMilestoneprotocol/programs/barn/src/lib.rs:47
review_grant_milestoneUpdateGrantMilestoneprotocol/programs/barn/src/lib.rs:51
reject_grant_milestoneUpdateGrantMilestoneprotocol/programs/barn/src/lib.rs:55
accept_grant_milestoneUpdateGrantMilestoneprotocol/programs/barn/src/lib.rs:59
settle_grant_milestoneSettleGrantMilestoneprotocol/programs/barn/src/lib.rs:63
approve_sponsorApproveSponsorprotocol/programs/barn/src/lib.rs:68
reset_profile_authorityResetProfileAuthorityprotocol/programs/barn/src/lib.rs:72

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
protocol/ts/src/client/account.tsPublicKey, findProgramAddressSync, Program
protocol/ts/src/client/types.tsPublicKey
app/src/components/barn/rpc.tsxPublicKey, useConnection, Program, getAssociatedTokenAddressSync, getAccountInfo
protocol/ts/src/client/transaction.tsTransaction, Program, PublicKey
protocol/programs/barn/src/contexts/settle_grant_milestone.rsseeds, has_one, CpiContext, transfer, Program, AccountInfo
protocol/ts/src/client/methods.tsProgram, Transaction
protocol/ts/src/client/client.tsPublicKey, Program, AnchorProvider, getAssociatedTokenAddressSync, Keypair
protocol/programs/barn/src/state/mod.rsPubkey
protocol/ts/tests/barn.test.tsKeypair, getAssociatedTokenAddressSync, requestAirdrop, getBalance, AnchorProvider, Transaction
protocol/programs/barn/src/contexts/update_grant_milestone.rsseeds, has_one
protocol/programs/barn/src/contexts/add_grant_milestone.rsseeds, has_one, Program
protocol/programs/barn/src/contexts/award_grant.rsseeds, has_one, 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/barn/. 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 dev
.npm run start
.npm run build
.npm run lint
appnpm run dev
appnpm run start
appnpm run build
appnpm run lint
protocol/tsnpm run build
.anchor build
.anchor test
.anchor run test
.anchor run barn
.cargo build
.cargo test

What you could build from it