0xHaM-dComparison Swaps Fee Over Time
    Updated 2025-01-22
    WITH priceTb as (
    select
    hour,
    PRICE
    from crosschain.price.ez_prices_hourly
    where symbol ='ETH'
    and BLOCKCHAIN = 'ethereum'
    and date_trunc(day,hour)::date >= '2024-12-01'
    and TOKEN_ADDRESS is NULL
    )
    , swapTB as (
    SELECT
    BLOCK_TIMESTAMP,
    'INK' as chain,
    TX_HASH,
    FROM_ADDRESS,
    TX_FEE_PRECISE as FEE_PRECISE,
    TX_FEE_PRECISE*PRICE as FEE_USD,
    FROM ink.core.fact_transactions
    JOIN priceTb on trunc(BLOCK_TIMESTAMP, 'hour') = hour
    WHERE TX_HASH in (SELECT DISTINCT TX_HASH FROM ink.core.ez_decoded_event_logs
    WHERE EVENT_NAME ilike '%Swap%'
    AND DECODED_LOG:liquidity is NULL
    )

    UNION ALL

    SELECT
    BLOCK_TIMESTAMP,
    'Avalanche' as chain,
    TX_HASH,
    FROM_ADDRESS,
    TX_FEE_PRECISE as FEE_PRECISE,
    TX_FEE_PRECISE*PRICE as FEE_USD,
    FROM avalanche.core.fact_transactions
    JOIN priceTb on trunc(BLOCK_TIMESTAMP, 'hour') = hour
    QueryRunArchived: QueryRun has been archived