-
Notifications
You must be signed in to change notification settings - Fork 28
/
migrate.go
36 lines (30 loc) · 899 Bytes
/
migrate.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
29
30
31
32
33
34
35
36
package v3
import (
"github.com/OmniFlix/omniflixhub/v2/x/marketplace/exported"
"github.com/OmniFlix/omniflixhub/v2/x/marketplace/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "marketplace"
)
var ParamsKey = []byte{0x15}
// Migrate migrates the x/marketplace module state from the consensus version 2 to
// version 3. Specifically, it takes the parameters that are currently stored
// and managed by the x/params modules and stores them directly into the x/marketplace
// module state.
func Migrate(
ctx sdk.Context,
store sdk.KVStore,
legacySubspace exported.Subspace,
cdc codec.BinaryCodec,
) error {
var currParams types.Params
legacySubspace.GetParamSet(ctx, &currParams)
if err := currParams.ValidateBasic(); err != nil {
return err
}
bz := cdc.MustMarshal(&currParams)
store.Set(ParamsKey, bz)
return nil
}