Eman-Raztotal stats: holders & balance
    Updated 2024-11-12
    WITH FINAL_TAB as (with tab4 as (with tab3 as (with tab1 as (select to_address, sum(amount) as input_vol
    from blast.core.ez_token_transfers
    where contract_address=lower('0x764933fbAd8f5D04Ccd088602096655c2ED9879F')
    group by 1),

    tab2 as (select from_address, sum(amount) as output_vol
    from blast.core.ez_token_transfers
    where contract_address=lower('0x764933fbAd8f5D04Ccd088602096655c2ED9879F')
    group by 1)

    select to_address as address, case
    when input_vol is null then 0 else input_vol end as input_volume, case
    when output_vol is null then 0 else output_vol end as output_volume
    from tab1 left join tab2 on tab1.to_address=tab2.from_address)

    select address, input_volume AS "📥Input Volume", output_volume AS "📤Output Volume",
    input_volume-output_volume as "🔴Balance"
    from tab3
    ---
    ORDER BY 4 DESC),

    tab5 as (select address, ADDRESS_name
    from blast.core.dim_labels)

    select tab4.address as "💼Address", "🔴Balance", "📥Input Volume", "📤Output Volume"
    from tab4 left join tab5 on tab4.address=tab5.address
    where "🔴Balance">0 and "💼Address" is not null
    order by 2 desc)

    select count(distinct "💼Address") as "Holders Count", avg("🔴Balance") as "Avg", max("🔴Balance") as "Max", median("🔴Balance") as "Median",
    sum("🔴Balance") as "Total Supply"
    from final_tab

    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived