Overview
Understanding DEX Transaction Complexity
When a user executes a swap on Ethereum, 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 in turn 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. However, this complexity makes it challenging to understand who facilitated the trade and where the actual liquidity came from. This model aims to create a generalized swap flow model to map the flow of a swap execution from its origin through intermediary routing systems like meta-aggregators, aggregators, or solvers, to the decentralized exchanges’ liquidity pools and vaults that settle it. This model helps users understand and explore the flow of DEX transactions through frontends and intermediaries.- Where trades originate (e.g., wallets, dApps, bot contracts, interfaces)
- How they are routed (via aggregators, meta-aggregators, or intent-based systems)
- Where liquidity is sourced (DEX protocols and pools that ultimately settle the swap)
Models
There are currently 2 versions of the orderflow model. Models with the
“unhydrated” prefix are models without frontend/intermediary labels. The v2 (New) orderflow model is currently only supported on Ethereum, Unichain, Arbitrum, and Base.
Data Schemas
Data Schemas
Model:
dex.orderflow_liquidity_view (New)The dex.orderflow_liquidity_view model is a flattend view of the dex.unhydrated_orderflow/_v2 model, where all the relevant swap details are compressed within a unit of transaction hash. The entiites (frontend, meta-aggregator, aggregator, solver, pmm) labels are normalized to their respective project names.In this mode, a swap that originates from 1 frontend and is routed to 3 liquidity sources will be represented as 3 rows in the model.Model:
dex.orderflow (Legacy)Methodology
Two core abstractions are used to construct the orderflow schemas:dex.trades and dex.aggregator_trades (Table 2).
Table 2: Core abstractions used to construct the orderflow schemas
The Core Challenge: Attribution in Multi-Layered Transactions
Consider a typical complex swap: A user connects their MetaMask wallet to Jumper Exchange (LiFi’s frontend), which routes through KyberSwap Aggregator, ultimately pulling liquidity from two Uniswap V3 pools and one Curve pool. This single transaction generates multiple swap events across different protocol layers. The fundamental question becomes: How do we attribute this transaction? We sought to identify the following entities involved in a swap:Stage 1: Categorizing DEX Protocols
We classify all DEX protocols into different tiers based on their role in the execution mechanism. This classification reflects both the technical complexity of each protocol type and its position in the execution stack. Every swap event, whether from a high-level aggregator or a direct pool interaction, is tagged with its protocol category and assigned the corresponding priority ranking. Table 3: Protocol Classification Hierarchy
Priority Rationale:
- Intent-based protocols (rank 1) receive the highest priority because of their fundamentally different execution model. Instead of deterministic routing, they rely on solvers or batch auctions.
- Meta-aggregators (rank 2) are distinguished from standard aggregators because they make routing decisions across multiple aggregation layers.
- Standard aggregators (rank 3) represent the conventional routing layer, whether through traditional aggregation algorithms or request-for-quote systems where professional market makers provide liquidity.
- Direct AMM pool or vault swaps (rank 4) represent the liquidity sources of most DEX swaps, where the underlying tokens are exchanged.
Stage 2: Labeling Transaction Origin
Most transactions don’t explicitly encode which wallet or frontend the user employed. We rely on a mix of transaction-level contract interactions and decoded event log data to infer the origin. Several aggregators emit clues about the transaction origin in their event logs. These can be either string text stating the integrator of the DEX aggregator, or addresses pointing to the referral or affiliate address of the swap. For example, KyberSwap’sClientData events, LiFi’s integrator tags, and Paraswap’s partner addresses are identifiers that tell us whether the user came from MetaMask, Rabby, Ledger, or another interface.
Table 4: Transaction Origin Attribution
Stage 3: Transaction-Level Aggregation and Conflict Resolution
Once each swap event is categorized and labeled with origin information, we aggregate all events at the transaction level usingtransaction_hash as the key. This consolidation produces a single orderflow record per transaction, but it requires resolving conflicts when multiple protocols of different types participate.
Selection Logic: Priority-Based with Chronological Tiebreaking
When multiple protocols appear in a single transaction under each entity (e.g., meta-aggregator), we apply a two-tier selection rule:- Primary criterion: Priority ranking (lowest rank number = highest priority)
- Secondary criterion: Event order (lowest
log_index= first event)
meta_aggregator.
Scenario B: Same Protocol Type
When multiple protocols share the same priority—for example, both LiFi and Bungee (both rank 2) routing portions of the same trade—the chronological tiebreaker applies. The protocol whose event appears first (lowest log_index) is selected.
Stage 4: Final Schema Mapping
The aggregation process produces a transaction-level orderflow record with the following attribution dimensions:Liquidity View Flattening
To enable granular analysis of liquidity routing patterns, thedex.orderflow_liquidity_view flattens the transaction-level schema into a liquidity-source-level schema. This transformation creates one row per liquidity source. If a swap splits into 4 different AMM pools, it will be represented as 4 rows in the liquidity view model. This allows users to plot the output in a Sankey chart and also enables queries like:
- “Which AMM pools does LiFi route through most frequently?”
- “What percentage of CoW Protocol swaps use Uniswap V3 vs V4?”
- “Which solvers access which PMMs?”
Flattened Schema Structure
The view maintains all transaction-level attribution fields (origin, meta_aggregator, aggregator, solver, etc.) and adds per-liquidity-source columns:
Data Labels
We source the labels of solvers, frontends, private market makers, and hooks from various publicly available sources. Frontend labels are identified by a mix of integrators used by DEX aggregators. The table below outlines the labeling heuristics for the intermediaries involved in the swap.Design Assumptions and Limitations
The liquidity flow schema was designed to generalize how swap executions move through the DeFi stack, beginning at user-facing interfaces, passing through intermediaries such as aggregators and solvers, and concluding in settlement across DEX liquidity pools. In creating a standardized model, we have made certain simplifications and assumptions, leading to inherent trade-offs in attribution. DeFi infrastructure evolves constantly. New aggregators launch, existing ones add features, and protocols migrate to new contract versions. The schema requires active curation to stay accurate:- Contract registries must be updated as protocols deploy new routers
- Event decoding must expand to parse new integrator metadata formats
- Classification rules need periodic review as protocol boundaries shift