# xWin FundFactory

### FundV2Initialize

#### initialize

```solidity
function initialize(string _name, string _symbol, address _USDAddr, address _manageraddr, address _managerRebaddr, address _platformWallet) external
```

### FundV2Factory

#### fundV2Array

```solidity
address[] fundV2Array
```

#### supportedBaseTokens

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

#### whitelisted

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

#### fundIDs

```solidity
mapping(address => uint256) fundIDs
```

#### xWinToken

```solidity
contract IERC20Upgradeable xWinToken
```

#### xWinPriceMaster

```solidity
contract IxWinPriceMaster xWinPriceMaster
```

#### xEmitEvent

```solidity
contract IxWinEmitEvent xEmitEvent
```

#### beaconContract

```solidity
address beaconContract
```

#### autoLockAddr

```solidity
address autoLockAddr
```

#### xWinSwapAddr

```solidity
address xWinSwapAddr
```

#### xWinAdminWallet

```solidity
address xWinAdminWallet
```

#### DEFAULT\_BASETOKEN

```solidity
address DEFAULT_BASETOKEN
```

#### DEFAULT\_MANAGER

```solidity
address DEFAULT_MANAGER
```

#### DEFAULT\_PLATFORM

```solidity
address DEFAULT_PLATFORM
```

#### DEFAULT\_MANAGER\_FEE

```solidity
uint256 DEFAULT_MANAGER_FEE
```

#### DEFAULT\_PERFORMANCE\_FEE

```solidity
uint256 DEFAULT_PERFORMANCE_FEE
```

#### DEFAULT\_CREATION\_FEE

```solidity
uint256 DEFAULT_CREATION_FEE
```

#### DEFAULT\_PLATFORM\_FEE

```solidity
uint256 DEFAULT_PLATFORM_FEE
```

#### DEFAULT\_REBALANCE\_PERIOD

```solidity
uint256 DEFAULT_REBALANCE_PERIOD
```

#### DEFAULT\_BLOCKSPERDAY

```solidity
uint256 DEFAULT_BLOCKSPERDAY
```

#### DEFAULT\_SMALLRATIO

```solidity
uint256 DEFAULT_SMALLRATIO
```

#### BaseTokenUpdate

```solidity
event BaseTokenUpdate(address, bool)
```

#### Received

```solidity
event Received(address, uint256)
```

#### FundCreation

```solidity
event FundCreation(address rebalanceOwner, address newFund, uint256 fundId, string name, string symbol)
```

#### executors

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

#### initialize

```solidity
function initialize(address _xWinAdminWallet, address _xWinSwapAddr, address _xWinPriceMaster, address _emitEventAddr, address _xWinLockStaking, address _xwinAddr, address _beaconAddress, address _baseToken, address _defaultManagerAddr, address _defaultPlatformAddr) public
```

#### createFundPrivate

```solidity
function createFundPrivate(string name, string symbol, address[] _toAddresses, uint256[] _targetWeight) external
```

Create a Fund

**Parameters**

| Name           | Type       | Description                                  |
| -------------- | ---------- | -------------------------------------------- |
| name           | string     | Name of new fund                             |
| symbol         | string     | Symbol of new fund                           |
| \_toAddresses  | address\[] | Array of initial target allocation addresses |
| \_targetWeight | uint256\[] | Array of inital target allocation weights    |

#### createFundPrivateWithBaseToken

```solidity
function createFundPrivateWithBaseToken(string name, string symbol, address _baseToken, address[] _toAddresses, uint256[] _targetWeight) external
```

Create a Fund, with specific base token

**Parameters**

| Name           | Type       | Description                                  |
| -------------- | ---------- | -------------------------------------------- |
| name           | string     | Name of new fund                             |
| symbol         | string     | Symbol of new fund                           |
| \_baseToken    | address    | base token for new fund                      |
| \_toAddresses  | address\[] | Array of initial target allocation addresses |
| \_targetWeight | uint256\[] | Array of inital target allocation weights    |

#### createFund

```solidity
function createFund(string name, string symbol, address _baseToken, address managerFeeAddr, address rebalanceAddr, address _USDAddr) external returns (uint256)
```

#### createProxy

```solidity
function createProxy(string name, string symbol, address _baseToken, address managerFeeAddr, address rebalanceAddr, address _USDAddr) internal returns (address)
```

#### initialiseFund

```solidity
function initialiseFund(uint256 fundId, uint256 _managerFee, uint256 _performanceFee, bool _openForPublic, uint256 _unitpriceMultiplier, address _platformAddr) external
```

#### \_initialiseFund

```solidity
function _initialiseFund(uint256 fundId, uint256 _managerFee, uint256 _performanceFee, bool _openForPublic, uint256 _unitpriceMultiplier, address _platformAddr) internal
```

#### massProcessPlatformFee

```solidity
function massProcessPlatformFee() external
```

#### processPlatformFee

```solidity
function processPlatformFee(address _fundAddr) external
```

#### processManagerFee

```solidity
function processManagerFee(address _fundAddr) external
```

#### massProcessManagerFee

```solidity
function massProcessManagerFee() external
```

#### setSwapAddr

```solidity
function setSwapAddr(address _xWinSwapAddr) external
```

#### addNewBaseToken

```solidity
function addNewBaseToken(address _newTokenAddr) external
```

#### removeBaseToken

```solidity
function removeBaseToken(address _tokenAddr) external
```

#### updatePriceMaster

```solidity
function updatePriceMaster(address _newPriceMaster) external
```

#### getLatestFundID

```solidity
function getLatestFundID() public view returns (uint256)
```

#### getFundfromIndex

```solidity
function getFundfromIndex(uint256 _index) public view returns (address)
```

#### setProperties

```solidity
function setProperties(address _baseToken, uint256 _defaultManagerFee, uint256 _defaultPerformFee, address _defaultManager, uint256 _defaultPlatFee, uint256 _defaultRebalancePeriod, uint256 _defaultBlockPerDays, uint256 _defaultSmallRatio, address _defaultPlatform) external
```

#### addWhiteList

```solidity
function addWhiteList(address _addr) external
```

#### removeWhiteList

```solidity
function removeWhiteList(address _addr) external
```

#### setPause

```solidity
function setPause(address _fundAddr, bool _pauseVal) external
```

#### MoveNonIndexNameToBase

```solidity
function MoveNonIndexNameToBase(address _fundAddr, address _tokenaddress, uint32 _slippage) external returns (uint256 balanceToken, uint256 swapOutput)
```

#### setOpenForPublic

```solidity
function setOpenForPublic(address _fundAddr, bool _allow) external
```

#### updateOtherProperties

```solidity
function updateOtherProperties(address _fundAddr, uint256 newCycle, uint256 _ratio, uint256 _UPMultiplier) external
```

#### updatePlatformProperty

```solidity
function updatePlatformProperty(address _fundAddr, address newPlatformWallet, uint256 newPlatformFee) external
```

#### setPerformanceFee

```solidity
function setPerformanceFee(address _fundAddr, uint256 newPerformFee) external
```

#### updateManagerProperty

```solidity
function updateManagerProperty(address _fundAddr, address newRebManager, address newManager, uint256 newFeebps) external
```

#### updateBlockPerday

```solidity
function updateBlockPerday(address _fundAddr, uint256 _blocksPerDay) external
```

#### updatexWinEngines

```solidity
function updatexWinEngines(address _fundAddr, address _xwinPricesMaster, address _xwinSwap) external
```

#### updateUSDAddr

```solidity
function updateUSDAddr(address _fundAddr, address _newUSDAddr) external
```

#### updateEmitEvent

```solidity
function updateEmitEvent(address _fundAddr) external
```

#### updateLockedStaking

```solidity
function updateLockedStaking(address _fundAddr) external
```

#### setWaivedPerformanceFee

```solidity
function setWaivedPerformanceFee(address _fundAddr, address _toWaive, bool _status) external
```

#### setAdminWallet

```solidity
function setAdminWallet(address _address) external
```

#### setEmitEvent

```solidity
function setEmitEvent(address _newEmitEvent) external
```

#### setAutoLock

```solidity
function setAutoLock(address _newAutoLock) external
```

#### setCreationFee

```solidity
function setCreationFee(uint256 _newCreationFee) external
```

#### isRegistered

```solidity
function isRegistered(address _fundAddress) internal view
```

#### countTotalFunds

```solidity
function countTotalFunds() external view returns (uint256 count)
```

#### countActiveFunds

```solidity
function countActiveFunds() external view returns (uint256 count)
```

#### countTVL

```solidity
function countTVL() external view returns (uint256 amount)
```

#### countFundNumberByAddress

```solidity
function countFundNumberByAddress(address _user) external view returns (uint256 count)
```

#### countTotalTVLByAddress

```solidity
function countTotalTVLByAddress(address _user) external view returns (uint256 amount)
```

Gets the total deposit value of the given address in all FundV2 contracts

**Parameters**

| Name   | Type    | Description     |
| ------ | ------- | --------------- |
| \_user | address | Wallet to query |

#### receive

```solidity
receive() external payable
```

#### setExecutor

```solidity
function setExecutor(address _address, bool _allow) external
```

#### onlyExecutor

```solidity
modifier onlyExecutor()
```
