bergUntitled Query
Updated 2022-12-12
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 tbl1 as (
select block_timestamp,
tx_id,
a.attribute_value as voter,
try_parse_json (c.attribute_value) as metadata,
metadata:option as vote_option,
case vote_option
when '1' then 'Yes'
when '2' then 'Abstain'
when '3' then 'No'
when '4' then 'No With Veto'
end as vote_value
from cosmos.core.fact_msg_attributes a
join cosmos.core.fact_msg_attributes b
using(tx_id)
join cosmos.core.fact_msg_attributes c
using(tx_id)
where a.attribute_key = 'spender'
and b.attribute_key = 'proposal_id'
and b.attribute_value = '82'
and c.attribute_key = 'option'
and a.tx_succeeded = 1
),
tbl2 as (
select distinct a.voter,
a.block_timestamp,
a.tx_id,
a.vote_option
from tbl1 a join tbl1 b
on a.voter = b.voter
and a.block_timestamp > b.block_timestamp
and a.vote_option != b.vote_option
)
select iff(voter in (select voter from tbl2), 'Voter Changed the vote', 'Voter didnt changed the vote') "Type",
Run a query to Download Data