Skip to content

BeaconDeposit

0x4242424242424242424242424242424242424242 | ABI JSON

The contract handling validators deposits. Its events are used by the beacon chain to manage the staking process.

Inherits: IBeaconDeposit, ERC165.

Constants

CREDENTIALS_LENGTH

The length of the credentials, 1 byte prefix + 11 bytes padding + 20 bytes address = 32 bytes.

solidity
uint8 public constant CREDENTIALS_LENGTH = 32;

MIN_DEPOSIT_AMOUNT_IN_GWEI

The minimum amount of BERA to deposit i.e 10_000 ether.

solidity
uint64 public constant MIN_DEPOSIT_AMOUNT_IN_GWEI = 10_000 gwei;

PUBLIC_KEY_LENGTH

The length of the public key, PUBLIC_KEY_LENGTH bytes.

solidity
uint8 public constant PUBLIC_KEY_LENGTH = 48;

SIGNATURE_LENGTH

The length of the signature, SIGNATURE_LENGTH bytes.

solidity
uint8 public constant SIGNATURE_LENGTH = 96;

Structs

QueuedOperator

QueuedOperator is a struct that represents an operator address change request.

solidity
struct QueuedOperator {
    uint96 queuedTimestamp;
    address newOperator;
}

Properties

NameTypeDescription
queuedTimestampuint96The timestamp when the operator change was queued
newOperatoraddressThe new operator address

State Variables

depositCount

The number of deposits that have been made to the contract.

solidity
uint64 public depositCount;

genesisDepositsRoot

The hash tree root of the genesis deposits.

Should be set in deployment (predeploy state or constructor).

solidity
bytes32 public genesisDepositsRoot;

queuedOperator

The mapping of public keys to operator change requests.

solidity
mapping(bytes => QueuedOperator) public queuedOperator;

View Functions

getOperator

Get the operator address for a given pubkey.

Returns zero address if the pubkey is not registered.

solidity
function getOperator(bytes calldata pubkey) external view returns (address);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator.

Returns

NameTypeDescription
<none>addressThe operator address for the given pubkey.

Functions

acceptOperatorChange

Accept the operator change of a validator.

Only the new operator can accept the change.

Emits:

solidity
function acceptOperatorChange(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator.

cancelOperatorChange

Cancel the operator change of a validator.

Only the current operator can cancel the change.

Emits:

solidity
function cancelOperatorChange(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator.

deposit

Submit a deposit message to the Beaconchain.

emits the Deposit event upon successful deposit.

Emits:

solidity
function deposit(
    bytes calldata pubkey,
    bytes calldata credentials,
    bytes calldata signature,
    address operator
)
    external
    payable;

Parameters

NameTypeDescription
pubkeybytesis the consensus public key of the validator.
credentialsbytesis the withdrawal credentials of the validator.
signaturebytesis the signature used only on the first deposit.
operatoraddressis the address of the operator used for POL mechanics.

requestOperatorChange

Request to change the operator of a validator.

Only the current operator can request a change.

Emits:

solidity
function requestOperatorChange(bytes calldata pubkey, address newOperator) external;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator.
newOperatoraddressThe new operator address.

Events

Deposit

Emitted when a deposit is made.

solidity
event Deposit(bytes pubkey, bytes credentials, uint64 amount, bytes signature, uint64 index);

Parameters

NameTypeDescription
pubkeybytesThe consensus public key of the validator
credentialsbytesThe withdrawal credentials of the validator
amountuint64The amount deposited in Gwei
signaturebytesThe signature used only on the first deposit
indexuint64The deposit index

OperatorChangeQueued

Emitted when an operator change is queued.

solidity
event OperatorChangeQueued(bytes indexed pubkey, address queuedOperator, address currentOperator, uint256 queuedTimestamp);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator
queuedOperatoraddressThe new queued operator address
currentOperatoraddressThe current operator address
queuedTimestampuint256The timestamp when the change was queued

OperatorChangeCancelled

Emitted when an operator change is cancelled.

solidity
event OperatorChangeCancelled(bytes indexed pubkey);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator

OperatorUpdated

Emitted when the operator of a validator is updated.

solidity
event OperatorUpdated(bytes indexed pubkey, address newOperator, address previousOperator);

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator
newOperatoraddressThe new operator address
previousOperatoraddressThe previous operator address