/
params.go
43 lines (34 loc) · 1021 Bytes
/
params.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/osmosis-labs/mesh-security-sdk/x/meshsecurity/types"
)
// SetParams sets the module's parameters.
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
}
// GetParams gets the module's parameters.
func (k Keeper) GetParams(clientCtx sdk.Context) (params types.Params) {
store := clientCtx.KVStore(k.storeKey)
bz := store.Get(types.ParamsKey)
if bz == nil {
return params
}
k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
func (k Keeper) GetMaxSudoGas(ctx sdk.Context) sdk.Gas {
return sdk.Gas(k.GetParams(ctx).MaxGasEndBlocker)
}
func (k Keeper) GetRebalanceEpochLength(ctx sdk.Context) uint64 {
return uint64(k.GetParams(ctx).EpochLength)
}
func (k Keeper) GetTotalContractsMaxCap(ctx sdk.Context) sdk.Coin {
return k.GetParams(ctx).TotalContractsMaxCap
}