rewards

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: GPL-3.0 Imports: 35 Imported by: 3

Documentation

Overview

Experimenting with an alternate language style - named return params

Index

Constants

View Source
const (
	SmoothingPoolDetailsBatchSize uint64 = 20
	RewardsFileVersion            uint64 = 1
)

Settings

Variables

This section is empty.

Functions

func DownloadRewardsFile

func DownloadRewardsFile(cfg *config.RocketPoolConfig, interval uint64, cid string, isDaemon bool) error

Downloads a single rewards file

func GetClaimIntervalTime

func GetClaimIntervalTime(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (time.Duration, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetClaimStatus

func GetClaimStatus(rp *rocketpool.RocketPool, nodeAddress common.Address) (unclaimed []uint64, claimed []uint64, err error)

Gets the intervals the node can claim and the intervals that have already been claimed

func GetELBlockHeaderForTime

func GetELBlockHeaderForTime(targetTime time.Time, ec rocketpool.ExecutionClient) (*types.Header, error)

Get the number of the latest EL block that was created before the given timestamp

func GetNodeOperatorRewardsPercent

func GetNodeOperatorRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetPendingRPLRewards

func GetPendingRPLRewards(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetProtocolDaoRewardsPercent

func GetProtocolDaoRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetTrustedNodeOperatorRewardsPercent

func GetTrustedNodeOperatorRewardsPercent(cfg *config.RocketPoolConfig, index uint64, rp *rocketpool.RocketPool, opts *bind.CallOpts) (*big.Int, error)

TODO: temp until rocketpool-go supports RocketStorage contract address lookups per block

func GetUpgradedRewardSnapshotEvent

func GetUpgradedRewardSnapshotEvent(cfg *config.RocketPoolConfig, rp *rocketpool.RocketPool, index uint64, intervalSize *big.Int, startBlock *big.Int) (rewards.RewardsEvent, error)

This retrieves the rewards snapshot event from a set of contracts, upgrading it to the latest struct version

Types

type CommitteeInfo

type CommitteeInfo struct {
	Index     uint64
	Positions map[int]*MinipoolInfo
}

type IntervalDutiesInfo

type IntervalDutiesInfo struct {
	Index uint64
	Slots map[uint64]*SlotInfo
}

type IntervalInfo

type IntervalInfo struct {
	Index                  uint64        `json:"index"`
	TreeFilePath           string        `json:"treeFilePath"`
	TreeFileExists         bool          `json:"treeFileExists"`
	MerkleRootValid        bool          `json:"merkleRootValid"`
	CID                    string        `json:"cid"`
	StartTime              time.Time     `json:"startTime"`
	EndTime                time.Time     `json:"endTime"`
	NodeExists             bool          `json:"nodeExists"`
	CollateralRplAmount    *QuotedBigInt `json:"collateralRplAmount"`
	ODaoRplAmount          *QuotedBigInt `json:"oDaoRplAmount"`
	SmoothingPoolEthAmount *QuotedBigInt `json:"smoothingPoolEthAmount"`
	MerkleProof            []common.Hash `json:"merkleProof"`
}

Information about an interval

func GetIntervalInfo

func GetIntervalInfo(rp *rocketpool.RocketPool, cfg *config.RocketPoolConfig, nodeAddress common.Address, interval uint64) (info IntervalInfo, err error)

Gets the information for an interval including the file status, the validity, and the node's rewards

type MinipoolInfo

type MinipoolInfo struct {
	Address                 common.Address
	ValidatorPubkey         types.ValidatorPubkey
	ValidatorIndex          uint64
	NodeAddress             common.Address
	NodeIndex               uint64
	Fee                     *big.Int
	MissedAttestations      uint64
	GoodAttestations        uint64
	MinipoolShare           *big.Int
	MissingAttestationSlots map[uint64]bool
	WasActive               bool
}

type MinipoolPerformanceFile

type MinipoolPerformanceFile struct {
	Index               uint64                                               `json:"index"`
	Network             string                                               `json:"network"`
	MinipoolPerformance map[common.Address]*SmoothingPoolMinipoolPerformance `json:"minipoolPerformance"`
}

Holds information

type NetworkRewardsInfo

type NetworkRewardsInfo struct {
	CollateralRpl    *QuotedBigInt `json:"collateralRpl"`
	OracleDaoRpl     *QuotedBigInt `json:"oracleDaoRpl"`
	SmoothingPoolEth *QuotedBigInt `json:"smoothingPoolEth"`
}

Rewards per network

type NodeRewardsInfo

type NodeRewardsInfo struct {
	RewardNetwork                uint64        `json:"rewardNetwork"`
	CollateralRpl                *QuotedBigInt `json:"collateralRpl"`
	OracleDaoRpl                 *QuotedBigInt `json:"oracleDaoRpl"`
	SmoothingPoolEth             *QuotedBigInt `json:"smoothingPoolEth"`
	SmoothingPoolEligibilityRate float64       `json:"smoothingPoolEligibilityRate"`
	MerkleData                   []byte        `json:"-"`
	MerkleProof                  []string      `json:"merkleProof"`
}

Node operator rewards

func (*NodeRewardsInfo) GetMerkleProof

func (n *NodeRewardsInfo) GetMerkleProof() ([]common.Hash, error)

Get the deserialized Merkle Proof bytes

type NodeSmoothingDetails

type NodeSmoothingDetails struct {
	Address          common.Address
	IsEligible       bool
	IsOptedIn        bool
	StatusChangeTime time.Time
	Minipools        []*MinipoolInfo
	EligibleSeconds  *big.Int
	SmoothingPoolEth *big.Int
}

Details about a node for the Smoothing Pool

type QuotedBigInt

type QuotedBigInt struct {
	big.Int
}

func NewQuotedBigInt

func NewQuotedBigInt(x int64) *QuotedBigInt

func (*QuotedBigInt) MarshalJSON

func (b *QuotedBigInt) MarshalJSON() ([]byte, error)

func (*QuotedBigInt) UnmarshalJSON

func (b *QuotedBigInt) UnmarshalJSON(p []byte) error

type RewardsFile

type RewardsFile struct {
	// Serialized fields
	RewardsFileVersion         uint64                              `json:"rewardsFileVersion"`
	Index                      uint64                              `json:"index"`
	Network                    string                              `json:"network"`
	StartTime                  time.Time                           `json:"startTime,omitempty"`
	EndTime                    time.Time                           `json:"endTime"`
	ConsensusStartBlock        uint64                              `json:"consensusStartBlock,omitempty"`
	ConsensusEndBlock          uint64                              `json:"consensusEndBlock"`
	ExecutionStartBlock        uint64                              `json:"executionStartBlock,omitempty"`
	ExecutionEndBlock          uint64                              `json:"executionEndBlock"`
	IntervalsPassed            uint64                              `json:"intervalsPassed"`
	MerkleRoot                 string                              `json:"merkleRoot,omitempty"`
	MinipoolPerformanceFileCID string                              `json:"minipoolPerformanceFileCid,omitempty"`
	TotalRewards               *TotalRewards                       `json:"totalRewards"`
	NetworkRewards             map[uint64]*NetworkRewardsInfo      `json:"networkRewards"`
	NodeRewards                map[common.Address]*NodeRewardsInfo `json:"nodeRewards"`
	MinipoolPerformanceFile    MinipoolPerformanceFile             `json:"-"`

	// Non-serialized fields
	MerkleTree          *merkletree.MerkleTree    `json:"-"`
	InvalidNetworkNodes map[common.Address]uint64 `json:"-"`
	// contains filtered or unexported fields
}

JSON struct for a complete rewards file

func NewRewardsFile

func NewRewardsFile(log log.ColorLogger, logPrefix string, index uint64, startTime time.Time, endTime time.Time, consensusBlock uint64, elSnapshotHeader *types.Header, intervalsPassed uint64) *RewardsFile

Create a new rewards file

func (*RewardsFile) GenerateTree

func (r *RewardsFile) GenerateTree(rp *rocketpool.RocketPool, cfg *config.RocketPoolConfig, bc beacon.Client) error

type SlotInfo

type SlotInfo struct {
	Index      uint64
	Committees map[uint64]*CommitteeInfo
}

type SmoothingPoolMinipoolPerformance

type SmoothingPoolMinipoolPerformance struct {
	Pubkey                  string   `json:"pubkey"`
	SuccessfulAttestations  uint64   `json:"successfulAttestations"`
	MissedAttestations      uint64   `json:"missedAttestations"`
	ParticipationRate       float64  `json:"participationRate"`
	MissingAttestationSlots []uint64 `json:"missingAttestationSlots"`
	EthEarned               float64  `json:"ethEarned"`
}

Minipool stats

type TotalRewards

type TotalRewards struct {
	ProtocolDaoRpl               *QuotedBigInt `json:"protocolDaoRpl"`
	TotalCollateralRpl           *QuotedBigInt `json:"totalCollateralRpl"`
	TotalOracleDaoRpl            *QuotedBigInt `json:"totalOracleDaoRpl"`
	TotalSmoothingPoolEth        *QuotedBigInt `json:"totalSmoothingPoolEth"`
	PoolStakerSmoothingPoolEth   *QuotedBigInt `json:"poolStakerSmoothingPoolEth"`
	NodeOperatorSmoothingPoolEth *QuotedBigInt `json:"nodeOperatorSmoothingPoolEth"`
}

Total cumulative rewards for an interval

Jump to

Keyboard shortcuts

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