RioLRTCoordinator

RioLRTCoordinator

Inherits: IRioLRTCoordinator, OwnableUpgradeable, UUPSUpgradeable, RioLRTCore

State Variables

rebalanceDelay

The required delay between rebalances.

uint24 public rebalanceDelay;

assetLastRebalancedAt

Tracks the last timestamp when each asset was rebalanced.

mapping(address asset => uint256 timestamp) public assetLastRebalancedAt;

Functions

checkDeposit

Require that 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

NameTypeDescription

asset

address

The asset being deposited.

amountIn

uint256

The amount of the asset being deposited.

checkWithdrawal

Require that the asset is supported and the withdrawal amount is non-zero.

modifier checkWithdrawal(address asset, uint256 amountIn);

Parameters

NameTypeDescription

asset

address

The asset being deposited.

amountIn

uint256

The amount of the asset being deposited.

onRebalance

First, require that the rebalance delay has been met. Then, update the last rebalanced timestamp.

modifier onRebalance(address asset);

Parameters

NameTypeDescription

asset

address

The asset being rebalanced.

constructor

constructor(address issuer_) RioLRTCore(issuer_);

Parameters

NameTypeDescription

issuer_

address

The LRT issuer that's authorized to deploy this contract.

initialize

Initializes the contract.

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

Parameters

NameTypeDescription

initialOwner

address

The owner of the contract.

token_

address

The address of the liquid restaking token.

getTVL

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

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

deposit

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

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

Parameters

NameTypeDescription

asset

address

The asset being deposited.

amountIn

uint256

The amount of the asset being deposited.

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)
    returns (uint256 sharesOwed);

Parameters

NameTypeDescription

asset

address

The asset being withdrawn.

amountIn

uint256

The amount of restaking tokens being redeemed.

rebalance

Rebalances the provided asset by processing outstanding withdrawals and depositing remaining assets into EigenLayer.

function rebalance(address asset) external onRebalance(asset);

Parameters

NameTypeDescription

asset

address

The asset to rebalance.

setRebalanceDelay

Sets the rebalance delay.

function setRebalanceDelay(uint24 newRebalanceDelay) external onlyOwner;

Parameters

NameTypeDescription

newRebalanceDelay

uint24

The new rebalance delay.

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

NameTypeDescription

value

uint256

The restaking token's value in the unit of account.

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

NameTypeDescription

amount

uint256

The amount of restaking tokens to convert.

convertFromAssetToRestakingTokens

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

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

Parameters

NameTypeDescription

asset

address

The address of the asset to convert.

amount

uint256

The amount of the asset to convert.

convertToAssetFromRestakingTokens

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

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

Parameters

NameTypeDescription

asset

address

The address of the asset to convert to.

amount

uint256

The amount of restaking tokens to convert.

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

NameTypeDescription

asset

address

The address of the asset whose EigenLayer shares to convert to.

amount

uint256

The amount of restaking tokens to convert.

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

NameTypeDescription

newRebalanceDelay

uint24

The new rebalance delay.

_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 sharesOwed) internal;

Parameters

NameTypeDescription

asset

address

The asset being withdrawn.

sharesOwed

uint256

The amount of shares owed to users.

_checkAssetSupported

Checks if the provided asset is supported.

function _checkAssetSupported(address asset) internal view;

Parameters

NameTypeDescription

asset

address

The address of the asset.

_checkAmountGreaterThanZero

Checks if the provided amount is greater than zero.

function _checkAmountGreaterThanZero(uint256 amount) internal pure;

Parameters

NameTypeDescription

amount

uint256

The amount being checked.

_checkDepositCapReached

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

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

Parameters

NameTypeDescription

asset

address

The address of the asset.

amountIn

uint256

The amount of the asset being deposited.

_checkRebalanceDelayMet

Reverts if the rebalance delay has not been met.

function _checkRebalanceDelayMet(address asset) internal view;

Parameters

NameTypeDescription

asset

address

The asset being rebalanced.

_reducePrecisionToGwei

Reduces the precision of the given amount to the nearest Gwei.

function _reducePrecisionToGwei(uint256 amount) internal pure returns (uint256);

Parameters

NameTypeDescription

amount

uint256

The amount whose precision is to be reduced.

_authorizeUpgrade

Allows the owner to upgrade the gateway implementation.

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

Parameters

NameTypeDescription

newImplementation

address

The implementation to upgrade to.

Last updated