-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
params.go
56 lines (46 loc) · 1.69 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
package keeper
import (
"context"
"time"
"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// UnbondingTime - The time duration for unbonding
func (k Keeper) UnbondingTime(ctx context.Context) (time.Duration, error) {
params, err := k.Params.Get(ctx)
return params.UnbondingTime, err
}
// MaxValidators - Maximum number of validators
func (k Keeper) MaxValidators(ctx context.Context) (uint32, error) {
params, err := k.Params.Get(ctx)
return params.MaxValidators, err
}
// MaxEntries - Maximum number of simultaneous unbonding
// delegations or redelegations (per pair/trio)
func (k Keeper) MaxEntries(ctx context.Context) (uint32, error) {
params, err := k.Params.Get(ctx)
return params.MaxEntries, err
}
// HistoricalEntries = number of historical info entries
// to persist in store
func (k Keeper) HistoricalEntries(ctx context.Context) (uint32, error) {
params, err := k.Params.Get(ctx)
return params.HistoricalEntries, err
}
// BondDenom - Bondable coin denomination
func (k Keeper) BondDenom(ctx context.Context) (string, error) {
params, err := k.Params.Get(ctx)
return params.BondDenom, err
}
// PowerReduction - is the amount of staking tokens required for 1 unit of consensus-engine power.
// Currently, this returns a global variable that the app developer can tweak.
// TODO: we might turn this into an on-chain param:
// https://github.com/cosmos/cosmos-sdk/issues/8365
func (k Keeper) PowerReduction(ctx context.Context) math.Int {
return sdk.DefaultPowerReduction
}
// MinCommissionRate - Minimum validator commission rate
func (k Keeper) MinCommissionRate(ctx context.Context) (math.LegacyDec, error) {
params, err := k.Params.Get(ctx)
return params.MinCommissionRate, err
}