AeraVaultAssetRegistry

AeraVaultAssetRegistry

Inherits: IAssetRegistry, Sweepable, ERC165

Maintains a list of registered assets and their oracles (when applicable).

State Variables

MAX_ASSETS

Maximum number of assets.

uint256 public constant MAX_ASSETS = 50;

GRACE_PERIOD_TIME

Time to pass before accepting answers when sequencer comes back up.

uint256 public constant GRACE_PERIOD_TIME = 3600;

vault

Vault address.

address public immutable vault;

numeraireToken

Numeraire token.

IERC20 public immutable numeraireToken;

feeToken

Fee token.

IERC20 public immutable feeToken;

wrappedNativeToken

Wrapped native token.

IERC20 public immutable wrappedNativeToken;

sequencer

Sequencer Uptime Feed address for L2.

AggregatorV2V3Interface public immutable sequencer;

_assets

STORAGE ///

List of currently registered assets.

AssetInformation[] internal _assets;

numYieldAssets

Number of ERC4626 assets. Maintained for more efficient calculation of spotPrices.

uint256 public numYieldAssets;

Functions

constructor

FUNCTIONS ///

constructor(
    address owner_,
    address vault_,
    AssetInformation[] memory assets_,
    IERC20 numeraireToken_,
    IERC20 feeToken_,
    IERC20 wrappedNativeToken_,
    AggregatorV2V3Interface sequencer_
) Ownable;

Parameters

addAsset

Add a new asset.

MUST revert if not called by owner.

MUST revert if asset with the same address exists.

function addAsset(AssetInformation calldata asset) external onlyOwner;

Parameters

removeAsset

Remove an asset.

MUST revert if not called by owner.

function removeAsset(address asset) external onlyOwner;

Parameters

assets

Get a list of all registered assets.

MUST return assets in an order sorted by address.

function assets() external view override returns (AssetInformation[] memory);

Returns

spotPrices

Calculate spot prices of non-ERC4626 assets.

MUST return assets in the same order as in assets but with ERC4626 assets filtered out.

function spotPrices()
    external
    view
    override
    returns (AssetPriceReading[] memory);

Returns

supportsInterface

Returns true if this contract implements the interface defined by interfaceId. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas.

function supportsInterface(bytes4 interfaceId)
    public
    view
    override
    returns (bool);

_checkAssetOracle

INTERNAL FUNCTIONS ///

Ensure non-zero oracle address for ERC20 and zero oracle address for ERC4626.

function _checkAssetOracle(AssetInformation memory asset) internal view;

Parameters

_checkOraclePrice

Ensure oracle returns valid value and it's up to date.

function _checkOraclePrice(AssetInformation memory asset)
    internal
    view
    returns (uint256 price);

Parameters

Returns

_checkUnderlyingAsset

Check whether the underlying asset is listed as an ERC20.

Will revert if underlying asset is an ERC4626.

function _checkUnderlyingAsset(
    AssetInformation memory asset,
    AssetInformation[] memory assetsToCheck
) internal view;

Parameters

_insertAsset

Insert asset at the given index in an array of assets.

function _insertAsset(AssetInformation memory asset, uint256 index) internal;

Parameters

_checkAssetRegistryOwner

Check that owner is not the vault or the guardian.

function _checkAssetRegistryOwner(
    address owner_,
    address vault_
) internal view;

Parameters

transferOwnership

Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner.

function transferOwnership(address newOwner) public override onlyOwner;

Events

AssetAdded

EVENTS ///

Emitted when a new asset is added.

event AssetAdded(address indexed asset, AssetInformation assetInfo);

AssetRemoved

Emitted when an asset is removed.

event AssetRemoved(address indexed asset);

Created

Emitted in constructor.

event Created(
    address indexed owner,
    address indexed vault,
    AssetInformation[] assets,
    address indexed numeraireToken,
    address feeToken,
    address wrappedNativeToken,
    address sequencer
);

Errors

Aera__NumberOfAssetsExceedsMaximum

ERRORS ///

error Aera__NumberOfAssetsExceedsMaximum(uint256 max);

Aera__NumeraireTokenIsNotRegistered

error Aera__NumeraireTokenIsNotRegistered(address numeraireToken);

Aera__NumeraireTokenIsERC4626

error Aera__NumeraireTokenIsERC4626();

Aera__NumeraireOracleIsNotZeroAddress

error Aera__NumeraireOracleIsNotZeroAddress();

Aera__FeeTokenIsNotRegistered

error Aera__FeeTokenIsNotRegistered(address feeToken);

Aera__FeeTokenIsERC4626

error Aera__FeeTokenIsERC4626(address feeToken);

Aera__WrappedNativeTokenIsNotRegistered

error Aera__WrappedNativeTokenIsNotRegistered(address wrappedNativeToken);

Aera__WrappedNativeTokenIsERC4626

error Aera__WrappedNativeTokenIsERC4626(address wrappedNativeToken);

Aera__AssetOrderIsIncorrect

error Aera__AssetOrderIsIncorrect(uint256 index);

Aera__AssetRegistryInitialOwnerIsZeroAddress

error Aera__AssetRegistryInitialOwnerIsZeroAddress();

Aera__AssetRegistryOwnerIsGuardian

error Aera__AssetRegistryOwnerIsGuardian();

Aera__AssetRegistryOwnerIsVault

error Aera__AssetRegistryOwnerIsVault();

Aera__ERC20OracleIsZeroAddress

error Aera__ERC20OracleIsZeroAddress(address asset);

Aera__ERC4626OracleIsNotZeroAddress

error Aera__ERC4626OracleIsNotZeroAddress(address asset);

Aera__UnderlyingAssetIsNotRegistered

error Aera__UnderlyingAssetIsNotRegistered(
    address asset, address underlyingAsset
);

Aera__UnderlyingAssetIsItselfERC4626

error Aera__UnderlyingAssetIsItselfERC4626();

Aera__AssetIsUnderlyingAssetOfERC4626

error Aera__AssetIsUnderlyingAssetOfERC4626(address erc4626Asset);

Aera__AssetIsAlreadyRegistered

error Aera__AssetIsAlreadyRegistered(uint256 index);

Aera__AssetNotRegistered

error Aera__AssetNotRegistered(address asset);

Aera__CannotRemoveNumeraireToken

error Aera__CannotRemoveNumeraireToken(address asset);

Aera__CannotRemoveFeeToken

error Aera__CannotRemoveFeeToken(address feeToken);

Aera__CannotRemoveWrappedNativeToken

error Aera__CannotRemoveWrappedNativeToken(address wrappedNativeToken);

Aera__VaultIsZeroAddress

error Aera__VaultIsZeroAddress();

Aera__SequencerIsDown

error Aera__SequencerIsDown();

Aera__GracePeriodNotOver

error Aera__GracePeriodNotOver();

Aera__OraclePriceIsInvalid

error Aera__OraclePriceIsInvalid(AssetInformation asset, int256 actual);

Aera__OraclePriceIsTooOld

error Aera__OraclePriceIsTooOld(AssetInformation asset, uint256 updatedAt);

Last updated