sinahosseinzadehUntitled Query
    Updated 2022-09-03
    with ethprice as (select hour::date as date, avg (price) as usdprice from ethereum.core.fact_hourly_token_prices where symbol ='WETH' group by 1),


    maintable as (
    select origin_from_address,
    sum (event_inputs:value/1e18) as ETH_Volume,
    sum (event_inputs:value/1e18*usdprice) as USD_Volume
    from ethereum.core.fact_event_logs t1 join ethprice t2 on t1.block_timestamp::date = t2.date
    where origin_to_address = lower('0x4D05E3d48a938db4b7a9A59A802D5b45011BDe58')
    and origin_function_signature = '0xd0e30db0' -- Deposit
    and event_name = 'Transfer' group by 1)

    select case when ETH_Volume <0.001 then 'Less Than 0.001 ETH'
    when ETH_Volume >= 0.001 and ETH_Volume <=0.01 then '0.001 - 0.01 ETH'
    when ETH_Volume > 0.01 and ETH_Volume <=0.1 then '0.01 - 0.1 ETH'
    when ETH_Volume > 0.1 and ETH_Volume <=1 then '0.1 - 1 ETH'
    when ETH_Volume > 1 and ETH_Volume <=2 then '1 - 2 ETH'
    when ETH_Volume > 2 and ETH_Volume <=5 then '2 - 5 ETH'
    when ETH_Volume > 5 and ETH_Volume <=10 then '5 - 10 ETH'
    when ETH_Volume > 10 and ETH_Volume <=25 then '10 - 25 ETH'
    when ETH_Volume > 25 and ETH_Volume <=50 then '25 - 50 ETH'
    else 'More than 50 ETH' end as type,
    count (Distinct origin_from_address) as Users_Count
    from maintable
    group by 1
    order by 2 desc
    Run a query to Download Data