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

29 lines
846 B
Go

package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/crisis/exported"
v2 "github.com/cosmos/cosmos-sdk/x/crisis/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.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc)
}