stader

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.5.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.5.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License alongth this program. If not, see <http://www.gnu.org/licenses/>.

This work is licensed and released under GNU GPL v3 or any other later versions. The full text of the license is below/ found at <http://www.gnu.org/licenses/>

(c) 2023 Rocket Pool Pty Ltd. Modified under GNU GPL v3. [1.5.0]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	GasLimitMultiplier float64 = 1.5
	MaxGasLimit        uint64  = 50000000
)

Transaction settings

Variables

This section is empty.

Functions

func DecodeAbi

func DecodeAbi(abiEncoded string) (*abi.ABI, error)

Decode, decompress and parse a zlib-compressed, base64-encoded ABI

func EncodeAbiStr

func EncodeAbiStr(abiStr string) (string, error)

zlib-compress and base64-encode an ABI JSON string

Types

type Contract

type Contract struct {
	Contract *bind.BoundContract
	Address  *common.Address
	ABI      *abi.ABI
	Client   ExecutionClient
}

Contract type wraps go-ethereum bound contract

func (*Contract) Call

func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call a contract method

func (*Contract) GetTransactionEvents

func (c *Contract) GetTransactionEvents(txReceipt *types.Receipt, eventName string, eventPrototype interface{}) ([]interface{}, error)

Get contract events from a transaction eventPrototype must be an event struct type Returns a slice of untyped values; assert returned events to event struct type

func (*Contract) GetTransactionGasInfo

func (c *Contract) GetTransactionGasInfo(opts *bind.TransactOpts, method string, params ...interface{}) (GasInfo, error)

Get Gas Limit for transaction

func (*Contract) GetTransferGasInfo

func (c *Contract) GetTransferGasInfo(opts *bind.TransactOpts) (GasInfo, error)

Get gas limit for a transfer call

func (*Contract) Transact

func (c *Contract) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact on a contract method and wait for a receipt

func (*Contract) Transfer

func (c *Contract) Transfer(opts *bind.TransactOpts) (common.Hash, error)

Transfer ETH to a contract and wait for a receipt

type Erc20TokenContractManager

type Erc20TokenContractManager struct {
	Client             ExecutionClient
	Erc20Token         *contracts.Erc20
	Erc20TokenContract *Contract
}

func NewErc20TokenContract

func NewErc20TokenContract(client ExecutionClient, erc20TokenAddress common.Address) (*Erc20TokenContractManager, error)

type ExecutionClient

type ExecutionClient interface {

	// CodeAt returns the code of the given account. This is needed to differentiate
	// between contract internal errors and the local chain being out of sync.
	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)

	// CallContract executes an Ethereum contract call with the specified data as the
	// input.
	CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

	// HeaderByHash returns the block header with the given hash.
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

	// HeaderByNumber returns a block header from the current canonical chain. If number is
	// nil, the latest known header is returned.
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

	// PendingCodeAt returns the code of the given account in the pending state.
	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

	// PendingNonceAt retrieves the current pending nonce associated with an account.
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

	// SuggestGasPrice retrieves the currently suggested gas price to allow a timely
	// execution of a transaction.
	SuggestGasPrice(ctx context.Context) (*big.Int, error)

	// SuggestGasTipCap retrieves the currently suggested 1559 priority fee to allow
	// a timely execution of a transaction.
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)

	// EstimateGas tries to estimate the gas needed to execute a specific
	// transaction based on the current pending state of the backend blockchain.
	// There is no guarantee that this is the true gas limit requirement as other
	// transactions may be added or removed by miners, but it should provide a basis
	// for setting a reasonable default.
	EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)

	// SendTransaction injects the transaction into the pending pool for execution.
	SendTransaction(ctx context.Context, tx *types.Transaction) error

	// FilterLogs executes a log filter operation, blocking during execution and
	// returning all the results in one batch.
	//
	FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

	// SubscribeFilterLogs creates a background log filtering operation, returning
	// a subscription immediately, which can be used to stream the found events.
	SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

	// TransactionReceipt returns the receipt of a transaction by transaction hash.
	// Note that the receipt is not available for pending transactions.
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

	// BlockNumber returns the most recent block number
	BlockNumber(ctx context.Context) (uint64, error)

	// BalanceAt returns the wei balance of the given account.
	// The block number can be nil, in which case the balance is taken from the latest known block.
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

	// TransactionByHash returns the transaction with the given hash.
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)

	// NonceAt returns the account nonce of the given account.
	// The block number can be nil, in which case the nonce is taken from the latest known block.
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

	// SyncProgress retrieves the current progress of the sync algorithm. If there's
	// no sync currently running, it returns nil.
	SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
}

This is the common interface for execution clients.

type GasInfo

type GasInfo struct {
	EstGasLimit  uint64 `json:"estGasLimit"`
	SafeGasLimit uint64 `json:"safeGasLimit"`
}

Response for gas limits from network and from user request

type NodeElRewardVaultContractManager

type NodeElRewardVaultContractManager struct {
	Client                    ExecutionClient
	NodeElRewardVault         *contracts.NodeElRewardVault
	NodeElRewardVaultContract *Contract
}

func NewNodeElRewardVaultFactory

func NewNodeElRewardVaultFactory(client ExecutionClient, nodeElRewardVaultAddress common.Address) (*NodeElRewardVaultContractManager, error)

type OperatorRewardsCollectorContractManager

type OperatorRewardsCollectorContractManager struct {
	Client                           ExecutionClient
	OperatorRewardsCollector         *contracts.OperatorRewardsCollector
	OperatorRewardsCollectorContract *Contract
}

func NewOperatorRewardsCollector

func NewOperatorRewardsCollector(client ExecutionClient, operatorRewardsCollectorAddress common.Address) (*OperatorRewardsCollectorContractManager, error)

type PenaltyTrackerContractManager

type PenaltyTrackerContractManager struct {
	Client          ExecutionClient
	Penalty         *contracts.PenaltyTracker
	PenaltyContract *Contract
}

func NewPenaltyTracker

func NewPenaltyTracker(client ExecutionClient, penaltyAddress common.Address) (*PenaltyTrackerContractManager, error)

type PermissionlessNodeRegistryContractManager

type PermissionlessNodeRegistryContractManager struct {
	Client                             ExecutionClient
	PermissionlessNodeRegistry         *contracts.PermissionlessNodeRegistry
	PermissionlessNodeRegistryContract *Contract
}

func NewPermissionlessNodeRegistry

func NewPermissionlessNodeRegistry(client ExecutionClient, permissionlessNodeRegistryAddress common.Address) (*PermissionlessNodeRegistryContractManager, error)

type PermissionlessPoolContractManager

type PermissionlessPoolContractManager struct {
	Client                     ExecutionClient
	PermissionlessPool         *contracts.PermissionlessPool
	PermissionlessPoolContract *Contract
}

func NewPermissionlessPoolFactory

func NewPermissionlessPoolFactory(client ExecutionClient, permissionPoolAddress common.Address) (*PermissionlessPoolContractManager, error)

type PoolUtilsContractManager

type PoolUtilsContractManager struct {
	Client            ExecutionClient
	PoolUtils         *contracts.PoolUtils
	PoolUtilsContract *Contract
}

func NewPoolUtils

func NewPoolUtils(client ExecutionClient, poolUtilsAddress common.Address) (*PoolUtilsContractManager, error)

type SDUtilityPoolContractManager added in v1.5.0

type SDUtilityPoolContractManager struct {
	Client                ExecutionClient
	SDUtilityPool         *contracts.SDUtilityPool
	SDUtilityPoolContract *Contract
}

func NewSDUtilityPool added in v1.5.0

func NewSDUtilityPool(client ExecutionClient, sdUtilizeAddress common.Address) (*SDUtilityPoolContractManager, error)

type SdCollateralContractManager

type SdCollateralContractManager struct {
	Client               ExecutionClient
	SdCollateral         *contracts.SdCollateral
	SdCollateralContract *Contract
}

func NewSdCollateralContract

func NewSdCollateralContract(client ExecutionClient, sdCollateralAddress common.Address) (*SdCollateralContractManager, error)

type SocializingPoolContractManager

type SocializingPoolContractManager struct {
	Client                  ExecutionClient
	SocializingPool         *contracts.SocializingPool
	SocializingPoolContract *Contract
}

func NewSocializingPool

func NewSocializingPool(client ExecutionClient, socializingPoolAddress common.Address) (*SocializingPoolContractManager, error)

type StaderConfigContractManager

type StaderConfigContractManager struct {
	Client               ExecutionClient
	StaderConfig         *contracts.StaderConfig
	StaderConfigContract *Contract
}

func NewStaderConfig

func NewStaderConfig(client ExecutionClient, staderConfigAddress common.Address) (*StaderConfigContractManager, error)

type StakePoolManagerContractManager

type StakePoolManagerContractManager struct {
	Client                   ExecutionClient
	StakePoolManager         *contracts.StakePoolManager
	StakePoolManagerContract *Contract
}

func NewStakePoolManager

func NewStakePoolManager(client ExecutionClient, stakePoolManagerAddress common.Address) (*StakePoolManagerContractManager, error)

type ValidatorWithdrawVaultContractManager

type ValidatorWithdrawVaultContractManager struct {
	Client                         ExecutionClient
	ValidatorWithdrawVault         *contracts.ValidatorWithdrawVault
	ValidatorWithdrawVaultContract *Contract
}

func NewValidatorWithdrawVaultFactory

func NewValidatorWithdrawVaultFactory(client ExecutionClient, validatorWithdrawVaultAddress common.Address) (*ValidatorWithdrawVaultContractManager, error)

type VaultFactoryContractManager

type VaultFactoryContractManager struct {
	Client               ExecutionClient
	VaultFactory         *contracts.VaultFactory
	VaultFactoryContract *Contract
}

func NewVaultFactory

func NewVaultFactory(client ExecutionClient, vaultFactoryAddress common.Address) (*VaultFactoryContractManager, error)

type VaultProxyContractManager

type VaultProxyContractManager struct {
	Client             ExecutionClient
	VaultProxy         *contracts.VaultProxy
	VaultProxyContract *Contract
}

Write above bindings for VaultProxy

func NewVaultProxy

func NewVaultProxy(client ExecutionClient, vaultProxyAddress common.Address) (*VaultProxyContractManager, error)

Jump to

Keyboard shortcuts

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