> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raffl.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# IFactoryFeeManager

# IFactoryFeeManager

[Git Source](https://github.com/Raffleth/protocol/blob/d0e7a98ac74e241068705b47dbc09c29744e1867/src/interfaces/IFactoryFeeManager.sol)

**Inherits:**
[IFeeManager](/src/interfaces/IFeeManager.sol/interface.IFeeManager.md)

*Interface that describes the struct and accessor function for the data related to the collection of fees.*

## Functions

### setFeeCollector

FUNCTIONS

\*Set address of fee collector.
Requirements:

* `msg.sender` has to be the owner of the factory.
* `newFeeCollector` can't be address 0x0.\*

```solidity theme={null}
function setFeeCollector(address newFeeCollector) external;
```

**Parameters**

| Name              | Type      | Description                |
| ----------------- | --------- | -------------------------- |
| `newFeeCollector` | `address` | Address of `feeCollector`. |

### scheduleGlobalCreationFee

Sets a new global creation fee value, to take effect after 1 hour.

*`msg.sender` has to be the fee collector of the factory.*

```solidity theme={null}
function scheduleGlobalCreationFee(uint64 newFeeValue) external;
```

**Parameters**

| Name          | Type     | Description                                                            |
| ------------- | -------- | ---------------------------------------------------------------------- |
| `newFeeValue` | `uint64` | Value for `creationFee` that will be charged on `Raffl`'s deployments. |

### scheduleGlobalPoolFee

Sets a new global pool fee percentage, to take effect after 1 hour.

\*Percentages and fees are calculated using 18 decimals where 1 ether is 100%.
Requirements:

* `newFeePercentage` must be within minPoolFee and maxPoolFee.
* `msg.sender` has to be the fee collector of the factory.\*

```solidity theme={null}
function scheduleGlobalPoolFee(uint64 newFeePercentage) external;
```

**Parameters**

| Name               | Type     | Description                                                            |
| ------------------ | -------- | ---------------------------------------------------------------------- |
| `newFeePercentage` | `uint64` | Value for `poolFeePercentage` that will be charged on `Raffl`'s pools. |

### scheduleCustomCreationFee

Sets a new custom creation fee value for a specific User, to be enabled and take effect
after 1 hour from the time of this transaction.

\*Allows the contract owner to modify the creation fee associated with a specific User.
The new fee becomes effective after a delay of 1 hour, aiming to provide a buffer for users to be aware of the
upcoming fee change.
This function updates the fee and schedules its activation, ensuring transparency and predictability in fee
adjustments.
The fee is specified in wei, allowing for granular control over the fee structure. Emits a
`CustomCreationFeeChange` event upon successful fee update.
Requirements:

* `msg.sender` has to be the fee collector of the factory.\*

```solidity theme={null}
function scheduleCustomCreationFee(address user, uint64 newFeeValue) external;
```

**Parameters**

| Name          | Type      | Description                                                                                          |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------- |
| `user`        | `address` | Address of the `user`.                                                                               |
| `newFeeValue` | `uint64`  | The new creation fee amount to be set, in wei, to replace the current fee after the specified delay. |

### scheduleCustomPoolFee

Sets a new custom pool fee percentage for a specific User, to be enabled and take effect
after 1 hour from the time of this transaction.

\*This function allows the contract owner to adjust the pool fee for a User.
The fee adjustment is delayed by 1 hour to provide transparency and predictability. Fees are calculated with
precision to 18 decimal places, where 1 ether equals 100% fee.
The function enforces fee limits; `newFeePercentage` must be within the predefined 0-`MAX_POOL_FEE` bounds.
If the custom fee was previously disabled or set to a different value, this operation schedules the new fee to
take effect after the delay, enabling it if necessary.
Emits a `CustomPoolFeeChange` event upon successful execution.
Requirements:

* `msg.sender` has to be the fee collector of the factory.
* `newFeePercentage` must be within the range limited by `MAX_POOL_FEE`.\*

```solidity theme={null}
function scheduleCustomPoolFee(address user, uint64 newFeePercentage) external;
```

**Parameters**

| Name               | Type      | Description                                                                                                            |
| ------------------ | --------- | ---------------------------------------------------------------------------------------------------------------------- |
| `user`             | `address` | Address of the `user`.                                                                                                 |
| `newFeePercentage` | `uint64`  | The new pool fee percentage to be applied, expressed in ether terms (18 decimal places) where 1 ether represents 100%. |

### toggleCustomCreationFee

Enables or disables the custom creation fee for a given Raffle, with the change taking effect
after 1 hour.

*`msg.sender` has to be the fee collector of the factory.*

```solidity theme={null}
function toggleCustomCreationFee(address user, bool enable) external;
```

**Parameters**

| Name     | Type      | Description                                  |
| -------- | --------- | -------------------------------------------- |
| `user`   | `address` | Address of the `user`.                       |
| `enable` | `bool`    | True to enable the fee, false to disable it. |

### toggleCustomPoolFee

Enables or disables the custom pool fee for a given Raffle, to take effect after 1 hour.

*`msg.sender` has to be the fee collector of the factory.*

```solidity theme={null}
function toggleCustomPoolFee(address user, bool enable) external;
```

**Parameters**

| Name     | Type      | Description                                  |
| -------- | --------- | -------------------------------------------- |
| `user`   | `address` | Address of the `user`.                       |
| `enable` | `bool`    | True to enable the fee, false to disable it. |

### minPoolFee

*Exposes the minimum pool fee.*

```solidity theme={null}
function minPoolFee() external pure returns (uint64);
```

### maxPoolFee

*Exposes the maximum pool fee.*

```solidity theme={null}
function maxPoolFee() external pure returns (uint64);
```

### feeCollector

Exposes the `FeeData.feeCollector` to users.

```solidity theme={null}
function feeCollector() external view returns (address);
```

### globalCreationFee

Retrieves the current global creation fee to users.

```solidity theme={null}
function globalCreationFee() external view returns (uint64);
```

### globalPoolFee

Retrieves the current global pool fee percentage to users.

```solidity theme={null}
function globalPoolFee() external view returns (uint64);
```

### creationFeeData

Returns the current creation fee for a specific user, considering any pending updates.

```solidity theme={null}
function creationFeeData(address user)
    external
    view
    override
    returns (address feeCollectorAddress, uint64 creationFeeValue);
```

**Parameters**

| Name   | Type      | Description            |
| ------ | --------- | ---------------------- |
| `user` | `address` | Address of the `user`. |

### poolFeeData

Returns the current pool fee for a specific user, considering any pending updates.

```solidity theme={null}
function poolFeeData(address user)
    external
    view
    override
    returns (address feeCollectorAddress, uint64 poolFeePercentage);
```

**Parameters**

| Name   | Type      | Description            |
| ------ | --------- | ---------------------- |
| `user` | `address` | Address of the `user`. |

## Events

### FeeCollectorChange

EVENTS

```solidity theme={null}
event FeeCollectorChange(address indexed feeCollector);
```

**Parameters**

| Name           | Type      | Description                       |
| -------------- | --------- | --------------------------------- |
| `feeCollector` | `address` | Address of the new fee collector. |

### GlobalCreationFeeChange

```solidity theme={null}
event GlobalCreationFeeChange(uint64 creationFeeValue);
```

**Parameters**

| Name               | Type     | Description                     |
| ------------------ | -------- | ------------------------------- |
| `creationFeeValue` | `uint64` | Value for the new creation fee. |

### GlobalPoolFeeChange

```solidity theme={null}
event GlobalPoolFeeChange(uint64 poolFeePercentage);
```

**Parameters**

| Name                | Type     | Description                 |
| ------------------- | -------- | --------------------------- |
| `poolFeePercentage` | `uint64` | Value for the new pool fee. |

### CustomCreationFeeChange

```solidity theme={null}
event CustomCreationFeeChange(address indexed user, uint64 creationFeeValue);
```

**Parameters**

| Name               | Type      | Description                     |
| ------------------ | --------- | ------------------------------- |
| `user`             | `address` | Address of the user.            |
| `creationFeeValue` | `uint64`  | Value for the new creation fee. |

### CustomCreationFeeToggle

```solidity theme={null}
event CustomCreationFeeToggle(address indexed user, bool enable);
```

**Parameters**

| Name     | Type      | Description                             |
| -------- | --------- | --------------------------------------- |
| `user`   | `address` | Address of the user.                    |
| `enable` | `bool`    | Indicates the enabled state of the fee. |

### CustomPoolFeeChange

```solidity theme={null}
event CustomPoolFeeChange(address indexed user, uint64 poolFeePercentage);
```

**Parameters**

| Name                | Type      | Description                 |
| ------------------- | --------- | --------------------------- |
| `user`              | `address` | Address of the user.        |
| `poolFeePercentage` | `uint64`  | Value for the new pool fee. |

### CustomPoolFeeToggle

```solidity theme={null}
event CustomPoolFeeToggle(address indexed user, bool enable);
```

**Parameters**

| Name     | Type      | Description                             |
| -------- | --------- | --------------------------------------- |
| `user`   | `address` | Address of the user.                    |
| `enable` | `bool`    | Indicates the enabled state of the fee. |
