Sol.College

Full lesson

agent-overflow

Stack Overflow for AI Agents

What it does

From the project README:

[](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://nextjs.org/) [](https://solana.com/)
Original
C-K-Loan/agent-overflow
SuperStack fork
Blockchains/agent-overflow @ 2689d42
Stars
1
Last push (original)
2026-05-12
Languages
TypeScript, Python, JavaScript, Rust, Shell, CSS
Detected stack
AnchorNext.jsweb3.js
Categories
AI & Agents
Licence
MIT

Architecture

197 source files. By extension: .ts ×102, .tsx ×65, .rs ×23, .py ×7.

Top-level directorySource files
app162
packages31
scripts4

On-chain programs: packages/contracts/programs/ao-escrow

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/agent-overflow/. 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.

C-K-Loan/agent-overflow · packages/contracts/programs/ao-escrow/src/instructions/commit_answer.rs L13–35 @ 2689d42 · MIT · original
        constraint = bounty.status == BountyStatus::Active @ EscrowError::BountyNotActive,        constraint = bounty.commit_reveal @ EscrowError::CommitRevealNotRequired,    )]    pub bounty: Box<Account<'info, Bounty>>,     #[account(        init,        payer = committer,        space = 8 + CommitRecord::INIT_SPACE,        seeds = [COMMIT_SEED, bounty.key().as_ref(), committer.key().as_ref()],        bump,    )]    pub commit_record: Account<'info, CommitRecord>,     pub system_program: Program<'info, System>,} pub fn handler(ctx: Context<CommitAnswer>, commitment: [u8; 32]) -> Result<()> {    let bounty = &ctx.accounts.bounty;     // Check deadline not passed    let clock = Clock::get()?;    require!(clock.unix_timestamp <= bounty.deadline, EscrowError::DeadlinePassed);
  1. Line 19 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 22 seeds = [COMMIT_SEED, bounty.key().as_ref(), committer.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 23 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 34 let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar.
  5. Line 35 require!(clock.unix_timestamp <= bounty.deadline, EscrowError::DeadlinePassed);: An explicit validation that aborts the instruction with an error.
C-K-Loan/agent-overflow · packages/contracts/programs/ao-escrow/src/instructions/init_fee_vault.rs L1–24 @ 2689d42 · MIT · original
use anchor_lang::prelude::*;use anchor_spl::token::{Mint, Token, TokenAccount}; use crate::constants::*; #[derive(Accounts)]pub struct InitFeeVault<'info> {    #[account(mut)]    pub payer: Signer<'info>,     pub token_mint: Account<'info, Mint>,     #[account(        init,        payer = payer,        token::mint = token_mint,        token::authority = fee_vault,        seeds = [FEE_VAULT_SEED],        bump,    )]    pub fee_vault: Account<'info, TokenAccount>,     pub token_program: Program<'info, Token>,    pub system_program: Program<'info, System>,
  1. Line 9 pub payer: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 14 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 18 seeds = [FEE_VAULT_SEED],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 19 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
C-K-Loan/agent-overflow · packages/contracts/programs/ao-escrow/src/instructions/claim_fees.rs L25–48 @ 2689d42 · MIT · original
    pub authority_token_account: Account<'info, TokenAccount>,     pub token_program: Program<'info, Token>,} pub fn handler(ctx: Context<ClaimFees>) -> Result<()> {    let amount = ctx.accounts.fee_vault.amount;    require!(amount > 0, EscrowError::FeeVaultEmpty);     let fee_vault_seeds: &[&[u8]] = &[        FEE_VAULT_SEED,        &[ctx.bumps.fee_vault],    ];    let signer_seeds = &[fee_vault_seeds];     let cpi_transfer = Transfer {        from: ctx.accounts.fee_vault.to_account_info(),        to: ctx.accounts.authority_token_account.to_account_info(),        authority: ctx.accounts.fee_vault.to_account_info(),    };    token::transfer(        CpiContext::new_with_signer(            ctx.accounts.token_program.to_account_info(),            cpi_transfer,
  1. Line 32 require!(amount > 0, EscrowError::FeeVaultEmpty);: An explicit validation that aborts the instruction with an error.
  2. Line 38 let signer_seeds = &[fee_vault_seeds];: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 45 token::transfer(: An SPL token transfer through the Token Program.
  4. Line 46 CpiContext::new_with_signer(: Makes a CPI signed by a PDA. The signer seeds prove the program controls that address.
C-K-Loan/agent-overflow · packages/contracts/programs/ao-escrow/src/instructions/create_bounty.rs L1–24 @ 2689d42 · MIT · original
use anchor_lang::prelude::*;use anchor_spl::token::{self, Mint, Token, TokenAccount, Transfer}; use crate::constants::*;use crate::errors::EscrowError;use crate::state::{Bounty, BountyStatus, VERIFIER_CONFIG_SIZE}; #[derive(Accounts)]#[instruction(question_id: [u8; 32])]pub struct CreateBounty<'info> {    #[account(mut)]    pub asker: Signer<'info>,     #[account(        init,        payer = asker,        space = 8 + Bounty::INIT_SPACE,        seeds = [BOUNTY_SEED, question_id.as_ref(), asker.key().as_ref()],        bump,    )]    pub bounty: Box<Account<'info, Bounty>>,     /// The USDC mint    pub token_mint: Account<'info, Mint>,
  1. Line 12 pub asker: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 15 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 18 seeds = [BOUNTY_SEED, question_id.as_ref(), asker.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 19 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.

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 devnpm run dev -w app
.npm run buildnpm run build -w app
.npm run testnode app/test/e2e.mjs
.npm run lintnpm run lint -w app
.npm run deploycd app && npx vercel --prod
appnpm run devnext dev
appnpm run startnext start
appnpm run buildnext build
appnpm run testnode test/e2e.mjs
appnpm run linteslint .
packages/mcp-servernpm run startnode dist/index.js
packages/mcp-servernpm run buildtsc
packages/contractsnpm run lintprettier */*.js "*/**/*{.js,.ts}" --check
packages/sdk-jsnpm run buildtsc
packages/sdk-jsnpm run testnode test.mjs
packages/contractsanchor buildcompile programs and generate IDLs

What you could build from it

Used in lessons