> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# What is Zap?

> Learn how Meteora Zap coordinates supported zap-in and zap-out flows for DAMM v2 and DLMM positions.

## Overview

Zap is Meteora's helper program for position workflows that need token accounting, a supported swap, or a follow-up liquidity action.

In practice, Zap has two jobs:

* **Zap In**: use tracked token amounts to add liquidity to a supported DAMM v2 or DLMM position flow.
* **Zap Out**: detect tokens received during the current flow and swap a selected percentage through a whitelisted route.

<Info>
  Zap runs on the program `zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz`.
</Info>

<Note>
  Zap is deliberately narrow. It only supports the instructions and routes described in this section; it is not a general-purpose Solana router.
</Note>

## Core Features

<CardGroup cols={2}>
  <Card title="User Ledger" icon="clipboard-list" iconType="solid">
    Zap In flows use a user-owned ledger PDA to track token A/B or token X/Y amounts before and after swaps or deposits.
  </Card>

  <Card title="DAMM v2 Zap In" icon="right-to-bracket" iconType="solid">
    Zap can add DAMM v2 liquidity, optionally swap the surplus side through DAMM v2, then add remaining liquidity again.
  </Card>

  <Card title="DLMM Zap In" icon="layer-group" iconType="solid">
    Zap can initialize a new DLMM position or deposit into an existing position with Spot, Curve, or Bid-Ask distribution parameters.
  </Card>

  <Card title="Zap Out" icon="right-from-bracket" iconType="solid">
    Zap can rewrite the amount field in a prepared DAMM v2, DLMM, or Jupiter v6 swap instruction and invoke it for the detected balance increase.
  </Card>
</CardGroup>

## What Zap Supports

| Area                     | Supported by the Zap program                                                                           |
| ------------------------ | ------------------------------------------------------------------------------------------------------ |
| DAMM v2 Zap In           | Add liquidity, calculate the surplus side, swap through DAMM v2 `swap2`, then add remaining liquidity. |
| DLMM Zap In              | New and existing positions through DLMM `rebalance_liquidity`.                                         |
| DLMM strategies          | `Spot`, `Curve`, and `BidAsk`.                                                                         |
| Zap Out routes           | DAMM v2 swap, DLMM `swap2`, Jupiter v6 route, and Jupiter v6 shared-account route.                     |
| Ledger accounting        | One PDA per owner using the `user_ledger` seed.                                                        |
| Token 2022 transfer fees | Transfer-fee-aware net amount calculations in Zap In liquidity math.                                   |

## What Zap Does Not Do

Zap does not choose the user's pool, route, quote, position range, or slippage settings. Frontends and integrators still prepare those decisions before calling the program.

Zap also does not guarantee the best route or exact final output. Swap execution still depends on pool liquidity, price movement, route accounts, token behavior, and the slippage checks used by the underlying program.

## How It Works

```text theme={"system"}
Frontend prepares accounts, quote, range, and payload
        |
Zap validates ownership, route type, and supplied limits
        |
Zap updates ledger balances or detects received tokens
        |
Zap CPIs into DAMM v2, DLMM, or a whitelisted Zap Out route
```

For Zap In, the frontend records the token amounts in a user ledger before calling the DAMM v2 or DLMM Zap In instruction. For Zap Out, the frontend supplies a prepared swap instruction payload, and Zap replaces the amount field with the percentage of tokens received during the current flow.

## Product Fit

Zap is useful when a user intent maps cleanly to one of the supported flows:

* Add liquidity to a DAMM v2 position using amounts already tracked in the ledger.
* Create a DLMM position and deposit into a selected bin range.
* Add to or reposition an existing DLMM position with a supported strategy.
* Claim, withdraw, or otherwise receive tokens, then convert a selected percentage through a supported Zap Out route.

For unsupported AMMs, unsupported Jupiter instructions, custom token behavior, or complex conditional execution, use the underlying program or route directly.

## Read Next

<CardGroup cols={2}>
  <Card title="Zap Compatibilities" href="/helper-products/zap/compatibilities" icon="plug" iconType="solid">
    Review supported instructions, routes, accounts, access controls, and not-fit cases.
  </Card>

  <Card title="Zap Formulas and Limits" href="/helper-products/zap/formula-and-limits" icon="calculator" iconType="solid">
    See the percentage, slippage, price, and DLMM strategy math used by the program.
  </Card>
</CardGroup>

<Warning>
  Zap simplifies supported workflows, but users still take AMM, route, price movement, and token behavior risk.
</Warning>
