feat(contracts): add read-only view functions to all contract modules - #446
Merged
Merged
Conversation
3 tasks
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.
Closes #433
PR Description
feat(giveaway): add read-only view functions
Summary
Adds read-only view functions to all contract modules (giveaway, admin, mutual_aid) to enable off-chain clients to query contract state without manually decoding raw storage keys.
Changes
Giveaway Module (
contracts/geev-core/src/giveaway.rs)get_giveaway(giveaway_id: u64) -> Option<Giveaway>- Retrieve complete giveaway dataget_winners(giveaway_id: u64) -> Vec<Address>- Get list of winners for a giveawayget_participants(giveaway_id: u64) -> Vec<Address>- Get all participants in a giveawayhas_claimed(giveaway_id: u64, winner: Address) -> bool- Check if winner has claimed their prizeAdmin Module (
contracts/geev-core/src/admin.rs)get_collected_fees() -> i128- View total collected platform feesMutual Aid Module (
contracts/geev-core/src/mutual_aid.rs)get_all_requests() -> Vec<(u64, Request)>- Retrieve all mutual aid requestsis_open(request_id: u64) -> bool- Check if request is openis_completed(request_id: u64) -> bool- Check if request is completedTesting
Documentation
contracts/README.mdwith full API documentation for all new view functionsBenefits
DataKeyor storage structs won't break off-chain clientsget_profile,get_request)Option/emptyVecfor missing dataBreaking Changes
None - this is purely additive functionality
Branch
feat/giveaway-view-functions