nitsDistribution based on Transfers
    Updated 2022-03-18
    with contribution_details as (SELECT case when total_contribution >0 and total_contribution <=50 then '0-50'
    when total_contribution >50 and total_contribution <=100 then '51-100'
    when total_contribution >100 and total_contribution <=200 then '101-200'
    when total_contribution >200 and total_contribution <=500 then '201-500'
    when total_contribution >500 then '501+' end as distribution , origin_address as oa, total_contribution
    from
    (SELECT
    origin_address, sum(amount) as total_contribution
    from ethereum.udm_events
    where contract_address = '0x3c50e19c7abf8e5c9a3c56fce64e7015a6e1f49c' and origin_function_name = 'contribute' and amount is not NULL
    GROUP by 1 )),
    transfer_details as
    (SELECT * from ethereum.udm_events
    where
    -- origin_address in (SELECT DISTINCT origin_address from contribution_details) and
    contract_address = '0x3c50e19c7abf8e5c9a3c56fce64e7015a6e1f49c' and origin_function_name!= 'contribute' )
    SELECT distribution, count(*) as total_addr from
    (SELECT * from transfer_details
    inner join contribution_details
    on oa = origin_address)
    GROUP by 1
    limit 100
    Run a query to Download Data