RioLRTCoordinator
Inherits: IRioLRTCoordinator, OwnableUpgradeable, UUPSUpgradeable, PausableUpgradeable, EIP712, RioLRTCore
State Variables
DEPOSIT_ROOT_TYPEHASH
EIP-712 typehash for DepositRoot
message
ethPOS
The Ethereum POS deposit contract address.
rebalanceDelay
The required delay between rebalances.
guardianSigner
The guardian signer address.
assetNextRebalanceAfter
Tracks the timestamp from which each asset is eligible for rebalancing, inclusive of the defined timestamp.
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.
Parameters
asset
address
The asset being deposited.
amountIn
uint256
The amount of the asset being deposited.
checkWithdrawal
Require that the coordinator is not paused, the asset is supported, and the withdrawal amount is non-zero.
Parameters
asset
address
The asset being deposited.
amountIn
uint256
The amount of the asset being deposited.
checkRebalance
Require that the coordinator is not paused and the rebalance delay has been met.
Parameters
asset
address
The asset being rebalanced.
constructor
Parameters
issuer_
address
The LRT issuer that's authorized to deploy this contract.
ethPOS_
address
The Ethereum POS deposit contract address.
initialize
Initializes the contract.
Parameters
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.
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.
Parameters
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.
requestWithdrawal
Requests a withdrawal to asset
for amountIn
restaking tokens.
Parameters
asset
address
The asset being withdrawn.
amountIn
uint256
The amount of restaking tokens being redeemed.
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.
Parameters
root
bytes32
The deposit merkle root.
signature
bytes
The guardian signature.
rebalanceERC20
Rebalances the provided ERC20 token
by processing outstanding withdrawals and depositing remaining tokens into EigenLayer.
Parameters
token
address
The token to rebalance.
setRebalanceDelay
Sets the rebalance delay.
Parameters
newRebalanceDelay
uint24
The new rebalance delay, in seconds.
setGuardianSigner
Set the guardian signer address.
Only callable by the owner.
Parameters
newGuardianSigner
address
The address of the new guardian signer.
emergencyPauseOperatorUndelegated
Pauses the coordinator if any operator has forcefully undelegated one of our delegators.
Anyone can call this function.
pause
Pauses deposits, withdrawals, and rebalances.
unpause
Unpauses deposits, withdrawals, and rebalances.
convertFromUnitOfAccountToRestakingTokens
Converts the unit of account value to its equivalent in restaking tokens. The unit of account is the price feed's quote asset.
Parameters
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.
Parameters
amount
uint256
The amount of restaking tokens to convert.
convertFromAssetToRestakingTokens
Converts an asset amount to its equivalent value in restaking tokens.
Parameters
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.
Parameters
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.
Parameters
asset
address
The address of the asset whose EigenLayer shares to convert to.
amount
uint256
The amount of restaking tokens to convert.
hashTypedData
EIP-712 helper.
Parameters
structHash
bytes32
The hash of the struct.
receive
Deposits ETH and mints restaking token(s) to the caller.
_depositETH
Deposits ETH and mints restaking token(s) to the caller.
This function assumes that the quote asset is ETH.
_setRebalanceDelay
Sets the rebalance delay.
Parameters
newRebalanceDelay
uint24
The new rebalance delay, in seconds.
_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.
Parameters
asset
address
The asset being withdrawn.
amountOutstanding
uint256
The amount restaking tokens requested for withdrawal in the current epoch.
_domainNameAndVersion
Returns the domain name and version for EIP-712 guardian signatures.
_verifyGuardianSignature
Verify EIP-712 DepositDataRoot
signature.
Parameters
root
bytes32
The deposit data merkle root to verify.
signature
bytes
The guardian signature to verify.
_requireAssetSupported
Reverts if the asset is not supported.
Parameters
asset
address
The address of the asset.
_requireAmountGreaterThanZero
Reverts if the provided amount is zero.
Parameters
amount
uint256
The amount being checked.
_requireDepositCapNotReached
Reverts if the deposit cap for the asset has been reached.
Parameters
asset
address
The address of the asset.
amountIn
uint256
The amount of the asset being deposited.
_requireRebalanceDelayMet
Reverts if the rebalance delay has not been met.
Parameters
asset
address
The asset being rebalanced.
_authorizeUpgrade
Allows the owner to upgrade the gateway implementation.
Parameters
newImplementation
address
The implementation to upgrade to.
Last updated