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

# dex.trades on mezo

> The `dex.trades` table captures detailed data on decentralized exchange (DEX) trades, recording all raw trade events across various protocols on mezo.

export const TableSampleParam = ({ParamCol, ParamValue, tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3793075/6376888?param_col_t6c1ea=${ParamCol}&param_value_t6c1ea=${ParamValue}&table_name_t6c1ea=${tableName}&table_schema_t6c1ea=${tableSchema}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3793075/6376888?param_col_t6c1ea=${ParamCol}&param_value_t6c1ea=${ParamValue}&table_name_t6c1ea=${tableName}&table_schema_t6c1ea=${tableSchema}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

export const DexCoverage = ({blockchain}) => <div>
    <iframe src={`https://dune.com/embeds/3740060/6289929?blockchain_t6c1ea=${blockchain}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
  </div>;

export const DexTradesSnippet = ({blockchain}) => <div>

    <Info> This is a cross-chain table but can be filtered for {blockchain} transactions.</Info>
    <h2>Table Description</h2>
    <p>
      The <code>dex.trades</code> table captures detailed data on trades executed via decentralized exchanges (DEXs). This table captures all raw trade events that happen across all liqudity pools. It provides a comprehensive view of the entire trade execution process, detailing the specific paths and liquidity sources utilized.
    </p>
    <h2>Functional Overview</h2>
    <p>
      The <code>dex.trades</code> table provides an in-depth view of trades on decentralized exchanges like Uniswap or Curve. This table includes entries for each segment of a trade that passes through different liquidity pools, as well as single-step trades. For example, a user may initiate a trade to swap USDC for PEPE. If this trade is executed through multiple liquidity pools, such as USDC-WETH and WETH-PEPE, the <code>dex.trades</code> table will record each segment of the trade as a separate entry. Conversely, a single-step trade, such as directly swapping USDC for ETH, will be recorded as a single entry. 
    </p>
    <p>
      This detailed approach allows for granular analysis of trade execution paths, enabling users to:
    </p>
    <ul>
      <li><strong>Analyze Liquidity Sources:</strong> Understand which liquidity pools are used and how they interact in both single-step and multi-step trades.</li>
      <li><strong>Track Trade Execution Paths:</strong> Follow the exact route a trade takes across different DEXs and liquidity pools
      </li>
      <li><strong>Assess Slippage and Execution Quality:</strong> Evaluate the impact of each step on the overall trade execution, including slippage and price changes.</li>
      <li><strong>Monitor Market Dynamics:</strong> Gain insights into the behavior and dynamics of different liquidity pools and DEXs over time.</li>
    </ul>
    <h2>Table Coverage</h2>
    <p> The following table shows which projects and versions of those projects are covered in the <code>dex.trades</code> table on {blockchain}. </p>
    <DexCoverage blockchain={blockchain} />
    <h2>Column Descriptions</h2>
    <table>
      <thead><tr><th>Column</th><th>Type</th><th>Description</th></tr></thead>
      <tbody>
        <tr><td><code>blockchain</code></td><td><code>varchar</code></td><td>Blockchain network (e.g., ethereum, arbitrum)</td></tr>
        <tr><td><code>project</code></td><td><code>varchar</code></td><td>DEX project name (e.g., uniswap, curve)</td></tr>
        <tr><td><code>version</code></td><td><code>varchar</code></td><td>Version of the DEX protocol</td></tr>
        <tr><td><code>block_month</code></td><td><code>date</code></td><td>Month of the block (for partitioning)</td></tr>
        <tr><td><code>block_date</code></td><td><code>date</code></td><td>Date of the block (UTC)</td></tr>
        <tr><td><code>block_time</code></td><td><code>timestamp</code></td><td>Timestamp of the block containing this trade</td></tr>
        <tr><td><code>block_number</code></td><td><code>bigint</code></td><td>Block number containing this trade</td></tr>
        <tr><td><code>token_bought_symbol</code></td><td><code>varchar</code></td><td>Symbol of the token bought</td></tr>
        <tr><td><code>token_sold_symbol</code></td><td><code>varchar</code></td><td>Symbol of the token sold</td></tr>
        <tr><td><code>token_pair</code></td><td><code>varchar</code></td><td>Token pair (e.g., WETH-USDC)</td></tr>
        <tr><td><code>token_bought_amount</code></td><td><code>double</code></td><td>Decimal-adjusted amount of the token bought</td></tr>
        <tr><td><code>token_sold_amount</code></td><td><code>double</code></td><td>Decimal-adjusted amount of the token sold</td></tr>
        <tr><td><code>token_bought_amount_raw</code></td><td><code>uint256</code></td><td>Raw amount of the token bought (no decimal adjustment)</td></tr>
        <tr><td><code>token_sold_amount_raw</code></td><td><code>uint256</code></td><td>Raw amount of the token sold (no decimal adjustment)</td></tr>
        <tr><td><code>amount_usd</code></td><td><code>double</code></td><td>Trade value in USD</td></tr>
        <tr><td><code>token_bought_address</code></td><td><code>varbinary</code></td><td>Contract address of the token bought</td></tr>
        <tr><td><code>token_sold_address</code></td><td><code>varbinary</code></td><td>Contract address of the token sold</td></tr>
        <tr><td><code>taker</code></td><td><code>varbinary</code></td><td>Address of the trade taker</td></tr>
        <tr><td><code>maker</code></td><td><code>varbinary</code></td><td>Address of the trade maker (liquidity provider)</td></tr>
        <tr><td><code>project_contract_address</code></td><td><code>varbinary</code></td><td>Address of the DEX contract (pool/router)</td></tr>
        <tr><td><code>tx_hash</code></td><td><code>varbinary</code></td><td>Hash of the transaction containing this trade</td></tr>
        <tr><td><code>tx_from</code></td><td><code>varbinary</code></td><td>Address that initiated the transaction</td></tr>
        <tr><td><code>tx_to</code></td><td><code>varbinary</code></td><td>Address the transaction was sent to</td></tr>
        <tr><td><code>evt_index</code></td><td><code>bigint</code></td><td>Index of the event log within the transaction</td></tr>
      </tbody>
    </table>
    <h2>Table Sample</h2>
    <TableSampleParam tableSchema="dex" tableName="trades" ParamCol="blockchain" ParamValue={blockchain} />
  </div>;

<DexTradesSnippet blockchain="mezo" />
