2024-04-24 07:10:22 +00:00
|
|
|
package keeper
|
|
|
|
|
|
|
|
import (
|
2024-04-25 06:13:27 +00:00
|
|
|
"github.com/0glabs/0g-chain/x/council/v1/types"
|
2024-04-24 07:10:22 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
|
|
|
store := ctx.KVStore(k.storeKey)
|
|
|
|
bz := store.Get(types.ParamsKey)
|
|
|
|
if len(bz) == 0 {
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
|
|
|
k.cdc.MustUnmarshal(bz, ¶ms)
|
|
|
|
return params
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
|
|
|
|
store := ctx.KVStore(k.storeKey)
|
|
|
|
bz, err := k.cdc.Marshal(¶ms)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
store.Set(types.ParamsKey, bz)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|