RioLRTAssetRegistry

Git Source

Inherits: IRioLRTAssetRegistry, OwnableUpgradeable, UUPSUpgradeable, RioLRTCore

State Variables

priceFeedDecimals

The number of decimals that all asset price feeds must use.

uint8 public priceFeedDecimals;

priceScale

The price scale used for all assets (max of 18 decimals).

uint64 public priceScale;

supportedAssets

All supported assets.

address[] public supportedAssets;

assetInfo

Information about a supported asset.

mapping(address asset => AssetInfo) public assetInfo;

ethBalanceInUnverifiedValidators

The amount of ETH held in unverified validators.

uint256 public ethBalanceInUnverifiedValidators;

Functions

onlyWithdrawalQueueOrDepositPool

Require that the caller is the withdrawal queue or deposit pool.

modifier onlyWithdrawalQueueOrDepositPool();

constructor

constructor(address issuer_) RioLRTCore(issuer_);

Parameters

Name
Type
Description

issuer_

address

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

initialize

Initializes the asset registry contract.

function initialize(
    address initialOwner,
    address token_,
    uint8 priceFeedDecimals_,
    AssetConfig[] calldata initialAssets
) external initializer;

Parameters

Name
Type
Description

initialOwner

address

The initial owner of the contract.

token_

address

The address of the liquid restaking token.

priceFeedDecimals_

uint8

The number of decimals that all price feeds must use.

initialAssets

AssetConfig[]

The initial supported asset configurations.

getTVL

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

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

getTVLForAsset

Returns the total value of the underlying asset in the unit of account.

function getTVLForAsset(address asset) public view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getTotalBalanceForAsset

Returns the total balance of the asset, including the deposit pool and EigenLayer.

function getTotalBalanceForAsset(address asset) public view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getETHBalanceInEigenLayer

Returns the ETH balance held in EigenLayer. This includes the ETH held in unverified validators, EigenPod shares, and ETH that's queued for withdrawal.

function getETHBalanceInEigenLayer() public view returns (uint256 balance);

isSupportedAsset

Checks if a given asset is supported.

function isSupportedAsset(address asset) public view returns (bool);

Parameters

Name
Type
Description

asset

address

The address of the asset to check.

getAssetInfoByAddress

Returns information about an asset.

function getAssetInfoByAddress(address asset) public view returns (AssetInfo memory);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetStrategy

Returns the asset's EigenLayer strategy.

function getAssetStrategy(address asset) public view returns (address);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetSharesHeld

Returns the amount of EigenLayer shares held for an asset.

function getAssetSharesHeld(address asset) public view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetPriceFeed

Returns the asset's current price feed.

function getAssetPriceFeed(address asset) external view returns (address);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetDepositCap

Returns the asset's current deposit cap.

function getAssetDepositCap(address asset) external view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetDecimals

Returns the asset's decimal precision.

function getAssetDecimals(address asset) external view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getAssetPrice

Returns the asset's current price.

function getAssetPrice(address asset) public view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

getSupportedAssets

Returns an array of all supported assets.

function getSupportedAssets() public view returns (address[] memory assets);

getAssetStrategies

Returns the EigenLayer strategies for all supported assets.

function getAssetStrategies() external view returns (address[] memory strategies);

convertToUnitOfAccountFromAsset

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

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

Parameters

Name
Type
Description

asset

address

The address of the asset to convert.

amount

uint256

The amount of the asset to convert.

convertFromUnitOfAccountToAsset

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

function convertFromUnitOfAccountToAsset(address asset, uint256 value) public view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset to convert to.

value

uint256

The asset's value in the unit of account.

convertToSharesFromAsset

Converts an amount of an asset to the equivalent amount of EigenLayer shares.

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

Parameters

Name
Type
Description

asset

address

The address of the asset to convert.

amount

uint256

The amount of the asset to convert.

convertFromSharesToAsset

Converts an amount of EigenLayer shares to the equivalent amount of an asset.

function convertFromSharesToAsset(address strategy, uint256 shares) public view returns (uint256 amount);

Parameters

Name
Type
Description

strategy

address

The EigenLayer strategy.

shares

uint256

The amount of EigenLayer shares.

getPrice

Get the current price from the provided price feed. This function performs no checks on the price feed. Its output should not be trusted unless the price feed parameter is known and trusted.

function getPrice(address priceFeed) public view returns (uint256);

Parameters

Name
Type
Description

priceFeed

address

The price feed contract address.

addAsset

Adds a new underlying asset to the liquid restaking token.

function addAsset(AssetConfig calldata config) external onlyOwner;

Parameters

Name
Type
Description

config

AssetConfig

The asset's configuration.

removeAsset

Removes an underlying asset from the liquid restaking token.

function removeAsset(address asset) external onlyOwner;

Parameters

Name
Type
Description

asset

address

The address of the asset to remove.

forceRemoveAsset

Force removes an underlying asset from the liquid restaking token regardless of its balance.

function forceRemoveAsset(address asset) external onlyOwner;

Parameters

Name
Type
Description

asset

address

The address of the asset to force remove.

setAssetDepositCap

Sets the asset's deposit cap.

function setAssetDepositCap(address asset, uint96 newDepositCap) external onlyOwner;

Parameters

Name
Type
Description

asset

address

newDepositCap

uint96

The new rebalance delay.

setAssetPriceFeed

Sets the asset's price feed.

function setAssetPriceFeed(address asset, address newPriceFeed) external onlyOwner;

Parameters

Name
Type
Description

asset

address

newPriceFeed

address

The new price feed.

increaseSharesHeldForAsset

Increases the number of EigenLayer shares held for an asset.

function increaseSharesHeldForAsset(address asset, uint256 amount) external onlyCoordinator;

Parameters

Name
Type
Description

asset

address

The address of the asset.

amount

uint256

The amount of EigenLayer shares to increase.

decreaseSharesHeldForAsset

Decreases the number of EigenLayer shares held for an asset.

function decreaseSharesHeldForAsset(address asset, uint256 amount) external onlyWithdrawalQueueOrDepositPool;

Parameters

Name
Type
Description

asset

address

The address of the asset.

amount

uint256

The amount of EigenLayer shares to decrease.

increaseUnverifiedValidatorETHBalance

Increases the unverified validator ETH balance.

function increaseUnverifiedValidatorETHBalance(uint256 amount) external onlyCoordinator;

Parameters

Name
Type
Description

amount

uint256

The amount of ETH to increase.

decreaseUnverifiedValidatorETHBalance

Decreases the unverified validator ETH balance.

function decreaseUnverifiedValidatorETHBalance(uint256 amount) external onlyOperatorRegistry;

Parameters

Name
Type
Description

amount

uint256

The amount of ETH to decrease.

_addAsset

Adds a new underlying asset to the liquid restaking token.

function _addAsset(AssetConfig calldata config) internal;

Parameters

Name
Type
Description

config

AssetConfig

The asset's configuration.

_removeAsset

Removes an underlying asset from the liquid restaking token.

function _removeAsset(address asset, bool force) internal;

Parameters

Name
Type
Description

asset

address

The address of the asset to remove.

force

bool

If true, the asset will be removed regardless of its balance.

_findAssetIndex

Returns the index of the asset in the supported assets array.

function _findAssetIndex(address asset) internal view returns (uint256);

Parameters

Name
Type
Description

asset

address

The address of the asset.

_normalizeDecimals

Normalizes an amount from one decimal precision to another.

function _normalizeDecimals(uint256 amount, uint8 fromDecimals, uint8 toDecimals) internal pure returns (uint256);

Parameters

Name
Type
Description

amount

uint256

The amount to normalize.

fromDecimals

uint8

The amount's current decimal precision.

toDecimals

uint8

The amount's target decimal precision.

_authorizeUpgrade

Allows the owner to upgrade the asset registry implementation.

function _authorizeUpgrade(address newImplementation) internal override onlyOwner;

Parameters

Name
Type
Description

newImplementation

address

The implementation to upgrade to.

Last updated