
Generalized swap flow mapping trade execution from origin frontends, through aggregators, to the liquidity pools that settle trades.
| Blockchains | Projects | Protocols | Tables |
|---|---|---|---|
arbitrum ethereum base unichain | Protocols supported in dex.trades and dex.aggregator_trades | Protocols supported in dex.trades and dex.aggregator_trades | ethereum.dex.orderflow_liquidity_view base.dex.orderflow_liquidity_view unichain.dex.orderflow_liquidity_view arbitrum.dex.orderflow_liquidity_view |
When a user executes a swap, the transaction often involves multiple layers of intermediaries before reaching the actual liquidity pools. A user might interact with a wallet like Rabby, which routes through LiFi, which uses 1inch, which finally pulls liquidity from Uniswap and Curve pools. Each layer serves a purpose—optimizing routes, aggregating liquidity, or providing user-friendly interfaces—but this complexity makes it challenging to understand who facilitated the trade and where the actual liquidity came from.
This model creates a generalized swap flow mapping trade execution from origin, through intermediary routing systems, to the liquidity pools that settle it. It allows users to understand:
The orderflow schema is constructed by combining two core Allium tables:
<table> <thead> <tr> <th>Table</th> <th>What it Represents</th> <th>Examples</th> </tr> </thead> <tbody> <tr> <td><code>dex.trades</code></td> <td>AMM swaps emitted directly by liquidity pools, reflecting raw on-chain execution</td> <td>Uniswap V2/V3/V4 pools, Curve pools, Balancer vaults</td> </tr> <tr> <td><code>dex.aggregator_trades</code></td> <td>Swaps routed through intermediaries (aggregators, intent-based protocols, RFQ systems)</td> <td>1inch, Odos, CoW Protocol, Uniswap X</td> </tr> </tbody> </table>We classify all DEX protocols into tiers based on their role in the execution mechanism:
<table> <thead> <tr> <th>Priority</th> <th>Category</th> <th>Examples</th> <th>Function</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Intent-Based</td> <td>CoW Protocol, Uniswap X, 0x Settler</td> <td>Batch auctions and solver competitions</td> </tr> <tr> <td>2</td> <td>Meta-Aggregators</td> <td>Bungee, LiFi, Kyber Aggregator v2</td> <td>Orchestrate multiple aggregators</td> </tr> <tr> <td>3</td> <td>Standard Aggregators</td> <td>1inch, Paraswap, OpenOcean, Odos</td> <td>Route across liquidity sources</td> </tr> <tr> <td>4</td> <td>AMM / Vault Swaps</td> <td>Uniswap, Curve, Balancer, Aerodrome</td> <td>Actual liquidity pools</td> </tr> </tbody> </table>Intent-based protocols receive highest priority because they use a fundamentally different execution model—relying on solvers or batch auctions rather than deterministic routing.
Most transactions don't explicitly encode which wallet or frontend the user employed. We infer origins from event logs and contract interactions:
<table> <thead> <tr> <th>Protocol Type</th> <th>Origin Attribution Method</th> </tr> </thead> <tbody> <tr> <td>Intent-based</td> <td>Project name assigned if <code>to_address</code> matches the contract</td> </tr> <tr> <td>Meta-aggregators</td> <td>KyberSwap <code>ClientData</code>, LiFi <code>integrator</code> tags, Bungee <code>routeName</code></td> </tr> <tr> <td>Standard aggregators</td> <td>0x affiliate addresses, OpenOcean <code>referrer</code>, Paraswap <code>partner</code>, Odos <code>referralCode</code></td> </tr> <tr> <td>Fallback</td> <td>Label the <code>to_address</code> contract from Allium's registry</td> </tr> </tbody> </table>Once each swap event is categorized, we aggregate at the transaction level using transaction_hash as the key. When multiple protocols appear in a single transaction, we apply:
log_index breaks ties between same-priority protocolsThe result is one row per transaction with: origin, meta_aggregator, aggregator, solver_address, pmm_address, and a liquidity_details array containing all AMM pools accessed.
The orderflow_liquidity_view explodes the liquidity_details array into one row per liquidity source. If a swap splits across 4 AMM pools, it creates 4 rows—enabling Sankey chart visualization and queries like:
Priority-Based Selection Sacrifices Nuance: When a transaction involves multiple routing layers, we collapse this complexity into a single representative intermediary at each tier. The meta-aggregator gets attribution even if understanding full routing requires knowing downstream aggregators.
Frontend Attribution Depends on Inconsistent Metadata: Integrator tags are incomplete across some aggregators. Some trades default to protocol level, underrepresenting smaller or less well-integrated frontends.
Ongoing Maintenance Required: DeFi infrastructure evolves constantly. Contract registries, event decoding, and classification rules require periodic updates as protocols deploy new versions.