apr

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInsufficientEpoch is returned when insufficient past epochs for apr computation
	ErrInsufficientEpoch = errors.New("insufficient past epochs to compute apr")
	// ErrCouldNotRetreiveHeaderByNumber is returned when fail to retrieve header by number
	ErrCouldNotRetreiveHeaderByNumber = errors.New("could not retrieve header by number")
	// ErrZeroStakeOneEpochAgo is returned when total delegation is zero for one epoch ago
	ErrZeroStakeOneEpochAgo = errors.New("zero total delegation one epoch ago")
)

Functions

func ComputeForValidator

func ComputeForValidator(
	bc Reader,
	block *types.Block,
	wrapper *staking.ValidatorWrapper,
) (*numeric.Dec, error)

ComputeForValidator ..

Types

type Reader

type Reader interface {
	GetHeaderByNumber(number uint64) *block.Header
	Config() *params.ChainConfig
	GetHeaderByHash(hash common.Hash) *block.Header
	// GetHeader retrieves a block header from the database by hash and number.
	GetHeader(hash common.Hash, number uint64) *block.Header
	CurrentHeader() *block.Header
	ReadValidatorSnapshotAtEpoch(
		epoch *big.Int,
		addr common.Address,
	) (*staking.ValidatorSnapshot, error)
}

Reader ..

Jump to

Keyboard shortcuts

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