Skip to content

Commit

Permalink
Added BeginBlock logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Sep 20, 2021
1 parent d912ba9 commit 7b61628
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions x/mint/abci.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package mint

import (
sdk "github.com/cosmos/cosmos-sdk/types"
abcitypes "github.com/tendermint/tendermint/abci/types"

"github.com/sentinel-official/hub/x/mint/keeper"
"github.com/sentinel-official/hub/x/mint/types"
)

func BeginBlock(ctx sdk.Context, k keeper.Keeper) []abcitypes.ValidatorUpdate {
k.IterateInflations(ctx, func(_ int, inflation types.Inflation) bool {
if inflation.Timestamp.After(ctx.BlockTime()) {
return true
}

params := k.GetParams(ctx)
params.InflationMax = inflation.Max
params.InflationMin = inflation.Min
params.InflationRateChange = inflation.RateChange

k.SetParams(ctx, params)
k.DeleteInflation(ctx, inflation.Timestamp)

return false
})

return nil
}

0 comments on commit 7b61628

Please sign in to comment.