# FeeVault

**Inherits:** IFeeVault, BaseVault

This contract extends BaseVault with fee capabilities for vaults that have a single logical owner of all assets. The vault relies on an external contract called the fee calculator which is shared across multiple vaults The fee calculator is responsible for calculating the TVL and performance fees for the vault, but the vault has control over those fees. Fee claims are initiated via the vault, which consults and updates the fee calculator upon successful claims

## State Variables

### FEE\_TOKEN

Address of the fee token

```solidity
IERC20 public immutable FEE_TOKEN;
```

### feeCalculator

Address of the fee calculator contract

```solidity
IFeeCalculator public feeCalculator;
```

### feeRecipient

Address of the fee recipient

```solidity
address public feeRecipient;
```

## Functions

### onlyFeeRecipient

Modifier to check that the caller is the fee recipient

```solidity
modifier onlyFeeRecipient();
```

### constructor

```solidity
constructor() BaseVault();
```

### setFeeCalculator

Set the fee calculator

*newFeeCalculator can be zero, which has the effect as disabling the fee calculator*

```solidity
function setFeeCalculator(IFeeCalculator newFeeCalculator) external requiresAuth;
```

**Parameters**

| Name               | Type             | Description            |
| ------------------ | ---------------- | ---------------------- |
| `newFeeCalculator` | `IFeeCalculator` | The new fee calculator |

### setFeeRecipient

Set the fee recipient

```solidity
function setFeeRecipient(address newFeeRecipient) external requiresAuth;
```

**Parameters**

| Name              | Type      | Description                   |
| ----------------- | --------- | ----------------------------- |
| `newFeeRecipient` | `address` | The new fee recipient address |

### claimFees

Claim accrued fees for msg.sender

*Automatically claims any earned protocol fees for the protocol*

```solidity
function claimFees() external onlyFeeRecipient returns (uint256 feeRecipientFees, uint256 protocolFees);
```

**Returns**

| Name               | Type      | Description                                               |
| ------------------ | --------- | --------------------------------------------------------- |
| `feeRecipientFees` | `uint256` | The amount of fees to be claimed by the fee recipient     |
| `protocolFees`     | `uint256` | The amount of protocol fees to be claimed by the protocol |

### claimProtocolFees

Claim accrued protocol fees

```solidity
function claimProtocolFees() external returns (uint256 protocolFees);
```

**Returns**

| Name           | Type      | Description                                               |
| -------------- | --------- | --------------------------------------------------------- |
| `protocolFees` | `uint256` | The amount of protocol fees to be claimed by the protocol |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aera.finance/the-protocol/core/feevault.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
