Sol.College

Full lesson

agroflux

Passaporte digital de recebíveis agrícolas com registro verificável na Solana Devnet — Colosseum Crypto World's Fair

What it does

From the project README:

Brazilian farm-input distributors (fertilizer, seed, crop protection) sell on credit, with payment at harvest. They need cash now, and funders (credit funds, banks, cooperatives) are willing to advance it, but every funder asks the same three questions before buying a receivable:
Original
wilgnnerdamas-hub/agroflux
SuperStack fork
Blockchains/agroflux @ ff3c6d9
Stars
0
Last push (original)
2026-10-22
Languages
TypeScript, JavaScript, Rust, CSS
Detected stack
AnchorNext.jsweb3.js
Categories
Other
Licence
MIT
Homepage
https://agroflux-ruby.vercel.app

Architecture

121 source files. By extension: .ts ×82, .tsx ×38, .rs ×1.

Top-level directorySource files
frontend61
backend58
blockchain2

On-chain programs: blockchain/programs/agroflux-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/agroflux/. 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.

wilgnnerdamas-hub/agroflux · blockchain/programs/agroflux-escrow/src/lib.rs L169–192 @ ff3c6d9 · MIT · original
        init_if_needed,        payer = payer,        associated_token::mint = settlement_mint,        associated_token::authority = distributor,        associated_token::token_program = settlement_token_program,    )]    pub distributor_settlement: Box<InterfaceAccount<'info, TokenAccount>>,     /// Registro da liquidação. `init` falha se o token já foi liquidado.    #[account(        init,        payer = payer,        space = 8 + Settlement::INIT_SPACE,        seeds = [SETTLEMENT_SEED, asset_mint.key().as_ref()],        bump,    )]    pub settlement: Account<'info, Settlement>,     /// Trava do documento (v1.2). `init` falha se o documento já foi cedido, mesmo com outro token.    #[account(        init,        payer = payer,        space = 8 + DocumentLock::INIT_SPACE,        seeds = [DOCUMENT_SEED, document_hash.as_ref()],
  1. Line 169 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
  2. Line 179 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 182 seeds = [SETTLEMENT_SEED, asset_mint.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 183 bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
wilgnnerdamas-hub/agroflux · backend/src/chain/assignment.ts L1–24 @ ff3c6d9 · MIT · original
// Cessão tokenizada na Devnet (contrato v1.3, §6.4, §6.5 e §15.3). SIMULAÇÃO: token e moeda sem valor.// 1) Token da cessão: Token-2022, supply 1, decimals 0, metadados só com referência e payloadHash, mint revogado.// 2) Liquidação atômica pelo programa Anchor de escrow (blockchain/programs/agroflux-escrow), com trava por documento.import {  AuthorityType,  ExtensionType,  LENGTH_SIZE,  TOKEN_2022_PROGRAM_ID,  TOKEN_PROGRAM_ID,  TYPE_SIZE,  ASSOCIATED_TOKEN_PROGRAM_ID,  createAssociatedTokenAccountIdempotentInstruction,  createBurnCheckedInstruction,  createInitializeMetadataPointerInstruction,  createInitializeMintInstruction,  createMintToInstruction,  createSetAuthorityInstruction,  getAssociatedTokenAddressSync,  getMint,  getMintLen,  getTokenMetadata,} from "@solana/spl-token";import { createInitializeInstruction, createUpdateAuthorityInstruction, createUpdateFieldInstruction, pack, type TokenMetadata } from "@solana/spl-token-metadata";import { Connection, Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, type Signer } from "@solana/web3.js";
  1. Line 8 TOKEN_2022_PROGRAM_ID,: Targets the Token-2022 program instead of the original Token Program.
  2. Line 16 createMintToInstruction,: Mints new tokens. The mint authority must sign.

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
blockchainnpm run lintprettier */*.js "*/**/*{.js,.ts}" --check
frontendnpm run devnext dev
frontendnpm run startnext start
frontendnpm run buildnext build
frontendnpm run linteslint
backendnpm run devtsx watch src/server.ts
backendnpm run starttsx src/server.ts
backendnpm run testvitest run
blockchainanchor buildcompile programs and generate IDLs
blockchainanchor testlocal validator + test suite
blockchainanchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 \

What you could build from it

Used in lessons