# IDelayedFeeCalculator

Interface for a contract that calculates fee inputs for a single-depositor vault

## Functions

### submitSnapshot

Submit a new snapshot for fee calculation

```solidity
function submitSnapshot(address vault, uint160 averageValue, uint128 highestProfit, uint32 timestamp) external;
```

**Parameters**

| Name            | Type      | Description                                                                        |
| --------------- | --------- | ---------------------------------------------------------------------------------- |
| `vault`         | `address` | The address of the vault                                                           |
| `averageValue`  | `uint160` | The average value during the period since last snapshot to this snapshot timestamp |
| `highestProfit` | `uint128` | The highest profit achieved up to the snapshot timestamp                           |
| `timestamp`     | `uint32`  | The timestamp of the snapshot                                                      |

### accrueFees

Process fee accrual for a vault

```solidity
function accrueFees(address vault) external returns (uint256 tvlFeesEarned, uint256 performanceFeesEarned);
```

**Parameters**

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

**Returns**

| Name                    | Type      | Description                                                |
| ----------------------- | --------- | ---------------------------------------------------------- |
| `tvlFeesEarned`         | `uint256` | The earned TVL fees for the vault and the protocol         |
| `performanceFeesEarned` | `uint256` | The earned performance fees for the vault and the protocol |

### vaultFeeState

The fee state of a vault

```solidity
function vaultFeeState(address vault) external view returns (VaultSnapshot memory, VaultAccruals memory);
```

**Parameters**

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

**Returns**

| Name     | Type            | Description                                               |
| -------- | --------------- | --------------------------------------------------------- |
| `<none>` | `VaultSnapshot` | vaultSnapshotFeeState The snapshot fee state of the vault |
| `<none>` | `VaultAccruals` | baseVaultFeeState The base fee state of the vault         |

## Events

### SnapshotSubmitted

Emitted when a new snapshot of fee inputs is submitted for a vault

*highestProfit is equivalent to a high water mark but could be applicable to a subset of the vault*

```solidity
event SnapshotSubmitted(address indexed vault, uint160 averageValue, uint128 highestProfit, uint32 timestamp);
```

**Parameters**

| Name            | Type      | Description                                                          |
| --------------- | --------- | -------------------------------------------------------------------- |
| `vault`         | `address` | The vault address                                                    |
| `averageValue`  | `uint160` | The average value of the vault during the period since last snapshot |
| `highestProfit` | `uint128` | The highest profit achieved during the period since last snapshot    |
| `timestamp`     | `uint32`  | The timestamp of the snapshot                                        |

## Errors

### Aera\_\_SnapshotTooOld

Thrown when a snapshot's timestamp is older than the last fee accrual

```solidity
error Aera__SnapshotTooOld();
```

### Aera\_\_SnapshotInFuture

Thrown when a snapshot's timestamp is in the future

```solidity
error Aera__SnapshotInFuture();
```

### Aera\_\_HighestProfitDecreased

Thrown when attempting to accrue fees with a highest profit that is less than the last highest profit

```solidity
error Aera__HighestProfitDecreased();
```

### Aera\_\_DisputePeriodTooLong

Thrown when the dispute period is greater than the maximum allowed

```solidity
error Aera__DisputePeriodTooLong();
```
