-
Notifications
You must be signed in to change notification settings - Fork 6
/
params.go
33 lines (27 loc) · 1019 Bytes
/
params.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
package v3
import (
"github.com/chain4energy/c4e-chain/v2/types/subspace"
v2 "github.com/chain4energy/c4e-chain/v2/x/cfevesting/migrations/v2"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var ParamsKey = []byte{0x00}
// MigrateParams migrates the x/cfevesting 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 module and stores them directly into the x/cfevesting
// module state.
func MigrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, legacySubspace subspace.Subspace, cdc codec.BinaryCodec) error {
store := ctx.KVStore(storeKey)
var currParams v2.Params
if !legacySubspace.HasKeyTable() {
legacySubspace.WithKeyTable(v2.ParamKeyTable())
}
legacySubspace.GetParamSet(ctx, &currParams)
bz, err := cdc.Marshal(&currParams)
if err != nil {
return err
}
store.Set(ParamsKey, bz)
return nil
}