Documentation ¶
Index ¶
Constants ¶
View Source
const PercentDenominator = 1_000_000
PercentDenominator is the denominator used to calculate percentages
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Calculator ¶
type Calculator interface {
Calculate(stakedDuration time.Duration, currentTime time.Time, stakedAmount uint64) uint64
}
func NewCalculator ¶
func NewCalculator(c Config) Calculator
type Config ¶
type Config struct { // MinStakePeriod is the minimal stake duration. MinStakePeriod time.Duration // MaxStakePeriod is the maximum stake duration. MaxStakePeriod time.Duration // stake period equal to MaxStakePeriod. StakePeriodRewardShare uint64 // Restrictions: // - Must be > 0 // - Must be <= [reward.PercentDenominator] StartRewardShare uint64 `serialize:"true" json:"startRewardShare"` // StartRewardTime is the starting timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // Restrictions: // - Must be > 0 // - Must be <= [TargetRewardTime] StartRewardTime uint64 `serialize:"true" json:"startRewardTime"` // Restrictions: // - Must be > 0 // - Must be <= [StartRewardShare] DiminishingRewardShare uint64 `serialize:"true" json:"diminishingRewardShare"` // DiminishingRewardTime is the target timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // Restrictions: // - Must be >= [StartRewardTime] DiminishingRewardTime uint64 `serialize:"true" json:"diminishingRewardTime"` // Restrictions: // - Must be > 0 // - Must be <= [DiminishingRewardShare] TargetRewardShare uint64 `serialize:"true" json:"targetRewardShare"` // TargetRewardTime is the target timestamp that will be used to calculate // the remaining percentage of rewards given to validators. // Restrictions: // - Must be >= [DiminishingRewardTime] TargetRewardTime uint64 `serialize:"true" json:"targetRewardTime"` }
Click to show internal directories.
Click to hide internal directories.