InfraredBERA
Inherits: ERC20Upgradeable, Upgradeable, IInfraredBERA
Infrared liquid staking token for BERA
Assumes BERA balances do not change at the CL
State Variables
withdrawalsEnabled
Flag to show whether withdrawals are currently enabled
bool public withdrawalsEnabled;
_initialized
Whether initial mint to address(this) has happened
bool private _initialized;
feeDivisorShareholders
Fee taken by the shareholders on yield from EL coinbase priority fees + MEV, represented as an integer denominator (1/x)%
uint16 public feeDivisorShareholders;
infrared
Address of the Infrared operator contract
address public infrared;
depositor
Address of the depositor that interacts with chain deposit precompile
address public depositor;
withdrawor
Address of the withdrawor that interacts with chain withdraw precompile
address public withdrawor;
receivor
Address of the fee receivor contract that receives tx priority fees + MEV on EL
address public receivor;
deposits
Deposits of BERA backing InfraredBERA intended for use in CL by validators
uint256 public deposits;
_stakes
mapping(bytes32 pubkeyHash => uint256 stake) internal _stakes;
_staked
mapping(bytes32 pubkeyHash => bool isStaked) internal _staked;
_exited
mapping(bytes32 pubkeyHash => bool hasExited) internal _exited;
_signatures
mapping(bytes32 pubkeyHash => bytes) internal _signatures;
Functions
initialize
Initializes InfraredBERA to allow for future mints and burns
Must be called before InfraredBERA can offer deposits and withdraws
function initialize(
address _gov,
address _keeper,
address _infrared,
address _depositor,
address _withdrawor,
address _receivor
) external payable initializer;
setWithdrawalsEnabled
function setWithdrawalsEnabled(bool flag) external onlyGovernor;
_deposit
function _deposit(uint256 value)
private
returns (uint256 nonce, uint256 amount, uint256 fee);
_withdraw
function _withdraw(address receiver, uint256 amount, uint256 fee)
private
returns (uint256 nonce);
pending
Pending deposits yet to be forwarded to CL
function pending() public view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount of BERA yet to be deposited to CL |
confirmed
Confirmed deposits sent to CL
function confirmed() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount of BERA confirmed to be deposited to CL |
keeper
Returns whether given account is an InfraredBERA keeper
function keeper(address account) public view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether account is a keeper |
governor
Returns whether given account is an InfraredBERA governor
function governor(address account) public view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether account is a governor |
validator
Returns whether given pubkey is in Infrared validator set
function validator(bytes calldata pubkey) external view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whether pubkey in Infrared validator set |
compound
Compounds accumulated EL yield in fee receivor into deposits
Called internally at bof whenever InfraredBERA minted or burned
function compound() public;
sweep
Sweeps received funds in msg.value
as yield into deposits
Fee receivor must call this function in its sweep function for autocompounding
function sweep() external payable;
mint
Mints ibera shares to receiver for bera paid in by sender
function mint(address receiver)
public
payable
returns (uint256 nonce, uint256 shares);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | Address of the receiver of ibera |
Returns
Name | Type | Description |
---|---|---|
nonce | uint256 | The nonce issued to identify the credited bera funds for deposit |
shares | uint256 | The amount of shares of ibera minted |
burn
Burns ibera shares from sender for bera to ultimately be transferred to receiver on subsequent call to claim
Sender must pay withdraw precompile fee upfront
function burn(address receiver, uint256 shares)
external
payable
returns (uint256 nonce, uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
receiver | address | Address of the receiver of future bera |
shares | uint256 | The amount of shares of ibera burned |
Returns
Name | Type | Description |
---|---|---|
nonce | uint256 | The nonce issued to identify the owed bera funds for claim |
amount | uint256 | The amount of bera funds that will be available for claim |
register
Registers update to BERA staked in validator with given pubkey at CL
Reverts if not called by depositor or withdrawor
function register(bytes calldata pubkey, int256 delta) external;
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The pubkey of the validator to update BERA stake for at CL |
delta | int256 | The change in the amount of BERA staked/unstaked (+/-) at CL |
setFeeDivisorShareholders
Sets the fee shareholders taken on yield from EL coinbase priority fees + MEV
function setFeeDivisorShareholders(uint16 to) external onlyGovernor;
Parameters
Name | Type | Description |
---|---|---|
to | uint16 | The new fee shareholders represented as an integer denominator (1/x)% |
setDepositSignature
Sets the deposit signature to be used when depositing to pubkey
function setDepositSignature(bytes calldata pubkey, bytes calldata signature)
external
onlyGovernor;
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The pubkey of the validator receiving the deposit |
signature | bytes | The deposit signature to use for pubkey |
collect
Collects yield from fee receivor and mints ibera shares to Infrared
Only Infrared can call this function
function collect() external returns (uint256 sharesMinted);
Returns
Name | Type | Description |
---|---|---|
sharesMinted | uint256 | The amount of ibera shares minted |
previewMint
Previews the amount of InfraredBERA shares that would be minted for a given BERA amount
function previewMint(uint256 beraAmount)
public
view
returns (uint256 shares, uint256 fee);
Parameters
Name | Type | Description |
---|---|---|
beraAmount | uint256 | The amount of BERA to simulate depositing |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The amount of InfraredBERA shares that would be minted, returns 0 if the operation would fail |
fee | uint256 | The fee that would be charged for the mint operation |
previewBurn
Previews the amount of BERA that would be received for burning InfraredBERA shares
function previewBurn(uint256 shareAmount)
public
view
returns (uint256 beraAmount, uint256 fee);
Parameters
Name | Type | Description |
---|---|---|
shareAmount | uint256 |
Returns
Name | Type | Description |
---|---|---|
beraAmount | uint256 | The amount of BERA that would be received, returns 0 if the operation would fail |
fee | uint256 | The fee that would be charged for the burn operation |
stakes
Returns the amount of BERA staked in validator with given pubkey
function stakes(bytes calldata pubkey) external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount of BERA staked in validator |
staked
Returns whether initial deposit has been staked to validator with given pubkey
function staked(bytes calldata pubkey) external view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | Whethere initial deposit has been staked to validator |
hasExited
Checks if a validator has been force exited from the Consensus Layer
exited validators can no longer be deposited in.
function hasExited(bytes calldata pubkey) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The public key of the validator to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool True if the validator has been force exited, false otherwise |
signatures
Returns the deposit signature to use for given pubkey
function signatures(bytes calldata pubkey)
external
view
returns (bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The deposit signature for pubkey |