-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
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
1. add only initial_claim action to get all claim amount
Codecov Report
@@ Coverage Diff @@
## main #42 +/- ##
=======================================
Coverage ? 54.89%
=======================================
Files ? 24
Lines ? 2184
Branches ? 0
=======================================
Hits ? 1199
Misses ? 916
Partials ? 69 |
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
// 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
// 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
return | ||
} | ||
// End Airdrop | ||
goneTime := ctx.BlockTime().Sub(params.AirdropStartTime) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
return | ||
} | ||
// End Airdrop | ||
goneTime := ctx.BlockTime().Sub(params.AirdropStartTime) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
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
// airdrop time passed | ||
err := k.EndAirdrop(ctx) | ||
if err != nil { | ||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods
Description
Closes: #6
Added claim module to support 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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change