Skip to content

Commit 0a59a0a

Browse files
configure a limit on the number of blocks when a validator can receive rewards
1 parent fd0cdea commit 0a59a0a

File tree

3 files changed

+66
-23
lines changed

3 files changed

+66
-23
lines changed

proto/cosmos/mint/v1beta1/mint.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ message Params {
1515
// expected blocks per month
1616
uint64 blocks_per_month = 2;
1717
// block when no additional tokens will be minted
18+
uint64 end_block = 3;
1819

19-
cosmos.base.v1beta1.Coin month_reward = 3
20+
cosmos.base.v1beta1.Coin month_reward = 4
2021
[(gogoproto.nullable) = false, (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin"];
2122
}

x/mint/abci.go

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
1515
// fetch stored minter & params
1616
params := k.GetParams(ctx)
1717

18+
// skip if all tokens already minted
19+
if uint64(ctx.BlockHeight()) >= params.EndBlock {
20+
return
21+
}
1822
monthReward := sdk.NewDecFromInt(params.MonthReward.Amount)
1923
mintedAmount := monthReward.QuoInt(sdk.NewInt(int64(params.BlocksPerMonth)))
2024

x/mint/types/mint.pb.go

+60-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)