hessNew Users Balance
    Updated 2023-01-11
    with user as ( select min(block_timestamp) as date, sender as user
    from terra.core.ez_transfers
    group by 2
    UNION
    select min(block_timestamp) as date, receiver as user
    from terra.core.ez_transfers
    group by 2)
    ,
    new_user as ( select DISTINCT user
    from user
    where date >= CURRENT_DATE - 60)
    ,
    sender as (select receiver as user , sum(amount/pow(10,6)) as amounts
    from terra.core.ez_transfers
    where receiver in (select user from new_user)
    and currency = 'uluna'
    group by 1
    UNION
    select sender as user, sum(amount/pow(10,6))*-1 as amounts
    from terra.core.ez_transfers
    where sender in (select user from new_user)
    and currency = 'uluna'
    group by 1)


    select count(DISTINCT(user)) as total,
    case when amounts <= 1 then 'Up to 1 Luna'
    when amounts <= 10 then '1-10 Luna'
    when amounts <= 100 then '10-100 Luna'
    when amounts <= 500 then '100-500 Luna'
    when amounts <= 1000 then '500-1K Luna'
    when amounts <= 5000 then '1K-5K Luna'
    when amounts <= 10000 then '10K Luna'
    when amounts > 10000 then '+10K Luna' end as types
    from sender
    where amounts > 0
    Run a query to Download Data