anomonefor venn
Updated 2022-02-20
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 Whales as (
SELECT DISTINCT address FROM terra.daily_balances
WHERE balance_usd >= 1000000
AND (date_trunc('day', date) > date_trunc('day', getdate()) - interval '90 days')
),
Mirror_Voters as(
SELECT DISTINCT MSG_VALUE:"sender" as voters, 'Mirror' as protocol
FROM terra.msgs
WHERE MSG_VALUE:"execute_msg":"cast_vote":"vote" in ('yes','abstain','no')
AND MSG_VALUE:"contract"= 'terra1wh39swv7nq36pnefnupttm2nr96kz7jjddyt2x' -- Mirror voting contract address
AND (date_trunc('day', block_timestamp) > date_trunc('day', getdate()) - interval '90 days')
),
Terra_Voters as(
SELECT DISTINCT voter as voters, 'Terra' as protocol
FROM terra.gov_vote
WHERE (date_trunc('day', block_timestamp) > date_trunc('day', getdate()) - interval '90 days')
AND msg_type = 'gov/MsgVote'
),
Anchor_Voters as(
SELECT DISTINCT EVENT_ATTRIBUTES:"voter" as voters, 'Anchor' as protocol
FROM terra.msg_events
WHERE EVENT_ATTRIBUTES:"contract_address" = 'terra1f32xyep306hhcxxxf7mlyh0ucggc00rm2s9da5' -- Anchor voting contract address
AND EVENT_ATTRIBUTES:"action" = 'cast_vote' AND event_type = 'from_contract'
AND (date_trunc('day', block_timestamp) > date_trunc('day', getdate()) - interval '90 days')
),
Mirror_Anchor_Voters as(
SELECT voters, protocol FROM Mirror_Voters
UNION
SELECT voters, protocol FROM Anchor_Voters