InfraredBERAWithdrawor

Git Source

Inherits: Upgradeable, IInfraredBERAWithdrawor

Withdrawor to withdraw BERA from CL for Infrared liquid staking token

Assumes ETH returned via withdraw precompile credited to contract so receive unnecessary

State Variables

WITHDRAW_REQUEST_TYPE

uint8 public constant WITHDRAW_REQUEST_TYPE = 0x01;

WITHDRAW_PRECOMPILE

address public WITHDRAW_PRECOMPILE;

InfraredBERA

The address of the InfraredBERA contract

address public InfraredBERA;

claimor

address public claimor;

requests

Outstanding requests for claims on previously burnt ibera

mapping(uint256 => Request) public requests;

fees

Amount of BERA internally set aside for withdraw precompile request fees

uint256 public fees;

rebalancing

Amount of BERA internally rebalancing amongst Infrared validators

uint256 public rebalancing;

nonceRequest

The next nonce to issue withdraw request for

uint256 public nonceRequest;

nonceSubmit

The next nonce to submit withdraw request for

uint256 public nonceSubmit;

nonceProcess

The next nonce in queue to process claims for

uint256 public nonceProcess;

__gap

Reserve storage slots for future upgrades for safety

uint256[40] private __gap;

Functions

initializeV2

function initializeV2(address _claimor, address _withdraw_precompile)
    external
    onlyGovernor;

_enoughtime

Checks whether enough time has passed beyond min delay

function _enoughtime(uint96 then, uint96 current)
    private
    pure
    returns (bool has);

Parameters

NameTypeDescription
thenuint96The block timestamp in past
currentuint96The current block timestamp now

Returns

NameTypeDescription
hasboolWhether time between then and now exceeds forced min delay

reserves

Amount of BERA internally set aside to process withdraw compile requests from funds received on successful requests

function reserves() public view returns (uint256);

queue

Queues a withdraw request from InfraredBERA

Requires msg.value to cover minimum withdrawal fee

function queue(address receiver, uint256 amount)
    external
    payable
    returns (uint256 nonce);

Parameters

NameTypeDescription
receiveraddressThe address to receive withdrawn funds
amountuint256The amount of funds to withdraw

Returns

NameTypeDescription
nonceuint256The unique identifier for this withdrawal request

execute

Executes a withdraw request to withdraw precompile

Payable to cover any additional fees required by precompile

function execute(bytes calldata pubkey, uint256 amount) external payable;

Parameters

NameTypeDescription
pubkeybytesThe validator's public key to withdraw from
amountuint256The amount of BERA to withdraw

process

Processes the funds received from withdraw precompile

Reverts if balance has not increased by full amount of request

function process() external;

sweep

Sweeps forced withdrawals to InfraredBERA to re-stake principal

Only callable when withdrawals are disabled and by keeper

function sweep(bytes calldata pubkey) external;

Parameters

NameTypeDescription
pubkeybytesThe validator's public key to sweep funds from

receive

receive() external payable;

Structs

Request

struct Request {
    address receiver;
    uint96 timestamp;
    uint256 fee;
    uint256 amountSubmit;
    uint256 amountProcess;
}