datavortexweekly Gas Fees
    Updated 2025-02-03
    WITH swaps AS (
    SELECT
    s.tx_hash,
    s.block_timestamp
    FROM
    kaia.defi.ez_dex_swaps s
    WHERE
    s.token_in = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'
    ),
    swap_fees AS (
    SELECT
    s.tx_hash,
    t.tx_fee,
    DATE_TRUNC('week', s.block_timestamp) AS week
    FROM
    swaps s
    JOIN kaia.core.fact_transactions t ON s.tx_hash = t.tx_hash
    )
    SELECT
    week,
    SUM(sf.tx_fee) AS WeeklyFees,
    AVG(sf.tx_fee) AS AvgWeeklyFee
    FROM
    swap_fees sf
    GROUP BY
    week
    ORDER BY
    week;

    QueryRunArchived: QueryRun has been archived