cypherLil Nouns voting activity - balance per voter
Updated 2022-06-21Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
with votes as (select
block_timestamp,
tx_hash,
event_inputs:"proposalId"::integer as proposal_id,
event_inputs:voter as voter,
case event_inputs:"support"
when '1' then 'for'
when '0' then 'against'
when '2' then 'abstain'
end as vote,
case event_inputs:"support"
when '1' then 1
when '0' then -1
when '2' then 0
end as vote_math,
event_inputs:votes as n_votes,
vote_math * n_votes as total_vote
from ethereum.core.fact_event_logs
where contract_address = '0x5d2c31ce16924c2a71d317e5bbfd5ce387854039'
and event_name = 'VoteCast'),
voters as (select distinct(voter) as unique_voters
from votes),
balances as (select balance_date,
user_address,
symbol,
balance,
amount_usd
from flipside_prod_db.ethereum.erc20_balances
where balance_date = current_date()
and user_address in (select * from voters)),
total_balances as (select
user_address as voter,
sum(amount_usd) as total_balance
Run a query to Download Data