# xWin SCA

### xWinERC20Alpha

#### targetToken

```solidity
contract IERC20Upgradeable targetToken
```

#### \_baseTokenStaking

```solidity
contract IERC20Upgradeable _baseTokenStaking
```

#### swapEngine

```solidity
contract IxWinSwap swapEngine
```

#### xWinPriceMaster

```solidity
contract IxWinPriceMaster xWinPriceMaster
```

#### executors

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

#### lastInvestedBlock

```solidity
uint256 lastInvestedBlock
```

#### reinvestDuration

```solidity
uint256 reinvestDuration
```

#### totalDeposit

```solidity
uint256 totalDeposit
```

#### Pause

```solidity
event Pause()
```

#### Unpause

```solidity
event Unpause()
```

#### initialize

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

#### init

```solidity
function init(contract IERC20Upgradeable _targetToken, address _swapEngine, address baseTokenStaking_, address _xWinPriceMaster) external
```

#### onlyExecutor

```solidity
modifier onlyExecutor()
```

#### deposit

```solidity
function deposit(uint256 _amount) external returns (uint256)
```

#### deposit

```solidity
function deposit(uint256 _amount, uint32 _slippage) public returns (uint256)
```

#### \_deposit

```solidity
function _deposit(uint256 _amount, uint32 _slippage) internal returns (uint256)
```

#### canSystemDeposit

```solidity
function canSystemDeposit() external view returns (bool)
```

#### \_calcMintQty

```solidity
function _calcMintQty(uint256 _unitPrice) internal view returns (uint256 mintQty)
```

#### systemDeposit

```solidity
function systemDeposit() external
```

Swaps interest received from baseTokenStaking into target token

*Only possible when contract not paused.*

#### getAmountToSwap

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

#### getVaultValues

```solidity
function getVaultValues() public view returns (uint256 vaultValue)
```

Gets the total value of the tokens within the fund, value shown in baseToken

#### \_getVaultValues

```solidity
function _getVaultValues() internal view returns (uint256 vaultValue)
```

#### getVaultValuesInUSD

```solidity
function getVaultValuesInUSD() public view returns (uint256 vaultValue)
```

Gets the total value of the tokens within the fund, value shown in stablecoinUSDAddr

#### \_getVaultValuesInUSD

```solidity
function _getVaultValuesInUSD() internal view returns (uint256 vaultValue)
```

#### getStableValues

```solidity
function getStableValues() external view returns (uint256 vaultValue)
```

#### getTargetValues

```solidity
function getTargetValues() external view returns (uint256 vaultValue)
```

#### getBaseValues

```solidity
function getBaseValues() external view returns (uint256 vaultValue)
```

#### withdraw

```solidity
function withdraw(uint256 _shares) external returns (uint256)
```

Withdraws from funds from the Cake Vault

**Parameters**

| Name     | Type    | Description |
| -------- | ------- | ----------- |
| \_shares | uint256 |             |

#### withdraw

```solidity
function withdraw(uint256 _shares, uint32 _slippage) public returns (uint256)
```

#### \_withdraw

```solidity
function _withdraw(uint256 _shares, uint32 _slippage) internal returns (uint256)
```

#### adminStakeStable

```solidity
function adminStakeStable() external
```

#### emergencyUnWindPosition

```solidity
function emergencyUnWindPosition() external
```

#### setPriceMaster

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

#### setProperties

```solidity
function setProperties(uint256 _reinvestDuration) external
```

#### setExecutor

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

#### setSwapEngine

```solidity
function setSwapEngine(address _newSwapEngine) external
```

#### getUnitPrice

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

Calculates the price per share

#### \_getUnitPrice

```solidity
function _getUnitPrice() internal view returns (uint256)
```

#### getUnitPriceInUSD

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

The unitprice of a share of this fund, in stablecoinUSDAddr

#### getNextInvestBlock

```solidity
function getNextInvestBlock() external view returns (uint256)
```
