MLDZMNATR6
    Updated 2022-12-02
    WITH tb1 as (
    SELECT
    block_timestamp::date as date,
    receiver as users,
    sum(amount/pow(10,decimal)) as volume_in
    from axelar.core.fact_transfers
    where currency ='uaxl'
    and transfer_type in ('IBC_TRANSFER_IN','AXELAR')
    group by 1,2
    ),
    tb2 as (
    SELECT
    block_timestamp::date as date,
    sender as users,
    sum(amount/pow(10,decimal)) as volume_out
    from axelar.core.fact_transfers
    where currency ='uaxl'
    and transfer_type in ('IBC_TRANSFER_OUT','AXELAR')
    group by 1,2
    ),
    tb3 as (
    SELECT
    ifnull(a.date,b.date) as day,
    ifnull(a.users,b.users) as holders,
    ifnull(volume_in,0)-ifnull(volume_out,0) as AXL_balance
    from tb1 a left join tb2 b on a.users=b.users and a.date=b.date
    where volume_in<>0
    and volume_out>0
    )
    select
    day,
    CASE
    WHEN AXL_balance < 5 then 'a. Below 5'
    WHEN AXL_balance < 100 then 'b. 5 - 100'
    Run a query to Download Data