# Streaming Fee Module

The **StreamingFeeModule** ([Etherscan](https://etherscan.io/address/0x165edf07bb61904f47800e13f5120e64c4b9a186)) is a smart contract that accrues streaming fees for managers and methodologists. Streaming fees are denominated as percent per year and realized as inflation rewarded to recipients.

## Select Methods

### accrueFee()

`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()

`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 manager 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()

`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()

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