0xHaM-dUntitled Query
    Updated 2022-10-24
    with eth_price as (
    select
    hour::date as day,
    avg(price) as ETH_Price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    group by 1
    )
    , tx as (
    SELECT
    block_timestamp::date as date,
    'Ethereum' as network,
    tx_hash,
    from_address,
    tx_fee as tx_fee_eth,
    tx_fee * ETH_Price as tx_fee_usd
    from ethereum.core.fact_transactions a join eth_price b on a.block_timestamp::date = b.day
    where status = 'SUCCESS'
    and block_timestamp::date > CURRENT_DATE - 181
    and block_timestamp::date <= CURRENT_DATE - 1

    UNION
    SELECT
    block_timestamp::date as date,
    'Optimism' as network,
    tx_hash,
    from_address,
    tx_fee as tx_fee_eth,
    tx_fee * ETH_Price as tx_fee_usd
    from optimism.core.fact_transactions a join eth_price b on a.block_timestamp::date = b.day
    where status = 'SUCCESS'
    and block_timestamp::date > CURRENT_DATE - 181
    and block_timestamp::date <= CURRENT_DATE - 1
    )
    , lstTb as (
    Run a query to Download Data