forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrator.go
28 lines (24 loc) · 846 Bytes
/
migrator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
}