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
withdraw
Withdraw assets.
MUST revert if not called by owner.
Parameters
setGuardianAndFeeRecipient
Set current guardian and fee recipient.
MUST revert if not called by owner.
Parameters
setHooks
Sets the current hooks module.
MUST revert if not called by owner.
Parameters
execute
Execute a transaction via the vault.
reserveFees modifier is not used to avoid reverts.
Parameters
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
claim
Claim fees on behalf of a current or previous fee recipient.
holdings
Get current balances of all assets.
Returns
value
Get current total value of assets in vault.
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.
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
_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
Returns
_checkAmountsSorted
Check that assets in provided amounts are sorted and unique.
Parameters
_checkWithdrawRequest
Check request to withdraw.
Parameters
_getSpotPricesAndUnits
Get spot prices and units of requested assets.
Spot prices are scaled to 18 decimals.
Parameters
Returns
_getHoldings
Get total amount of assets in vault.
Parameters
Returns
_checkReservedFees
Check if balance of fee becomes insolvent or becomes more insolvent.
Parameters
_checkGuardianAddress
Check if the address can be a guardian.
Parameters
_checkFeeRecipientAddress
Check if the address can be a fee recipient.
Parameters
_checkAssetRegistryAddress
Check if the address can be an asset registry.
Parameters
_checkHooksAddress
Check if the address can be a hooks contract.
Parameters
_isAssetRegistered
Check whether asset is registered to asset registry or not.
Parameters
Returns
Last updated