binhachon$RUNE Distribution
    Updated 2022-04-23
    with transactions as (
    select
    from_address,
    case when lp_action = 'add_liquidity' then rune_amount else - rune_amount end as amount
    from thorchain.liquidity_actions
    where rune_amount > 0
    union all
    select
    from_address,
    -rune_amount as amount
    from thorchain.transfers
    union all
    select
    to_address,
    rune_amount as amount
    from thorchain.transfers
    ),
    balance_table as (
    select
    from_address,
    sum(amount) as amount
    from transactions
    group by 1
    )
    select
    floor(amount, -2) as rounded_amount,
    sum(amount) as rune_holding,
    100 * ratio_to_report(rune_holding) over () as percentage_holding,
    count(*) as number_of_addresses,
    100 * ratio_to_report(number_of_addresses) over () as percentage
    from balance_table
    where rounded_amount >= 0
    group by 1
    Run a query to Download Data