InfraredBERAWithdraworLite
Inherits: Upgradeable, IInfraredBERAWithdraworLite
Title: InfraredBERAWithdraworLite
This contract is only responsible for handling involuntary exits from the CL. It is a light version of the InfraredBERAWithdrawor contract.
This contract should be upgraded once withdrawals are enabled by https://github.com/berachain/beacon-kit.
expects compliance of https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7002.md
State Variables
WITHDRAW_REQUEST_TYPE
The withdrawal request type, execution layer withdrawal.
uint8 public constant WITHDRAW_REQUEST_TYPE = 0x01
WITHDRAW_PRECOMPILE
The address of the Withdraw Precompile settable in the next upgrade.
address public WITHDRAW_PRECOMPILE
InfraredBERA
The address of the InfraredBERA.sol contract.
address public InfraredBERA
claimor
The address of the InfraredBERAClaimor.sol contract.
This contract will be set in the next upgrade.
address public claimor
requests
Outstanding requests for claims on previously burnt ibera The key = nonce associated with the claim
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
initialize
Initialize the contract (replaces the constructor)
function initialize(address _gov, address _keeper, address ibera)
public
initializer;
Parameters
| Name | Type | Description |
|---|---|---|
_gov | address | Address for admin / gov to upgrade |
_keeper | address | Address for keeper |
ibera | address | The initial InfraredBERA address |
_enoughtime
Checks whether enough time has passed beyond min delay
function _enoughtime(uint96 then, uint96 current)
private
pure
returns (bool has);
Parameters
| Name | Type | Description |
|---|---|---|
then | uint96 | The block timestamp in past |
current | uint96 | The current block timestamp now |
Returns
| Name | Type | Description |
|---|---|---|
has | bool | Whether 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 from InfraredBERA for chain withdraw precompile escrowing minimum fees for request to withdraw precompile
not used until next upgrade.
function queue(address, uint256) external payable returns (uint256);
execute
Executes a withdraw request to withdraw precompile
not used until next upgrade.
function execute(bytes calldata, uint256) external payable;
process
Processes the funds received from withdraw precompile to next-to-process request receiver
Reverts if balance has not increased by full amount of request for next-to-process request nonce
not used until next upgrade.
function process() external pure;
sweep
Handles Forced withdrawals from the CL.
RESTRICTED USAGE: This function should ONLY be called when:
- A validator has been forced to exit from the CL.
The funds will enter the IBERA system as a deposit via the InfraredBERADepositor.
function sweep(bytes calldata pubkey) external onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
pubkey | bytes | The pubkey of the validator that has been forced to exit. |
sweepUnaccountedForFunds
Handles excess stake that was refunded from a validator due to non-IBERA deposits exceeding MAX_EFFECTIVE_BALANCE
RESTRICTED USAGE: This function should ONLY be called when:
- A non-IBERA entity deposits to our validator, pushing total stake above MAX_EFFECTIVE_BALANCE
- The excess stake is refunded by the CL to this contract
The funds will enter the IBERA system as yield via the FeeReceivor
This should NEVER be used for:
- Validators exited due to falling out of the validator set
Note: access: Only callable by governance
function sweepUnaccountedForFunds(uint256 amount) external onlyGovernor;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | The amount of excess stake to sweep |
receive
receive() external payable;
Structs
Request
The request struct for withdrawal requests.
struct Request {
address receiver;
uint96 timestamp;
uint256 fee;
uint256 amountSubmit;
uint256 amountProcess;
}
Properties
| Name | Type | Description |
|---|---|---|
receiver | address | The address of the receiver of the withdrawn BERA funds. |
timestamp | uint96 | The block.timestamp at which the withdraw request was issued. |
fee | uint256 | The fee escrow for the withdraw precompile request. |
amountSubmit | uint256 | The amount of withdrawn BERA funds left to submit request to withdraw precompile. |
amountProcess | uint256 | The amount of withdrawn BERA funds left to process from funds received via withdraw request. |