# Aggregator and routing decoders (Carbon 2.0)

> Decode 4 Solana aggregator and routing programs in Rust, including Jupiter Swap, DFlow Aggregator v4 and OKX DEX, with Carbon decoder crates.

Carbon 2.0.0 has decoder crates for 4 aggregator and routing programs on Solana: 67 instructions, 3 account types and 16 events in all. Use them to index swaps routed across several DEXs, with their routes and amounts 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 |
| ----------------------------------------------------------------------------------- | ------------------------------------ | ---------------------------------------------- | -----------: | -------: | -----: |
| [DFlow Aggregator v4](https://carbon.sevenlabs.org/decoders/dflow-aggregator-v4.md) | `carbon-dflow-aggregator-v4-decoder` | `DF1ow4tspfHX9JwWJsAb9epbkA8hmpSEAtxXy1V27QBH` |           17 |        1 |      2 |
| [Jupiter Swap](https://carbon.sevenlabs.org/decoders/jupiter-swap.md)               | `carbon-jupiter-swap-decoder`        | `JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4`  |           17 |        1 |      6 |
| [OKX DEX](https://carbon.sevenlabs.org/decoders/okx-dex.md)                         | `carbon-okx-dex-decoder`             | `6m2CDdhRgxpH4WjvdzxAYbGxwdGUz5MziiL5jek2kBma` |           14 |        0 |      2 |
| [OnChain Labs DEX v2](https://carbon.sevenlabs.org/decoders/onchain-labs-dex-v2.md) | `carbon-onchain-labs-dex-v2-decoder` | `proVF4pMXVaYqmy4NjniPh4pqKNfMmsihgd4wdkCX3u`  |           19 |        1 |      6 |

## 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-dflow-aggregator-v4-decoder@2.0.0 carbon-jupiter-swap-decoder@2.0.0 carbon-okx-dex-decoder@2.0.0 carbon-onchain-labs-dex-v2-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_jupiter_swap_decoder::JupiterSwapDecoder;
use carbon_dflow_aggregator_v4_decoder::DflowAggregatorV4Decoder;
use carbon_okx_dex_decoder::OkxDexDecoder;

Pipeline::builder()
    .datasource(datasource) // a datasource that emits these programs' transactions
    .instruction(JupiterSwapDecoder, JupiterSwapProcessor)
    .instruction(DflowAggregatorV4Decoder, DflowAggregatorV4Processor)
    .instruction(OkxDexDecoder, OkxDexProcessor)
    .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).

## 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/aggregators · Last updated 2026-11-09 · Index of all pages: https://carbon.sevenlabs.org/llms.txt
