-
Notifications
You must be signed in to change notification settings - Fork 22
/
params.go
77 lines (64 loc) · 1.8 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package keeper
import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stratosnet/stratos-chain/x/register/types"
)
// SetParams sets the params on the store
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error {
if err := params.Validate(); err != nil {
return err
}
store := ctx.KVStore(k.storeKey)
bz := k.cdc.MustMarshal(¶ms)
store.Set(types.ParamsKey, bz)
return nil
}
// GetParams returns the params from the store
func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ParamsKey)
if bz == nil {
return p
}
k.cdc.MustUnmarshal(bz, &p)
return p
}
// BondDenom - Bondable coin denomination
func (k Keeper) BondDenom(ctx sdk.Context) (res string) {
params := k.GetParams(ctx)
res = params.GetBondDenom()
return
}
// MaxEntries - Maximum number of simultaneous unbonding
// delegations or redelegations (per pair/trio)
func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32) {
params := k.GetParams(ctx)
res = params.GetMaxEntries()
return
}
func (k Keeper) UnbondingThreasholdTime(ctx sdk.Context) (res time.Duration) {
params := k.GetParams(ctx)
res = params.GetUnbondingThreasholdTime()
return
}
func (k Keeper) UnbondingCompletionTime(ctx sdk.Context) (res time.Duration) {
params := k.GetParams(ctx)
res = params.GetUnbondingCompletionTime()
return
}
func (k Keeper) ResourceNodeRegEnabled(ctx sdk.Context) (res bool) {
params := k.GetParams(ctx)
res = params.GetResourceNodeRegEnabled()
return
}
func (k Keeper) ResourceNodeMinDeposit(ctx sdk.Context) (res sdk.Coin) {
params := k.GetParams(ctx)
res = params.GetResourceNodeMinDeposit()
return
}
func (k Keeper) VotingPeriod(ctx sdk.Context) (res time.Duration) {
params := k.GetParams(ctx)
res = params.GetVotingPeriod()
return
}