Afonso_Diazgrouping fees
    Updated 2024-08-06
    with

    pricet as (
    select
    hour::date as date,
    avg(price) as price_usd
    from ethereum.price.ez_prices_hourly
    where symbol = 'WETH'
    group by 1
    ),

    main as (
    select
    tx_hash,
    block_timestamp,
    from_address as user,
    tx_fee,
    tx_fee * price_usd as tx_fee_usd
    from arbitrum.core.fact_transactions
    left join pricet on block_timestamp::date = date
    where block_timestamp >= '{{ start_date }}'
    and block_timestamp <= '{{ end_date }}'
    and status = 'SUCCESS'
    )

    select
    case
    when tx_fee_usd <= 0.001 then '0.001 <= $'
    when tx_fee_usd <= 0.003 then '0.001- 0.003 $'
    when tx_fee_usd <= 0.005 then '0.003 - 0.005 $'
    when tx_fee_usd <= 0.1 then '0.005 - 0.1 $'
    when tx_fee_usd <= 0.5 then '0.1 - 0.5 $'
    when tx_fee_usd <= 1 then '0.5 - 1 $'
    when tx_fee_usd <= 5 then '1 - 5 $'
    when tx_fee_usd <= 10 then '5 - 10 $'
    else 'More than 10 $'
    QueryRunArchived: QueryRun has been archived