mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-04-04 15:55:23 +00:00
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package v1
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
|
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
|
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
|
)
|
|
|
|
const (
|
|
UpgradeName = "v1"
|
|
)
|
|
|
|
func CreateUpgradeHandler(
|
|
mm *module.Manager,
|
|
configurator module.Configurator,
|
|
mk mintkeeper.Keeper,
|
|
pk paramskeeper.Keeper,
|
|
) upgradetypes.UpgradeHandler {
|
|
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
|
|
subspace, _ := pk.GetSubspace(minttypes.ModuleName)
|
|
params := minttypes.DefaultParams()
|
|
subspace.Get(ctx, minttypes.KeyMintDenom, ¶ms.MintDenom)
|
|
subspace.Get(ctx, minttypes.KeyInflationRateChange, ¶ms.InflationRateChange)
|
|
subspace.Get(ctx, minttypes.KeyInflationMax, ¶ms.InflationMax)
|
|
subspace.Get(ctx, minttypes.KeyInflationMin, ¶ms.InflationMin)
|
|
subspace.Get(ctx, minttypes.KeyGoalBonded, ¶ms.GoalBonded)
|
|
subspace.Get(ctx, minttypes.KeyBlocksPerYear, ¶ms.BlocksPerYear)
|
|
ctx.Logger().Info("Mint module parameters", "params", params)
|
|
mk.SetParams(ctx, params)
|
|
return mm.RunMigrations(ctx, configurator, vm)
|
|
}
|
|
}
|