Skip to content

Implement buy_ticket storage updates#252

Open
Utilitycoder wants to merge 1 commit intoWeb3Novalabs:mainfrom
Utilitycoder:issue-198-buy-ticket-storage-updates
Open

Implement buy_ticket storage updates#252
Utilitycoder wants to merge 1 commit intoWeb3Novalabs:mainfrom
Utilitycoder:issue-198-buy-ticket-storage-updates

Conversation

@Utilitycoder
Copy link

@Utilitycoder Utilitycoder commented Mar 26, 2026

Description

This PR implements storage updates for the buy_ticket function as specified in issue #198. It adds EventMetrics to track ticket sales and ensures UserTicket is correctly recorded for buyers.

Changes

  • Types: Added EventMetrics struct and EventMetrics(u64) storage key.
  • Interface: Added get_event_metrics and is_ticket_buyer to CrowdfundingTrait for better transparency and testing.
  • Implementation: Updated buy_ticket to increment tickets_sold in EventMetrics and implemented the new getters.
  • Testing: Added state logic tests in buy_ticket_test.rs to verify that metrics are updated and user tickets are recorded.

Verification

  • cargo build --target wasm32-unknown-unknown --release succeeded.
  • cargo test buy_ticket_test passed all 13 tests.

Closes #198

@drips-wave
Copy link

drips-wave bot commented Mar 26, 2026

@Utilitycoder 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement buy_ticket storage updates

1 participant