# (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](/single-bridge-integration/ybridge-contract-integration/integrate-ybridgevault-contract.md) 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xy.finance/single-bridge-integration/ybridge-contract-integration/legacy-integrate-y-pool-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
