2021-02-25 02:43:31 -08:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2021-07-05 07:55:51 -07:00
|
|
|
v043 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v043"
|
2021-10-08 19:02:16 -07:00
|
|
|
v045 "github.com/cosmos/cosmos-sdk/x/staking/migrations/v045"
|
2021-02-25 02:43:31 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
// Migrator is a struct for handling in-place store migrations.
|
|
|
|
type Migrator struct {
|
|
|
|
keeper Keeper
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewMigrator returns a new Migrator.
|
|
|
|
func NewMigrator(keeper Keeper) Migrator {
|
2021-10-08 19:02:16 -07:00
|
|
|
return Migrator{
|
|
|
|
keeper: keeper,
|
|
|
|
}
|
2021-02-25 02:43:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Migrate1to2 migrates from version 1 to 2.
|
|
|
|
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
|
2021-06-14 07:45:15 -07:00
|
|
|
return v043.MigrateStore(ctx, m.keeper.storeKey)
|
2021-02-25 02:43:31 -08:00
|
|
|
}
|
2021-10-08 19:02:16 -07:00
|
|
|
|
|
|
|
// Migrate2to3 migrates x/staking state from consensus version 2 to 3.
|
|
|
|
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
|
2021-11-12 03:55:55 -08:00
|
|
|
return v045.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc, m.keeper.paramstore)
|
2021-10-08 19:02:16 -07:00
|
|
|
}
|