KaskoazulTop12 Most active DAOs
    Updated 2022-08-03
    with votes_raw as (
    select fc.tx_hash
    ,parse_json(fc.args):id as proposal
    ,parse_json(fc.args):action as vote
    ,t.tx_receiver as proposer
    ,t.tx_signer as voter
    from near.core.fact_actions_events_function_call fc
    join near.core.fact_transactions t
    on fc.tx_hash = t.tx_hash
    where method_name = 'act_proposal' --and args:id = 13
    and deposit = 0
    ),

    ordered as (
    select proposer,
    count (proposal) as number_of_proposals,
    count (distinct voter) as unique_voters,
    rank() over (order by number_of_proposals desc) as rank
    from votes_raw
    group by 1
    order by 2 desc
    limit 12)

    select rank,
    proposer,
    number_of_proposals,
    sum (number_of_proposals) over (order by rank) as total_proposals,
    unique_voters
    from ordered
    order by rank
    Run a query to Download Data