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
Name | Type | Description |
---|---|---|
|
| Assets and amounts to deposit. |
withdraw
Withdraw assets.
MUST revert if not called by owner.
Parameters
Name | Type | Description |
---|---|---|
|
| Assets and amounts to withdraw. |
setGuardianAndFeeRecipient
Set current guardian and fee recipient.
MUST revert if not called by owner.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
setHooks
Sets the current hooks module.
MUST revert if not called by owner.
Parameters
Name | Type | Description |
---|---|---|
|
|
execute
Execute a transaction via the vault.
reserveFees modifier is not used to avoid reverts.
Parameters
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| assetAmounts Amounts of registered assets. |
value
Get current total value of assets in vault.
Returns
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| Spot prices of ERC20 assets. |
Returns
Name | Type | Description |
---|---|---|
|
| Current total value. |
|
| Fee token price. |
_checkAmountsSorted
Check that assets in provided amounts are sorted and unique.
Parameters
Name | Type | Description |
---|---|---|
|
| Struct details for assets and amounts to withdraw. |
_checkWithdrawRequest
Check request to withdraw.
Parameters
Name | Type | Description |
---|---|---|
|
| Struct details for asset information from asset registry. |
|
| 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
Name | Type | Description |
---|---|---|
|
| Registered assets in asset registry and their information. |
|
| Struct details for spot prices of ERC20 assets. |
Returns
Name | Type | Description |
---|---|---|
|
| Spot prices of assets. |
|
| Units of assets. |
_getHoldings
Get total amount of assets in vault.
Parameters
Name | Type | Description |
---|---|---|
|
| Struct details for registered assets in asset registry. |
Returns
Name | Type | Description |
---|---|---|
|
| Amount of assets. |
_checkReservedFees
Check if balance of fee becomes insolvent or becomes more insolvent.
Parameters
Name | Type | Description |
---|---|---|
|
| Balance of fee token before action. |
_checkGuardianAddress
Check if the address can be a guardian.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to check. |
|
| Owner address. |
_checkFeeRecipientAddress
Check if the address can be a fee recipient.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to check. |
|
| Owner address. |
_checkAssetRegistryAddress
Check if the address can be an asset registry.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to check. |
_checkHooksAddress
Check if the address can be a hooks contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Address to check. |
_isAssetRegistered
Check whether asset is registered to asset registry or not.
Parameters
Name | Type | Description |
---|---|---|
|
| Asset to check. |
|
| Array of registered assets. |
Returns
Name | Type | Description |
---|---|---|
|
| True if asset is registered. |
|
| Index of asset in asset registry. |
Last updated