# xWin Strategy With Fee

### xWinStrategyWithFee

#### waivedPerformanceFees

```solidity
mapping(address => bool) waivedPerformanceFees
```

Priviliged addresses with fees waived for this fund (e.g. manager/platform)

#### performanceFee

```solidity
uint256 performanceFee
```

performance fee in 4 decimals, e.g 100% = 10000

#### managerFee

```solidity
uint256 managerFee
```

manager fee in 4 decimals, e.g 100% = 10000

#### pendingMFee

```solidity
uint256 pendingMFee
```

Pending shares to award to manager

#### collectionPeriod

```solidity
uint256 collectionPeriod
```

Blocks between performance fee collection

#### collectionBlock

```solidity
uint256 collectionBlock
```

Next available collection block number

#### prevCollectionBlock

```solidity
uint256 prevCollectionBlock
```

Last performance fee collection block number

#### watermarkUnitprice

```solidity
uint256 watermarkUnitprice
```

High water mark for performance fee collection

#### strategyManager

```solidity
address strategyManager
```

Manager of this strategy

#### lastManagerFeeCollection

```solidity
uint256 lastManagerFeeCollection
```

Last management fee collection block number

#### blocksPerDay

```solidity
uint256 blocksPerDay
```

#### pendingNewPerformanceFee

```solidity
uint256 pendingNewPerformanceFee
```

New performance fee rate, which will be applied on next performance fee collection

#### lockingAddress

```solidity
address lockingAddress
```

Address of locked staking contract, for performance fee discounts

#### \_\_xWinStrategyWithFee\_init

```solidity
function __xWinStrategyWithFee_init(string _name, string _symbol, address _baseToken, address _USDTokenAddr, uint256 _managerFee, uint256 _performanceFee, uint256 _collectionPeriod, address _managerAddr) internal
```

#### updateLockedStakingAddress

```solidity
function updateLockedStakingAddress(address _lockedStaking) external
```

#### canCollectPerformanceFee

```solidity
function canCollectPerformanceFee() public view virtual returns (bool)
```

View function to check if performance fee can be collected

#### \_calcFundFee

```solidity
function _calcFundFee() internal virtual
```

Calculates management fee, updating pendingMFee

#### collectFundFee

```solidity
function collectFundFee() external virtual
```

Mints management fee shares to manager

#### collectPerformanceFee

```solidity
function collectPerformanceFee() external virtual
```

collects performance fee

#### performanceWithdraw

```solidity
function performanceWithdraw(uint256 _withdrawUnits, uint256 _amtOut) internal returns (uint256)
```

Function to handle performance fee on withdraw

**Parameters**

| Name            | Type    | Description                                           |
| --------------- | ------- | ----------------------------------------------------- |
| \_withdrawUnits | uint256 | Amount of shares being withdrawn                      |
| \_amtOut        | uint256 | Amount of tokens after swapping back to base currency |

**Return Values**

| Name | Type    | Description                                        |
| ---- | ------- | -------------------------------------------------- |
| \[0] | uint256 | amount Amount left after performance fee deduction |

#### \_getMintQty

```solidity
function _getMintQty(uint256 _depositAmt) internal view virtual returns (uint256 mintQty)
```

Calc qty to issue during deposit

#### \_getNewFundUnits

```solidity
function _getNewFundUnits(uint256 totalFundB4, uint256 totalValueAfter) internal view virtual returns (uint256)
```

#### setPerformanceFee

```solidity
function setPerformanceFee(uint256 _newPerformanceFee) external
```

#### setManagerFee

```solidity
function setManagerFee(uint256 _newManagerFee) external
```

#### setPerformanceCollectionPeriod

```solidity
function setPerformanceCollectionPeriod(uint256 _newPeriod) external
```

#### setBlockPerDay

```solidity
function setBlockPerDay(uint256 _newBlocksPerDay) external
```

#### getFundTotalSupply

```solidity
function getFundTotalSupply() public view virtual returns (uint256)
```

#### GetStrategyData

```solidity
function GetStrategyData() external view returns (address baseCcy, uint256 totalUnitB4, uint256 unitprice, uint256 fundvalue, uint256 unitpriceUSD, uint256 fundvalueUSD, string name, string symbol, uint256 managementFee, uint256 performFee, address mAddr, uint256 highWaterMarkPrice)
```

View function to get all the fund's main data and parameters

#### setManagerWallet

```solidity
function setManagerWallet(address _newManagerWallet) external
```

#### \_convertTo18

```solidity
function _convertTo18(uint256 value, address token) internal view returns (uint256)
```

#### \_convertFrom18

```solidity
function _convertFrom18(uint256 value, address token) internal view returns (uint256)
```

#### addWaiveFee

```solidity
function addWaiveFee(address _contract) external
```

#### removeWaiveFee

```solidity
function removeWaiveFee(address _contract) external
```

#### \_isContract

```solidity
function _isContract(address addr) internal view returns (bool)
```
