github.com/cosmos/cosmos-sdk@v0.50.10/x/mint/keeper/migrator.go (about) 1 package keeper 2 3 import ( 4 sdk "github.com/cosmos/cosmos-sdk/types" 5 "github.com/cosmos/cosmos-sdk/x/mint/exported" 6 v2 "github.com/cosmos/cosmos-sdk/x/mint/migrations/v2" 7 ) 8 9 // Migrator is a struct for handling in-place state migrations. 10 type Migrator struct { 11 keeper Keeper 12 legacySubspace exported.Subspace 13 } 14 15 // NewMigrator returns Migrator instance for the state migration. 16 func NewMigrator(k Keeper, ss exported.Subspace) Migrator { 17 return Migrator{ 18 keeper: k, 19 legacySubspace: ss, 20 } 21 } 22 23 // Migrate1to2 migrates the x/mint module state from the consensus version 1 to 24 // version 2. Specifically, it takes the parameters that are currently stored 25 // and managed by the x/params modules and stores them directly into the x/mint 26 // module state. 27 func (m Migrator) Migrate1to2(ctx sdk.Context) error { 28 return v2.Migrate(ctx, m.keeper.storeService.OpenKVStore(ctx), m.legacySubspace, m.keeper.cdc) 29 }