deposit

package
v5.1.3-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: GPL-3.0 Imports: 15 Imported by: 5

README

Validator Deposit Contract Local Copy

This package contains a copy of the official Ethereum Validator Deposit Contract along with its ABI, bytecode, and Go bindings generated by go-ethereum's abigen version 1.10.4-stable. It contains useful test harnesses for setting up and deploying a validator deposit contract using Go bindings, which are used across tests in Prysm.

Documentation

Overview

Code generated - DO NOT EDIT. This file is a generated binding and any manual changes will be lost.

Package depositutil contains useful functions for dealing with Ethereum deposit inputs.

Index

Constants

View Source
const DepositContractABI = "" /* 1613-byte string literal not displayed */

DepositContractABI is the input ABI used to generate the binding from.

Variables

This section is empty.

Functions

func DepositInput

func DepositInput(depositKey, withdrawalKey bls.SecretKey, amountInGwei uint64) (*ethpb.Deposit_Data, [32]byte, error)

DepositInput for a given key. This input data can be used to when making a validator deposit. The input data includes a proof of possession field signed by the deposit key.

Spec details about general deposit workflow:

To submit a deposit:

- Pack the validator's initialization parameters into deposit_data, a Deposit_Data SSZ object.
- Let amount be the amount in Gwei to be deposited by the validator where MIN_DEPOSIT_AMOUNT <= amount <= MAX_EFFECTIVE_BALANCE.
- Set deposit_data.amount = amount.
- Let signature be the result of bls_sign of the signing_root(deposit_data) with domain=compute_domain(DOMAIN_DEPOSIT). (Deposits are valid regardless of fork version, compute_domain will default to zeroes there).
- Send a transaction on the Ethereum 1.0 chain to DEPOSIT_CONTRACT_ADDRESS executing `deposit(pubkey: bytes[48], withdrawal_credentials: bytes[32], signature: bytes[96])` along with a deposit of amount Gwei.

See: https://github.com/ethereum/consensus-specs/blob/master/specs/validator/0_beacon-chain-validator.md#submit-deposit

func UnpackDepositLogData

func UnpackDepositLogData(data []byte) (pubkey, withdrawalCredentials, amount, signature, index []byte, err error)

UnpackDepositLogData unpacks the data from a deposit log using the ABI decoder.

func VerifyDepositSignature

func VerifyDepositSignature(dd *ethpb.Deposit_Data, domain []byte) error

VerifyDepositSignature verifies the correctness of Eth1 deposit BLS signature

func WithdrawalCredentialsHash

func WithdrawalCredentialsHash(withdrawalKey bls.SecretKey) []byte

WithdrawalCredentialsHash forms a 32 byte hash of the withdrawal public address.

The specification is as follows:

withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX_BYTE
withdrawal_credentials[1:] == hash(withdrawal_pubkey)[1:]

where withdrawal_credentials is of type bytes32.

Types

type DepositContract

type DepositContract struct {
	DepositContractCaller     // Read-only binding to the contract
	DepositContractTransactor // Write-only binding to the contract
	DepositContractFilterer   // Log filterer for contract events
}

DepositContract is an auto generated Go binding around an Ethereum contract.

func NewDepositContract

func NewDepositContract(address common.Address, backend bind.ContractBackend) (*DepositContract, error)

NewDepositContract creates a new instance of DepositContract, bound to a specific deployed contract.

type DepositContractCaller

type DepositContractCaller struct {
	// contains filtered or unexported fields
}

DepositContractCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewDepositContractCaller

func NewDepositContractCaller(address common.Address, caller bind.ContractCaller) (*DepositContractCaller, error)

NewDepositContractCaller creates a new read-only instance of DepositContract, bound to a specific deployed contract.

func NewDepositContractCallerFromBoundContract

func NewDepositContractCallerFromBoundContract(contract *bind.BoundContract) DepositContractCaller

NewDepositContractCallerFromBoundContract creates a new instance of DepositContractCaller, bound to a specific deployed contract.

func (*DepositContractCaller) GetDepositCount

func (_DepositContract *DepositContractCaller) GetDepositCount(opts *bind.CallOpts) ([]byte, error)

GetDepositCount is a free data retrieval call binding the contract method 0x621fd130.

Solidity: function get_deposit_count() view returns(bytes)

func (*DepositContractCaller) GetDepositRoot

func (_DepositContract *DepositContractCaller) GetDepositRoot(opts *bind.CallOpts) ([32]byte, error)

GetDepositRoot is a free data retrieval call binding the contract method 0xc5f2892f.

Solidity: function get_deposit_root() view returns(bytes32)

func (*DepositContractCaller) SupportsInterface

func (_DepositContract *DepositContractCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error)

SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.

Solidity: function supportsInterface(bytes4 interfaceId) pure returns(bool)

type DepositContractCallerRaw

type DepositContractCallerRaw struct {
	Contract *DepositContractCaller // Generic read-only contract binding to access the raw methods on
}

DepositContractCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*DepositContractCallerRaw) Call

func (_DepositContract *DepositContractCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type DepositContractCallerSession

type DepositContractCallerSession struct {
	Contract *DepositContractCaller // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts          // Call options to use throughout this session
}

DepositContractCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*DepositContractCallerSession) GetDepositCount

func (_DepositContract *DepositContractCallerSession) GetDepositCount() ([]byte, error)

GetDepositCount is a free data retrieval call binding the contract method 0x621fd130.

Solidity: function get_deposit_count() view returns(bytes)

func (*DepositContractCallerSession) GetDepositRoot

func (_DepositContract *DepositContractCallerSession) GetDepositRoot() ([32]byte, error)

GetDepositRoot is a free data retrieval call binding the contract method 0xc5f2892f.

Solidity: function get_deposit_root() view returns(bytes32)

func (*DepositContractCallerSession) SupportsInterface

func (_DepositContract *DepositContractCallerSession) SupportsInterface(interfaceId [4]byte) (bool, error)

SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.

Solidity: function supportsInterface(bytes4 interfaceId) pure returns(bool)

type DepositContractDepositEvent

type DepositContractDepositEvent struct {
	Pubkey                []byte
	WithdrawalCredentials []byte
	Amount                []byte
	Signature             []byte
	Index                 []byte
	Raw                   types.Log // Blockchain specific contextual infos
}

DepositContractDepositEvent represents a DepositEvent event raised by the DepositContract contract.

type DepositContractDepositEventIterator

type DepositContractDepositEventIterator struct {
	Event *DepositContractDepositEvent // Event containing the contract specifics and raw log
	// contains filtered or unexported fields
}

DepositContractDepositEventIterator is returned from FilterDepositEvent and is used to iterate over the raw logs and unpacked data for DepositEvent events raised by the DepositContract contract.

func (*DepositContractDepositEventIterator) Close

Close terminates the iteration process, releasing any pending underlying resources.

func (*DepositContractDepositEventIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*DepositContractDepositEventIterator) Next

Next advances the iterator to the subsequent event, returning whether there are any more events found. In case of a retrieval or parsing error, false is returned and Error() can be queried for the exact failure.

type DepositContractFilterer

type DepositContractFilterer struct {
	// contains filtered or unexported fields
}

DepositContractFilterer is an auto generated log filtering Go binding around an Ethereum contract events.

func NewDepositContractFilterer

func NewDepositContractFilterer(address common.Address, filterer bind.ContractFilterer) (*DepositContractFilterer, error)

NewDepositContractFilterer creates a new log filterer instance of DepositContract, bound to a specific deployed contract.

func NewDepositContractFiltererFromBoundContract

func NewDepositContractFiltererFromBoundContract(contract *bind.BoundContract) DepositContractFilterer

NewDepositContractFiltererFromBoundContract creates a new instance of DepositContractFilterer, bound to a specific deployed contract.

func (*DepositContractFilterer) FilterDepositEvent

func (_DepositContract *DepositContractFilterer) FilterDepositEvent(opts *bind.FilterOpts) (*DepositContractDepositEventIterator, error)

FilterDepositEvent is a free log retrieval operation binding the contract event 0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5.

Solidity: event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index)

func (*DepositContractFilterer) ParseDepositEvent

func (_DepositContract *DepositContractFilterer) ParseDepositEvent(log types.Log) (*DepositContractDepositEvent, error)

ParseDepositEvent is a log parse operation binding the contract event 0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5.

Solidity: event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index)

func (*DepositContractFilterer) WatchDepositEvent

func (_DepositContract *DepositContractFilterer) WatchDepositEvent(opts *bind.WatchOpts, sink chan<- *DepositContractDepositEvent) (event.Subscription, error)

WatchDepositEvent is a free log subscription operation binding the contract event 0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5.

Solidity: event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index)

type DepositContractRaw

type DepositContractRaw struct {
	Contract *DepositContract // Generic contract binding to access the raw methods on
}

DepositContractRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*DepositContractRaw) Call

func (_DepositContract *DepositContractRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*DepositContractRaw) Transact

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

Transact invokes the (paid) contract method with params as input values.

func (*DepositContractRaw) Transfer

func (_DepositContract *DepositContractRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type DepositContractSession

type DepositContractSession struct {
	Contract     *DepositContract  // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

DepositContractSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*DepositContractSession) Deposit

func (_DepositContract *DepositContractSession) Deposit(pubkey []byte, withdrawal_credentials []byte, signature []byte, deposit_data_root [32]byte) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x22895118.

Solidity: function deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root) payable returns()

func (*DepositContractSession) GetDepositCount

func (_DepositContract *DepositContractSession) GetDepositCount() ([]byte, error)

GetDepositCount is a free data retrieval call binding the contract method 0x621fd130.

Solidity: function get_deposit_count() view returns(bytes)

func (*DepositContractSession) GetDepositRoot

func (_DepositContract *DepositContractSession) GetDepositRoot() ([32]byte, error)

GetDepositRoot is a free data retrieval call binding the contract method 0xc5f2892f.

Solidity: function get_deposit_root() view returns(bytes32)

func (*DepositContractSession) SupportsInterface

func (_DepositContract *DepositContractSession) SupportsInterface(interfaceId [4]byte) (bool, error)

SupportsInterface is a free data retrieval call binding the contract method 0x01ffc9a7.

Solidity: function supportsInterface(bytes4 interfaceId) pure returns(bool)

type DepositContractTransactor

type DepositContractTransactor struct {
	// contains filtered or unexported fields
}

DepositContractTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewDepositContractTransactor

func NewDepositContractTransactor(address common.Address, transactor bind.ContractTransactor) (*DepositContractTransactor, error)

NewDepositContractTransactor creates a new write-only instance of DepositContract, bound to a specific deployed contract.

func NewDepositContractTransactorFromBoundContract

func NewDepositContractTransactorFromBoundContract(contract *bind.BoundContract) DepositContractTransactor

NewDepositContractTransactorFromBoundContract creates a new instance of DepositContractTransactor, bound to a specific deployed contract.

func (*DepositContractTransactor) Deposit

func (_DepositContract *DepositContractTransactor) Deposit(opts *bind.TransactOpts, pubkey []byte, withdrawal_credentials []byte, signature []byte, deposit_data_root [32]byte) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x22895118.

Solidity: function deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root) payable returns()

type DepositContractTransactorRaw

type DepositContractTransactorRaw struct {
	Contract *DepositContractTransactor // Generic write-only contract binding to access the raw methods on
}

DepositContractTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*DepositContractTransactorRaw) Transact

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

Transact invokes the (paid) contract method with params as input values.

func (*DepositContractTransactorRaw) Transfer

func (_DepositContract *DepositContractTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type DepositContractTransactorSession

type DepositContractTransactorSession struct {
	Contract     *DepositContractTransactor // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts          // Transaction auth options to use throughout this session
}

DepositContractTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*DepositContractTransactorSession) Deposit

func (_DepositContract *DepositContractTransactorSession) Deposit(pubkey []byte, withdrawal_credentials []byte, signature []byte, deposit_data_root [32]byte) (*types.Transaction, error)

Deposit is a paid mutator transaction binding the contract method 0x22895118.

Solidity: function deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root) payable returns()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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