apr

package
v0.0.0-...-bf01c4b Latest Latest
Warning

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

Go to latest
Published: Mar 8, 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")
	// ErrZeroStakenetEpochAgo is returned when total delegation is zero for net epoch ago
	ErrZeroStakenetEpochAgo = errors.New("zero total delegation net 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