# xWin Strategy

### xWinStrategy

#### stablecoinUSDAddr

```solidity
address stablecoinUSDAddr
```

stablecoinUSDAddr is used for view functions with the 'inUSD' suffix.

#### baseToken

```solidity
address baseToken
```

baseToken for the fund/strategy, token for deposit, and token recieved on withdraw

#### emitEvent

```solidity
contract IxWinEmitEvent emitEvent
```

#### \_\_xWinStrategy\_init

```solidity
function __xWinStrategy_init(string name, string symbol, address _baseToken, address _USDTokenAddr) internal
```

#### \_Deposit

```solidity
event _Deposit(uint256 datetime, address contractaddress, uint256 rate, uint256 depositAmount, uint256 shares)
```

#### \_Withdraw

```solidity
event _Withdraw(uint256 datetime, address contractaddress, uint256 rate, uint256 avrCost, uint256 withdrawAmount, uint256 shares)
```

#### getVaultValues

```solidity
function getVaultValues() external view virtual returns (uint256)
```

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

#### \_getVaultValues

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

#### getUnitPrice

```solidity
function getUnitPrice() external view virtual returns (uint256)
```

The unitprice of a share of this fund in baseToken

#### \_getUnitPrice

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

#### getVaultValuesInUSD

```solidity
function getVaultValuesInUSD() external view virtual returns (uint256)
```

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

#### getUnitPriceInUSD

```solidity
function getUnitPriceInUSD() external view virtual returns (uint256)
```

The unitprice of a share of this fund, in stablecoinUSDAddr

#### deposit

```solidity
function deposit(uint256 amount) external virtual returns (uint256)
```

Deposits baseToken into the fund, and receives shares based on the fund's unitPrice

**Parameters**

| Name   | Type    | Description                    |
| ------ | ------- | ------------------------------ |
| amount | uint256 | Amount of baseToken to deposit |

**Return Values**

| Name | Type    | Description                                 |
| ---- | ------- | ------------------------------------------- |
| \[0] | uint256 | shares Amount of shares minted to depositor |

#### withdraw

```solidity
function withdraw(uint256 amount) external virtual returns (uint256)
```

Withdraws from the fund by burning shares, liquidating assets into baseToken and transfering to user

**Parameters**

| Name   | Type    | Description                  |
| ------ | ------- | ---------------------------- |
| amount | uint256 | Amount of shares to withdraw |

**Return Values**

| Name | Type    | Description                                          |
| ---- | ------- | ---------------------------------------------------- |
| \[0] | uint256 | amount Amount of baseTokens transferred to depositor |

#### deposit

```solidity
function deposit(uint256 amount, uint32 slippage) external virtual returns (uint256)
```

Deposits baseToken into the fund, and receives shares based on the fund's unitPrice

**Parameters**

| Name     | Type    | Description                                      |
| -------- | ------- | ------------------------------------------------ |
| amount   | uint256 | Amount of baseToken to deposit                   |
| slippage | uint32  | Slippage to use for any swaps during the process |

**Return Values**

| Name | Type    | Description                                 |
| ---- | ------- | ------------------------------------------- |
| \[0] | uint256 | shares Amount of shares minted to depositor |

#### withdraw

```solidity
function withdraw(uint256 amount, uint32 slippage) external virtual returns (uint256)
```

Withdraws from the fund by burning shares, liquidating assets into baseToken and transfering to user

**Parameters**

| Name     | Type    | Description                                      |
| -------- | ------- | ------------------------------------------------ |
| amount   | uint256 | Amount of shares to withdraw                     |
| slippage | uint32  | Slippage to use for any swaps during the process |

**Return Values**

| Name | Type    | Description                                          |
| ---- | ------- | ---------------------------------------------------- |
| \[0] | uint256 | amount Amount of baseTokens transferred to depositor |

#### setEmitEvent

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

#### updateUSDAddr

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

#### setPause

```solidity
function setPause() external
```

#### setUnPause

```solidity
function setUnPause() external
```
