Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: refactored the claim module #42

Merged
merged 36 commits into from
Jul 6, 2022
Merged

refactor: refactored the claim module #42

merged 36 commits into from
Jul 6, 2022

Conversation

gsk967
Copy link
Contributor

@gsk967 gsk967 commented Jun 6, 2022

Description

Closes: #6

Added claim module to support airdrop

  1. Added Initial_Claim_Action for get total airdrop

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

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...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Sai Kumar added 30 commits January 27, 2022 14:57
1. Change the proto generation with buf
2. Change the `proto-lint` in `Makefile`
1. Add claim records
2. Add claim module params
3. Add claim module keeper functions for airdrop
4. Add grpc_query and cli query for claim module of claim records
1. Removed airdrop actions enum
2. Add airdrop actions as a enum in types
1. skip the tx fee checking for MsgClaim transactions
gsk967 and others added 3 commits May 4, 2022 15:02
@gsk967 gsk967 requested a review from anilcse June 6, 2022 07:35
@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@82c7206). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage        ?   54.89%           
=======================================
  Files           ?       24           
  Lines           ?     2184           
  Branches        ?        0           
=======================================
  Hits            ?     1199           
  Misses          ?      916           
  Partials        ?       69           

Comment on lines +176 to +184
for action := range types.Action_name {
claimableForAction, err := k.GetClaimableAmountForAction(ctx, addr, action)
if err != nil {
return sdk.Coins{}, err
}
if !claimableForAction.IsNil() {
totalClaimable = totalClaimable.Add(claimableForAction)
}
}

Check warning

Code scanning / CodeQL

Iteration over map

Iteration over map may be a possible source of non-determinism
// EndBlocker is called on every block
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
params := k.GetParams(ctx)
if !params.IsAirdropEnabled(ctx.BlockTime()) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// EndBlocker is called on every block
func EndBlocker(ctx sdk.Context, k keeper.Keeper) {
params := k.GetParams(ctx)
if !params.IsAirdropEnabled(ctx.BlockTime()) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
return
}
// End Airdrop
goneTime := ctx.BlockTime().Sub(params.AirdropStartTime)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
return
}
// End Airdrop
goneTime := ctx.BlockTime().Sub(params.AirdropStartTime)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
goneTime := ctx.BlockTime().Sub(params.AirdropStartTime)
if goneTime > params.DurationUntilDecay+params.DurationOfDecay {
// airdrop time passed
err := k.EndAirdrop(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// airdrop time passed
err := k.EndAirdrop(ctx)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
@anilcse anilcse merged commit 84cc2f9 into main Jul 6, 2022
@anilcse anilcse deleted the sai/refactor_claim branch July 6, 2022 06:07
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.

Integrate claim module
3 participants