57 lines
1.7 KiB
Go
57 lines
1.7 KiB
Go
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
|
|
}
|