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