Query editor
-- methodid tracking-- 0x5f398a14 -- castVoteWithReasonAndParams/*select bytearray_substring(data,1,4) as method_id, count(distinct hash)from arbitrum.transactionswhere to=0x8a1cDA8dee421cD06023470608605934c16A05a0group by 1*/-- logs/*select *from arbitrum.logswhere to=0x8a1cDA8dee421cD06023470608605934c16A05a0and topic0=0x322749465d05e1108aa7ed0309dc429e4d139164e4fd32c5a5d4fd887cfff3c8and evt_tx_hash=0x2d3e3ba3ba5a0118cf8d4ab8a0e7da550aac0d0978734a29ef2d5932ace677cb --eg tx 0x2d3e3ba3ba5a0118cf8d4ab8a0e7da550aac0d0978734a29ef2d5932ace677cb (klausbrave- 0x0393931783b1d0ead3b8b0e0f44c1f23ec3c4af5)and tx_from=0x0393931783b1d0ead3b8b0e0f44c1f23ec3c4af5*/----select *--from arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender--limit 10000-- deocded data for sc voting, use the totalUsedVotes column as how much votes they have used, and usableVotes as how much votes they have leftWITH latest AS (SELECTa.*,ROW_NUMBER() OVER (PARTITION BY voterORDER BY evt_block_time DESC, evt_block_number DESC, evt_index DESC) AS rn,sum(votes) over(partition by voter order by evt_block_time,evt_block_number,evt_index asc) as votes_cast_cumuFROM arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender a -- arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender a-- where evt_block_time>= timestamp '2024-09-22'),vote_stats as (select voter as voter_vs, count(distinct evt_tx_hash) as no_votes_tx,count(distinct contender) as no_contenders_voted_for, sum(votes) as vp_used_votesFROM arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender a--where evt_block_time>= timestamp '2024-09-22'group by 1) ,nominee_stats as (select contender as nominee , PROPOSALid, count(distinct evt_tx_hash) as no_votes_tx,count(distinct voter) as no_voters, sum(votes) as vp_used_votes, max(evt_block_time) as latest_vote_date, min(evt_block_time) as earliest_vote_date, count(distinct proposalID) as no_proposalFROM arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender a -- arbitrum_arbitrum.SecurityCouncilNomineeElectionGovernor_evt_VoteCastForContender a--where evt_block_time>= timestamp '2024-09-22'group by 1 ,2)select nominee, PROPOSALID, case when latest_vote_date >= timestamp '2024-09-01' then 'Sept 24' when latest_vote_date >= timestamp '2024-03-01' then 'March 24'when latest_vote_date >= timestamp '2023-09-01' then 'Sept 23' end as SC_Election_no, latest_vote_date, b.name AS identity, no_votes_tx, no_voters