RioLRTOperatorDelegator

Git Source

Inherits: IRioLRTOperatorDelegator, RioLRTCore

State Variables

WITHDRAWALS_ENABLED_PREFIX

The withdrawal credentials prefix, which signals that withdrawals are enabled.

bytes1 internal constant WITHDRAWALS_ENABLED_PREFIX = 0x01;

MIN_EXCESS_FULL_WITHDRAWAL_ETH_FOR_SCRAPE

The minimum amount of excess ETH from full withdrawals that can be scraped from the EigenPod.

uint256 internal constant MIN_EXCESS_FULL_WITHDRAWAL_ETH_FOR_SCRAPE = 1 ether;

strategyManager

The primary entry and exit-point for funds into and out of EigenLayer.

IStrategyManager public immutable strategyManager;

eigenPodManager

The contract used for creating and managing EigenPods.

IEigenPodManager public immutable eigenPodManager;

delegationManager

The primary delegation contract for EigenLayer.

IDelegationManager public immutable delegationManager;

eigenPod

The operator delegator's EigenPod.

IEigenPod public eigenPod;

withdrawalCredentials

Credentials to withdraw ETH on Consensus Layer via the EigenPod.

bytes32 public withdrawalCredentials;

ethQueuedForUserSettlementGwei

The amount of ETH queued for withdrawal to the withdrawal queue, intended for settling user withdrawals, in gwei.

uint64 public ethQueuedForUserSettlementGwei;

ethQueuedForOperatorExitsAndScrapesGwei

The amount of ETH queued for withdrawal to the deposit pool, specifically for facilitating operator exits and excess full withdrawal scrapes, in gwei.

uint64 public ethQueuedForOperatorExitsAndScrapesGwei;

authorizedClaimerByWithdrawalRoot

The mapping of withdrawal roots to the address that's allowed to claim them.

mapping(bytes32 root => address claimer) public authorizedClaimerByWithdrawalRoot;

Functions

constructor

constructor(address issuer_, address strategyManager_, address eigenPodManager_, address delegationManager_)
    RioLRTCore(issuer_);

Parameters

NameTypeDescription

issuer_

address

The issuer of the LRT instance that this contract is deployed for.

strategyManager_

address

The primary entry and exit-point for funds into and out of EigenLayer.

eigenPodManager_

address

The contract used for creating and managing EigenPods.

delegationManager_

address

The primary delegation contract for EigenLayer.

initialize

Initializes the contract by delegating to the provided EigenLayer operator.

function initialize(address token_, address operator) external initializer;

Parameters

NameTypeDescription

token_

address

The address of the liquid restaking token.

operator

address

The operator's address.

getEigenPodShares

Returns the number of shares in the operator delegator's EigenPod.

function getEigenPodShares() public view returns (int256);

getETHQueuedForWithdrawal

The amount of ETH queued for withdrawal from EigenLayer, in wei.

function getETHQueuedForWithdrawal() public view returns (uint256);

getETHUnderManagement

Returns the total amount of ETH under management by the operator delegator.

This includes EigenPod shares (verified validator balances minus queued withdrawals) and ETH queued for withdrawal from EigenLayer. Returns 0 if the total is negative.

function getETHUnderManagement() external view returns (uint256);

verifyWithdrawalCredentials

Verifies withdrawal credentials of validator(s) owned by this operator. It also verifies the effective balance of the validator(s).

function verifyWithdrawalCredentials(
    uint64 oracleTimestamp,
    IBeaconChainProofs.StateRootProof calldata stateRootProof,
    uint40[] calldata validatorIndices,
    bytes[] calldata validatorFieldsProofs,
    bytes32[][] calldata validatorFields
) external onlyOperatorRegistry;

Parameters

NameTypeDescription

oracleTimestamp

uint64

The Beacon Chain timestamp whose state root the proof will be proven against.

stateRootProof

IBeaconChainProofs.StateRootProof

Proves a beaconStateRoot against a block root fetched from the oracle.

validatorIndices

uint40[]

The list of indices of the validators being proven, refer to consensus specs.

validatorFieldsProofs

bytes[]

Proofs against the beaconStateRoot for each validator in validatorFields.

validatorFields

bytes32[][]

The fields of the "Validator Container", refer to consensus specs.

scrapeNonBeaconChainETHFromEigenPod

Scrapes non-beacon chain ETH sitting in the operator delegator's EigenPod to the reward distributor.

Anyone can call this function.

function scrapeNonBeaconChainETHFromEigenPod() external;

scrapeExcessFullWithdrawalETHFromEigenPod

Scrapes excess full withdrawal ETH from the operator delegator's EigenPod to the deposit pool. ETH from full withdrawals may accumulate in the EigenPod over time as full withdrawals contain more ETH than was requested from the withdrawal queue.

Anyone can call this function.

function scrapeExcessFullWithdrawalETHFromEigenPod() external;

emergencyScrapeExcessFullWithdrawalETHFromEigenPod

Scrapes excess full withdrawal ETH from the operator delegator's EigenPod to the deposit pool WITHOUT checking whether the minimum excess ETH amount is met.

Only the operator registry owner can call this function.

function emergencyScrapeExcessFullWithdrawalETHFromEigenPod() external;

stakeERC20

Approve EigenLayer to spend an ERC20 token, then stake it into an EigenLayer strategy.

function stakeERC20(address strategy, address token_, uint256 amount)
    external
    onlyDepositPool
    returns (uint256 shares);

Parameters

NameTypeDescription

strategy

address

The strategy to stake the tokens into.

token_

address

The token to stake.

amount

uint256

The amount of tokens to stake.

stakeETH

Stake ETH via the operator delegator's EigenPod, using the provided validator information.

function stakeETH(uint256 validatorCount, bytes calldata pubkeyBatch, bytes calldata signatureBatch)
    external
    payable
    onlyDepositPool;

Parameters

NameTypeDescription

validatorCount

uint256

The number of validators to deposit into.

pubkeyBatch

bytes

Batched validator public keys.

signatureBatch

bytes

Batched validator signatures.

queueWithdrawalForUserSettlement

Queues a withdrawal of the specified amount of shares from the given strategy for claim by the withdrawal queue, intended for settling user withdrawals.

function queueWithdrawalForUserSettlement(address strategy, uint256 shares)
    external
    onlyCoordinator
    returns (bytes32 root);

Parameters

NameTypeDescription

strategy

address

The strategy from which to withdraw.

shares

uint256

The amount of shares to withdraw.

queueWithdrawalForOperatorExit

Queues a withdrawal of the specified amount of shares from the given strategy for claim by the deposit pool, specifically for facilitating operator exits.

function queueWithdrawalForOperatorExit(address strategy, uint256 shares)
    external
    onlyOperatorRegistry
    returns (bytes32 root);

Parameters

NameTypeDescription

strategy

address

The strategy from which to withdraw.

shares

uint256

The amount of shares to withdraw.

completeQueuedWithdrawal

Completes a queued withdrawal of the specified queuedWithdrawal for the given asset.

function completeQueuedWithdrawal(
    IDelegationManager.Withdrawal calldata queuedWithdrawal,
    address asset,
    uint256 middlewareTimesIndex
) external returns (bytes32 root);

Parameters

NameTypeDescription

queuedWithdrawal

IDelegationManager.Withdrawal

The withdrawal to complete.

asset

address

The asset to withdraw.

middlewareTimesIndex

uint256

The index of the middleware times to use for the withdrawal.

receive

Forwards ETH rewards to the reward distributor. We consider any ETH sent from the delayed withdrawal router as a reward - this includes partial withdrawals, any amount in excess of 32 ETH for full withdrawals, and non-beacon chain ETH.

receive() external payable;

_queueWithdrawalForOperatorExitOrScrape

Queues a withdrawal of the specified amount of shares from the given strategy for claim by the deposit pool, specifically for facilitating operator exits or excess full withdrawal scrapes.

function _queueWithdrawalForOperatorExitOrScrape(address strategy, uint256 shares) internal returns (bytes32 root);

Parameters

NameTypeDescription

strategy

address

The strategy from which to withdraw.

shares

uint256

The amount of shares to withdraw.

_queueWithdrawal

Queue a withdrawal of the given amount of shares to the withdrawer from the provided strategy.

EigenLayer enforces that the withdrawer is the staker (this contract).

function _queueWithdrawal(address strategy, uint256 shares) internal returns (bytes32 root);

Parameters

NameTypeDescription

strategy

address

The strategy to withdraw from.

shares

uint256

The amount of shares to withdraw.

_increaseETHQueuedForUserSettlement

Increase the amount of ETH queued from EigenLayer for user settlement.

function _increaseETHQueuedForUserSettlement(uint256 amountWei) internal;

Parameters

NameTypeDescription

amountWei

uint256

The amount of ETH to increase by, in wei.

_decreaseETHQueuedForUserSettlement

Decrease the amount of ETH queued from EigenLayer for user settlement.

function _decreaseETHQueuedForUserSettlement(uint256 amountWei) internal;

Parameters

NameTypeDescription

amountWei

uint256

The amount of ETH to decrease by, in wei.

_increaseETHQueuedForOperatorExitOrScrape

Increase the amount of ETH queued for operator exit or excess full withdrawal scrape from EigenLayer.

function _increaseETHQueuedForOperatorExitOrScrape(uint256 amountWei) internal;

Parameters

NameTypeDescription

amountWei

uint256

The amount of ETH to increase by, in wei.

_decreaseETHQueuedForOperatorExitOrScrape

Decrease the amount of ETH queued for operator exit or excess full withdrawal scrape from EigenLayer.

function _decreaseETHQueuedForOperatorExitOrScrape(uint256 amountWei) internal;

Parameters

NameTypeDescription

amountWei

uint256

The amount of ETH to decrease by, in wei.

_computeWithdrawalCredentials

Compute withdrawal credentials for the given EigenPod.

function _computeWithdrawalCredentials(address pod) internal pure returns (bytes32);

Parameters

NameTypeDescription

pod

address

The EigenPod to compute the withdrawal credentials for.

_computeWithdrawalRoot

Returns the keccak256 hash of an EigenLayer withdrawal.

function _computeWithdrawalRoot(IDelegationManager.Withdrawal calldata withdrawal) internal pure returns (bytes32);

Parameters

NameTypeDescription

withdrawal

IDelegationManager.Withdrawal

The withdrawal.

_computeDepositDataRoot

Computes the deposit_root_hash required by the Beacon Deposit contract.

function _computeDepositDataRoot(bytes32 withdrawalCredentials_, bytes memory publicKey, bytes memory signature)
    internal
    pure
    returns (bytes32);

Parameters

NameTypeDescription

withdrawalCredentials_

bytes32

Credentials to withdraw ETH on Consensus Layer.

publicKey

bytes

A BLS12-381 public key.

signature

bytes

A BLS12-381 signature.

Last updated