feat(contracts): resource_credits queries + expiry + tests + event_ticketing scaffold#874
Merged
yusuftomilola merged 2 commits intoDistinctCodes:mainfrom Apr 26, 2026
Conversation
…tracts CT-05 (DistinctCodes#769): Add get_balance, get_total_supply, get_admin query functions CT-06 (DistinctCodes#770): Add credit expiry mechanism with expires_at, CreditsExpired, is_expired CT-07 (DistinctCodes#771): Comprehensive test suite for resource_credits contract CT-08 (DistinctCodes#772): Scaffold event_ticketing contract with types, errors, DataKey, initialize - contracts/sandbox/resource_credits: full contract with query functions, expiry mechanism, and 14 tests covering all functions and error paths - contracts/sandbox/event_ticketing: scaffolded contract with Event/Ticket types, 10 error variants, DataKey enum, and initialize stub - contracts/Cargo.toml: added both sandbox contracts to workspace members
|
@Tinna23 is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Tinna23 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
yusuftomilola
approved these changes
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements four issues assigned to @Tinna23 in a single branch.
Closes #769
Closes #770
Closes #771
Closes #772
Changes
CT-05 — Credit balance & supply query functions (#769)
get_balance(env, member) -> u128— returns member's credit balance (0 if unset)get_total_supply(env) -> u128— returns total credits in circulationget_admin(env) -> Result<Address, Error>— returns current adminCT-06 — Credit expiry mechanism (#770)
CreditBalanceintypes.rsgainsexpires_at: Option<u64>mint_creditsaccepts optionalexpires_at: Option<u64>transfer_creditsreturnsError::CreditsExpiredwhen sender's credits are past expiryspend_creditsreturnsError::CreditsExpiredwhen credits are expiredis_expired(env, member) -> boolquery addedCT-07 — Test suite for resource_credits (#771)
14 tests in
src/test.rscovering:initializesets admin and rejects re-initializationmint_creditsincreases balance and total supply; rejects non-admintransfer_creditsmoves credits correctly; fails withInsufficientBalancespend_creditsreduces balance and supply; fails withInsufficientBalanceget_balancereturns 0 for unknown membersget_adminandget_total_supplyreturn correct valuesCT-08 — Scaffold event_ticketing contract (#772)
New contract at
contracts/sandbox/event_ticketing/:Cargo.tomlwith soroban-sdk workspace dependencysrc/types.rs:Event,Ticket,EventStatus,TicketStatussrc/errors.rs: 10 error variants (AdminNotSet,AlreadyInitialized,Unauthorized,EventNotFound,TicketNotFound,EventSoldOut,EventNotActive,InvalidTimeRange,InvalidPrice,TicketNotTransferable)src/lib.rs:DataKeyenum (Admin,PaymentToken,Event(String),EventList,Ticket(String),EventTickets(String),OwnerTickets(Address)) +initializestubWorkspace
sandbox/resource_creditsandsandbox/event_ticketingadded tocontracts/Cargo.tomlworkspace members