Query editor
-- https://dune.com/queries/3653616with dedup_votes as (--governance_optimism.proposal_votes has duplicated rowsselecttx_hash, date_timestamp, voter, proposal_id, max(votingweightage) as votingweightage -- 重复的,取任意值都可以from governance_optimism.proposal_votesgroup by 1,2,3,4), proposals_onlyone_topic as (-- 因为Dune不允许太复杂、太深的subquery调用-- 这里不得不让每个proposal只有一个topic,方便group by-- 好在现时拥有多个topic的并不多selectproposal_id, casewhen topic_security=1 then 'Security' -- security topic最少,归为第一类when topic_defi=1 then 'DeFi'when topic_chain=1 then 'Chain'when topic_fund=1 then 'Fund' -- funding topic最多,所以归为最后一类else 'NA'end as topicfrom dune.tianjinfan.result_op_airdrop_4_proposal_keywords -- https://dune.com/queries/3653266, proposal_keywords.sql)selecttopic, count(distinct proposal_id) as num_proposals, count(v.voter) as total_num_votes, count(distinct v.voter) as unique_voters, approx_percentile(v.votingweightage, 0.5) as med_vote_power, sum(v.votingweightage) as sum_vote_powerfrom dedup_votes vinner join proposals_onlyone_topicusing (proposal_id)group by 1order by num_proposals desc