sepehrmhz8Untitled Query
    Updated 2022-09-05
    with Ether_price as (
    select date_trunc(day,hour)::date daily_price_time ,
    avg (price) price
    from ethereum.core.fact_hourly_token_prices
    where symbol ='WETH'
    group by 1
    ),
    BendDAO as (select
    origin_from_address,
    sum (event_inputs:value/pow(10,18)) volume,
    sum ((event_inputs:value/pow(10,18))*price) volume_usd
    from ethereum.core.fact_event_logs
    join Ether_price on block_timestamp::date = daily_price_time
    where origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'
    and block_timestamp::date >= CURRENT_DATE - 30
    and event_name = 'Transfer'
    and origin_function_signature in ('0x58c22be7') and contract_name = 'WETH9'
    group by 1
    )
    select case when Volume <0.001 then 'Less Than 0.001 ETH'
    when Volume >= 0.001 and Volume <=0.01 then '0.001 - 0.01 ETH'
    when Volume > 0.01 and Volume <=0.1 then '0.01 - 0.1 ETH'
    when Volume > 0.1 and Volume <=1 then '0.1 - 1 ETH'
    when Volume > 1 and Volume <=2 then '1 - 2 ETH'
    when Volume > 2 and Volume <=5 then '2 - 5 ETH'
    when Volume > 5 and Volume <=10 then '5 - 10 ETH'
    when Volume > 10 and Volume <=20 then '10 - 20 ETH'
    when volume > 20 and Volume <=50 then '20 - 50 ETH'
    when Volume > 50 and Volume <=100 then '50 - 100 ETH'
    else 'More than 100 ETH'
    end as range ,
    count (origin_from_address) num_wallets
    from BendDAO
    group by 1
    Run a query to Download Data