2023-09-22 16:05:12 +00:00
|
|
|
package v2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
|
|
|
2023-09-26 17:08:26 +00:00
|
|
|
sdkmath "cosmossdk.io/math"
|
2024-08-03 09:51:56 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/community/types"
|
2023-09-22 16:05:12 +00:00
|
|
|
"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(
|
2023-09-26 17:08:26 +00:00
|
|
|
time.Time{},
|
|
|
|
sdkmath.LegacyNewDec(0),
|
2023-10-03 15:41:54 +00:00
|
|
|
sdkmath.LegacyNewDec(0),
|
2023-09-22 16:05:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if err := params.Validate(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
bz := cdc.MustMarshal(¶ms)
|
|
|
|
store.Set(types.ParamsKey, bz)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|