> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/reserve-protocol/reserve-index-dtf/llms.txt
> Use this file to discover all available pages before exploring further.

# FolioDAOFeeRegistry Contract

> Manages DAO fee splits and minimum fee floors for Folio protocol revenue sharing

## Overview

The **FolioDAOFeeRegistry** contract manages the protocol-level fee configuration for all Folios. It determines what percentage of Folio fees go to the DAO versus fee recipients, and enforces minimum fee floors to ensure the protocol remains sustainable.

### Key Features

* **DAO Fee Split**: Configurable percentage of fees that go to the protocol
* **Fee Floor**: Minimum fees charged to users, regardless of Folio settings
* **Per-Folio Overrides**: Custom fee settings for specific Folios
* **Chain-Specific Maximums**: Different max fees based on blockchain

### Fee Mechanics

The registry implements a two-tier fee system:

1. **DAO Fee Percentage**: The DAO receives a percentage of collected fees (e.g., 50%)
2. **Fee Floor**: A minimum amount the DAO receives, even if the percentage calculation is lower

**Example**: If DAO fee is 50% and floor is 0.15%:

* At 0.30% TVL fee: DAO gets 0.15%, recipients get 0.15%
* At 0.20% TVL fee: DAO gets 0.15%, recipients get 0.05%
* At 0.10% TVL fee: DAO gets 0.15%, recipients get 0%

## Configuration Functions

### Set Fee Recipient

Set the address that receives DAO fees.

<ParamField path="feeRecipient_" type="address">
  New fee recipient address (cannot be zero)
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function setFeeRecipient(address feeRecipient_) external onlyOwner
```

### Set Default Fee Numerator

Set the default DAO fee percentage for all Folios.

<ParamField path="feeNumerator_" type="uint256">
  New fee numerator as D18 (e.g., 0.5e18 = 50%)
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function setDefaultFeeNumerator(uint256 feeNumerator_) external onlyOwner
```

<Info>
  The fee numerator must not exceed the chain-specific `MAX_DAO_FEE`. The denominator is always `FEE_DENOMINATOR` (1e18).
</Info>

### Set Token Fee Numerator

Set a custom DAO fee percentage for a specific Folio.

<ParamField path="fToken" type="address">
  Address of the Folio token
</ParamField>

<ParamField path="feeNumerator_" type="uint256">
  Custom fee numerator (D18)
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function setTokenFeeNumerator(address fToken, uint256 feeNumerator_) external onlyOwner
```

### Set Default Fee Floor

Set the default minimum DAO fee for all Folios.

<ParamField path="_defaultFeeFloor" type="uint256">
  New default fee floor as D18 (e.g., 0.0015e18 = 0.15% = 15 bps)
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function setDefaultFeeFloor(uint256 _defaultFeeFloor) external onlyOwner
```

### Set Token Fee Floor

Set a custom minimum DAO fee for a specific Folio.

<ParamField path="fToken" type="address">
  Address of the Folio token
</ParamField>

<ParamField path="_feeFloor" type="uint256">
  Custom fee floor (cannot exceed default floor)
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function setTokenFeeFloor(address fToken, uint256 _feeFloor) external onlyOwner
```

<Warning>
  Token-specific fee floors cannot exceed the default fee floor. This ensures a baseline minimum across the protocol.
</Warning>

### Reset Token Fees

Remove custom fee settings for a Folio, reverting to defaults.

<ParamField path="fToken" type="address">
  Address of the Folio token
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function resetTokenFees(address fToken) external onlyOwner
```

## View Functions

### Get Fee Details

Retrieve complete fee configuration for a Folio.

<ParamField path="fToken" type="address">
  Address of the Folio token
</ParamField>

```solidity FolioDAOFeeRegistry.sol theme={null}
function getFeeDetails(address fToken) external view returns (
    address recipient,
    uint256 feeNumerator,
    uint256 feeDenominator,
    uint256 feeFloor
)
```

**Returns:**

* `recipient`: Address receiving DAO fees
* `feeNumerator`: DAO percentage numerator (D18)
* `feeDenominator`: Always 1e18
* `feeFloor`: Minimum DAO fee (D18)

## Chain-Specific Limits

Maximum fees vary by blockchain:

### Ethereum Mainnet (Chain ID: 1)

<ParamField path="MAX_DAO_FEE" type="uint256" default="0.5e18">
  Maximum DAO fee: 50%
</ParamField>

<ParamField path="MAX_FEE_FLOOR" type="uint256" default="0.0015e18">
  Maximum fee floor: 0.15% (15 bps)
</ParamField>

### Base (Chain ID: 8453)

<ParamField path="MAX_DAO_FEE" type="uint256" default="0.5e18">
  Maximum DAO fee: 50%
</ParamField>

<ParamField path="MAX_FEE_FLOOR" type="uint256" default="0.0015e18">
  Maximum fee floor: 0.15% (15 bps)
</ParamField>

### BNB Smart Chain (Chain ID: 56)

<ParamField path="MAX_DAO_FEE" type="uint256" default="0.333...e18">
  Maximum DAO fee: 33.33%
</ParamField>

<ParamField path="MAX_FEE_FLOOR" type="uint256" default="0.001e18">
  Maximum fee floor: 0.10% (10 bps)
</ParamField>

## Events

<ResponseField name="FeeRecipientSet" type="event">
  Emitted when DAO fee recipient is changed

  **Parameters:**

  * `feeRecipient` - New recipient address
</ResponseField>

<ResponseField name="DefaultFeeNumeratorSet" type="event">
  Emitted when default DAO fee percentage is updated

  **Parameters:**

  * `feeNumerator` - New default numerator (D18)
</ResponseField>

<ResponseField name="TokenFeeNumeratorSet" type="event">
  Emitted when a Folio-specific fee numerator is set

  **Parameters:**

  * `fToken` - Folio token address
  * `feeNumerator` - Custom numerator
  * `isActive` - Whether override is active
</ResponseField>

<ResponseField name="DefaultFeeFloorSet" type="event">
  Emitted when default fee floor is updated

  **Parameters:**

  * `defaultFeeFloor` - New default floor (D18)
</ResponseField>

<ResponseField name="TokenFeeFloorSet" type="event">
  Emitted when a Folio-specific fee floor is set

  **Parameters:**

  * `fToken` - Folio token address
  * `feeFloor` - Custom floor
  * `isActive` - Whether override is active
</ResponseField>

## Constants

<ParamField path="FEE_DENOMINATOR" type="uint256" default="1e18">
  Denominator for all fee calculations (D18 precision)
</ParamField>

## Access Control

<ParamField path="roleRegistry" type="IRoleRegistry">
  Immutable reference to the RoleRegistry contract for owner checks
</ParamField>

All configuration functions require the caller to be an owner in the RoleRegistry.

## Fee Distribution Flow

<Info>
  When fee settings are changed, the registry automatically calls `distributeFees()` on the affected Folio before applying changes. This ensures pending fees are calculated with old settings.
</Info>

## Usage Example

```solidity theme={null}
// Get fee configuration for a Folio
(
    address recipient,
    uint256 feeNumerator,
    uint256 feeDenominator,
    uint256 feeFloor
) = daoFeeRegistry.getFeeDetails(folioAddress);

// Calculate DAO share of 100 shares
uint256 daoShares = (100 * feeNumerator) / feeDenominator;
// daoShares = 50 (if feeNumerator is 0.5e18)
```
