Query editor
-- 希望回答如下问题:-- Which delegates have the most “active” delegator base? Is it correlated with the most actively voting delegates?-- 某个delegate voting power的变化次数,与这个delegate投票次数的关系-- delegate voting power的变化越多,简单理解为,有更多delegator来委托,或者追加OP-- https://dune.com/queries/3615697with deduplicated_vote_data as (--governance_optimism.proposal_votes有重复的脏数据selecttx_hash, date_timestamp, voter, proposal_id, arbitrary(votingweightage) as votingweightage -- 重复的,取任意值都可以, arbitrary(choice_name) as choice_namefrom governance_optimism.proposal_votesgroup by 1,2,3,4), votes as (selectvoter, ln(count(voter)) as num_votes -- 不能用count(tx_hash),来自snap的tx_hash都是nullfrom deduplicated_vote_datagroup by 1), votes_range as (-- 这里将lower bound比actual minimum更小,upper bound比actual maximum更大-- 这样保证[lb, ub)能够囊括全部范围selectmin(num_votes)*0.99 as min_votes-- upper bound is max(num_votes)+1-- lower bound is min(num_votes)-1, (max(num_votes)*1.01 - min(num_votes)*0.99)/{{bins}} as bin_widthfrom votes), votes_bins as (selectbin_idx, lb, ub, '[' || cast(cast(exp(lb) as int) as varchar) || ',' || cast(cast(exp(ub) as int) as varchar) || ')' as bin_labelfrom (selectbin_idx, r.min_votes + (bin_idx-1)*r.bin_width as lb, r.min_votes + bin_idx * r.bin_width as ubfrom unnest(sequence(1,{{bins}})) as tbl(bin_idx)cross join votes_range r)), votes_binned as (selectvoter, num_votes, b.bin_idx as votes_bin_idx, b.bin_label as votes_rangefrom votes v