# (Legacy) Integrate Y Pool Contract

{% hint style="danger" %}
yBridge has been updated to version v3, and this v2 documentation is currently only for reference purposes. If you need to integrate with our new contracts, please refer to [integrate-ybridgevault-contract](https://docs.xy.finance/single-bridge-integration/ybridge-contract-integration/integrate-ybridgevault-contract "mention") to get the latest information.
{% endhint %}

## YPoolVault

### Code

[`YPoolVault`](https://etherscan.io/address/0x8e921191a9dc6832C1c360C7c7B019eFB7c29B2d#code)

## State-Changing Functions

### deposit

```solidity
function deposit(uint256 amount)
```

Initiate a deposit request.

The `amount` 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 XY worker.

### withdraw

```solidity
function withdraw(uint256 amountXYWrappedToken)
```

Initiate a withdrawal request.

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

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

## Public States

#### depositAndWithdrawFees

```solidity
uint256 public depositAndWithdrawFees;
```

We can tell how much **native token** in the Y Pool belongs to the XY worker from this state.

#### closeSwapGasFees

```solidity
uint256 public closeSwapGasFees;
```

We can tell how much **Y Pool token** in the Y Pool belongs to the XY worker from this state.
