/
params.go
60 lines (50 loc) · 1.66 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
54
55
56
57
58
59
60
package keeper
import (
"github.com/Fairblock/fairyring/x/keyshare/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// GetParams get all parameters as types.Params
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
return types.NewParams(
k.KeyExpiry(ctx),
k.TrustedAddresses(ctx),
k.MinimumBonded(ctx),
k.SlashFractionNoKeyshare(ctx),
k.SlashFractionWrongKeyshare(ctx),
k.MaxIdledBlock(ctx),
)
}
// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {
k.paramstore.SetParamSet(ctx, ¶ms)
}
// KeyExpiry returns the KeyExpiry param
func (k Keeper) KeyExpiry(ctx sdk.Context) (res uint64) {
k.paramstore.Get(ctx, types.KeyKeyExpiry, &res)
return
}
// TrustedAddresses returns the TrustedAddresses param
func (k Keeper) TrustedAddresses(ctx sdk.Context) (res []string) {
k.paramstore.Get(ctx, types.KeyTrustedAddresses, &res)
return
}
// MinimumBonded returns the MinimumBonded param
func (k Keeper) MinimumBonded(ctx sdk.Context) (res uint64) {
k.paramstore.Get(ctx, types.KeyMinimumBonded, &res)
return
}
// SlashFractionNoKeyshare returns the SlashFractionNoKeyshare param
func (k Keeper) SlashFractionNoKeyshare(ctx sdk.Context) (res sdk.Dec) {
k.paramstore.Get(ctx, types.KeySlashFractionNoKeyShare, &res)
return
}
// SlashFractionWrongKeyshare returns the SlashFractionWrongKeyshare param
func (k Keeper) SlashFractionWrongKeyshare(ctx sdk.Context) (res sdk.Dec) {
k.paramstore.Get(ctx, types.KeySlashFractionWrongKeyShare, &res)
return
}
// MaxIdledBlock returns the MaxIdledBlock param
func (k Keeper) MaxIdledBlock(ctx sdk.Context) (res uint64) {
k.paramstore.Get(ctx, types.KeyMaxIdledBlock, &res)
return
}