hessUsers Breakdown Based on Volume
    Updated 2023-03-05
    with tb1 as ( select 'Stake' as type, origin_from_address, Count(DISTINCT(tx_hash)) as total_tx, count(DISTINCT(origin_from_address)) as total_user,
    sum(raw_amount/pow(10,6)) as volume, avg(raw_amount/pow(10,6)) as avg_volume,median(raw_amount/pow(10,6)) as median_volume,
    min(raw_amount/pow(10,6)) as min, max(raw_amount/pow(10,6)) as max
    from arbitrum.core.fact_token_transfers
    where origin_from_address = from_address
    and origin_to_address = lower('0x5957582f020301a2f732ad17a69ab2d8b2741241')
    and contract_address = lower('0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8')
    and tx_hash in (select tx_hash from arbitrum.core.fact_token_transfers
    where contract_address = lower('0x4e0D4a5A5b4FAf5C2eCc1C63C8d19BB0804A96F1'))
    and raw_amount/pow(10,6) > 0
    group by 1,2)

    select count(DISTINCT(origin_from_address)) as total_user,
    case when volume <= 1 then 'a. Below 1$'
    when volume <= 10 then 'b. 1-10$'
    when volume <= 100 then 'c. 10-100$'
    when volume <= 1000 then 'd. 100-1K$'
    when volume <= 10000 then 'e. 1K-10K$'
    when volume <= 100000 then 'f. 10-100K$'
    when volume > 100000 then 'g. +100K$' end as category
    from tb1
    group by 2



    Run a query to Download Data