state

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: GPL-3.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateCompleteMinipoolShares

func CalculateCompleteMinipoolShares(rp *rocketpool.RocketPool, contracts *NetworkContracts, minipoolDetails []*NativeMinipoolDetails, beaconBalances []*big.Int) error

Calculate the node and user shares of the total minipool balance, including the portion on the Beacon chain

func GetAllProtocolDaoProposalDetails

func GetAllProtocolDaoProposalDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts) ([]protocol.ProtocolDaoProposalDetails, error)

Gets all Protocol DAO proposal details using the efficient multicall contract

func GetProtocolDaoProposalDetails

func GetProtocolDaoProposalDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, proposalID uint64) (protocol.ProtocolDaoProposalDetails, error)

Gets a Protocol DAO proposal's details using the efficient multicall contract

func GetTotalEffectiveRplStake

func GetTotalEffectiveRplStake(rp *rocketpool.RocketPool, contracts *NetworkContracts) (*big.Int, error)

Gets the details for a node using the efficient multicall contract

Types

type NativeMinipoolDetails

type NativeMinipoolDetails struct {
	// Redstone
	Exists                  bool                  `json:"exists"`
	MinipoolAddress         common.Address        `json:"minipool_address"`
	Pubkey                  types.ValidatorPubkey `json:"pubkey"`
	StatusRaw               uint8                 `json:"status_raw"`
	StatusBlock             *big.Int              `json:"status_block"`
	StatusTime              *big.Int              `json:"status_time"`
	Finalised               bool                  `json:"finalised"`
	DepositTypeRaw          uint8                 `json:"deposit_type_raw"`
	NodeFee                 *big.Int              `json:"node_fee"`
	NodeDepositBalance      *big.Int              `json:"node_deposit_balance"`
	NodeDepositAssigned     bool                  `json:"node_deposit_assigned"`
	UserDepositBalance      *big.Int              `json:"user_deposit_balance"`
	UserDepositAssigned     bool                  `json:"user_deposit_assigned"`
	UserDepositAssignedTime *big.Int              `json:"user_deposit_assigned_time"`
	UseLatestDelegate       bool                  `json:"use_latest_delegate"`
	Delegate                common.Address        `json:"delegate"`
	PreviousDelegate        common.Address        `json:"previous_delegate"`
	EffectiveDelegate       common.Address        `json:"effective_delegate"`
	PenaltyCount            *big.Int              `json:"penalty_count"`
	PenaltyRate             *big.Int              `json:"penalty_rate"`
	NodeAddress             common.Address        `json:"node_address"`
	Version                 uint8                 `json:"version"`
	Balance                 *big.Int              `json:"balance"`
	DistributableBalance    *big.Int              `json:"distributable_balance"`
	NodeShareOfBalance      *big.Int              `json:"node_share_of_balance"` // Result of calculateNodeShare(contract balance)
	UserShareOfBalance      *big.Int              `json:"user_share_of_balance"` // Result of calculateUserShare(contract balance)
	NodeRefundBalance       *big.Int              `json:"node_refund_balance"`
	WithdrawalCredentials   common.Hash           `json:"withdrawal_credentials"`
	Status                  types.MinipoolStatus  `json:"status"`
	DepositType             types.MinipoolDeposit `json:"deposit_type"`

	// Must call CalculateCompleteMinipoolShares to get these
	NodeShareOfBalanceIncludingBeacon *big.Int `json:"node_share_of_balance_including_beacon"`
	UserShareOfBalanceIncludingBeacon *big.Int `json:"user_share_of_balance_including_beacon"`
	NodeShareOfBeaconBalance          *big.Int `json:"node_share_of_beacon_balance"`
	UserShareOfBeaconBalance          *big.Int `json:"user_share_of_beacon_balance"`

	// Atlas
	UserDistributed              bool     `json:"user_distributed"`
	Slashed                      bool     `json:"slashed"`
	IsVacant                     bool     `json:"is_vacant"`
	LastBondReductionTime        *big.Int `json:"last_bond_reduction_time"`
	LastBondReductionPrevValue   *big.Int `json:"last_bond_reduction_prev_value"`
	LastBondReductionPrevNodeFee *big.Int `json:"last_bond_reduction_prev_node_fee"`
	ReduceBondTime               *big.Int `json:"reduce_bond_time"`
	ReduceBondCancelled          bool     `json:"reduce_bond_cancelled"`
	ReduceBondValue              *big.Int `json:"reduce_bond_value"`
	PreMigrationBalance          *big.Int `json:"pre_migration_balance"`
}

Complete details for a minipool

func GetAllNativeMinipoolDetails

func GetAllNativeMinipoolDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts) ([]NativeMinipoolDetails, error)

Gets all minpool details using the efficient multicall contract

func GetNativeMinipoolDetails

func GetNativeMinipoolDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, minipoolAddress common.Address) (NativeMinipoolDetails, error)

Gets the details for a minipool using the efficient multicall contract

func GetNodeNativeMinipoolDetails

func GetNodeNativeMinipoolDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, nodeAddress common.Address) ([]NativeMinipoolDetails, error)

Gets the minpool details for a node using the efficient multicall contract

func (*NativeMinipoolDetails) GetMinipoolBondAndNodeFee

func (details *NativeMinipoolDetails) GetMinipoolBondAndNodeFee(blockTime time.Time) (*big.Int, *big.Int)

Get the bond and node fee of a minipool for the specified time

func (*NativeMinipoolDetails) IsEligibleForBonuses

func (details *NativeMinipoolDetails) IsEligibleForBonuses(eligibleEnd time.Time) bool

type NativeNodeDetails

type NativeNodeDetails struct {
	Exists                           bool           `json:"exists"`
	RegistrationTime                 *big.Int       `json:"registration_time"`
	TimezoneLocation                 string         `json:"timezone_location"`
	FeeDistributorInitialised        bool           `json:"fee_distributor_initialised"`
	FeeDistributorAddress            common.Address `json:"fee_distributor_address"`
	RewardNetwork                    *big.Int       `json:"reward_network"`
	RplStake                         *big.Int       `json:"rpl_stake"`
	EffectiveRPLStake                *big.Int       `json:"effective_rpl_stake"`
	MinimumRPLStake                  *big.Int       `json:"minimum_rpl_stake"`
	MaximumRPLStake                  *big.Int       `json:"maximum_rpl_stake"`
	EthMatched                       *big.Int       `json:"eth_matched"`
	EthMatchedLimit                  *big.Int       `json:"eth_matched_limit"`
	MinipoolCount                    *big.Int       `json:"minipool_count"`
	BalanceETH                       *big.Int       `json:"balance_eth"`
	BalanceRETH                      *big.Int       `json:"balance_reth"`
	BalanceRPL                       *big.Int       `json:"balance_rpl"`
	BalanceOldRPL                    *big.Int       `json:"balance_old_rpl"`
	DepositCreditBalance             *big.Int       `json:"deposit_credit_balance"`
	DistributorBalanceUserETH        *big.Int       `json:"distributor_balance_user_eth"` // Must call CalculateAverageFeeAndDistributorShares to get this
	DistributorBalanceNodeETH        *big.Int       `json:"distributor_balance_node_eth"` // Must call CalculateAverageFeeAndDistributorShares to get this
	WithdrawalAddress                common.Address `json:"withdrawal_address"`
	PendingWithdrawalAddress         common.Address `json:"pending_withdrawal_address"`
	SmoothingPoolRegistrationState   bool           `json:"smoothing_pool_registration_state"`
	SmoothingPoolRegistrationChanged *big.Int       `json:"smoothing_pool_registration_changed"`
	NodeAddress                      common.Address `json:"node_address"`
	AverageNodeFee                   *big.Int       `json:"average_node_fee"` // Must call CalculateAverageFeeAndDistributorShares to get this
	CollateralisationRatio           *big.Int       `json:"collateralisation_ratio"`
	DistributorBalance               *big.Int       `json:"distributor_balance"`
}

Complete details for a node

func GetAllNativeNodeDetails

func GetAllNativeNodeDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts) ([]NativeNodeDetails, error)

Gets the details for all nodes using the efficient multicall contract

func GetNativeNodeDetails

func GetNativeNodeDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, nodeAddress common.Address) (NativeNodeDetails, error)

Gets the details for a node using the efficient multicall contract

func (*NativeNodeDetails) CalculateAverageFeeAndDistributorShares

func (node *NativeNodeDetails) CalculateAverageFeeAndDistributorShares(minipoolDetails []*NativeMinipoolDetails) error

Calculate the average node fee and user/node shares of the distributor's balance

func (*NativeNodeDetails) IsEligibleForBonuses

func (nnd *NativeNodeDetails) IsEligibleForBonuses(eligibleStart time.Time, eligibleEnd time.Time) (bool, time.Time, time.Time)

Returns whether the node is eligible for bonuses, and the start and end times of its eligibility

func (*NativeNodeDetails) WasOptedInAt

func (node *NativeNodeDetails) WasOptedInAt(t time.Time) bool

type NetworkContracts

type NetworkContracts struct {
	// Non-RP Utility
	BalanceBatcher *multicall.BalanceBatcher
	Multicaller    *multicall.MultiCaller
	ElBlockNumber  *big.Int

	// Network version
	Version *version.Version

	// Redstone
	RocketDAONodeTrusted                 *rocketpool.Contract
	RocketDAONodeTrustedSettingsMinipool *rocketpool.Contract
	RocketDAOProtocolSettingsMinipool    *rocketpool.Contract
	RocketDAOProtocolSettingsNetwork     *rocketpool.Contract
	RocketDAOProtocolSettingsNode        *rocketpool.Contract
	RocketDepositPool                    *rocketpool.Contract
	RocketMinipoolManager                *rocketpool.Contract
	RocketMinipoolQueue                  *rocketpool.Contract
	RocketNetworkBalances                *rocketpool.Contract
	RocketNetworkFees                    *rocketpool.Contract
	RocketNetworkPrices                  *rocketpool.Contract
	RocketNodeDeposit                    *rocketpool.Contract
	RocketNodeDistributorFactory         *rocketpool.Contract
	RocketNodeManager                    *rocketpool.Contract
	RocketNodeStaking                    *rocketpool.Contract
	RocketRewardsPool                    *rocketpool.Contract
	RocketSmoothingPool                  *rocketpool.Contract
	RocketStorage                        *rocketpool.Contract
	RocketTokenRETH                      *rocketpool.Contract
	RocketTokenRPL                       *rocketpool.Contract
	RocketTokenRPLFixedSupply            *rocketpool.Contract

	// Atlas
	RocketMinipoolBondReducer *rocketpool.Contract

	// Houston
	RocketDAOProtocolProposal *rocketpool.Contract
	RocketDAOProtocolVerifier *rocketpool.Contract
}

Container for network contracts

func NewNetworkContracts

func NewNetworkContracts(rp *rocketpool.RocketPool, multicallerAddress common.Address, balanceBatcherAddress common.Address, opts *bind.CallOpts) (*NetworkContracts, error)

Get a new network contracts container

type NetworkDetails

type NetworkDetails struct {
	// Redstone
	RplPrice                          *big.Int               `json:"rpl_price"`
	MinCollateralFraction             *big.Int               `json:"min_collateral_fraction"`
	MaxCollateralFraction             *big.Int               `json:"max_collateral_fraction"`
	IntervalDuration                  time.Duration          `json:"interval_duration"`
	IntervalStart                     time.Time              `json:"interval_start"`
	NodeOperatorRewardsPercent        *big.Int               `json:"node_operator_rewards_percent"`
	TrustedNodeOperatorRewardsPercent *big.Int               `json:"trusted_node_operator_rewards_percent"`
	ProtocolDaoRewardsPercent         *big.Int               `json:"protocol_dao_rewards_percent"`
	PendingRPLRewards                 *big.Int               `json:"pending_rpl_rewards"`
	RewardIndex                       uint64                 `json:"reward_index"`
	ScrubPeriod                       time.Duration          `json:"scrub_period"`
	SmoothingPoolAddress              common.Address         `json:"smoothing_pool_address"`
	DepositPoolBalance                *big.Int               `json:"deposit_pool_balance"`
	DepositPoolExcess                 *big.Int               `json:"deposit_pool_excess"`
	QueueCapacity                     minipool.QueueCapacity `json:"queue_capacity"`
	QueueLength                       *big.Int               `json:"queue_length"`
	RPLInflationIntervalRate          *big.Int               `json:"rpl_inflation_interval_rate"`
	RPLTotalSupply                    *big.Int               `json:"rpl_total_supply"`
	PricesBlock                       uint64                 `json:"prices_block"`
	LatestReportablePricesBlock       uint64                 `json:"latest_reportable_prices_block"`
	ETHUtilizationRate                float64                `json:"eth_utilization_rate"`
	StakingETHBalance                 *big.Int               `json:"staking_eth_balance"`
	RETHExchangeRate                  float64                `json:"reth_exchange_rate"`
	TotalETHBalance                   *big.Int               `json:"total_eth_balance"`
	RETHBalance                       *big.Int               `json:"reth_balance"`
	TotalRETHSupply                   *big.Int               `json:"total_reth_supply"`
	TotalRPLStake                     *big.Int               `json:"total_rpl_stake"`
	SmoothingPoolBalance              *big.Int               `json:"smoothing_pool_balance"`
	NodeFee                           float64                `json:"node_fee"`
	BalancesBlock                     uint64                 `json:"balances_block"`
	LatestReportableBalancesBlock     uint64                 `json:"latest_reportable_balances_block"`
	SubmitBalancesEnabled             bool                   `json:"submit_balances_enabled"`
	SubmitPricesEnabled               bool                   `json:"submit_prices_enabled"`
	MinipoolLaunchTimeout             *big.Int               `json:"minipool_launch_timeout"`

	// Atlas
	PromotionScrubPeriod      time.Duration `json:"promotion_scrub_period"`
	BondReductionWindowStart  time.Duration `json:"bond_reduction_window_start"`
	BondReductionWindowLength time.Duration `json:"bond_reduction_window_length"`
	DepositPoolUserBalance    *big.Int      `json:"deposit_pool_user_balance"`

	// Houston
	PricesSubmissionFrequency   uint64 `json:"prices_submission_frequency"`
	BalancesSubmissionFrequency uint64 `json:"balances_submission_frequency"`
}

func NewNetworkDetails

func NewNetworkDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts) (*NetworkDetails, error)

Create a snapshot of all of the network's details

type OracleDaoMemberDetails

type OracleDaoMemberDetails struct {
	Address            common.Address `json:"address"`
	Exists             bool           `json:"exists"`
	ID                 string         `json:"id"`
	Url                string         `json:"url"`
	JoinedTime         time.Time      `json:"joinedTime"`
	LastProposalTime   time.Time      `json:"lastProposalTime"`
	RPLBondAmount      *big.Int       `json:"rplBondAmount"`
	ReplacementAddress common.Address `json:"replacementAddress"`
	IsChallenged       bool           `json:"isChallenged"`
	// contains filtered or unexported fields
}

func GetAllOracleDaoMemberDetails

func GetAllOracleDaoMemberDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts) ([]OracleDaoMemberDetails, error)

Gets all Oracle DAO member details using the efficient multicall contract

func GetOracleDaoMemberDetails

func GetOracleDaoMemberDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, memberAddress common.Address) (OracleDaoMemberDetails, error)

Gets the details for an Oracle DAO member using the efficient multicall contract

Jump to

Keyboard shortcuts

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