Sol.College

Structure lesson (licence does not allow quoting code)

Carbon_Credit_Exchange

Original
Rapidsnopp/Carbon_Credit_Exchange
SuperStack fork
Blockchains/Carbon_Credit_Exchange @ 104a60d
Stars
0
Last push (original)
2025-10-31
Languages
TypeScript, JavaScript, Rust, CSS, HTML
Detected stack
AnchorMetaplexweb3.js
Categories
Other
Licence
none detected: code not quoted on Sol.College

Architecture

97 source files. By extension: .ts ×39, .tsx ×33, .rs ×11, .js ×9, .jsx ×5.

Top-level directorySource files
frontend61
backend19
contracts12
scripts5

On-chain programs: contracts/carbon-credit-exchange/programs/carbon-credit-exchange

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
initializeInitializecontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/lib.rs:19
cancel_listingCancelListingcontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/lib.rs:40
buy_carbon_creditBuyCarbonCreditcontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/lib.rs:44
handlerRetireCarbonCreditcontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/retire_carbon_credit.rs:43
handlerListForSalecontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/list_for_sale.rs:37
handlerCancelListingcontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/cancel_listing.rs:32
handlerInitializecontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/initialize.rs:21
handlerBuyCarbonCreditcontracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/buy_carbon_credit.rs:57

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
frontend/src/services/solana.jsPublicKey, getAssociatedTokenAddress, findProgramAddressSync, SystemProgram, Program, getAccountInfo
backend/src/services/solanaService.tsPublicKey, findProgramAddressSync, Program, getAssociatedTokenAddress, getAccountInfo, Transaction
scripts/mint-test-nfts.tsPublicKey, Program, Keypair, findProgramAddressSync, AnchorProvider, Connection
scripts/initialize-exchange.tsPublicKey, Keypair, requestAirdrop, getBalance, Program, SystemProgram
scripts/test-mint.tsPublicKey, Keypair, findProgramAddressSync, getAccountInfo, SystemProgram, getAssociatedTokenAddress
frontend/src/services/metaplex.tsPublicKey, Connection, findProgramAddressSync, getAccountInfo
contracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/instructions/buy_carbon_credit.rsProgram, transfer, invoke, AccountInfo, init_if_needed, seeds
frontend/src/services/homeData.tsConnection, AnchorProvider, PublicKey, Program
scripts/check-exchange.tsPublicKey, Program, Connection, findProgramAddressSync, getAccountInfo
contracts/carbon-credit-exchange/programs/carbon-credit-exchange/src/events.rsPubkey
frontend/src/config/constants.jsProgram, PublicKey
frontend/src/temp/NFTDetails.tsxuseConnection, useWallet, PublicKey, AnchorProvider

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/carbon-credit-exchange/. 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
contracts/carbon-credit-exchangenpm run test
contracts/carbon-credit-exchangenpm run lint
frontendnpm run dev
frontendnpm run build
frontendnpm run lint
backendnpm run dev
backendnpm run start
backendnpm run build
backendnpm run test
backendnpm run lint
.anchor build
.anchor test
.anchor run test

What you could build from it