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.
GRACE_PERIOD_TIME
Time to pass before accepting answers when sequencer comes back up.
vault
Vault address.
numeraireToken
Numeraire token.
feeToken
Fee token.
wrappedNativeToken
Wrapped native token.
sequencer
Sequencer Uptime Feed address for L2.
_assets
STORAGE ///
List of currently registered assets.
numYieldAssets
Number of ERC4626 assets. Maintained for more efficient calculation of spotPrices.
Functions
constructor
FUNCTIONS ///
Parameters
owner_
address
Initial owner address.
vault_
address
Vault address.
assets_
AssetInformation[]
Initial list of registered assets.
numeraireToken_
IERC20
Numeraire token address.
feeToken_
IERC20
Fee token address.
wrappedNativeToken_
IERC20
Wrapped native token address.
sequencer_
AggregatorV2V3Interface
Sequencer Uptime Feed address for L2.
addAsset
Add a new asset.
MUST revert if not called by owner.
MUST revert if asset with the same address exists.
Parameters
asset
AssetInformation
Asset information for new asset.
removeAsset
Remove an asset.
MUST revert if not called by owner.
Parameters
asset
address
An asset to remove.
assets
Get a list of all registered assets.
MUST return assets in an order sorted by address.
Returns
<none>
AssetInformation[]
assets List of assets.
spotPrices
Calculate spot prices of non-ERC4626 assets.
MUST return assets in the same order as in assets but with ERC4626 assets filtered out.
Returns
<none>
AssetPriceReading[]
spotPrices Spot prices of non-ERC4626 assets in 18 decimals.
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.
_checkAssetOracle
INTERNAL FUNCTIONS ///
Ensure non-zero oracle address for ERC20 and zero oracle address for ERC4626.
Parameters
asset
AssetInformation
Asset details to check
_checkOraclePrice
Ensure oracle returns valid value and it's up to date.
Parameters
asset
AssetInformation
Asset details to check.
Returns
price
uint256
Valid oracle price.
_checkUnderlyingAsset
Check whether the underlying asset is listed as an ERC20.
Will revert if underlying asset is an ERC4626.
Parameters
asset
AssetInformation
ERC4626 asset to check underlying asset.
assetsToCheck
AssetInformation[]
Array of assets.
_insertAsset
Insert asset at the given index in an array of assets.
Parameters
asset
AssetInformation
New asset details.
index
uint256
Index of the new asset in the asset array.
_checkAssetRegistryOwner
Check that owner is not the vault or the guardian.
Parameters
owner_
address
Asset registry owner address.
vault_
address
Vault address.
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.
Events
AssetAdded
EVENTS ///
Emitted when a new asset is added.
AssetRemoved
Emitted when an asset is removed.
Created
Emitted in constructor.
Errors
Aera__NumberOfAssetsExceedsMaximum
ERRORS ///
Aera__NumeraireTokenIsNotRegistered
Aera__NumeraireTokenIsERC4626
Aera__NumeraireOracleIsNotZeroAddress
Aera__FeeTokenIsNotRegistered
Aera__FeeTokenIsERC4626
Aera__WrappedNativeTokenIsNotRegistered
Aera__WrappedNativeTokenIsERC4626
Aera__AssetOrderIsIncorrect
Aera__AssetRegistryInitialOwnerIsZeroAddress
Aera__AssetRegistryOwnerIsGuardian
Aera__AssetRegistryOwnerIsVault
Aera__ERC20OracleIsZeroAddress
Aera__ERC4626OracleIsNotZeroAddress
Aera__UnderlyingAssetIsNotRegistered
Aera__UnderlyingAssetIsItselfERC4626
Aera__AssetIsUnderlyingAssetOfERC4626
Aera__AssetIsAlreadyRegistered
Aera__AssetNotRegistered
Aera__CannotRemoveNumeraireToken
Aera__CannotRemoveFeeToken
Aera__CannotRemoveWrappedNativeToken
Aera__VaultIsZeroAddress
Aera__SequencerIsDown
Aera__GracePeriodNotOver
Aera__OraclePriceIsInvalid
Aera__OraclePriceIsTooOld
Last updated