/
params.go
53 lines (44 loc) · 1.4 KB
/
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
52
53
package keeper
import (
"github.com/Fairblock/fairyring/x/pep/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
coin := k.MinGasPrice(ctx)
return types.NewParams(
k.TrustedAddresses(ctx),
k.TrustedCounterParties(ctx),
k.PepChannelID(ctx),
k.KeyshareChannelID(ctx),
&coin,
)
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
// TrustedAddresses returns the TrustedAddresses param
func (k Keeper) TrustedAddresses(ctx sdk.Context) (res []string) {
k.paramstore.Get(ctx, types.KeyTrustedAddresses, &res)
return
}
// TrustedCounterParties returns the TrustedCounterParties param
func (k Keeper) TrustedCounterParties(ctx sdk.Context) (res []*types.TrustedCounterParty) {
k.paramstore.Get(ctx, types.KeyTrustedCounterParties, &res)
return
}
// ChannelID returns the PepChannelID param
func (k Keeper) PepChannelID(ctx sdk.Context) (res string) {
k.paramstore.Get(ctx, types.KeyPepChannelID, &res)
return
}
// KeyshareChannelID returns the KeyshareChannelID param
func (k Keeper) KeyshareChannelID(ctx sdk.Context) (res string) {
k.paramstore.Get(ctx, types.KeyKeyshareChannelID, &res)
return
}
func (k Keeper) MinGasPrice(ctx sdk.Context) (res sdk.Coin) {
k.paramstore.Get(ctx, types.KeyMinGasPrice, &res)
return
}