-
Notifications
You must be signed in to change notification settings - Fork 40
/
params.go
39 lines (31 loc) · 861 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
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/elys-network/elys/x/masterchef/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
store := ctx.KVStore(k.storeKey)
b := store.Get([]byte(types.ParamsKey))
if b == nil {
return
}
k.cdc.MustUnmarshal(b, ¶ms)
return
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
store := ctx.KVStore(k.storeKey)
b := k.cdc.MustMarshal(¶ms)
store.Set([]byte(types.ParamsKey), b)
}
// GetParams get all parameters as types.Params
func (k Keeper) GetLegacyParams(ctx sdk.Context) (params types.LegacyParams) {
store := ctx.KVStore(k.storeKey)
b := store.Get([]byte(types.ParamsKey))
if b == nil {
return
}
k.cdc.MustUnmarshal(b, ¶ms)
return
}