# Integrate YBridgeVault Contract

## YBridgeVaultV3

## State-Changing Functions

### deposit

```solidity
function deposit(uint256 vaultTokenAmount)
```

Initiate a deposit request.

The `vaultTokenAmount` is the desired pool token to be deposited. After deposit, the liquidity provider will receive `XYWrappedToken` (`xyUSDT`, `xyUSDC` or `xyETH)`, along with another transaction sent by YBridge worker.

### withdraw

```solidity
function withdraw(uint256 shareAmount)
```

Initiate a withdrawal request.

The `shareAmount` is the desired amount of `XYWrappedToken` to be redeemed to the underlying token.

Similar to `deposit`, you will receive the underlying vault token along with another transaction sent by YBridge worker.

## Public States

#### acceptDepositRequest

```solidity
bool public acceptDepositRequest;
```

We can tell whether a YBridgeVault accepts deposit request or not from this state.

#### acceptWithdrawRequest

```solidity
bool public acceptWithdrawRequest;
```

We can tell whether a YBridgeVault accepts withdraw request or not from this state.

#### isDepositCompleted

```solidity
mapping (uint256 => bool) public isDepositCompleted;
```

We can tell whether a deposit request is completed by giving the deposit request ID from this mapping.

#### isWithdrawCompleted

```solidity
mapping (uint256 => bool) public isWithdrawCompleted;
```

We can tell whether a withdrawal request is completed by giving the withdrawal request ID from this mapping.
