# DEX and AMM decoders (Carbon 2.0)

> Decode 22 Solana DEX and AMM programs in Rust, including Raydium AMM v4, Raydium CPMM, Raydium CLMM and PumpSwap, with Carbon decoder crates.

Carbon 2.0.0 has decoder crates for 22 DEX and AMM programs on Solana: 543 instructions, 104 account types and 155 events in all. Use them to index swaps, liquidity deposits and withdrawals, pools, positions and order book markets as typed Rust values instead of parsing raw bytes. Each program's page lists every instruction with its discriminator, data fields and accounts, every account and event, and a complete program that runs against the public RPC.

## Programs

Program IDs are the mainnet addresses compiled into each crate as `PROGRAM_ID`. Instruction counts exclude the `CpiEvent` wrapper.

| Program                                                                                  | Crate                                  | Program ID                                     | Instructions | Accounts | Events |
| ---------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------------------- | -----------: | -------: | -----: |
| [BonkSwap](https://carbon.sevenlabs.org/decoders/bonkswap.md)                            | `carbon-bonkswap-decoder`              | `BSwp6bEBihVLdqJRKGgzjcGLHkcTuzmSo1TQkHepzH8p` |           19 |        5 |      0 |
| [FluxBeam](https://carbon.sevenlabs.org/decoders/fluxbeam.md)                            | `carbon-fluxbeam-decoder`              | `FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X` |            6 |        0 |      0 |
| [Gavel](https://carbon.sevenlabs.org/decoders/gavel.md)                                  | `carbon-gavel-decoder`                 | `srAMMzfVHVAtgSJc8iH6CfKzuWuUTzLHVCE81QU1rgi`  |           10 |        2 |      0 |
| [Heaven](https://carbon.sevenlabs.org/decoders/heaven.md)                                | `carbon-heaven-decoder`                | `HEAVENoP2qxoeuF8Dj2oT1GHEnu49U5mJYkdeC8BAX2o` |           54 |        6 |      7 |
| [Jupiter Limit Order](https://carbon.sevenlabs.org/decoders/jupiter-limit-order.md)      | `carbon-jupiter-limit-order-decoder`   | `jupoNjAxXgZ4rjzxzPMP4oxduvQsQtZzyknqvzYNrNu`  |            9 |        2 |      3 |
| [Jupiter Limit Order v2](https://carbon.sevenlabs.org/decoders/jupiter-limit-order-2.md) | `carbon-jupiter-limit-order-2-decoder` | `j1o2qRpjcyUwEvwtcfhEQefh773ZgjxcVRry7LDqg5X`  |            8 |        2 |      4 |
| [Kamino Limit Order](https://carbon.sevenlabs.org/decoders/kamino-limit-order.md)        | `carbon-kamino-limit-order-decoder`    | `LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF`  |           15 |        3 |      2 |
| [Lifinity AMM v2](https://carbon.sevenlabs.org/decoders/lifinity-amm-v2.md)              | `carbon-lifinity-amm-v2-decoder`       | `2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c` |            3 |        1 |      0 |
| [Meteora DAMM v2](https://carbon.sevenlabs.org/decoders/meteora-damm-v2.md)              | `carbon-meteora-damm-v2-decoder`       | `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`  |           38 |        9 |     23 |
| [Meteora DLMM](https://carbon.sevenlabs.org/decoders/meteora-dlmm.md)                    | `carbon-meteora-dlmm-decoder`          | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo`  |           76 |       12 |     30 |
| [Meteora Pools](https://carbon.sevenlabs.org/decoders/meteora-pools.md)                  | `carbon-meteora-pools-decoder`         | `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` |           26 |        3 |     18 |
| [OpenBook v2](https://carbon.sevenlabs.org/decoders/openbook-v2.md)                      | `carbon-openbook-v2-decoder`           | `opnb2LAfJYbRMAHHvqjCwQxanZn7ReEHp1k81EohpZb`  |           29 |        6 |      8 |
| [Orca Whirlpools](https://carbon.sevenlabs.org/decoders/orca-whirlpool.md)               | `carbon-orca-whirlpool-decoder`        | `whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc`  |           66 |       12 |      6 |
| [PancakeSwap](https://carbon.sevenlabs.org/decoders/pancake-swap.md)                     | `carbon-pancake-swap-decoder`          | `HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq` |           27 |       10 |     11 |
| [Phoenix v1](https://carbon.sevenlabs.org/decoders/phoenix-v1.md)                        | `carbon-phoenix-v1-decoder`            | `PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY`  |           28 |        0 |      0 |
| [PumpSwap](https://carbon.sevenlabs.org/decoders/pump-swap.md)                           | `carbon-pump-swap-decoder`             | `pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA`  |           25 |        7 |     22 |
| [Raydium AMM v4](https://carbon.sevenlabs.org/decoders/raydium-amm-v4.md)                | `carbon-raydium-amm-v4-decoder`        | `675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8` |           18 |        3 |      0 |
| [Raydium CLMM](https://carbon.sevenlabs.org/decoders/raydium-clmm.md)                    | `carbon-raydium-clmm-decoder`          | `CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK` |           34 |       12 |     15 |
| [Raydium CPMM](https://carbon.sevenlabs.org/decoders/raydium-cpmm.md)                    | `carbon-raydium-cpmm-decoder`          | `CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C` |           14 |        4 |      2 |
| [Raydium Stable Swap](https://carbon.sevenlabs.org/decoders/raydium-stable-swap.md)      | `carbon-raydium-stable-swap-decoder`   | `5quBtoiQqxF9Jv6KYKctB59NT3gtJD2Y65kdnB1Uev3h` |            6 |        0 |      0 |
| [Stabble Stable Swap](https://carbon.sevenlabs.org/decoders/stabble-stable-swap.md)      | `carbon-stabble-stable-swap-decoder`   | `swapNyd8XiQwJ6ianp9snpu4brUqFxadzvHebnAXjJZ`  |           19 |        3 |      2 |
| [Stabble Weighted Swap](https://carbon.sevenlabs.org/decoders/stabble-weighted-swap.md)  | `carbon-stabble-weighted-swap-decoder` | `swapFpHZwjELNnjvThjajtiVmkz3yPQEHjLtka2fwHW`  |           13 |        2 |      2 |

## Decode several in one pipeline

Add `carbon-core` and the decoder crates you need, all at the same version. For every program in this category:

```sh
cargo add carbon-core@2.0.0 carbon-bonkswap-decoder@2.0.0 carbon-fluxbeam-decoder@2.0.0 carbon-gavel-decoder@2.0.0 carbon-heaven-decoder@2.0.0 carbon-jupiter-limit-order-decoder@2.0.0 carbon-jupiter-limit-order-2-decoder@2.0.0 carbon-kamino-limit-order-decoder@2.0.0 carbon-lifinity-amm-v2-decoder@2.0.0 carbon-meteora-damm-v2-decoder@2.0.0 carbon-meteora-dlmm-decoder@2.0.0 carbon-meteora-pools-decoder@2.0.0 carbon-openbook-v2-decoder@2.0.0 carbon-orca-whirlpool-decoder@2.0.0 carbon-pancake-swap-decoder@2.0.0 carbon-phoenix-v1-decoder@2.0.0 carbon-pump-swap-decoder@2.0.0 carbon-raydium-amm-v4-decoder@2.0.0 carbon-raydium-clmm-decoder@2.0.0 carbon-raydium-cpmm-decoder@2.0.0 carbon-raydium-stable-swap-decoder@2.0.0 carbon-stabble-stable-swap-decoder@2.0.0 carbon-stabble-weighted-swap-decoder@2.0.0
```

Register each decoder with a processor for its instruction enum. This fragment goes in your pipeline setup; the processors are yours, one per program, each implementing `Processor` for that program's instruction input (see [processors](https://carbon.sevenlabs.org/concepts/processors.md)):

```rust
use carbon_raydium_amm_v4_decoder::RaydiumAmmV4Decoder;
use carbon_raydium_cpmm_decoder::RaydiumCpmmDecoder;
use carbon_raydium_clmm_decoder::RaydiumClmmDecoder;

Pipeline::builder()
    .datasource(datasource) // a datasource that emits these programs' transactions
    .instruction(RaydiumAmmV4Decoder, RaydiumAmmV4Processor)
    .instruction(RaydiumCpmmDecoder, RaydiumCpmmProcessor)
    .instruction(RaydiumClmmDecoder, RaydiumClmmProcessor)
    .build()?
    .run()
    .await
```

Each decoder only returns instructions whose program ID matches its own `PROGRAM_ID`, so one pipeline can hold all of them. For datasource filters that follow several programs, and one processor that sees every program's instructions in a transaction, see [index multiple programs](https://carbon.sevenlabs.org/guides/multiple-programs.md).

## Guides

- [Index swaps across DEXs](https://carbon.sevenlabs.org/guides/index-dex-swaps.md)

## A program that is not listed

Generate a decoder from the program's Anchor or Codama IDL with the Carbon CLI: see [generate a decoder](https://carbon.sevenlabs.org/guides/generate-a-decoder.md). Every crate above was generated the same way. The [full catalog](https://carbon.sevenlabs.org/decoders.md) lists decoders in every category.

---

Carbon 2.0.0 documentation · Web: https://carbon.sevenlabs.org/decoders/dex-and-amm · Last updated 2026-11-09 · Index of all pages: https://carbon.sevenlabs.org/llms.txt
