AeraVaultV2
AeraVaultV2
Inherits: IVault, ERC165, Ownable2Step, Pausable, ReentrancyGuard
Aera Vault V2 Vault contract.
State Variables
_MAX_FEE
Largest possible fee earned proportion per one second.
0.0000001% per second, i.e. 3.1536% per year. 0.0000001% * (365 * 24 * 60 * 60) = 3.1536% or 3.16224% per year in leap years.
_feeTokenDecimals
Number of decimals for fee token.
_numeraireTokenDecimals
Number of decimals for numeraire token.
_feeToken
Fee token used by asset registry.
fee
Fee per second in 18 decimal fixed point format.
assetRegistry
Asset registry address.
wrappedNativeToken
The address of wrapped native token.
hooks
STORAGE ///
Hooks module address.
guardian
Guardian address.
feeRecipient
Fee recipient address.
finalized
True if vault has been finalized.
lastValue
Last measured value of assets in vault.
lastFeeTokenPrice
Last spot price of fee token.
fees
Fee earned amount for each prior fee recipient.
feeTotal
Total fee earned and unclaimed amount by all fee recipients.
lastFeeCheckpoint
Last timestamp when fee index was reserved.
Functions
onlyOwnerOrGuardian
MODIFIERS ///
Throws if called by any account other than the owner or guardian.
onlyGuardian
Throws if called by any account other than the guardian.
whenNotFinalized
Throws if called after the vault is finalized.
whenHooksSet
Throws if hooks is not set
reserveFees
Calculate current guardian fees.
checkReservedFees
Check insolvency of fee token was not made worse.
constructor
FUNCTIONS ///
deposit
FUNCTIONS ///
MUST revert if not called by owner.
Parameters
amounts
AssetValue[]
Assets and amounts to deposit.
withdraw
Withdraw assets.
MUST revert if not called by owner.
Parameters
amounts
AssetValue[]
Assets and amounts to withdraw.
setGuardianAndFeeRecipient
Set current guardian and fee recipient.
MUST revert if not called by owner.
Parameters
newGuardian
address
newFeeRecipient
address
setHooks
Sets the current hooks module.
MUST revert if not called by owner.
Parameters
newHooks
address
execute
Execute a transaction via the vault.
reserveFees modifier is not used to avoid reverts.
Parameters
operation
Operation
Struct details for target and calldata to execute.
finalize
Terminate the vault and return all funds to owner.
MUST revert if not called by owner.
pause
Stops the guardian from submission and halts fee accrual.
MUST revert if not called by owner or guardian.
resume
Resume fee accrual and guardian submissions.
MUST revert if not called by owner.
submit
Submit a series of transactions for execution via the vault.
MUST revert if not called by guardian.
Parameters
operations
Operation[]
Sequence of operations to execute.
claim
Claim fees on behalf of a current or previous fee recipient.
holdings
Get current balances of all assets.
Returns
<none>
AssetValue[]
assetAmounts Amounts of registered assets.
value
Get current total value of assets in vault.
Returns
vaultValue
uint256
value Current total value.
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.
renounceOwnership
Leaves the contract without owner. It will not be possible to call onlyOwner
functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.
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.
receive
Only accept native token from the wrapped native token contract when burning wrapped native tokens.
_getFeeIndex
INTERNAL FUNCTIONS ///
Calculate guardian fee index.
Returns
feeIndex
uint256
Guardian fee index.
_reserveFees
Calculate current guardian fees.
_value
Get current total value of assets in vault and price of fee token.
It calculates the value in Numeraire token decimals.
Parameters
erc20SpotPrices
IAssetRegistry.AssetPriceReading[]
Spot prices of ERC20 assets.
Returns
vaultValue
uint256
Current total value.
feeTokenPrice
uint256
Fee token price.
_checkAmountsSorted
Check that assets in provided amounts are sorted and unique.
Parameters
amounts
AssetValue[]
Struct details for assets and amounts to withdraw.
_checkWithdrawRequest
Check request to withdraw.
Parameters
assets
IAssetRegistry.AssetInformation[]
Struct details for asset information from asset registry.
amounts
AssetValue[]
Struct details for assets and amounts to withdraw.
_getSpotPricesAndUnits
Get spot prices and units of requested assets.
Spot prices are scaled to 18 decimals.
Parameters
assets
IAssetRegistry.AssetInformation[]
Registered assets in asset registry and their information.
erc20SpotPrices
IAssetRegistry.AssetPriceReading[]
Struct details for spot prices of ERC20 assets.
Returns
spotPrices
uint256[]
Spot prices of assets.
assetUnits
uint256[]
Units of assets.
_getHoldings
Get total amount of assets in vault.
Parameters
assets
IAssetRegistry.AssetInformation[]
Struct details for registered assets in asset registry.
Returns
assetAmounts
AssetValue[]
Amount of assets.
_checkReservedFees
Check if balance of fee becomes insolvent or becomes more insolvent.
Parameters
prevFeeTokenBalance
uint256
Balance of fee token before action.
_checkGuardianAddress
Check if the address can be a guardian.
Parameters
newGuardian
address
Address to check.
owner_
address
Owner address.
_checkFeeRecipientAddress
Check if the address can be a fee recipient.
Parameters
newFeeRecipient
address
Address to check.
owner_
address
Owner address.
_checkAssetRegistryAddress
Check if the address can be an asset registry.
Parameters
newAssetRegistry
address
Address to check.
_checkHooksAddress
Check if the address can be a hooks contract.
Parameters
newHooks
address
Address to check.
_isAssetRegistered
Check whether asset is registered to asset registry or not.
Parameters
asset
IERC20
Asset to check.
registeredAssets
IAssetRegistry.AssetInformation[]
Array of registered assets.
Returns
isRegistered
bool
True if asset is registered.
index
uint256
Index of asset in asset registry.
Last updated