state

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateAverageFeeAndDistributorShares_Legacy added in v0.4.0

func CalculateAverageFeeAndDistributorShares_Legacy(rp *rocketpool.RocketPool, contracts *NetworkContracts, node NativeNodeDetails, minipoolDetails []*NativeMinipoolDetails) error

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

func CalculateAverageFeeAndDistributorShares_New added in v0.4.0

func CalculateAverageFeeAndDistributorShares_New(rp *rocketpool.RocketPool, contracts *NetworkContracts, node NativeNodeDetails, minipoolDetails []*NativeMinipoolDetails) error

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

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 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
	MinipoolAddress                   common.Address
	Pubkey                            types.ValidatorPubkey
	StatusRaw                         uint8
	StatusBlock                       *big.Int
	StatusTime                        *big.Int
	Finalised                         bool
	DepositTypeRaw                    uint8
	NodeFee                           *big.Int
	NodeDepositBalance                *big.Int
	NodeDepositAssigned               bool
	UserDepositBalance                *big.Int
	UserDepositAssigned               bool
	UserDepositAssignedTime           *big.Int
	UseLatestDelegate                 bool
	Delegate                          common.Address
	PreviousDelegate                  common.Address
	EffectiveDelegate                 common.Address
	PenaltyCount                      *big.Int
	PenaltyRate                       *big.Int
	NodeAddress                       common.Address
	Version                           uint8
	Balance                           *big.Int // Contract balance
	DistributableBalance              *big.Int // Contract balance minus node op refund
	NodeShareOfBalance                *big.Int // Result of calculateNodeShare(contract balance)
	UserShareOfBalance                *big.Int // Result of calculateUserShare(contract balance)
	NodeRefundBalance                 *big.Int
	WithdrawalCredentials             common.Hash
	Status                            types.MinipoolStatus
	DepositType                       types.MinipoolDeposit
	NodeShareOfBalanceIncludingBeacon *big.Int // Must call CalculateCompleteMinipoolShares to get this
	UserShareOfBalanceIncludingBeacon *big.Int // Must call CalculateCompleteMinipoolShares to get this
	NodeShareOfBeaconBalance          *big.Int // Must call CalculateCompleteMinipoolShares to get this
	UserShareOfBeaconBalance          *big.Int // Must call CalculateCompleteMinipoolShares to get this

	// Atlas
	UserDistributed              bool
	Slashed                      bool
	IsVacant                     bool
	LastBondReductionTime        *big.Int
	LastBondReductionPrevValue   *big.Int
	LastBondReductionPrevNodeFee *big.Int
	ReduceBondTime               *big.Int
	ReduceBondCancelled          bool
	ReduceBondValue              *big.Int
	PreMigrationBalance          *big.Int
}

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

type NativeNodeDetails

type NativeNodeDetails struct {
	Exists                           bool
	RegistrationTime                 *big.Int
	TimezoneLocation                 string
	FeeDistributorInitialised        bool
	FeeDistributorAddress            common.Address
	RewardNetwork                    *big.Int
	RplStake                         *big.Int
	EffectiveRPLStake                *big.Int
	MinimumRPLStake                  *big.Int
	MaximumRPLStake                  *big.Int
	EthMatched                       *big.Int
	EthMatchedLimit                  *big.Int
	MinipoolCount                    *big.Int
	BalanceETH                       *big.Int
	BalanceRETH                      *big.Int
	BalanceRPL                       *big.Int
	BalanceOldRPL                    *big.Int
	DepositCreditBalance             *big.Int
	DistributorBalanceUserETH        *big.Int // Must call CalculateAverageFeeAndDistributorShares to get this
	DistributorBalanceNodeETH        *big.Int // Must call CalculateAverageFeeAndDistributorShares to get this
	WithdrawalAddress                common.Address
	PendingWithdrawalAddress         common.Address
	SmoothingPoolRegistrationState   bool
	SmoothingPoolRegistrationChanged *big.Int
	NodeAddress                      common.Address
	AverageNodeFee                   *big.Int // Must call CalculateAverageFeeAndDistributorShares to get this
	CollateralisationRatio           *big.Int
	DistributorBalance               *big.Int
}

Complete details for a node

func GetAllNativeNodeDetails

func GetAllNativeNodeDetails(rp *rocketpool.RocketPool, contracts *NetworkContracts, isAtlasDeployed bool) ([]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, isAtlasDeployed bool) (NativeNodeDetails, error)

Gets the details for a node using the efficient multicall contract

type NetworkContracts

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

	// Network version
	Version *version.Version

	// Redstone
	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
}

Container for network contracts

func NewNetworkContracts

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

Get a new network contracts container

type NetworkDetails

type NetworkDetails struct {
	// Redstone
	RplPrice                          *big.Int
	MinCollateralFraction             *big.Int
	MaxCollateralFraction             *big.Int
	IntervalDuration                  time.Duration
	IntervalStart                     time.Time
	NodeOperatorRewardsPercent        *big.Int
	TrustedNodeOperatorRewardsPercent *big.Int
	ProtocolDaoRewardsPercent         *big.Int
	PendingRPLRewards                 *big.Int
	RewardIndex                       uint64
	ScrubPeriod                       time.Duration
	SmoothingPoolAddress              common.Address
	DepositPoolBalance                *big.Int
	DepositPoolExcess                 *big.Int
	QueueCapacity                     minipool.QueueCapacity
	QueueLength                       *big.Int
	RPLInflationIntervalRate          *big.Int
	RPLTotalSupply                    *big.Int
	PricesBlock                       uint64
	LatestReportablePricesBlock       uint64
	ETHUtilizationRate                float64
	StakingETHBalance                 *big.Int
	RETHExchangeRate                  float64
	TotalETHBalance                   *big.Int
	RETHBalance                       *big.Int
	TotalRETHSupply                   *big.Int
	TotalRPLStake                     *big.Int
	SmoothingPoolBalance              *big.Int
	NodeFee                           float64
	BalancesBlock                     *big.Int
	LatestReportableBalancesBlock     *big.Int
	SubmitBalancesEnabled             bool
	SubmitPricesEnabled               bool
	MinipoolLaunchTimeout             *big.Int

	// Atlas
	PromotionScrubPeriod      time.Duration
	BondReductionWindowStart  time.Duration
	BondReductionWindowLength time.Duration
	DepositPoolUserBalance    *big.Int
}

func NewNetworkDetails

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

Create a snapshot of all of the network's details

Jump to

Keyboard shortcuts

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