Overview
The resource_credits contract enables an on-chain credit ledger for resource usage (printing, meeting room minutes, amenities) but is currently unimplemented. This is the blockchain layer for the credit/hour packs feature.
Context
- Language: Rust 2021 edition, Soroban SDK (
no_std)
access_control contract governs who can issue credits — only hub admin should mint
- Credits are fungible units (represented as i128) that can be issued and spent
Tasks
Files to Modify / Create
contracts/resource_credits/src/ (all source files)
Overview
The
resource_creditscontract enables an on-chain credit ledger for resource usage (printing, meeting room minutes, amenities) but is currently unimplemented. This is the blockchain layer for the credit/hour packs feature.Context
no_std)access_controlcontract governs who can issue credits — only hub admin should mintTasks
issue_credits(member_address, amount, issued_by)— admin mints credit units to a member's balancespend_credits(member_address, amount, resource_id)— deducts credits; panics if balance insufficientget_balance(member_address)→ i128 — returns current balanceget_transaction_history(member_address)→ Vec of credit events (issue/spend with timestamp and resource_id)access_control) can callissue_creditsFiles to Modify / Create
contracts/resource_credits/src/(all source files)