cosmos-sdk/x/mint/keeper/migrator.go

29 lines
848 B
Go

package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/mint/exported"
v2 "github.com/cosmos/cosmos-sdk/x/mint/migrations/v2"
)
// Migrator is a struct for handling in-place state migrations.
type Migrator struct {
keeper Keeper
legacySubspace exported.Subspace
}
func NewMigrator(k Keeper, ss exported.Subspace) Migrator {
return Migrator{
keeper: k,
legacySubspace: ss,
}
}
// Migrate1to2 migrates the x/mint module state from the consensus version 1 to
// version 2. Specifically, it takes the parameters that are currently stored
// and managed by the x/params modules and stores them directly into the x/mint
// module state.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.Migrate(ctx, ctx.KVStore(m.keeper.storeKey), m.legacySubspace, m.keeper.cdc)
}