sinahosseinzadehUntitled Query
    Updated 2022-08-08
    with pricet as (select hour::date as date,avg(price) as USDPrice from optimism.core.fact_hourly_token_prices where token_address ='0x4200000000000000000000000000000000000042'
    and hour >= '2022-07-01' and hour < '2022-08-01'
    group by 1),
    table1 as (
    select count (distinct tx_hash),
    count (distinct from_address),
    sum (tx_fee) as OP_Fee,
    sum (tx_fee*USDPrice) as USD_Fee
    from optimism.core.fact_transactions join pricet on date = block_timestamp::Date
    where block_timestamp >= '2022-07-01' and block_timestamp < '2022-08-01'
    and status = 'FAIL'),

    table2 as (
    select count (distinct tx_hash),
    count (distinct from_address),
    sum (tx_fee) as OP_Fee,
    sum (tx_fee*USDPrice) as USD_Fee
    from optimism.core.fact_transactions join pricet on date = block_timestamp::Date
    where block_timestamp >= '2022-07-01' and block_timestamp < '2022-08-01'
    and status = 'SUCCESS')

    select 'Fail' as type, * from table1 union
    select 'Success' as type, * from table2
    Run a query to Download Data