forked from babylonlabs-io/babylon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparams.go
36 lines (30 loc) · 760 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
package keeper
import (
"context"
"github.com/babylonlabs-io/babylon/x/zoneconcierge/types"
)
// SetParams sets the x/zoneconcierge module parameters.
func (k Keeper) SetParams(ctx context.Context, p types.Params) error {
if err := p.Validate(); err != nil {
return err
}
store := k.storeService.OpenKVStore(ctx)
bz := k.cdc.MustMarshal(&p)
if err := store.Set(types.ParamsKey, bz); err != nil {
panic(err)
}
return nil
}
// GetParams returns the current x/zoneconcierge module parameters.
func (k Keeper) GetParams(ctx context.Context) (p types.Params) {
store := k.storeService.OpenKVStore(ctx)
bz, err := store.Get(types.ParamsKey)
if err != nil {
panic(err)
}
if bz == nil {
return p
}
k.cdc.MustUnmarshal(bz, &p)
return p
}