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

# Aggregator Trades

> Dex trades from aggregators.

<Info>
  This table is **not compatible **with `dex.trades` in terms of columns. There are additional gas fees and transaction details available on DEX aggregator trades.
</Info>

`ethereum.dex.aggregator_trades`contains successful DEX trades from DEX aggregators.

In addition to the convention fields involved in DEX swaps, this table includes transaction fees, extra fee details (priority fees), and additional fields emitted specifically to each aggregator contract.

### Coverage

<Tabs>
  <Tab title="Overview">
    The project and protocol coverage for our `aggregator_trades` table includes:

    | Projects              | Protocols                                                                                                                 |
    | --------------------- | ------------------------------------------------------------------------------------------------------------------------- |
    | 1inch                 | 1inch\_ar\_v3, 1inch\_ar\_v6, 1inch\_ar\_v2, 1inch\_ar\_v4, 1inch\_lop\_v3, 1inch\_lop\_v4, 1inch\_lop\_v2, 1inch\_ar\_v5 |
    | cow\_protocol         | cow\_protocol                                                                                                             |
    | dodo                  | dodo\_x\_v1, dodo\_x\_v2                                                                                                  |
    | hashflow              | hashflow\_x                                                                                                               |
    | kyberswap\_aggregator | kyberswap\_aggregator\_v2                                                                                                 |
    | okx                   | okx\_ar\_v1                                                                                                               |
    | openocean             | openocean\_v2                                                                                                             |
    | paraswap              | paraswap\_v4, paraswap\_v2, paraswap\_v3, paraswap\_v1, paraswap\_v5                                                      |
    | tokenlon              | tokenlon\_amm\_v2, tokenlon\_pmm, tokenlon\_amm\_v1, tokenlon\_rfq\_v2, tokenlon\_rfq\_v1                                 |
    | uniswap\_x            | uniswap\_x                                                                                                                |
    | zeroex                | zeroex\_v4                                                                                                                |
  </Tab>

  <Tab title="Specific Events/Calls Indexed">
    List of specific event names / function calls that are indexed.&#x20;

    | Project               | Protocol                  | Event Name / Function Call                                                                                                                                                         |
    | --------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | zeroex                | zeroex\_v4                | OtcOrderFilled, LimitOrderFilled, LiquidityProviderSwap, RfQOrderFilled                                                                                                            |
    | uniswap\_x            | uniswap\_x                | execute, executeBatch, executeBatchWithCallback, executeWithCallback                                                                                                               |
    | tokenlon              | tokenlon\_rfq\_v2         | FilledRFQ                                                                                                                                                                          |
    | tokenlon              | tokenlon\_rfq\_v1         | FillOrder                                                                                                                                                                          |
    | tokenlon              | tokenlon\_pmm             | FillOrder                                                                                                                                                                          |
    | tokenlon              | tokenlon\_amm\_v2         | Swapped                                                                                                                                                                            |
    | tokenlon              | tokenlon\_amm\_v1         | Swapped                                                                                                                                                                            |
    | paraswap              | paraswap\_v5              | SwappedDirect, Bought, BoughtV3, Swapped, Bought2, SwappedV3, Swapped2                                                                                                             |
    | paraswap              | paraswap\_v4              | Bought, Swapped                                                                                                                                                                    |
    | paraswap              | paraswap\_v3              | Bought, Swapped                                                                                                                                                                    |
    | paraswap              | paraswap\_v2              | Swapped                                                                                                                                                                            |
    | paraswap              | paraswap\_v1              | Swapped                                                                                                                                                                            |
    | openocean             | openocean\_v2             | Swapped                                                                                                                                                                            |
    | okx                   | okx\_ar\_v1               | OrderRecord                                                                                                                                                                        |
    | kyberswap\_aggregator | kyberswap\_aggregator\_v2 | Swapped                                                                                                                                                                            |
    | hashflow              | hashflow\_x               | Trade                                                                                                                                                                              |
    | dodo                  | dodo\_x\_v2               | OrderHistory                                                                                                                                                                       |
    | dodo                  | dodo\_x\_v1               | OrderHistory                                                                                                                                                                       |
    | cow\_protocol         | cow\_protocol             | Trade                                                                                                                                                                              |
    | 1inch                 | 1inch\_lop\_v4            | fillContractOrderArgs, fillOrder, fillContractOrder, fillOrderArgs                                                                                                                 |
    | 1inch                 | 1inch\_lop\_v3            | fillOrderRFQ, fillOrder, fillOrderTo, fillOrderRFQTo, fillOrderRFQToWithPermit, fillOrderToWithPermit, fillOrderRFQCompact                                                         |
    | 1inch                 | 1inch\_lop\_v2            | fillOrderRFQTo, fillOrderRFQToWithPermit, fillOrderRFQ                                                                                                                             |
    | 1inch                 | 1inch\_ar\_v6             | unoswap2, unoswap, unoswap3, ethUnoswap, swap, ethUnoswap3, ethUnoswapTo3, unoswapTo2, ethUnoswap2, ethUnoswapTo2, unoswapTo3, clipperSwap, clipperSwapTo, ethUnoswapTo, unoswapTo |
    | 1inch                 | 1inch\_ar\_v5             | uniswapV3Swap, unoswapToWithPermit, swap, clipperSwapToWithPermit, unoswap, uniswapV3SwapTo, clipperSwap, unoswapTo, uniswapV3SwapToWithPermit, clipperSwapTo                      |
    | 1inch                 | 1inch\_ar\_v4             | clipperSwap, uniswapV3Swap, uniswapV3SwapToWithPermit, unoswap, clipperSwapToWithPermit, swap, unoswapWithPermit, uniswapV3SwapTo                                                  |
    | 1inch                 | 1inch\_ar\_v3             | Swapped                                                                                                                                                                            |
    | 1inch                 | 1inch\_ar\_v2             | Swapped                                                                                                                                                                            |
  </Tab>
</Tabs>

### Data Caveats

<Tabs>
  <Tab title="Overview">
    There are several data caveats that you should take note of while using this table.

    1. The scope of DEXs and calls indexed in this table represents a subset of all on-chain DEX aggregator volume. For protocols and projects covered, please refer to the list above.

    2. Trades indexed from trace calls will have a `-1` log index assigned.

    3. Due to the limitation of trace calls, there are edge cases where the token-bought address is null.
  </Tab>

  <Tab title="Log Index">
    For trades that are index from traces calls, they do not have a corresponding log index. These trades will be assigned a default -1 value.
  </Tab>

  <Tab title="Null Token Bought">
    For 1inch, contracts beyond AggregatorRouterV4 (V5, V6) do not emit events. We index the trace calls to identify the swaps performed.

    There are several limitations in using trace call data as they are incomplete. Below are the caveats and data impact we identified:

    <table><thead><tr><th width="128">Call type</th><th width="373">Caveats</th><th>Implication</th></tr></thead><tbody><tr><td>unoswap calls </td><td><p>unoswap calls does not have the destination token swapped.</p><p /><p>The call data only has <code>srcToken</code> (token sold) param and an array of <code>pools</code> that the swap was routed too.<br /><br />We use erc20 token transfers from the last liqudity pool hopped in the unoswap call <br />to determine what was the destination token. (<code>token\_bought\_address</code>). <br /><br />However, are several edge-cases where we cannot determine the destination (token bought) accurately:</p><ol><li>There were no corresponding transfer events emitted from the liquidity pool<br />See: <a href="https://etherscan.io/tx/0x24095b912b1f4aa8038b3d5b14a04860cd249e62bccc62d53b27fde44c31287b#eventlog">this txn</a></li><li>The pools array for unoswap was <code>null</code> <br />See: <a href="https://app.blocksec.com/explorer/tx/eth/0x11af395f007d2280e0376ec74e1c1fb0fb1a4e1a9dc72109d991d92ab4af94cc?line=22">this txn</a></li><li>Series of odd transactions from WinterMute MM that did not involve any swaps.<br />See: <a href="https://app.blocksec.com/explorer/tx/eth/0x11af395f007d2280e0376ec74e1c1fb0fb1a4e1a9dc72109d991d92ab4af94cc?line=22">this txn</a></li></ol></td><td><p>There will be a small minority of trades where the </p><p><code>token\_bought\_address</code> will be null <br /><br />Currently the impact is at <br />For <code>1inch\_ar\_v4</code>: 0.0042% of all trades<br /><br />For <code>1inch\_ar\_v5:</code><br />0.0881% of all trades</p></td></tr><tr><td>uniswap calls</td><td><p>UniswapV3 calls does not have source and destination tokens swapped. </p><p /><p>We use <code>uniswapV3SwapCallback</code></p><p>to identify the tokens swapped. Following which, we roll-up the swaps by matching which Callback traces with the calls by pool address and swap amounts: </p><p>uniswapV3Swap </p><p>uniswapV3SwapTo uniswapV3SwapToWithPermit</p></td><td><p>There will be a small minority of trades where the </p><p><code>token\_bought\_address</code> will be null <br /><br />Currently the impact is at <br />For <code>1inch\_ar\_v4</code>: \~0.000104% of all trades<br /><br />For <code>1inch\_ar\_v5:</code><br />\~0.0040% of all trades<br /></p></td></tr></tbody></table>
  </Tab>
</Tabs>

### Table Column

| Column Name                     | Description                                                                                                                              | Example                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| project                         | Name of the project. Includes dodo, paraswap, zeroex, cow\_protocol, kyberswap\_aggregator, tokenlon, openocean.                         | cow\_protocol                                                                                                                                                                                                                                                                                                                                                                                                                            |
| protocol                        | DEX protocol or project contract which executed the aggregator trade.                                                                    | cow\_protocol                                                                                                                                                                                                                                                                                                                                                                                                                            |
| event\_name                     | This field will be null for majority of DEX aggregator trades. Unless the event specifies the pools that the trade was routed through.   | Trade                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| contract\_address               | The name of the event (or the function call) for this trade.                                                                             | 0x9008d19f58aabd9ed0d60971565aa8510560ab41                                                                                                                                                                                                                                                                                                                                                                                               |
| liquidity\_pool\_address        | The contract address of the aggregator.                                                                                                  | null                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| sender\_address                 | Address of the sender of the swap event log, which can be the Router.                                                                    | 0x2fb4aa67cc48c9dd126dc2f6a437c5c995b2732d                                                                                                                                                                                                                                                                                                                                                                                               |
| to\_address                     | Address of the recipient of the swap event.                                                                                              | 0x2fb4aa67cc48c9dd126dc2f6a437c5c995b2732d                                                                                                                                                                                                                                                                                                                                                                                               |
| token\_sold\_address            | Address of the token sold.                                                                                                               | 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48                                                                                                                                                                                                                                                                                                                                                                                               |
| token\_sold\_name               | Name of the token sold.                                                                                                                  | USD Coin                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| token\_sold\_symbol             | Symbol of the token sold.                                                                                                                | USDC                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| token\_sold\_amount\_raw\_str   | Amount of token sold (not divided by the number of decimals) in string.                                                                  | 6250000000                                                                                                                                                                                                                                                                                                                                                                                                                               |
| token\_sold\_amount\_raw        | Amount of token sold (not divided by the number of decimals).                                                                            | 6250000000                                                                                                                                                                                                                                                                                                                                                                                                                               |
| token\_sold\_amount\_str        | token\_sold\_amount\_raw divided by the number of decimals of the token in string.                                                       | 6250                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| token\_sold\_amount             | token\_sold\_amount\_raw divided by the number of decimals of the token.                                                                 | 6250                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| usd\_sold\_amount               | USD value of tokens sold.                                                                                                                | 6245                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| token\_bought\_address          | Token address of the token bought, i.e. the asset acquired from the trade.                                                               | 0xccccb68e1a848cbdb5b60a974e07aae143ed40c3                                                                                                                                                                                                                                                                                                                                                                                               |
| token\_bought\_name             | Name of the token bought.                                                                                                                | TOPIA                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| token\_bought\_symbol           | Symbol of the token bought.                                                                                                              | TOPIA                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| token\_bought\_amount\_raw\_str | Amount of token bought (not divided by the number of decimals) in string.                                                                | 64632249553876898925672                                                                                                                                                                                                                                                                                                                                                                                                                  |
| token\_bought\_amount\_raw      | Amount of token bought (not divided by the number of decimals).                                                                          | 6.46322E+22                                                                                                                                                                                                                                                                                                                                                                                                                              |
| token\_bought\_amount\_str      | token\_bought\_amount\_raw divided by the number of decimals of the token in string.                                                     | 64632.24955                                                                                                                                                                                                                                                                                                                                                                                                                              |
| token\_bought\_amount           | token\_bought\_amount\_raw divided by the number of decimals of the token.                                                               | 64632.24955                                                                                                                                                                                                                                                                                                                                                                                                                              |
| usd\_bought\_amount             | USD value of tokens bought.                                                                                                              | 6048.867603                                                                                                                                                                                                                                                                                                                                                                                                                              |
| usd\_amount                     | USD value of the swap. Note that this preferentially selects the price and value of the more reputable token.                            | 6245                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| extra\_fields                   | This field contains all the extra columns emitted from the event/function call that were not part of the convetional DEX trades columns. | `{ "fee\_amount": "0", "order\_uid": "0E839EC0B7F089F2337620489748E70BA616417C506B3C6BCC7749CAEFE2F3C32FB4AA67CC48C9DD126DC2F6A437C5C995B2732D65EF27BA" }`                                                                                                                                                                                                                                                                               |
| transaction\_from\_address      | The address of the sending party of this transaction.                                                                                    | 0xbf54079c9bc879ae4dd6bc79bce11d3988fd9c2b                                                                                                                                                                                                                                                                                                                                                                                               |
| transaction\_to\_address        | The address of the receiving party of this transaction (could be a contract address).                                                    | 0x9008d19f58aabd9ed0d60971565aa8510560ab41                                                                                                                                                                                                                                                                                                                                                                                               |
| transaction\_hash               | Transaction hash of this trade.                                                                                                          | 0x7a3be25e6fffa9fd29ef9aa9eafdfd0d8ee4a24aedb074ebb6c1a473ce750fce                                                                                                                                                                                                                                                                                                                                                                       |
| transaction\_index              | Transaction index of this trade in the block.                                                                                            | 17                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| transaction\_fees               | Fees paid at the transaction level.                                                                                                      | 0.02354155877                                                                                                                                                                                                                                                                                                                                                                                                                            |
| transaction\_fees\_usd          | Fees paid in USD.                                                                                                                        | 95.02173534                                                                                                                                                                                                                                                                                                                                                                                                                              |
| fee\_details                    | Additional fee details of the transaction, including max priority fee, gas price and gas used for the transaction.                       | `{ "base\_fee\_per\_gas": 88733305846, "block\_gas\_limit": 30000000, "block\_gas\_used": 12073153, "gas": 502304, "gas\_price": 93734307405, "max\_fee\_per\_gas": 358721698469, "max\_priority\_fee\_per\_gas": 5001001559, "priority\_fees": "0.001256011543545968", "priority\_fees\_usd": 5.069689633676332e+00, "priority\_gas\_fee": "5001001559", "receipt\_effective\_gas\_price": 93734307405, "receipt\_gas\_used": 251152 }` |
| calldata\_selector              | The call data selector of the transaction.                                                                                               | 0x13d79a0b                                                                                                                                                                                                                                                                                                                                                                                                                               |
| log\_index                      | Log index of this trade.                                                                                                                 | 42                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| block\_timestamp                | Block timestamp of this trade.                                                                                                           | 2024-03-11 12:48:59                                                                                                                                                                                                                                                                                                                                                                                                                      |
| block\_number                   | Block number of this trade.                                                                                                              | 19411959                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| block\_hash                     | Block hash of this trade.                                                                                                                | 0xe1944bbf513fa729bc78f34bee665dfafebede27cb73fd99d86ed4265c2b0852                                                                                                                                                                                                                                                                                                                                                                       |
| unique\_id                      | Unique ID of each trade.                                                                                                                 | txn-0x7a3be25e6fffa9fd29ef9aa9eafdfd0d8ee4a24aedb074ebb6c1a473ce750fce\_log\_index-42                                                                                                                                                                                                                                                                                                                                                    |
| \_created\_at                   | Timestamp of the entry creation.                                                                                                         | 2024-04-16 11:46:12                                                                                                                                                                                                                                                                                                                                                                                                                      |
| \_updated\_at                   | Timestamp of the entry update.                                                                                                           | 2024-04-16 11:46:12                                                                                                                                                                                                                                                                                                                                                                                                                      |
| \_changed\_since\_full\_refresh | Whether the entry was recreated.                                                                                                         | FALSE                                                                                                                                                                                                                                                                                                                                                                                                                                    |
