Flippppppaaverage user copy
    -- forked from rezarwz / average user @ https://flipsidecrypto.xyz/rezarwz/q/btG5nnu7abPo/average-user

    with
    price_tl as (
    select
    date_trunc('day', hour) as date,
    token_address,
    avg(price) as price
    from
    crosschain.core.fact_hourly_prices
    WHERE
    token_address = '0x4200000000000000000000000000000000000006'
    AND IS_IMPUTED = 'false'
    and PROVIDER in ('coinmarketcap', 'coingecko')
    and hour > '2023-01-20 00:00:00.000'
    group by
    1,
    2
    ),
    total_tx as (
    SELECT
    ez.BLOCK_TIMESTAMP::date as date,
    ez.tx_hash,
    ez.FROM_ADDRESS as user_address,
    ez.TX_FEE as eth_fee,
    ez.TX_FEE * price as usd_fee
    FROM
    optimism.core.fact_transactions ez
    INNER join price_tl pr on pr.date = ez.block_timestamp::date
    WHERE
    ez.block_timestamp::date >= '2023-01-20'
    ),
    total_user as(
    SELECT
    count(tx_hash) as number_of_transaction,
    sum(eth_fee) as total_eth_fee,
    Run a query to Download Data