mo115EVM - Fees Over Time usd + failed transactions
    Updated 2023-12-21
    -- forked from EVM - Fees @ https://flipsidecrypto.xyz/edit/queries/fe3c6b4b-60e1-4eb7-b951-dec1e0520ff3

    -- forked from https://flipsidecrypto.xyz/hess/q/blZ-l4FMTnz3/fees

    with zk_import as ( select * from (
    SELECT
    livequery.live.udf_api (
    'https://api.dune.com/api/v1/query/3145394/results?api_key=nPlMJ4JjTsMZcIo0C6kGSt5rpbcoXujU') as resp)
    ,
    table(FLATTEN(parse_json(resp:data:"result":"rows"))))
    ,
    chains as ( select TO_TIMESTAMP(value:"date") as date,
    'Zksync' as chain,
    'WETH' as symbol,
    value:"avg_fee"::string as tx_fee
    from zk_import a join ethereum.core.dim_dates b on a.value:"date" = b.date_day
    where date >= current_date() - 30
    -- and date >= '2023-11-01'
    UNION ALL
    select date(block_timestamp) as date,
    'Arbitrum' as chain,
    'WETH' as symbol,
    tx_fee
    from arbitrum.core.fact_transactions -- a join ethereum.core.dim_dates b on a.block_timestamp::date = b.date_day
    where date >= current_date() - 30
    -- and block_timestamp::date >= '2023-11-01'
    and status = 'SUCCESS'

    UNION ALL
    select date(block_timestamp) as date,
    'Optimism' as chain,
    'WETH' as symbol,
    tx_fee
    from optimism.core.fact_transactions -- a join ethereum.core.dim_dates b on a.block_timestamp::date = b.date_day
    where date >= current_date() - 30
    -- and block_timestamp::date >= '2023-11-01'
    QueryRunArchived: QueryRun has been archived