# xWin DCA-ARB

### xWinDCA

#### targetToken

```solidity
contract IERC20Upgradeable targetToken
```

#### \_baseTokenStaking

```solidity
contract IxWinSingleAssetInterface _baseTokenStaking
```

#### swapEngine

```solidity
contract IxWinSwap swapEngine
```

#### xWinPriceMaster

```solidity
contract IxWinPriceMaster xWinPriceMaster
```

#### executors

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

#### lastInvestedBlock

```solidity
uint256 lastInvestedBlock
```

#### maxPerSwap

```solidity
uint256 maxPerSwap
```

#### swapDuration

```solidity
uint256 swapDuration
```

#### reinvestDuration

```solidity
uint256 reinvestDuration
```

#### initialize

```solidity
function initialize(address _baseToken, contract IERC20Upgradeable _targetToken, address _swapEngine, address _priceMaster, address baseTokenStaking_, address _USDTokenAddr, uint256 _managerFee, uint256 _performanceFee, uint256 _collectionPeriod, address _managerAddr) 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)
```

#### getAmountToSwap

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

View function to get the amount of base tokens to swap into target token

#### canSystemDeposit

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

#### systemDeposit

```solidity
function systemDeposit() external returns (uint256)
```

Swaps from base token to target token

*Only possible when contract not paused.*

#### getStableCoinTotalBalance

```solidity
function getStableCoinTotalBalance() 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

#### getStableValues

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

#### getTargetValues

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

#### getBaseValues

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

#### withdraw

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

#### withdraw

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

#### \_withdraw

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

#### emergencyUnWindPosition

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

#### updateProperties

```solidity
function updateProperties(uint256 _maxPerSwap, uint256 _swapDuration, uint256 _reinvestDuration) public
```

#### 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() public view returns (uint256)
```
