0g-chain/x/community/migrations/v2/store.go
Nick DeLuca 57a1a4b10d
Community Param Updates (#1741)
* refactor param validation test cases to be shared by genesis and params
tests

* add additional test case for zero staking rewards in order to ensure
no regressions in support for turning off rewards

* add test case to ensure default params are valid -- prevent regression
if defaults change to an invalid state during updates of validation or
defaults

* zero out parameters in migration -- this module will be used with
existing chains and parameters should be set after migrations in
each upgrade handler

* update StakingRewardsPerSecond to an 18 decimal type in order to
reduce error

* add community grpc rest endpoints to swagger

* Fix copy pasta query name to refer to correct Community module

Co-authored-by: drklee3 <derrick@dlee.dev>

* generate swagger changes from previous commit

---------

Co-authored-by: drklee3 <derrick@dlee.dev>
2023-09-26 10:08:26 -07:00

39 lines
733 B
Go

package v2
import (
"time"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/x/community/types"
)
const (
ModuleName = "mint"
)
// 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),
)
if err := params.Validate(); err != nil {
return err
}
bz := cdc.MustMarshal(&params)
store.Set(types.ParamsKey, bz)
return nil
}