Sol.College

Structure lesson (licence does not allow quoting code)

H2U_contracts

Original
HydrogenUkraine/H2U_contracts
SuperStack fork
Blockchains/H2U_contracts @ ad7a094
Stars
0
Last push (original)
2026-08-18
Languages
Rust, TypeScript
Detected stack
AnchorMetaplexweb3.js
Categories
Other
Licence
NOASSERTION: code not quoted on Sol.College

Architecture

67 source files. By extension: .rs ×61, .ts ×6.

Top-level directorySource files
programs61
tests4
migrations1
utils1

On-chain programs: programs/h2u_contracts, programs/marketplace, programs/oracle

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
initialize_producerInitProducerprograms/h2u_contracts/src/lib.rs:15
update_producer_dataUpdateProducerprograms/h2u_contracts/src/lib.rs:19
add_kilowatts_to_eacAddKilowattsEacprograms/h2u_contracts/src/lib.rs:34
burn_eac_certificateBurnEacprograms/h2u_contracts/src/lib.rs:55
mint_h2_nftMintH2programs/h2u_contracts/src/lib.rs:59
producer_register_batchRegisterProduceprograms/h2u_contracts/src/lib.rs:71
update_producerUpdateProducerprograms/h2u_contracts/src/instructions/producer/update_producer.rs:5
init_producerInitProducerprograms/h2u_contracts/src/instructions/producer/initialize_producer.rs:4
register_produceRegisterProduceprograms/h2u_contracts/src/instructions/producer/register_produce.rs:17
add_kilowatts_eacAddKilowattsEacprograms/h2u_contracts/src/instructions/eac/add_kilowatts.rs:5
subtract_kilowatts_eacSubtractKilowattsEacprograms/h2u_contracts/src/instructions/eac/subctract_kilowatts.rs:11
mint_h2_contextMintH2programs/h2u_contracts/src/instructions/h2_canister/mint_nft.rs:46
burn_tokenBurnTokensprograms/h2u_contracts/src/instructions/token/burn.rs:5
mint_tokenMintTokenprograms/h2u_contracts/src/instructions/token/mint.rs:10
initialize_configInitConfigprograms/marketplace/src/lib.rs:14
update_configurationUpdateConfigprograms/marketplace/src/lib.rs:18
list_tokensListH2programs/marketplace/src/lib.rs:22
sell_tokensSellH2programs/marketplace/src/lib.rs:26
sell_h2SellH2programs/marketplace/src/instructions/sell/sell_h2.rs:17
init_configInitConfigprograms/marketplace/src/instructions/config/init_config.rs:4
update_configUpdateConfigprograms/marketplace/src/instructions/config/update_config.rs:4
list_h2ListH2programs/marketplace/src/instructions/list/list_h2.rs:7
init_configInitializeOracleConfigprograms/oracle/src/lib.rs:14
update_priceUpdateOraclePriceprograms/oracle/src/lib.rs:18
update_coinfigUpdateOracleConfigprograms/oracle/src/lib.rs:22
initialize_oracle_configInitializeOracleConfigprograms/oracle/src/instructions/config/init_config.rs:4
update_oracle_configUpdateOracleConfigprograms/oracle/src/instructions/config/update_config.rs:4

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
tests/cases/producer/producer.test.tsPublicKey, findProgramAddressSync, SystemProgram, getAssociatedTokenAddress, Program, Keypair
tests/cases/h2/h2.test.tsPublicKey, Program, SystemProgram, findProgramAddressSync, AnchorProvider, Keypair
programs/marketplace/src/instructions/sell/sell_h2.rstransfer, CpiContext, seeds, Program
tests/cases/marketplace/marketplace.test.tsPublicKey, Program, SystemProgram, AnchorProvider, Keypair
programs/h2u_contracts/src/instructions/eac/initialize_eac.rsProgram, seeds, CpiContext, init_if_needed
programs/h2u_contracts/src/instructions/producer/register_produce.rsProgram, seeds, init_if_needed, AccountInfo
programs/h2u_contracts/src/instructions/h2_canister/initialize_h2_canister.rsProgram, seeds, CpiContext, init_if_needed
programs/h2u_contracts/src/instructions/eac/burn_eac.rsseeds, Program, CpiContext, AccountInfo
programs/h2u_contracts/src/instructions/h2_canister/mint_nft.rsProgram, CpiContext, seeds, AccountInfo
programs/h2u_contracts/src/instructions/token/create.rsProgram, seeds, CpiContext
programs/marketplace/src/instructions/list/list_h2.rsProgram, transfer, CpiContext, seeds
programs/h2u_contracts/src/instructions/token/mint.rsProgram, CpiContext, init_if_needed

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/h2u-contracts/. 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 lint
.anchor build
.anchor test
.anchor run test
.cargo build
.cargo test

What you could build from it