IPriceAndFeeCalculator
Last updated
Last updated
Interface for the unit price provider
Set the initial price state for the vault
function setInitialPrice(address vault, uint128 price, uint32 timestamp) external;
Parameters
vault
address
Address of the vault
price
uint128
New unit price
timestamp
uint32
Timestamp when the price was measured
Set vault thresholds
function setThresholds(
address vault,
uint16 minPriceToleranceRatio,
uint16 maxPriceToleranceRatio,
uint16 minUpdateIntervalMinutes,
uint8 maxPriceAge,
uint8 maxUpdateDelayDays
) external;
Parameters
vault
address
Address of the vault
minPriceToleranceRatio
uint16
Minimum ratio (of a price decrease) in basis points
maxPriceToleranceRatio
uint16
Maximum ratio (of a price increase) in basis points
minUpdateIntervalMinutes
uint16
The minimum interval between updates in minutes
maxPriceAge
uint8
Max delay between when a vault was priced and when the price is acceptable
maxUpdateDelayDays
uint8
Max delay between two price updates
Set the unit price for the vault in numeraire terms
function setUnitPrice(address vault, uint128 price, uint32 timestamp) external;
Parameters
vault
address
Address of the vault
price
uint128
New unit price
timestamp
uint32
Timestamp when the price was measured
Pause the vault
function pauseVault(address vault) external;
Parameters
vault
address
Address of the vault
Unpause the vault
MUST revert if price or timestamp don't exactly match last update
function unpauseVault(address vault, uint128 price, uint32 timestamp) external;
Parameters
vault
address
Address of the vault
price
uint128
Expected price of the last update
timestamp
uint32
Expected timestamp of the last update
Resets the highest price for a vault to the current price
function resetHighestPrice(address vault) external;
Parameters
vault
address
Address of the vault
Convert units to token amount
function convertUnitsToToken(address vault, IERC20 token, uint256 unitsAmount)
external
view
returns (uint256 tokenAmount);
Parameters
vault
address
Address of the vault
token
IERC20
Address of the token
unitsAmount
uint256
Amount of units
Returns
tokenAmount
uint256
Amount of tokens
Convert units to token amount if vault is not paused
MUST revert if vault is paused
function convertUnitsToTokenIfActive(address vault, IERC20 token, uint256 unitsAmount, Math.Rounding rounding)
external
view
returns (uint256 tokenAmount);
Parameters
vault
address
Address of the vault
token
IERC20
Address of the token
unitsAmount
uint256
Amount of units
rounding
Math.Rounding
The rounding mode
Returns
tokenAmount
uint256
Amount of tokens
Convert token amount to units
function convertTokenToUnits(address vault, IERC20 token, uint256 tokenAmount)
external
view
returns (uint256 unitsAmount);
Parameters
vault
address
Address of the vault
token
IERC20
Address of the token
tokenAmount
uint256
Amount of tokens
Returns
unitsAmount
uint256
Amount of units
Convert token amount to units if vault is not paused
MUST revert if vault is paused
function convertTokenToUnitsIfActive(address vault, IERC20 token, uint256 tokenAmount, Math.Rounding rounding)
external
view
returns (uint256 unitsAmount);
Parameters
vault
address
Address of the vault
token
IERC20
Address of the token
tokenAmount
uint256
Amount of tokens
rounding
Math.Rounding
The rounding mode
Returns
unitsAmount
uint256
Amount of units
Convert units to numeraire token amount
function convertUnitsToNumeraire(address vault, uint256 unitsAmount) external view returns (uint256 numeraireAmount);
Parameters
vault
address
Address of the vault
unitsAmount
uint256
Amount of units
Returns
numeraireAmount
uint256
Amount of numeraire
Return the state of the vault
function getVaultState(address vault) external view returns (VaultPriceState memory, VaultAccruals memory);
Parameters
vault
address
Address of the vault
Returns
<none>
VaultPriceState
vaultPriceState The price state of the vault
<none>
VaultAccruals
vaultAccruals The accruals state of the vault
Returns the age of the last submitted price for a vault
function getVaultsPriceAge(address vault) external view returns (uint256);
Parameters
vault
address
Address of the vault
Returns
<none>
uint256
priceAge The difference between block.timestamp and vault's unit price timestamp
Check if a vault is paused
function isVaultPaused(address vault) external view returns (bool);
Parameters
vault
address
The address of the vault
Returns
<none>
bool
True if the vault is paused, false otherwise
Emitted when thresholds are set for a vault
event ThresholdsSet(
address indexed vault,
uint16 minPriceToleranceRatio,
uint16 maxPriceToleranceRatio,
uint16 minUpdateIntervalMinutes,
uint8 maxPriceAge
);
Parameters
vault
address
The address of the vault
minPriceToleranceRatio
uint16
Minimum ratio (of a price decrease) in basis points
maxPriceToleranceRatio
uint16
Maximum ratio (of a price increase) in basis points
minUpdateIntervalMinutes
uint16
The minimum interval between updates in minutes
maxPriceAge
uint8
Max delay between when a vault was priced and when the price is acceptable
Emitted when a vault's unit price is updated
event UnitPriceUpdated(address indexed vault, uint128 price, uint32 timestamp);
Parameters
vault
address
The address of the vault
price
uint128
The new unit price
timestamp
uint32
The timestamp when the price was updated
Emitted when a vault's paused state is changed
event VaultPausedChanged(address indexed vault, bool paused);
Parameters
vault
address
The address of the vault
paused
bool
Whether the vault is paused
Emitted when a vault's highest price is reset
event HighestPriceReset(address indexed vault, uint128 newHighestPrice);
Parameters
vault
address
The address of the vault
newHighestPrice
uint128
The new highest price
error Aera__StalePrice();
error Aera__TimestampMustBeAfterLastUpdate();
error Aera__TimestampCantBeInFuture();
error Aera__ZeroAddressOracleRegistry();
error Aera__InvalidMaxPriceToleranceRatio();
error Aera__InvalidMinPriceToleranceRatio();
error Aera__InvalidMaxPriceAge();
error Aera__InvalidMaxUpdateDelayDays();
error Aera__ThresholdNotSet();
error Aera__VaultPaused();
error Aera__VaultNotPaused();
error Aera__UnitPriceMismatch();
error Aera__TimestampMismatch();
error Aera__VaultAlreadyInitialized();
error Aera__VaultNotInitialized();
error Aera__InvalidPrice();
error Aera__CurrentPriceAboveHighestPrice();