reward

package
v1.10.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const PercentDenominator = 1_000_000

PercentDenominator is the denominator used to calculate percentages

Variables

This section is empty.

Functions

func Split

func Split(totalAmount uint64, shares uint32) (uint64, uint64)

Split [totalAmount] into [totalAmount * shares percentage] and the remainder.

Invariant: [shares] <= PercentDenominator

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL