RioLRTCoordinator

Git Source

Inherits: IRioLRTCoordinator, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable, EIP712, RioLRTCore

State Variables

DEPOSIT_ROOT_TYPEHASH

EIP-712 typehash for DepositRoot message

bytes32 public constant DEPOSIT_ROOT_TYPEHASH = keccak256('DepositRoot(bytes32 root)');

ethPOS

The Ethereum POS deposit contract address.

IETHPOSDeposit public immutable ethPOS;

rebalanceDelay

The required delay between rebalances.

uint24 public rebalanceDelay;

guardianSigner

The guardian signer address.

address public guardianSigner;

assetNextRebalanceAfter

Tracks the timestamp from which each asset is eligible for rebalancing, inclusive of the defined timestamp.

mapping(address asset => uint40 timestamp) public assetNextRebalanceAfter;

Functions

checkDeposit

Require that the coordinator is not paused, the asset is supported, the deposit amount is non-zero, and the deposit cap has not been reached.

modifier checkDeposit(address asset, uint256 amountIn);

Parameters

checkWithdrawal

Require that the coordinator is not paused, the asset is supported, and the withdrawal amount is non-zero.

modifier checkWithdrawal(address asset, uint256 amountIn);

Parameters

checkRebalance

Require that the coordinator is not paused and the rebalance delay has been met.

modifier checkRebalance(address asset);

Parameters

constructor

constructor(address issuer_, address ethPOS_) RioLRTCore(issuer_);

Parameters

initialize

Initializes the contract.

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

Parameters

getTVL

Returns the total value of all underlying assets in the unit of account.

function getTVL() public view returns (uint256 value);

depositERC20

Deposits ERC20 tokens and mints restaking token(s) to the caller.

Reentrancy protection is omitted as tokens with transfer hooks are not supported. Future inclusion of such tokens could risk reentrancy attacks. Developers should remain vigilant and consider safeguards if this assumption changes.

function depositERC20(address asset, uint256 amountIn)
    external
    checkDeposit(asset, amountIn)
    returns (uint256 amountOut);

Parameters

depositETH

Deposits ETH and mints restaking token(s) to the caller.

function depositETH() external payable returns (uint256);

requestWithdrawal

Requests a withdrawal to asset for amountIn restaking tokens.

function requestWithdrawal(address asset, uint256 amountIn) external checkWithdrawal(asset, amountIn);

Parameters

rebalanceETH

Rebalances ETH by processing outstanding withdrawals and depositing remaining ETH into EigenLayer.

This function requires a guardian signature prior to depositing ETH into EigenLayer. If the guardian doesn't provide a signature within 24 hours, then the rebalance will be allowed without a signature, but only for withdrawals. In the future, this may be extended to allow a rebalance without a guardian signature without waiting 24 hours if withdrawals outnumber deposits.

function rebalanceETH(bytes32 root, bytes calldata signature) external checkRebalance(ETH_ADDRESS);

Parameters

rebalanceERC20

Rebalances the provided ERC20 token by processing outstanding withdrawals and depositing remaining tokens into EigenLayer.

function rebalanceERC20(address token) external checkRebalance(token);

Parameters

setRebalanceDelay

Sets the rebalance delay.

function setRebalanceDelay(uint24 newRebalanceDelay) external onlyOwner;

Parameters

setGuardianSigner

Set the guardian signer address.

Only callable by the owner.

function setGuardianSigner(address newGuardianSigner) external onlyOwner;

Parameters

emergencyPauseOperatorUndelegated

Pauses the coordinator if any operator has forcefully undelegated one of our delegators.

Anyone can call this function.

function emergencyPauseOperatorUndelegated() external;

pause

Pauses deposits, withdrawals, and rebalances.

function pause() external onlyOwner;

unpause

Unpauses deposits, withdrawals, and rebalances.

function unpause() external onlyOwner;

convertFromUnitOfAccountToRestakingTokens

Converts the unit of account value to its equivalent in restaking tokens. The unit of account is the price feed's quote asset.

function convertFromUnitOfAccountToRestakingTokens(uint256 value) public view returns (uint256);

Parameters

convertToUnitOfAccountFromRestakingTokens

Converts an amount of restaking tokens to its equivalent value in the unit of account. The unit of account is the price feed's quote asset.

function convertToUnitOfAccountFromRestakingTokens(uint256 amount) public view returns (uint256);

Parameters

convertFromAssetToRestakingTokens

Converts an asset amount to its equivalent value in restaking tokens.

function convertFromAssetToRestakingTokens(address asset, uint256 amount) public view returns (uint256);

Parameters

convertToAssetFromRestakingTokens

Converts an amount of restaking tokens to the equivalent in the asset.

function convertToAssetFromRestakingTokens(address asset, uint256 amount) public view returns (uint256);

Parameters

convertToSharesFromRestakingTokens

Converts an amount of restaking tokens to the equivalent in the provided asset's EigenLayer shares.

function convertToSharesFromRestakingTokens(address asset, uint256 amount) public view returns (uint256 shares);

Parameters

hashTypedData

EIP-712 helper.

function hashTypedData(bytes32 structHash) external view returns (bytes32);

Parameters

receive

Deposits ETH and mints restaking token(s) to the caller.

receive() external payable;

_depositETH

Deposits ETH and mints restaking token(s) to the caller.

This function assumes that the quote asset is ETH.

function _depositETH() internal checkDeposit(ETH_ADDRESS, msg.value) returns (uint256 amountOut);

_setRebalanceDelay

Sets the rebalance delay.

function _setRebalanceDelay(uint24 newRebalanceDelay) internal;

Parameters

_processUserWithdrawalsForCurrentEpoch

Processes user withdrawals for the provided asset by transferring available assets from the deposit pool and queueing any remaining amount for withdrawal from EigenLayer.

function _processUserWithdrawalsForCurrentEpoch(address asset, uint256 amountOutstanding) internal;

Parameters

_domainNameAndVersion

Returns the domain name and version for EIP-712 guardian signatures.

function _domainNameAndVersion() internal pure override returns (string memory, string memory);

_verifyGuardianSignature

Verify EIP-712 DepositDataRoot signature.

function _verifyGuardianSignature(bytes32 root, bytes calldata signature) internal view returns (bool);

Parameters

_requireAssetSupported

Reverts if the asset is not supported.

function _requireAssetSupported(address asset) internal view;

Parameters

_requireAmountGreaterThanZero

Reverts if the provided amount is zero.

function _requireAmountGreaterThanZero(uint256 amount) internal pure;

Parameters

_requireDepositCapNotReached

Reverts if the deposit cap for the asset has been reached.

function _requireDepositCapNotReached(address asset, uint256 amountIn) internal view;

Parameters

_requireRebalanceDelayMet

Reverts if the rebalance delay has not been met.

function _requireRebalanceDelayMet(address asset) internal view;

Parameters

_authorizeUpgrade

Allows the owner to upgrade the gateway implementation.

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

Parameters

Last updated