> For the complete documentation index, see [llms.txt](https://docs.aera.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aera.finance/the-protocol/core/priceandfeecalculatorv2.md).

# PriceAndFeeCalculatorV2

**Title:** PriceAndFeeCalculator

Calculates and manages anchor/drift price and fees for multiple vaults that share the same numeraire token Acts as a price oracle and fee accrual engine. Vault registration workflow is:

1. Register a new vault with registerVault()
2. Set the thresholds for the vault with setThresholds()
3. Set the initial price state with setInitialPrice() Once registered, a vault can have its price updated by an authorized entity. Vault owners set thresholds for price changes, update intervals, and price age. Anchor-policy violations can either pause or revert depending on vault-level configuration, while drift-policy violations always revert. Paused vaults don’t accrue fees, reject drift updates, and unpause against the current anchor tuple. Accrues fees on each anchor update, based on TVL and performance since last update Supports conversion between vault units, tokens, and numeraire for deposits/withdrawals. All logic and state is per-vault, supporting many vaults in parallel. Only vault owners can set thresholds and pause/unpause their vaults, whereas accountants can also pause their vaults Integrates with an external oracle registry for token price conversions

### Constants <a href="#constants" id="constants"></a>

#### ORACLE\_REGISTRY <a href="#oracle_registry" id="oracle_registry"></a>

Oracle registry contract for price feeds

```solidity
IOracleRegistry public immutable ORACLE_REGISTRY
```

### State Variables <a href="#state-variables" id="state-variables"></a>

#### \_vaultPriceStates <a href="#vaultpricestates" id="vaultpricestates"></a>

Mapping of vault addresses to their state information

```solidity
mapping(address vault => VaultPriceStateV2 vaultPriceState) internal _vaultPriceStates
```

### Functions <a href="#functions" id="functions"></a>

#### requiresVaultAuthOrAccountant <a href="#requiresvaultauthoraccountant" id="requiresvaultauthoraccountant"></a>

```solidity
modifier requiresVaultAuthOrAccountant(address vault) ;
```

#### constructor <a href="#constructor" id="constructor"></a>

```solidity
constructor(IERC20 numeraire, IOracleRegistry oracleRegistry, address owner_, Authority authority_)
    BaseFeeCalculator(owner_, authority_)
    HasNumeraire(address(numeraire));
```

#### registerVault <a href="#registervault" id="registervault"></a>

Register a new vault with the fee calculator

```solidity
function registerVault() external override;
```

#### setInitialPrice <a href="#setinitialprice" id="setinitialprice"></a>

Set the initial anchor price state for the vault

```solidity
function setInitialPrice(address vault, uint128 price) external requiresVaultAuth(vault);
```

**Parameters**

| Name    | Type      | Description              |
| ------- | --------- | ------------------------ |
| `vault` | `address` | Address of the vault     |
| `price` | `uint128` | New initial anchor price |

#### setThresholds <a href="#setthresholds" id="setthresholds"></a>

Set vault thresholds

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

**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`              | `uint16`  | Max delay between when a vault was priced and when the price is acceptable |
| `maxUpdateDelayDays`       | `uint8`   | Max delay between two price updates                                        |

#### setPauseOnBadAnchorUpdate <a href="#setpauseonbadanchorupdate" id="setpauseonbadanchorupdate"></a>

Set whether out-of-range updates should pause or revert

MUST be configurable by vault owner/authority

```solidity
function setPauseOnBadAnchorUpdate(address vault, bool pauseOnBadAnchorUpdate) external requiresVaultAuth(vault);
```

**Parameters**

| Name                     | Type      | Description                                                    |
| ------------------------ | --------- | -------------------------------------------------------------- |
| `vault`                  | `address` | Address of the vault                                           |
| `pauseOnBadAnchorUpdate` | `bool`    | True to pause on bad anchor update, false to revert atomically |

#### setAnchorPrice <a href="#setanchorprice" id="setanchorprice"></a>

Set the anchor price for the vault in numeraire terms

```solidity
function setAnchorPrice(address vault, uint128 price, uint32 timestamp) external onlyVaultAccountant(vault);
```

**Parameters**

| Name        | Type      | Description                                  |
| ----------- | --------- | -------------------------------------------- |
| `vault`     | `address` | Address of the vault                         |
| `price`     | `uint128` | New anchor price                             |
| `timestamp` | `uint32`  | Timestamp when the anchor price was measured |

#### setDriftPrice <a href="#setdriftprice" id="setdriftprice"></a>

Set the drift price for the vault in numeraire terms

MUST revert when the vault is paused

```solidity
function setDriftPrice(address vault, uint128 price, uint32 timestamp) external onlyVaultAccountant(vault);
```

**Parameters**

| Name        | Type      | Description                                 |
| ----------- | --------- | ------------------------------------------- |
| `vault`     | `address` | Address of the vault                        |
| `price`     | `uint128` | New drift price                             |
| `timestamp` | `uint32`  | Timestamp when the drift price was measured |

#### pauseVault <a href="#pausevault" id="pausevault"></a>

Pause the vault

```solidity
function pauseVault(address vault) external requiresVaultAuthOrAccountant(vault);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

#### unpauseVault <a href="#unpausevault" id="unpausevault"></a>

Unpause the vault

MUST revert if price or timestamp don’t exactly match the current anchor tuple

```solidity
function unpauseVault(address vault, uint128 price, uint32 timestamp) external requiresVaultAuth(vault);
```

**Parameters**

| Name        | Type      | Description                               |
| ----------- | --------- | ----------------------------------------- |
| `vault`     | `address` | Address of the vault                      |
| `price`     | `uint128` | Expected anchor price at unpause time     |
| `timestamp` | `uint32`  | Expected anchor timestamp at unpause time |

#### resetHighestPrice <a href="#resethighestprice" id="resethighestprice"></a>

Resets the highest price for a vault to the current anchor price

```solidity
function resetHighestPrice(address vault) external requiresVaultAuth(vault);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

#### convertUnitsToToken <a href="#convertunitstotoken" id="convertunitstotoken"></a>

Convert units to token amount

```solidity
function convertUnitsToToken(address vault, IERC20 token, uint256 unitsAmount)
    external
    view
    returns (uint256 tokenAmount);
```

**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 <a href="#convertunitstotokenifactive" id="convertunitstotokenifactive"></a>

Convert units to token amount if vault is not paused

MUST revert if vault is paused

```solidity
function convertUnitsToTokenIfActive(address vault, IERC20 token, uint256 unitsAmount, Math.Rounding rounding)
    external
    view
    returns (uint256 tokenAmount);
```

**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 |

#### convertUnitsToNumeraire <a href="#convertunitstonumeraire" id="convertunitstonumeraire"></a>

Convert units to numeraire token amount

```solidity
function convertUnitsToNumeraire(address vault, uint256 unitsAmount) external view returns (uint256);
```

**Parameters**

| Name          | Type      | Description          |
| ------------- | --------- | -------------------- |
| `vault`       | `address` | Address of the vault |
| `unitsAmount` | `uint256` | Amount of units      |

**Returns**

| Name     | Type      | Description                         |
| -------- | --------- | ----------------------------------- |
| `<none>` | `uint256` | numeraireAmount Amount of numeraire |

#### convertUnitsToNumeraire <a href="#convertunitstonumeraire-1" id="convertunitstonumeraire-1"></a>

Convert units to numeraire token amount with rounding control

```solidity
function convertUnitsToNumeraire(address vault, uint256 unitsAmount, Math.Rounding rounding)
    external
    view
    returns (uint256);
```

**Parameters**

| Name          | Type            | Description          |
| ------------- | --------------- | -------------------- |
| `vault`       | `address`       | Address of the vault |
| `unitsAmount` | `uint256`       | Amount of units      |
| `rounding`    | `Math.Rounding` | The rounding mode    |

**Returns**

| Name     | Type      | Description                         |
| -------- | --------- | ----------------------------------- |
| `<none>` | `uint256` | numeraireAmount Amount of numeraire |

#### convertNumeraireToUnits <a href="#convertnumerairetounits" id="convertnumerairetounits"></a>

Convert numeraire amount to vault units

```solidity
function convertNumeraireToUnits(address vault, uint256 numeraireAmount, Math.Rounding rounding)
    external
    view
    returns (uint256);
```

**Parameters**

| Name              | Type            | Description          |
| ----------------- | --------------- | -------------------- |
| `vault`           | `address`       | Address of the vault |
| `numeraireAmount` | `uint256`       | Amount of numeraire  |
| `rounding`        | `Math.Rounding` | The rounding mode    |

**Returns**

| Name     | Type      | Description                 |
| -------- | --------- | --------------------------- |
| `<none>` | `uint256` | unitsAmount Amount of units |

#### convertNumeraireToToken <a href="#convertnumerairetotoken" id="convertnumerairetotoken"></a>

Convert numeraire amount to token amount via oracle

Returns numeraireAmount unchanged when token is the numeraire

```solidity
function convertNumeraireToToken(address vault, IERC20 token, uint256 numeraireAmount)
    external
    view
    returns (uint256);
```

**Parameters**

| Name              | Type      | Description          |
| ----------------- | --------- | -------------------- |
| `vault`           | `address` | Address of the vault |
| `token`           | `IERC20`  | Address of the token |
| `numeraireAmount` | `uint256` | Amount of numeraire  |

**Returns**

| Name     | Type      | Description                  |
| -------- | --------- | ---------------------------- |
| `<none>` | `uint256` | tokenAmount Amount of tokens |

#### convertTokenToNumeraire <a href="#converttokentonumeraire" id="converttokentonumeraire"></a>

Convert token amount to numeraire via oracle

Returns tokenAmount unchanged when token is the numeraire

```solidity
function convertTokenToNumeraire(address vault, IERC20 token, uint256 tokenAmount) external view returns (uint256);
```

**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                         |
| -------- | --------- | ----------------------------------- |
| `<none>` | `uint256` | numeraireAmount Amount of numeraire |

#### convertTokenToUnits <a href="#converttokentounits" id="converttokentounits"></a>

Convert token amount to units

```solidity
function convertTokenToUnits(address vault, IERC20 token, uint256 tokenAmount)
    external
    view
    returns (uint256 unitsAmount);
```

**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 <a href="#converttokentounitsifactive" id="converttokentounitsifactive"></a>

Convert token amount to units if vault is not paused

MUST revert if vault is paused

```solidity
function convertTokenToUnitsIfActive(address vault, IERC20 token, uint256 tokenAmount, Math.Rounding rounding)
    external
    view
    returns (uint256 unitsAmount);
```

**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 |

#### getVaultState <a href="#getvaultstate" id="getvaultstate"></a>

Return the state of the vault

```solidity
function getVaultState(address vault) external view returns (VaultPriceStateV2 memory, VaultAccruals memory);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

**Returns**

| Name     | Type                | Description                                   |
| -------- | ------------------- | --------------------------------------------- |
| `<none>` | `VaultPriceStateV2` | vaultPriceState The price state of the vault  |
| `<none>` | `VaultAccruals`     | vaultAccruals The accruals state of the vault |

#### getVaultPriceTimestamp <a href="#getvaultpricetimestamp" id="getvaultpricetimestamp"></a>

Returns the timestamp of the last submitted price for a vault

```solidity
function getVaultPriceTimestamp(address vault) external view returns (uint256 timestamp);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

**Returns**

| Name        | Type      | Description                                    |
| ----------- | --------- | ---------------------------------------------- |
| `timestamp` | `uint256` | The timestamp of the vault’s last price update |

#### getAnchorTimestamp <a href="#getanchortimestamp" id="getanchortimestamp"></a>

Returns the timestamp of the last submitted anchor price for a vault

```solidity
function getAnchorTimestamp(address vault) external view returns (uint32 timestamp);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

**Returns**

| Name        | Type     | Description                                       |
| ----------- | -------- | ------------------------------------------------- |
| `timestamp` | `uint32` | The timestamp of the vault’s current anchor price |

#### getVaultValueAtLastUpdate <a href="#getvaultvalueatlastupdate" id="getvaultvalueatlastupdate"></a>

Returns the vault value in numeraire at the last price update

MUST revert if the vault is paused

```solidity
function getVaultValueAtLastUpdate(address vault) external view returns (uint256);
```

**Parameters**

| Name    | Type      | Description          |
| ------- | --------- | -------------------- |
| `vault` | `address` | Address of the vault |

**Returns**

| Name     | Type      | Description                                                                           |
| -------- | --------- | ------------------------------------------------------------------------------------- |
| `<none>` | `uint256` | vaultValue The vault value in numeraire computed from lastTotalSupply and anchorPrice |

#### isVaultPaused <a href="#isvaultpaused" id="isvaultpaused"></a>

Check if a vault is paused

```solidity
function isVaultPaused(address vault) external view returns (bool);
```

**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 |

#### previewFees <a href="#previewfees" id="previewfees"></a>

```solidity
function previewFees(address vault, uint256 feeTokenBalance) external view override returns (uint256, uint256);
```

#### version <a href="#version" id="version"></a>

Returns the semantic version string for this contract surface

```solidity
function version() external pure returns (string memory);
```

**Returns**

| Name     | Type     | Description                 |
| -------- | -------- | --------------------------- |
| `<none>` | `string` | The semantic version string |

#### \_accrueFees <a href="#accruefees" id="accruefees"></a>

Accrues fees for a vault

It is assumed that validation has already been done Tvl is calculated as the product of the minimum of the current and last price and the minimum of the current and last total supply. This is to minimize potential issues with price spikes

```solidity
function _accrueFees(address vault, uint256 price, uint256 timestamp) internal;
```

**Parameters**

| Name        | Type      | Description                       |
| ----------- | --------- | --------------------------------- |
| `vault`     | `address` | The address of the vault          |
| `price`     | `uint256` | The price of a single vault unit  |
| `timestamp` | `uint256` | The timestamp of the price update |

#### \_setVaultPaused <a href="#setvaultpaused" id="setvaultpaused"></a>

Sets the paused state for a vault

```solidity
function _setVaultPaused(VaultPriceStateV2 storage vaultPriceState, address vault, bool paused) internal;
```

**Parameters**

| Name              | Type                | Description                                    |
| ----------------- | ------------------- | ---------------------------------------------- |
| `vaultPriceState` | `VaultPriceStateV2` | The storage pointer to the vault’s price state |
| `vault`           | `address`           | The address of the vault                       |
| `paused`          | `bool`              | The new paused state                           |

#### \_convertTokenToUnits <a href="#converttokentounits" id="converttokentounits"></a>

Converts a token amount to units

```solidity
function _convertTokenToUnits(
    address vault,
    IERC20 token,
    uint256 tokenAmount,
    uint256 unitPrice,
    Math.Rounding rounding
) internal view returns (uint256 unitsAmount);
```

**Parameters**

| Name          | Type            | Description                      |
| ------------- | --------------- | -------------------------------- |
| `vault`       | `address`       | The address of the vault         |
| `token`       | `IERC20`        | The token to convert             |
| `tokenAmount` | `uint256`       | The amount of tokens to convert  |
| `unitPrice`   | `uint256`       | The price of a single vault unit |
| `rounding`    | `Math.Rounding` | The rounding direction           |

**Returns**

| Name          | Type      | Description         |
| ------------- | --------- | ------------------- |
| `unitsAmount` | `uint256` | The amount of units |

#### \_convertUnitsToToken <a href="#convertunitstotoken" id="convertunitstotoken"></a>

Converts a units amount to tokens

```solidity
function _convertUnitsToToken(
    address vault,
    IERC20 token,
    uint256 unitsAmount,
    uint256 unitPrice,
    Math.Rounding rounding
) internal view returns (uint256 tokenAmount);
```

**Parameters**

| Name          | Type            | Description                      |
| ------------- | --------------- | -------------------------------- |
| `vault`       | `address`       | The address of the vault         |
| `token`       | `IERC20`        | The token to convert             |
| `unitsAmount` | `uint256`       | The amount of units to convert   |
| `unitPrice`   | `uint256`       | The price of a single vault unit |
| `rounding`    | `Math.Rounding` | The rounding direction           |

**Returns**

| Name          | Type      | Description          |
| ------------- | --------- | -------------------- |
| `tokenAmount` | `uint256` | The amount of tokens |

#### \_getQuoteCeil <a href="#getquoteceil" id="getquoteceil"></a>

Returns the value of `baseAmount` of `baseToken` in `quoteToken` terms for `vault`

```solidity
function _getQuoteCeil(address vault, uint256 baseAmount, IERC20 baseToken, IERC20 quoteToken)
    internal
    view
    returns (uint256 quoteAmount);
```

**Parameters**

| Name         | Type      | Description                                                  |
| ------------ | --------- | ------------------------------------------------------------ |
| `vault`      | `address` | The address of the vault used for oracle override resolution |
| `baseAmount` | `uint256` | The amount of base token to convert                          |
| `baseToken`  | `IERC20`  | The base token being quoted                                  |
| `quoteToken` | `IERC20`  | The quote token to convert into                              |

**Returns**

| Name          | Type      | Description                   |
| ------------- | --------- | ----------------------------- |
| `quoteAmount` | `uint256` | The ceil-rounded quote amount |

#### \_validatePriceUpdate <a href="#validatepriceupdate" id="validatepriceupdate"></a>

Validates a price update

Price is invalid if it is 0, before the last update, in the future, or if the price age is stale

```solidity
function _validatePriceUpdate(
    VaultPriceStateV2 storage state,
    uint256 price,
    uint256 timestamp,
    uint256 referenceTimestamp
) internal view;
```

**Parameters**

| Name                 | Type                | Description                                           |
| -------------------- | ------------------- | ----------------------------------------------------- |
| `state`              | `VaultPriceStateV2` | The storage pointer to the vault’s price state        |
| `price`              | `uint256`           | The price of a single vault unit                      |
| `timestamp`          | `uint256`           | The timestamp of the price update                     |
| `referenceTimestamp` | `uint256`           | The timestamp that the candidate update MUST be after |

#### \_shouldPauseAnchor <a href="#shouldpauseanchor" id="shouldpauseanchor"></a>

Determines if a price update should pause the vault

Vault should pause if the price increase or decrease is too large, or if the min update interval has not passed

```solidity
function _shouldPauseAnchor(
    VaultPriceStateV2 storage state,
    uint256 price,
    uint32 timestamp,
    uint256 anchorTimestamp
) internal view returns (bool);
```

**Parameters**

| Name              | Type                | Description                                    |
| ----------------- | ------------------- | ---------------------------------------------- |
| `state`           | `VaultPriceStateV2` | The storage pointer to the vault’s price state |
| `price`           | `uint256`           | The price of a single vault unit               |
| `timestamp`       | `uint32`            | The timestamp of the price update              |
| `anchorTimestamp` | `uint256`           | The previous anchor timestamp                  |

**Returns**

| Name     | Type   | Description                                                                  |
| -------- | ------ | ---------------------------------------------------------------------------- |
| `<none>` | `bool` | shouldPause True if the price update should pause the vault, false otherwise |

#### \_getCurrentPrice <a href="#getcurrentprice" id="getcurrentprice"></a>

Returns the current price by latest update between anchor and drift

```solidity
function _getCurrentPrice(VaultPriceStateV2 storage state) internal view returns (uint128 price);
```

**Parameters**

| Name    | Type                | Description                                    |
| ------- | ------------------- | ---------------------------------------------- |
| `state` | `VaultPriceStateV2` | The storage pointer to the vault’s price state |

**Returns**

| Name    | Type      | Description   |
| ------- | --------- | ------------- |
| `price` | `uint128` | Current price |

#### \_getLastTimestamp <a href="#getlasttimestamp" id="getlasttimestamp"></a>

Returns the latest timestamp between anchor and drift updates

```solidity
function _getLastTimestamp(VaultPriceStateV2 storage state) internal view returns (uint256 timestamp);
```

**Parameters**

| Name    | Type                | Description                                    |
| ------- | ------------------- | ---------------------------------------------- |
| `state` | `VaultPriceStateV2` | The storage pointer to the vault’s price state |

**Returns**

| Name        | Type      | Description            |
| ----------- | --------- | ---------------------- |
| `timestamp` | `uint256` | Active price timestamp |

#### \_isPriceWithinAnchorBand <a href="#ispricewithinanchorband" id="ispricewithinanchorband"></a>

Validates whether a candidate price stays inside the anchor tolerance band

```solidity
function _isPriceWithinAnchorBand(VaultPriceStateV2 storage state, uint256 anchorPrice, uint256 candidatePrice)
    internal
    view
    returns (bool isWithinBand);
```

**Parameters**

| Name             | Type                | Description                                            |
| ---------------- | ------------------- | ------------------------------------------------------ |
| `state`          | `VaultPriceStateV2` | The storage pointer to the vault’s price state         |
| `anchorPrice`    | `uint256`           | The anchor price used for band checks                  |
| `candidatePrice` | `uint256`           | The proposed price to validate against the anchor band |

**Returns**

| Name           | Type   | Description                                             |
| -------------- | ------ | ------------------------------------------------------- |
| `isWithinBand` | `bool` | True when candidate is inside the anchor tolerance band |

#### \_isUpdateDelayExceeded <a href="#isupdatedelayexceeded" id="isupdatedelayexceeded"></a>

Checks whether the elapsed time between updates exceeds configured max delay

```solidity
function _isUpdateDelayExceeded(uint256 lastTimestamp, uint256 timestamp, uint256 maxUpdateDelayDays)
    internal
    pure
    returns (bool isExceeded);
```

**Parameters**

| Name                 | Type      | Description                          |
| -------------------- | --------- | ------------------------------------ |
| `lastTimestamp`      | `uint256` | The timestamp of the prior update    |
| `timestamp`          | `uint256` | The timestamp of the proposed update |
| `maxUpdateDelayDays` | `uint256` | Maximum allowed delay in days        |

**Returns**

| Name         | Type   | Description                                           |
| ------------ | ------ | ----------------------------------------------------- |
| `isExceeded` | `bool` | True when elapsed time exceeds the configured maximum |
