# StreamingFeeModule

Smart contract that accrues streaming fees for Set managers. Streaming fees are denominated as percent per year and realized as Set inflation rewarded to the manager.

### Select Methods <a href="#select-methods" id="select-methods"></a>

#### accrueFee() <a href="#accruefee" id="accruefee"></a>

`function accrueFee(ISetToken _setToken)`Calculates total inflation percentage then mints new Sets to the fee recipient. Position units are then adjusted down (in magnitude) in order to ensure full collateralization. Callable by anyone.

| Parameter Name | Type      | Description              |
| -------------- | --------- | ------------------------ |
| \_setToken     | ISetToken | Instance of the SetToken |

#### initialize() <a href="#initialize" id="initialize"></a>

`function initialize(ISetToken _setToken, FeeState memory _settings)`**Manager only.** Initializes this module to the SetToken.

| Parameter Name | Type      | Description                             |
| -------------- | --------- | --------------------------------------- |
| \_setToken     | ISetToken | Address of the SetToken                 |
| \_settings     | FeeState  | FeeState struct defining fee parameters |

The FeeState struct is constructed as follows:

```typescript
struct FeeState {
    address feeRecipient;                   // Address to accrue fees to
    uint256 maxStreamingFeePercentage;      // Max streaming fee maanager commits to using (1% = 1e16, 100% = 1e18)
    uint256 streamingFeePercentage;         // Percent of Set accruing to manager annually (1% = 1e16, 100% = 1e18)
    uint256 lastStreamingFeeTimestamp;      // Timestamp last streaming fee was accrued
}                                                  
```

#### updateStreamingFee() <a href="#updatestreamingfee" id="updatestreamingfee"></a>

`function updateStreamingFee(ISetToken _setToken, uint256 _newFee)`**Manager only**. Set new streaming fee. Fees accrue at current rate then new rate is set. Fees are accrued to prevent the manager from unfairly accruing a larger percentage.

| Parameter Name | Type    | Description                               |
| -------------- | ------- | ----------------------------------------- |
| \_setToken     | address | Instance of the SetToken                  |
| \_newFee       | uint256 | New streaming fee in 18 decimal precision |

#### updateFeeRecipient() <a href="#updatefeerecipient" id="updatefeerecipient"></a>

`function updateFeeRecipient(ISetToken _setToken, address _newFeeRecipient)`**Manager only**. Set new fee recipient.

| Parameter Name    | Type      | Description              |
| ----------------- | --------- | ------------------------ |
| \_setToken        | ISetToken | Instance of the SetToken |
| \_newFeeRecipient | address   | New fee recipient        |


---

# 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://vingt-io.gitbook.io/vingt.io/technical-guide/visp-technical-foundation/contract-functions/streamingfeemodule.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.
