mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-05-22 23:06:42 +00:00

Take x/dao and x/machine default parameters and store them into the respective module state. Signed-off-by: Julian Strobl <jmastr@mailbox.org>
26 lines
708 B
Go
26 lines
708 B
Go
package v2
|
|
|
|
import (
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/machine/types"
|
|
)
|
|
|
|
// MigrateStore migrates the x/machine module state from the consensus version
|
|
// 1 to version 2. Specifically, it takes the default params and stores them
|
|
// directly into the x/machine module state.
|
|
func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error {
|
|
store := ctx.KVStore(storeKey)
|
|
params := types.DefaultParams()
|
|
|
|
bz, err := cdc.Marshal(¶ms)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
store.Set(types.KeyPrefix(types.ParamsKey), bz)
|
|
|
|
return nil
|
|
}
|