adriaparcerisasterra old bounty ax6
    Updated 2022-11-22
    with main as (
    select sender as wallet,
    sum(amount/pow(10,decimal)) as total_amount
    from axelar.core.fact_transfers
    where currency = 'uusdc' and TX_SUCCEEDED = 'TRUE'
    and block_timestamp::date >= current_date - 30
    group by 1
    )

    select count(wallet) as wallets,
    case when total_amount >= 0 and total_amount < 500 then 'Between 0 and 500 USDC'
    when total_amount >= 500 and total_amount < 5000 then 'Between 500 and 5k USDC'
    when total_amount >= 5000 and total_amount < 10000 then 'Between 5k and 10k USDC'
    when total_amount >= 10000 and total_amount < 100000 then 'Between 10k and 100kUSDC'
    when total_amount >= 100000 and total_amount < 1000000 then 'Between 100k and 1M USDC'
    when total_amount >= 1000000 and total_amount < 10000000 then 'Between 1M and 10M USDC'
    else 'Over 10M USDC'
    end as wallet_amount_distribution,
    row_number() over (order by wallets desc) as rank
    from main
    group by 2
    Run a query to Download Data