Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

InfraredBERADepositorV2

Git Source

Inherits: Upgradeable

Depositor to deposit BERA to CL for Infrared liquid staking token

State Variables

ETH1_ADDRESS_WITHDRAWAL_PREFIX

https://eth2book.info/capella/part2/deposits-withdrawals/withdrawal-processing/

uint8 public constant ETH1_ADDRESS_WITHDRAWAL_PREFIX = 0x01;

DEPOSIT_CONTRACT

The Deposit Contract Address for Berachain

address public DEPOSIT_CONTRACT;

InfraredBERA

the main InfraredBERA contract address

address public InfraredBERA;

reserves

the queued amount of BERA to be deposited

uint256 public reserves;

minActivationDeposit

Minimum deposit for a validator to become active.

uint256 public minActivationDeposit;

__gap

Reserve storage slots for future upgrades for safety

uint256[39] private __gap;

Functions

initializeV2

Initialize V2

function initializeV2() external onlyGovernor;

queue

Queues a deposit by sending BERA to this contract and storing the amount in reserves account for beacon deposits on batch

function queue() external payable;

executeInitialDeposit

Executes initial deposit for 10k bera to the specified pubkey.

Only callable by the keeper

Only callable if the deposits are enabled

Only callable for initial deposit

function executeInitialDeposit(bytes calldata pubkey) external onlyKeeper;

Parameters

NameTypeDescription
pubkeybytesThe pubkey of the validator to deposit for

execute

Executes a deposit to the deposit contract for the specified pubkey and amount.

Only callable by the keeper

Only callable if the deposits are enabled

Only for deposits subsequent to initialization

function execute(
    BeaconRootsVerify.BeaconBlockHeader calldata header,
    BeaconRootsVerify.Validator calldata validator,
    bytes32[] calldata validatorMerkleWitness,
    bytes32[] calldata balanceMerkleWitness,
    uint256 validatorIndex,
    bytes32 balanceLeaf,
    uint256 amount,
    uint256 nextBlockTimestamp
) external onlyKeeper;

Parameters

NameTypeDescription
headerBeaconRootsVerify.BeaconBlockHeaderThe Beacon block header data
validatorBeaconRootsVerify.ValidatorThe full validator struct to deposit for
validatorMerkleWitnessbytes32[]Merkle witness for validator
balanceMerkleWitnessbytes32[]Merkle witness for balance container
validatorIndexuint256index of validator
balanceLeafbytes3232 bytes chunk including packed balance
amountuint256The amount of BERA to deposit
nextBlockTimestampuint256timestamp of following block to header to verify parent root in beaconroots call

setMinActivationDeposit

function setMinActivationDeposit(uint256 _minActivationDeposit)
    external
    onlyGovernor;

Events

Queue

Emitted when a new deposit queued

event Queue(uint256 amount);

Parameters

NameTypeDescription
amountuint256New deposit amount in BERA

Execute

Emitted when a consensus layer deposit queued to a validator

event Execute(bytes pubkey, uint256 amount);

Parameters

NameTypeDescription
pubkeybytesPublic key af validator to deposit to
amountuint256Validator deposit amount

MinActivationDepositUpdated

Emitted when min activation deposit is updated by governance

event MinActivationDepositUpdated(uint256 newMinActivationDeposit);

Parameters

NameTypeDescription
newMinActivationDeposituint256New value for min activation deposit to guarentee set inclusion