NavidCopy of Untitled Query
Updated 2022-12-14Copy 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 proposal_transactions as (
select
tx_id, ATTRIBUTE_VALUE as proposal_id
from
cosmos.core.fact_msg_attributes
where
ATTRIBUTE_KEY= 'proposal_id' and ATTRIBUTE_VALUE='82' and tx_succeeded
), senders as (
select
a.tx_id,
a.ATTRIBUTE_VALUE as sender,
b.proposal_id
from
cosmos.core.fact_msg_attributes a join proposal_transactions b using (tx_id)
where
a.ATTRIBUTE_KEY='sender'
), votes as (
select
block_timestamp,
tx_id,
s.proposal_id,
s.sender,
try_parse_json(a.ATTRIBUTE_VALUE) as jsonvals,
jsonvals['option'] as vote,
jsonvals['weight'] as weight,
case
when vote = '1' then 'Yes'
when vote = '2' then 'Abstain'
when vote = '3' then 'No'
when vote = '4' then 'No With Veto'
end as vote_label
from
cosmos.core.fact_msg_attributes a join senders s using (tx_id)
where
ATTRIBUTE_KEY='option'
), d_votes as (
Run a query to Download Data