# Interactions

#### zapIn

Collects user tokens (e.g., ETH and stETH), deposits them into the SPA pool to mint SPA tokens, then wraps those SPA tokens into wSPA and sends them to the user in a **single transaction**.

```solidity
function zapIn(
    address spa,
    address wspa,
    address receiver,
    uint256 minMintAmount,
    uint256[] calldata amounts
) external returns (uint256);

```

| Name            | Type        | Description                       |
| --------------- | ----------- | --------------------------------- |
| `spa`           | `address`   | Address of the SPA contract.      |
| `wspa`          | `address`   | Address of the wrapped SPA token. |
| `receiver`      | `address`   | Address to receive wSPA tokens.   |
| `minMintAmount` | `uint256`   | Minimum SPA tokens to mint.       |
| `amounts`       | `uint256[]` | Array of input token amounts.     |

#### zapOut

Unwraps wSPA back into SPA, calls SPA’s redeem logic to retrieve the underlying tokens, and sends those to the user—all in **one transaction**.

```solidity
function zapOut(
    address spa,
    address wspa,
    address receiver,
    uint256 wspaAmount,
    uint256[] calldata minAmountsOut,
    bool proportional
) external returns (uint256[] memory);

```

| Name            | Type        | Description                              |
| --------------- | ----------- | ---------------------------------------- |
| `spa`           | `address`   | Address of the SPA contract.             |
| `wspa`          | `address`   | Address of the wrapped SPA token.        |
| `receiver`      | `address`   | Address to receive the output tokens.    |
| `wspaAmount`    | `uint256`   | Amount of wSPA tokens to redeem.         |
| `minAmountsOut` | `uint256[]` | Minimum amounts of tokens expected.      |
| `proportional`  | `bool`      | Whether to redeem proportionally or not. |

#### **zapOutSingle**

Unwrap wSPA tokens and redeem a single asset

```solidity
function zapOutSingle(
    address spa,
    address wspa,
    address receiver,
    uint256 wspaAmount,
    uint256 tokenIndex,
    uint256 minAmountOut
) external returns (uint256 amount);

```

**Parameters**

| Name           | Type      | Description                               |
| -------------- | --------- | ----------------------------------------- |
| `spa`          | `address` | Address of the SPA contract               |
| `wspa`         | `address` | Address of the wrapped SPA token contract |
| `receiver`     | `address` | Address to receive the tokens             |
| `wspaAmount`   | `uint256` | Amount of wrapped SPA tokens to redeem    |
| `tokenIndex`   | `uint256` | Index of the token to receive             |
| `minAmountOut` | `uint256` | Minimum amount of token to receive        |

**Returns**

| Name     | Type      | Description              |
| -------- | --------- | ------------------------ |
| `amount` | `uint256` | Amount of token received |


---

# 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.tapio.finance/smart-contracts/zap/interactions.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.
