0g-chain/x/community/migrations/v2/store.go
2024-08-03 15:03:23 +08:00

36 lines
729 B
Go

package v2
import (
"time"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdkmath "cosmossdk.io/math"
"github.com/0glabs/0g-chain/x/community/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// Migrate migrates the x/community module state from the consensus version 1 to
// version 2. Specifically, sets new parameters in the module state.
func Migrate(
ctx sdk.Context,
store storetypes.KVStore,
cdc codec.BinaryCodec,
) error {
params := types.NewParams(
time.Time{},
sdkmath.LegacyNewDec(0),
sdkmath.LegacyNewDec(0),
)
if err := params.Validate(); err != nil {
return err
}
bz := cdc.MustMarshal(&params)
store.Set(types.ParamsKey, bz)
return nil
}