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