> For the complete documentation index, see [llms.txt](https://docs.inverter.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inverter.network/contracts/technical-reference/external/fees/interfaces/ifeemanager_v1.sol.md).

# IFeeManager\_v1.sol

[Git Source](https://github.com/InverterNetwork/inverter-contracts/blob/924235ad72271a7cb09cd1b027f938f90a42eb93/src/external/fees/interfaces/IFeeManager_v1.sol)

### Functions

#### BPS

*This function returns the Base Points used for percentage calculation.*

```solidity
function BPS() external returns (uint);
```

**Returns**

| Name     | Type      | Description                                                                       |
| -------- | --------- | --------------------------------------------------------------------------------- |
| `<none>` | `uint256` | uint The Base Points used for percentage calculation. This value represents 100%. |

#### getDefaultProtocolTreasury

Returns the default treasury for all workflows.

```solidity
function getDefaultProtocolTreasury() external view returns (address);
```

**Returns**

| Name     | Type      | Description                  |
| -------- | --------- | ---------------------------- |
| `<none>` | `address` | The address of the treasury. |

#### getWorkflowTreasuries

Returns the treasury assigned to the given workflow.

```solidity
function getWorkflowTreasuries(address workflow)
    external
    view
    returns (address);
```

**Parameters**

| Name       | Type      | Description                  |
| ---------- | --------- | ---------------------------- |
| `workflow` | `address` | The address of the workflow. |

**Returns**

| Name     | Type      | Description                  |
| -------- | --------- | ---------------------------- |
| `<none>` | `address` | The address of the treasury. |

#### getDefaultCollateralFee

Returns the default collateral fee for all workflows.

```solidity
function getDefaultCollateralFee() external view returns (uint);
```

**Returns**

| Name     | Type      | Description                                       |
| -------- | --------- | ------------------------------------------------- |
| `<none>` | `uint256` | The collateral fee amount in relation to the BPS. |

#### getDefaultIssuanceFee

Returns the default issuance fee for all workflows.

```solidity
function getDefaultIssuanceFee() external view returns (uint);
```

**Returns**

| Name     | Type      | Description                                     |
| -------- | --------- | ----------------------------------------------- |
| `<none>` | `uint256` | The issuance fee amount in relation to the BPS. |

#### getCollateralWorkflowFee

Returns the collateral fee for a specific workflow module function.

```solidity
function getCollateralWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector
) external view returns (uint fee);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |

**Returns**

| Name  | Type      | Description                                       |
| ----- | --------- | ------------------------------------------------- |
| `fee` | `uint256` | The collateral fee amount in relation to the BPS. |

#### getIssuanceWorkflowFee

Returns the issuance fee for a specific workflow module function.

```solidity
function getIssuanceWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector
) external view returns (uint fee);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |

**Returns**

| Name  | Type      | Description                                     |
| ----- | --------- | ----------------------------------------------- |
| `fee` | `uint256` | The issuance fee amount in relation to the BPS. |

#### getCollateralWorkflowFeeAndTreasury

Returns the collateral fee for a specific workflow module function and the according treasury address of the workflow.

```solidity
function getCollateralWorkflowFeeAndTreasury(
    address workflow,
    address module,
    bytes4 functionSelector
) external view returns (uint fee, address treasury);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |

**Returns**

| Name       | Type      | Description                                       |
| ---------- | --------- | ------------------------------------------------- |
| `fee`      | `uint256` | The collateral fee amount in relation to the BPS. |
| `treasury` | `address` | The address of the treasury.                      |

#### getIssuanceWorkflowFeeAndTreasury

Returns the issuance fee for a specific workflow module function and the according treasury address of the workflow.

```solidity
function getIssuanceWorkflowFeeAndTreasury(
    address workflow,
    address module,
    bytes4 functionSelector
) external view returns (uint fee, address treasury);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |

**Returns**

| Name       | Type      | Description                                     |
| ---------- | --------- | ----------------------------------------------- |
| `fee`      | `uint256` | The issuance fee amount in relation to the BPS. |
| `treasury` | `address` | The address of the treasury.                    |

#### setMaxFee

Sets the maximum fee percentage that can be assigned.

*This function can only be called by the owner.*

*The given max fee can not be higher than the BPS.*

```solidity
function setMaxFee(uint _maxFee) external;
```

**Parameters**

| Name      | Type      | Description                         |
| --------- | --------- | ----------------------------------- |
| `_maxFee` | `uint256` | The max Fee in relation to the BPS. |

#### setDefaultProtocolTreasury

Sets the default protocol treasury address.

*This function can only be called by the owner.*

*The given treasury address can not be address(0).*

```solidity
function setDefaultProtocolTreasury(address _defaultProtocolTreasury)
    external;
```

**Parameters**

| Name                       | Type      | Description                                   |
| -------------------------- | --------- | --------------------------------------------- |
| `_defaultProtocolTreasury` | `address` | The address of the default protocol treasury. |

#### setWorkflowTreasury

Sets the protocol treasury address for a specific workflow.

*This function can only be called by the owner.*

*The given treasury address can not be address(0).*

```solidity
function setWorkflowTreasury(address workflow, address treasury) external;
```

**Parameters**

| Name       | Type      | Description                                                      |
| ---------- | --------- | ---------------------------------------------------------------- |
| `workflow` | `address` | The address of the workflow.                                     |
| `treasury` | `address` | The address of the protocol treasury for that specific workflow. |

#### setDefaultCollateralFee

Sets the default collateral fee of the protocol.

*This function can only be called by the owner.*

*The given fee needs to be less than the BPS.*

```solidity
function setDefaultCollateralFee(uint _defaultCollateralFee) external;
```

**Parameters**

| Name                    | Type      | Description                                                        |
| ----------------------- | --------- | ------------------------------------------------------------------ |
| `_defaultCollateralFee` | `uint256` | The default collateral fee of the protocol in relation to the BPS. |

#### setDefaultIssuanceFee

Sets the default issuance fee of the protocol.

*This function can only be called by the owner.*

*The given fee needs to be less than the BPS.*

```solidity
function setDefaultIssuanceFee(uint _defaultIssuanceFee) external;
```

**Parameters**

| Name                  | Type      | Description                                                      |
| --------------------- | --------- | ---------------------------------------------------------------- |
| `_defaultIssuanceFee` | `uint256` | The default issuance fee of the protocol in relation to the BPS. |

#### setCollateralWorkflowFee

Sets the collateral fee for a specific workflow module function.

*This function can only be called by the owner.*

*The given fee needs to be less than the BPS.*

```solidity
function setCollateralWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
) external;
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |
| `set`              | `bool`    | Boolean that determines if the fee is actually used or not.    |
| `fee`              | `uint256` | The collateral fee in relation to the BPS.                     |

#### setIssuanceWorkflowFee

Sets the issuance fee for a specific workflow module function.

*This function can only be called by the owner.*

*The given fee needs to be less than the BPS.*

```solidity
function setIssuanceWorkflowFee(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
) external;
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |
| `set`              | `bool`    | Boolean that determines if the fee is actually used or not.    |
| `fee`              | `uint256` | The issuance fee in relation to the BPS.                       |

### Events

#### MaxFeeSet

Event emitted when the max fee percentage is set.

```solidity
event MaxFeeSet(uint maxFee);
```

**Parameters**

| Name     | Type      | Description                 |
| -------- | --------- | --------------------------- |
| `maxFee` | `uint256` | The maximum fee percentage. |

#### DefaultProtocolTreasurySet

Event emitted when the default protocol treasury is set.

```solidity
event DefaultProtocolTreasurySet(address defaultProtocolTreasury);
```

**Parameters**

| Name                      | Type      | Description                                   |
| ------------------------- | --------- | --------------------------------------------- |
| `defaultProtocolTreasury` | `address` | The address of the default protocol treasury. |

#### WorkflowTreasurySet

Event emitted when the workflow treasury is set.

```solidity
event WorkflowTreasurySet(address workflow, address treasury);
```

**Parameters**

| Name       | Type      | Description                  |
| ---------- | --------- | ---------------------------- |
| `workflow` | `address` | The address of the workflow. |
| `treasury` | `address` | The address of the treasury. |

#### DefaultCollateralFeeSet

Event emitted when the default collateral fee is set.

```solidity
event DefaultCollateralFeeSet(uint fee);
```

**Parameters**

| Name  | Type      | Description                                       |
| ----- | --------- | ------------------------------------------------- |
| `fee` | `uint256` | The collateral fee amount in relation to the BPS. |

#### DefaultIssuanceFeeSet

Event emitted when the default issuance fee is set.

```solidity
event DefaultIssuanceFeeSet(uint fee);
```

**Parameters**

| Name  | Type      | Description                                     |
| ----- | --------- | ----------------------------------------------- |
| `fee` | `uint256` | The issuance fee amount in relation to the BPS. |

#### CollateralWorkflowFeeSet

Event emitted when the collateral workflow fee is set.

```solidity
event CollateralWorkflowFeeSet(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |
| `set`              | `bool`    | Boolean that determines if the fee is actually used or not.    |
| `fee`              | `uint256` | The collateral fee in relation to the BPS.                     |

#### IssuanceWorkflowFeeSet

Event emitted when the issuance workflow fee is set.

```solidity
event IssuanceWorkflowFeeSet(
    address workflow,
    address module,
    bytes4 functionSelector,
    bool set,
    uint fee
);
```

**Parameters**

| Name               | Type      | Description                                                    |
| ------------------ | --------- | -------------------------------------------------------------- |
| `workflow`         | `address` | The address of the workflow that contains the module function. |
| `module`           | `address` | The address of the module that contains the function.          |
| `functionSelector` | `bytes4`  | The function selector of the target function.                  |
| `set`              | `bool`    | Boolean that determines if the fee is actually used or not.    |
| `fee`              | `uint256` | The issuance fee in relation to the BPS.                       |

### Errors

#### FeeManager\_\_InvalidAddress

The given address is invalid.

```solidity
error FeeManager__InvalidAddress();
```

#### FeeManager\_\_InvalidFee

The given fee is invalid.

```solidity
error FeeManager__InvalidFee();
```

#### FeeManager\_\_InvalidMaxFee

The given max fee is invalid.

```solidity
error FeeManager__InvalidMaxFee();
```

### Structs

#### Fee

Struct used to store fee information.

*When \`set\` 'is true, the value is taken, otherwise it reverts to the default value. We need some indication here on whether the value is set or not, to differentiate between an uninitialized 0 and a real 0 fee.*

```solidity
struct Fee {
    bool set;
    uint value;
}
```

**Properties**

| Name    | Type      | Description                    |
| ------- | --------- | ------------------------------ |
| `set`   | `bool`    | Whether the fee is set or not. |
| `value` | `uint256` | The fee value.                 |
