Documentation ¶
Index ¶
- Constants
- func CalculateFeeReward(feePerWeightStored *big.Int, weight uint64, feePerWeightPaid *big.Int) uint64
- func CalculateMintReward(weight uint64, stakerMintRate, accumulatedMintRate *big.Int) uint64
- func NewMintCalculator(config MintConfig, initialSupply uint64) *mintCalculator
- type Calculator
- type Config
- type MintCalculator
- type MintConfig
Constants ¶
View Source
const BitShift uint = 96
View Source
const PercentDenominator = 1_000_000
PercentDenominator is the denominator used to calculate percentages
Variables ¶
This section is empty.
Functions ¶
func CalculateFeeReward ¶
func CalculateMintReward ¶
func NewMintCalculator ¶
func NewMintCalculator(config MintConfig, initialSupply uint64) *mintCalculator
Types ¶
type Calculator ¶
type Calculator interface {
Calculate(stakedDuration time.Duration, stakedAmount, currentSupply uint64) uint64
}
func NewCalculator ¶
func NewCalculator(c Config) Calculator
type Config ¶
type Config struct { // MaxConsumptionRate is the rate to allocate funds if the validator's stake // duration is equal to [MintingPeriod] MaxConsumptionRate uint64 `json:"maxConsumptionRate"` // MinConsumptionRate is the rate to allocate funds if the validator's stake // duration is 0. MinConsumptionRate uint64 `json:"minConsumptionRate"` // MintingPeriod is period that the staking calculator runs on. It is // not valid for a validator's stake duration to be larger than this. MintingPeriod time.Duration `json:"mintingPeriod"` // SupplyCap is the target value that the reward calculation should be // asymptotic to. SupplyCap uint64 `json:"supplyCap"` }
type MintCalculator ¶
type MintConfig ¶
type MintConfig struct { // MintSince is the Unix Epoch timestamp since which the reward will be // minted MintSince int64 `json:"mintSince"` // MintingPeriod is period of minting MintingPeriod time.Duration `json:"mintingPeriod"` // MintAmount is the percent of the total supply to mint during the minting // period MintRate uint64 `json:"mintRate"` // MintAmount is the maximum amount of tokens to mint during the minting // period MaxMintAmount uint64 `json:"maxMintAmount"` }
Click to show internal directories.
Click to hide internal directories.