SleepyNumber of Inflow transactions per CEX by volume category
    Updated 2023-04-19
    with cex_address as
    (
    select address, project_name from avalanche.core.dim_labels
    where label_type='cex'
    and label_subtype = 'deposit_wallet'
    )

    --inflow
    select
    project_name,
    volume_category,
    count(to_address) total_addresses
    from(
    select project_name,
    to_address,
    sum(amount_usd) total_inflow_volume_usd,
    case
    when total_inflow_volume_usd >= 0 and total_inflow_volume_usd <= 10 then '0-10 USD'
    when total_inflow_volume_usd > 10 and total_inflow_volume_usd <= 100 then '10-100 USD'
    when total_inflow_volume_usd > 100 and total_inflow_volume_usd <= 500 then '100-500 USD'
    when total_inflow_volume_usd > 500 and total_inflow_volume_usd <= 5000 then '500-5000 USD'
    when total_inflow_volume_usd > 5000 then '5000+ USD'
    end volume_category
    from avalanche.core.ez_token_transfers transfers
    join cex_address
    on transfers.to_address = cex_address.address
    where block_timestamp::date >= current_date - 365 and amount_usd > 0
    group by project_name, to_address
    order by project_name, to_address desc
    ) x
    group by project_name, x.volume_category
    order by project_name, x.volume_category desc


    Run a query to Download Data