/
getters_params.go
51 lines (41 loc) · 1.42 KB
/
getters_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
44
45
46
47
48
49
50
51
package keeper
import (
"github.com/KYVENetwork/chain/x/global/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GetParams returns the current x/global module parameters.
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ParamsKey)
if bz == nil {
return params
}
k.cdc.MustUnmarshal(bz, ¶ms)
return params
}
// GetMinGasPrice returns the MinGasPrice param.
func (k Keeper) GetMinGasPrice(ctx sdk.Context) (res sdk.Dec) {
return k.GetParams(ctx).MinGasPrice
}
// GetBurnRatio returns the BurnRatio param.
func (k Keeper) GetBurnRatio(ctx sdk.Context) (res sdk.Dec) {
return k.GetParams(ctx).BurnRatio
}
// GetGasAdjustments returns the GasAdjustments param.
func (k Keeper) GetGasAdjustments(ctx sdk.Context) (res []types.GasAdjustment) {
return k.GetParams(ctx).GasAdjustments
}
// GetGasRefunds returns the GasRefunds param.
func (k Keeper) GetGasRefunds(ctx sdk.Context) (res []types.GasRefund) {
return k.GetParams(ctx).GasRefunds
}
// GetMinInitialDepositRatio returns the MinInitialDepositRatio param.
func (k Keeper) GetMinInitialDepositRatio(ctx sdk.Context) (res sdk.Dec) {
return k.GetParams(ctx).MinInitialDepositRatio
}
// SetParams sets the x/global module parameters.
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshal(¶ms)
store.Set(types.ParamsKey, bz)
}