util

package
v0.19.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateDelegatorReward added in v0.11.0

func CalculateDelegatorReward(weight big.Float, remainingReward types.Float) (types.Float, error)

CalculateDelegatorReward calculates delegator reward

func CalculateSuperchargedWeighting added in v0.11.0

func CalculateSuperchargedWeighting(block model.Block) (types.Float, error)

CalculateSuperchargedWeighting calculates supercharged weighting for given block supercharged weighting = 1 + (1 / (1 + transaction fees / coinbase))

func CalculateValidatorReward added in v0.11.0

func CalculateValidatorReward(blockReward types.Amount, validatorFee types.Float) (types.Float, error)

CalculateValidatorReward calculates validator reward

func CalculateWeight added in v0.11.0

func CalculateWeight(balance types.Amount, totalStakedAmount types.Amount) (types.Float, error)

CalculateWeight calculates weight

func CalculateWeightsNonSupercharged added in v0.11.0

func CalculateWeightsNonSupercharged(delegations []model.Delegation) error

CalculateWeightsNonSupercharged calculates weights when block reward is not doubled for supercharged

func CalculateWeightsSupercharged added in v0.11.0

func CalculateWeightsSupercharged(superchargedWeighting types.Float, delegations []model.Delegation, records []model.LedgerEntry) error

CalculateWeightsSupercharged calculates weights when block reward is doubled for supercharged

func DayInterval

func DayInterval(t time.Time) (time.Time, time.Time)

DayInterval returns a time interval for 24h

func HourInterval

func HourInterval(t time.Time) (time.Time, time.Time)

HourInterval returns a time interval for an hour

func MustInt64

func MustInt64(input string) int64

MustInt64 returns an Int64 value without an error

func MustTime

func MustTime(input string) time.Time

MustTime returns a time from a string

func MustUInt64

func MustUInt64(input string) uint64

MustUInt64 returns an UInt64 value without an error

func ParseBase58

func ParseBase58(input string) []byte

ParseBase58 returns a decoded base58 data

func ParseInt

func ParseInt(input string) (int, error)

func ParseInt64

func ParseInt64(input string) (int64, error)

ParseInt64 returns an Int64 from a string

func ParseMemoText

func ParseMemoText(input string) string

ParseMemoText returns memo plaintext from base58 data

func ParseTime

func ParseTime(input string) (*time.Time, error)

ParseTime returns a timestamp from a string

func ParseUInt64

func ParseUInt64(input string) (uint64, error)

ParseUInt64 returns an UInt64 from a string

func SHA1

func SHA1(input string) string

SHA1 returns a SHA1 digest of a given string in hex format

Types

This section is empty.

Jump to

Keyboard shortcuts

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