Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes: #XXX ## Context and purpose of the change This PR adds two new queries to make FE development easier. * (k Keeper) GetClaimMetadata(ctx sdk.Context) ([]types.ClaimMetadata, error): Returns a list of claim metadata for all airdrops. It retrieves all airdrop identifiers and the associated epoch information to determine the current round, current round start time, and current round end time for each airdrop. * (k Keeper) GetClaimStatus(ctx sdk.Context, addr sdk.AccAddress) ([]types.ClaimStatus, error): Returns a list of claim statuses associated with the given user account address. It retrieves all airdrop identifiers and checks for each airdrop whether the user has claimed it or not. It filters claims to those a user has a claim record for, if a user has no claim record for an airdrop, nothing is returned. As well as two helper functions * areAllTrue(bools []bool) bool: This function takes a slice of boolean values and checks if all of the values are true. If all values are true, the function returns true. Otherwise, it returns false. * currentAirdropRound(start time.Time) int: This function calculates and returns the current airdrop round number based on the start time. It uses an initial round duration of 90 days and subsequent round durations of 30 days. ## Example query ``` ➜ build git:(query-claim-status-by-address) ✗ ./strided q claim claim-metadata --node http://localhost:26657 claim_metadata: - airdrop_identifier: stride current_round: "1" current_round_end: "2023-04-23T00:00:00Z" current_round_start: "2023-03-23T00:00:00Z" - airdrop_identifier: gaia current_round: "1" current_round_end: "2023-04-23T00:00:00Z" current_round_start: "2023-03-23T00:00:00Z" - airdrop_identifier: osmosis current_round: "1" current_round_end: "2023-04-23T00:00:00Z" current_round_start: "2023-03-23T00:00:00Z" - airdrop_identifier: juno current_round: "1" current_round_end: "2023-04-23T00:00:00Z" current_round_start: "2023-03-23T00:00:00Z" - airdrop_identifier: stars current_round: "1" current_round_end: "2023-04-23T00:00:00Z" current_round_start: "2023-03-23T00:00:00Z" ➜ build git:(query-claim-status-by-address) ✗ ./strided q claim claim-status stride1x2227f8js7c2eag5yy97x8tk2unchhrjp33mrs --node http://localhost:26657 claim_status: - airdrop_identifier: stride claimed: true - airdrop_identifier: gaia - airdrop_identifier: osmosis claimed: true - airdrop_identifier: juno - airdrop_identifier: stars claimed: true ``` ## Brief Changelog ## Author's Checklist I have... - [x] Run and PASSED locally all GAIA integration tests - [ ] If the change is contentful, I either: - [ ] Added a new unit test OR - [ ] Added test cases to existing unit tests - [ ] OR this change is a trivial rework / code cleanup without any test coverage If skipped any of the tests above, explain. ## Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] manually tested (if applicable) - [ ] confirmed the author wrote unit tests for new logic - [ ] reviewed documentation exists and is accurate ## Documentation and Release Note - [ ] Does this pull request introduce a new feature or user-facing behavior changes? - [ ] Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? - [ ] This pull request updates existing proto field values (and require a backend and frontend migration)? - [ ] Does this pull request change existing proto field names (and require a frontend migration)? How is the feature or change documented? - [ ] not applicable - [ ] jira ticket `XXX` - [ ] specification (`x/<module>/spec/`) - [ ] README.md - [ ] not documented
- Loading branch information