CoinConverseVelodrome Health (Redux) histrogram rewards
    Updated 2022-11-16
    -- I would like to thank you to #h4wk for his source code
    with total_claimed as (select origin_from_address,
    sum(claimed_amount_usd) as total_claim
    from optimism.velodrome.ez_claimed_rewards where claimed_amount_usd is not null
    group by 1
    )
    select
    -- https://count.co/sql-resources/snowflake/histograms
    count(distinct origin_from_address) as user_count,
    floor(total_claim / 10) * 10 as bin_start,
    floor(total_claim / 10) * 10 + 10 as bin_end,
    concat(
    cast(floor(total_claim / 10) * 10 as STRING),
    ' - ',
    cast(floor(total_claim / 10) * 10 + 10 as STRING)
    ) as bin_range
    from
    total_claimed
    group by
    bin_start,
    bin_end,
    bin_range
    having bin_start < 1500
    order by
    bin_start
    limit 250
    Run a query to Download Data