# 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.


---

# 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/integrate-ybridgevault-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.
