Skip to content

Commit

Permalink
upgrade handler added
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Staykov committed Sep 8, 2022
1 parent 0af4589 commit 6fba78d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ func New(
)
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp)

app.UpgradeKeeper.SetUpgradeHandler("v0.9.0", func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
ss, ok := app.ParamsKeeper.GetSubspace(cudoMinttypes.ModuleName)
if ok {
bpd := ss.GetRaw(ctx, []byte("BlocksPerDay"))

bpdString := strings.ReplaceAll(string(bpd), "\"", "")

bpdInt, parseOk := sdk.NewIntFromString(bpdString)
if parseOk {
ss.Set(ctx, []byte("IncrementModifier"), bpdInt)
}
}

return fromVM, nil
})

app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())

// register the staking hooks
Expand Down

0 comments on commit 6fba78d

Please sign in to comment.