contracts

package
v0.0.0-...-dde17ac Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

README

Validator Registration Contract

For beacon chain design, a validator will deposit 32 ETH to the main chain smart contract. The deposit is considered to be burned. As you burn the 32 ETH to participate, the beacon chain will see it and will credit the validator with the validator bond, and the validator can begin to validate. At some point in the future, after a hard fork, the original deposit + interest can be withdrawn back on one of the shards.

How to execute tests

go test ./...

Run with -v option for detailed log output

go test ./... -v
=== RUN   TestSetupAndContractRegistration
--- PASS: TestSetupAndContractRegistration (0.01s)
=== RUN   TestRegisterWithLessThan32Eth
--- PASS: TestRegisterWithLessThan32Eth (0.00s)
=== RUN   TestRegisterWithMoreThan32Eth
--- PASS: TestRegisterWithMoreThan32Eth (0.00s)
=== RUN   TestRegisterTwice
--- PASS: TestRegisterTwice (0.01s)
=== RUN   TestRegister
--- PASS: TestRegister (0.01s)
PASS
ok      beacon-chain/contracts  0.151s

Documentation

Index

Constants

View Source
const ValidatorRegistrationABI = "" /* 1120-byte string literal not displayed */

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

View Source
const ValidatorRegistrationBin = `` /* 976-byte string literal not displayed */

ValidatorRegistrationBin is the compiled bytecode used for deploying new contracts.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValidatorRegistration

type ValidatorRegistration struct {
	ValidatorRegistrationCaller     // Read-only binding to the contract
	ValidatorRegistrationTransactor // Write-only binding to the contract
	ValidatorRegistrationFilterer   // Log filterer for contract events
}

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

func DeployValidatorRegistration

func DeployValidatorRegistration(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ValidatorRegistration, error)

DeployValidatorRegistration deploys a new Ethereum contract, binding an instance of ValidatorRegistration to it.

func NewValidatorRegistration

func NewValidatorRegistration(address common.Address, backend bind.ContractBackend) (*ValidatorRegistration, error)

NewValidatorRegistration creates a new instance of ValidatorRegistration, bound to a specific deployed contract.

type ValidatorRegistrationCaller

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

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

func NewValidatorRegistrationCaller

func NewValidatorRegistrationCaller(address common.Address, caller bind.ContractCaller) (*ValidatorRegistrationCaller, error)

NewValidatorRegistrationCaller creates a new read-only instance of ValidatorRegistration, bound to a specific deployed contract.

func (*ValidatorRegistrationCaller) UsedPubkey

func (_ValidatorRegistration *ValidatorRegistrationCaller) UsedPubkey(opts *bind.CallOpts, arg0 [32]byte) (bool, error)

UsedPubkey is a free data retrieval call binding the contract method 0x01110845.

Solidity: function usedPubkey( bytes32) constant returns(bool)

func (*ValidatorRegistrationCaller) VALIDATORDEPOSIT

func (_ValidatorRegistration *ValidatorRegistrationCaller) VALIDATORDEPOSIT(opts *bind.CallOpts) (*big.Int, error)

VALIDATORDEPOSIT is a free data retrieval call binding the contract method 0x441d92cc.

Solidity: function VALIDATOR_DEPOSIT() constant returns(uint256)

type ValidatorRegistrationCallerRaw

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

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

func (*ValidatorRegistrationCallerRaw) Call

func (_ValidatorRegistration *ValidatorRegistrationCallerRaw) 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 ValidatorRegistrationCallerSession

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

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

func (*ValidatorRegistrationCallerSession) UsedPubkey

func (_ValidatorRegistration *ValidatorRegistrationCallerSession) UsedPubkey(arg0 [32]byte) (bool, error)

UsedPubkey is a free data retrieval call binding the contract method 0x01110845.

Solidity: function usedPubkey( bytes32) constant returns(bool)

func (*ValidatorRegistrationCallerSession) VALIDATORDEPOSIT

func (_ValidatorRegistration *ValidatorRegistrationCallerSession) VALIDATORDEPOSIT() (*big.Int, error)

VALIDATORDEPOSIT is a free data retrieval call binding the contract method 0x441d92cc.

Solidity: function VALIDATOR_DEPOSIT() constant returns(uint256)

type ValidatorRegistrationFilterer

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

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

func NewValidatorRegistrationFilterer

func NewValidatorRegistrationFilterer(address common.Address, filterer bind.ContractFilterer) (*ValidatorRegistrationFilterer, error)

NewValidatorRegistrationFilterer creates a new log filterer instance of ValidatorRegistration, bound to a specific deployed contract.

func (*ValidatorRegistrationFilterer) FilterValidatorRegistered

func (_ValidatorRegistration *ValidatorRegistrationFilterer) FilterValidatorRegistered(opts *bind.FilterOpts, pubKey [][32]byte, withdrawalAddressbytes32 []common.Address, randaoCommitment [][32]byte) (*ValidatorRegistrationValidatorRegisteredIterator, error)

FilterValidatorRegistered is a free log retrieval operation binding the contract event 0x7b0678aab009b61a805f5004869728b53a444f9a3e6bb9e22b8537c89af51274.

Solidity: event ValidatorRegistered(pubKey indexed bytes32, withdrawalShardID uint256, withdrawalAddressbytes32 indexed address, randaoCommitment indexed bytes32)

func (*ValidatorRegistrationFilterer) WatchValidatorRegistered

func (_ValidatorRegistration *ValidatorRegistrationFilterer) WatchValidatorRegistered(opts *bind.WatchOpts, sink chan<- *ValidatorRegistrationValidatorRegistered, pubKey [][32]byte, withdrawalAddressbytes32 []common.Address, randaoCommitment [][32]byte) (event.Subscription, error)

WatchValidatorRegistered is a free log subscription operation binding the contract event 0x7b0678aab009b61a805f5004869728b53a444f9a3e6bb9e22b8537c89af51274.

Solidity: event ValidatorRegistered(pubKey indexed bytes32, withdrawalShardID uint256, withdrawalAddressbytes32 indexed address, randaoCommitment indexed bytes32)

type ValidatorRegistrationRaw

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

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

func (*ValidatorRegistrationRaw) Call

func (_ValidatorRegistration *ValidatorRegistrationRaw) 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 (*ValidatorRegistrationRaw) Transact

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

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

func (*ValidatorRegistrationRaw) Transfer

func (_ValidatorRegistration *ValidatorRegistrationRaw) 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 ValidatorRegistrationSession

type ValidatorRegistrationSession struct {
	Contract     *ValidatorRegistration // 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
}

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

func (*ValidatorRegistrationSession) Deposit

func (_ValidatorRegistration *ValidatorRegistrationSession) Deposit(_pubkey [32]byte, _withdrawalShardID *big.Int, _withdrawalAddressbytes32 common.Address, _randaoCommitment [32]byte) (*types.Transaction, error)

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

Solidity: function deposit(_pubkey bytes32, _withdrawalShardID uint256, _withdrawalAddressbytes32 address, _randaoCommitment bytes32) returns()

func (*ValidatorRegistrationSession) UsedPubkey

func (_ValidatorRegistration *ValidatorRegistrationSession) UsedPubkey(arg0 [32]byte) (bool, error)

UsedPubkey is a free data retrieval call binding the contract method 0x01110845.

Solidity: function usedPubkey( bytes32) constant returns(bool)

func (*ValidatorRegistrationSession) VALIDATORDEPOSIT

func (_ValidatorRegistration *ValidatorRegistrationSession) VALIDATORDEPOSIT() (*big.Int, error)

VALIDATORDEPOSIT is a free data retrieval call binding the contract method 0x441d92cc.

Solidity: function VALIDATOR_DEPOSIT() constant returns(uint256)

type ValidatorRegistrationTransactor

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

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

func NewValidatorRegistrationTransactor

func NewValidatorRegistrationTransactor(address common.Address, transactor bind.ContractTransactor) (*ValidatorRegistrationTransactor, error)

NewValidatorRegistrationTransactor creates a new write-only instance of ValidatorRegistration, bound to a specific deployed contract.

func (*ValidatorRegistrationTransactor) Deposit

func (_ValidatorRegistration *ValidatorRegistrationTransactor) Deposit(opts *bind.TransactOpts, _pubkey [32]byte, _withdrawalShardID *big.Int, _withdrawalAddressbytes32 common.Address, _randaoCommitment [32]byte) (*types.Transaction, error)

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

Solidity: function deposit(_pubkey bytes32, _withdrawalShardID uint256, _withdrawalAddressbytes32 address, _randaoCommitment bytes32) returns()

type ValidatorRegistrationTransactorRaw

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

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

func (*ValidatorRegistrationTransactorRaw) Transact

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

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

func (*ValidatorRegistrationTransactorRaw) Transfer

func (_ValidatorRegistration *ValidatorRegistrationTransactorRaw) 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 ValidatorRegistrationTransactorSession

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

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

func (*ValidatorRegistrationTransactorSession) Deposit

func (_ValidatorRegistration *ValidatorRegistrationTransactorSession) Deposit(_pubkey [32]byte, _withdrawalShardID *big.Int, _withdrawalAddressbytes32 common.Address, _randaoCommitment [32]byte) (*types.Transaction, error)

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

Solidity: function deposit(_pubkey bytes32, _withdrawalShardID uint256, _withdrawalAddressbytes32 address, _randaoCommitment bytes32) returns()

type ValidatorRegistrationValidatorRegistered

type ValidatorRegistrationValidatorRegistered struct {
	PubKey                   [32]byte
	WithdrawalShardID        *big.Int
	WithdrawalAddressbytes32 common.Address
	RandaoCommitment         [32]byte
	Raw                      types.Log // Blockchain specific contextual infos
}

ValidatorRegistrationValidatorRegistered represents a ValidatorRegistered event raised by the ValidatorRegistration contract.

type ValidatorRegistrationValidatorRegisteredIterator

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

ValidatorRegistrationValidatorRegisteredIterator is returned from FilterValidatorRegistered and is used to iterate over the raw logs and unpacked data for ValidatorRegistered events raised by the ValidatorRegistration contract.

func (*ValidatorRegistrationValidatorRegisteredIterator) Close

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

func (*ValidatorRegistrationValidatorRegisteredIterator) Error

Error returns any retrieval or parsing error occurred during filtering.

func (*ValidatorRegistrationValidatorRegisteredIterator) 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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