MotilolaInput Token And Usage Count Of Jared
    Updated 2024-10-31
    WITH txs_raw AS (
    SELECT
    block_number,
    origin_to_address,
    contract_address,
    pool_name,
    symbol_in,
    symbol_out,
    tx_hash,
    platform
    FROM ethereum.defi.ez_dex_swaps
    WHERE origin_to_address = lower('0x1f2f10d1c40777ae1da742455c65828ff36df387')
    ),

    -- Find blocks with exactly 2 transactions
    filtered_blocks AS (
    SELECT
    block_number,
    COUNT(tx_hash) AS tx_count
    FROM txs_raw
    GROUP BY block_number
    HAVING tx_count = 2
    ),

    return_filtered_blocks AS (
    SELECT
    b.block_number,
    r.pool_name,
    r.symbol_in,
    r.symbol_out,
    r.platform
    FROM txs_raw r
    JOIN filtered_blocks b ON r.block_number = b.block_number
    ),

    -- Count the most used input tokens per platform
    QueryRunArchived: QueryRun has been archived