IPriceAndFeeCalculator

Interface for the unit price provider

Functions

setInitialPrice

Set the initial price state for the vault

function setInitialPrice(address vault, uint128 price, uint32 timestamp) external;

Parameters

Name
Type
Description

vault

address

Address of the vault

price

uint128

New unit price

timestamp

uint32

Timestamp when the price was measured

setThresholds

Set vault thresholds

function setThresholds(
    address vault,
    uint16 minPriceToleranceRatio,
    uint16 maxPriceToleranceRatio,
    uint16 minUpdateIntervalMinutes,
    uint8 maxPriceAge,
    uint8 maxUpdateDelayDays
) external;

Parameters

Name
Type
Description

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

setUnitPrice

Set the unit price for the vault in numeraire terms

Parameters

Name
Type
Description

vault

address

Address of the vault

price

uint128

New unit price

timestamp

uint32

Timestamp when the price was measured

pauseVault

Pause the vault

Parameters

Name
Type
Description

vault

address

Address of the vault

unpauseVault

Unpause the vault

MUST revert if price or timestamp don't exactly match last update

Parameters

Name
Type
Description

vault

address

Address of the vault

price

uint128

Expected price of the last update

timestamp

uint32

Expected timestamp of the last update

resetHighestPrice

Resets the highest price for a vault to the current price

Parameters

Name
Type
Description

vault

address

Address of the vault

convertUnitsToToken

Convert units to token amount

Parameters

Name
Type
Description

vault

address

Address of the vault

token

IERC20

Address of the token

unitsAmount

uint256

Amount of units

Returns

Name
Type
Description

tokenAmount

uint256

Amount of tokens

convertUnitsToTokenIfActive

Convert units to token amount if vault is not paused

MUST revert if vault is paused

Parameters

Name
Type
Description

vault

address

Address of the vault

token

IERC20

Address of the token

unitsAmount

uint256

Amount of units

rounding

Math.Rounding

The rounding mode

Returns

Name
Type
Description

tokenAmount

uint256

Amount of tokens

convertTokenToUnits

Convert token amount to units

Parameters

Name
Type
Description

vault

address

Address of the vault

token

IERC20

Address of the token

tokenAmount

uint256

Amount of tokens

Returns

Name
Type
Description

unitsAmount

uint256

Amount of units

convertTokenToUnitsIfActive

Convert token amount to units if vault is not paused

MUST revert if vault is paused

Parameters

Name
Type
Description

vault

address

Address of the vault

token

IERC20

Address of the token

tokenAmount

uint256

Amount of tokens

rounding

Math.Rounding

The rounding mode

Returns

Name
Type
Description

unitsAmount

uint256

Amount of units

convertUnitsToNumeraire

Convert units to numeraire token amount

Parameters

Name
Type
Description

vault

address

Address of the vault

unitsAmount

uint256

Amount of units

Returns

Name
Type
Description

numeraireAmount

uint256

Amount of numeraire

getVaultState

Return the state of the vault

Parameters

Name
Type
Description

vault

address

Address of the vault

Returns

Name
Type
Description

<none>

VaultPriceState

vaultPriceState The price state of the vault

<none>

VaultAccruals

vaultAccruals The accruals state of the vault

getVaultsPriceAge

Returns the age of the last submitted price for a vault

Parameters

Name
Type
Description

vault

address

Address of the vault

Returns

Name
Type
Description

<none>

uint256

priceAge The difference between block.timestamp and vault's unit price timestamp

isVaultPaused

Check if a vault is paused

Parameters

Name
Type
Description

vault

address

The address of the vault

Returns

Name
Type
Description

<none>

bool

True if the vault is paused, false otherwise

Events

ThresholdsSet

Emitted when thresholds are set for a vault

Parameters

Name
Type
Description

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

UnitPriceUpdated

Emitted when a vault's unit price is updated

Parameters

Name
Type
Description

vault

address

The address of the vault

price

uint128

The new unit price

timestamp

uint32

The timestamp when the price was updated

VaultPausedChanged

Emitted when a vault's paused state is changed

Parameters

Name
Type
Description

vault

address

The address of the vault

paused

bool

Whether the vault is paused

HighestPriceReset

Emitted when a vault's highest price is reset

Parameters

Name
Type
Description

vault

address

The address of the vault

newHighestPrice

uint128

The new highest price

Errors

Aera__StalePrice

Aera__TimestampMustBeAfterLastUpdate

Aera__TimestampCantBeInFuture

Aera__ZeroAddressOracleRegistry

Aera__InvalidMaxPriceToleranceRatio

Aera__InvalidMinPriceToleranceRatio

Aera__InvalidMaxPriceAge

Aera__InvalidMaxUpdateDelayDays

Aera__ThresholdNotSet

Aera__VaultPaused

Aera__VaultNotPaused

Aera__UnitPriceMismatch

Aera__TimestampMismatch

Aera__VaultAlreadyInitialized

Aera__VaultNotInitialized

Aera__InvalidPrice

Aera__CurrentPriceAboveHighestPrice

Last updated