MadiTop Validators by SFS amount
    Updated 2022-12-19
    with df as (select
    date_trunc('week', BLOCK_TIMESTAMP) as date, tx_id,DELEGATOR_ADDRESS, VALIDATOR_ADDRESS, AMOUNT/pow(10,decimal) as amount,label,
    replace(CURRENCY, 'gamm/pool/', '') as poolll,
    concat('pool #', poolll) as pool
    from osmosis.core.fact_superfluid_staking a left join osmosis.core.fact_validators b
    on a.VALIDATOR_ADDRESS = b.ADDRESS
    where poolll in ('1', '678', '704', '712', '674', '722', '9', '604', '497', '812', '584', '3', '481', '42', '463', '15')
    and tx_status = 'SUCCEEDED' and action = 'delegate')


    select
    case when "SFS OSMO" < 1000 then '1. less than 1k OSMO'
    when "SFS OSMO" >= 1000 and "SFS OSMO" <10000 then '2. 1k-10k OSMO'
    when "SFS OSMO" >= 10000 and "SFS OSMO" <100000 then '3. 10k-100k OSMO'
    when "SFS OSMO" >= 100000 and "SFS OSMO" < 1000000 then '4. 100k-1M OSMO'
    when "SFS OSMO" >= 1000000 and "SFS OSMO" < 10000000 then '5. 1M-10M OSMO'
    when "SFS OSMO" >= 10000000 and "SFS OSMO" < 100000000 then '6. 10M-100M OSMO'
    else '7. more than 100M OSMO' end as cat,
    count(DISTINCT validator) as validators
    from(
    select
    LABEL as validator,
    count(DISTINCT pool) as "Number of pools",
    round(sum(amount),2) as "SFS OSMO"
    from df
    where validator is not null
    group by 1 order by 3 desc )
    group by 1
    Run a query to Download Data