jackguyTERRA apollo 6
Updated 2023-03-22Copy 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
›
⌄
with tab1 as (
SELECT --*,
attributes:instantiate['_contract_address'] as multisig
-- date_trunc('week', block_timestamp) as week,
-- CASE WHEN message_value:msg:voters[1] is NULL THEN 'Multisig of 1'
-- WHEN message_value:msg:voters[2] is NULL then 'Multisig of 2'
-- WHEN message_value:msg:voters[3] is NULL then 'Multisig of 3'
-- WHEN message_value:msg:voters[4] is NULL then 'Multisig of 4'
-- WHEN message_value:msg:voters[5] is NULL then 'Multisig of 5'
-- WHEN message_value:msg:voters[6] is NULL then 'Multisig of 6'
-- WHEN message_value:msg:voters[7] is NULL then 'Multisig of 7'
-- WHEN message_value:msg:voters[8] is NULL then 'Multisig of 8'
-- ELSE 'Multisig of 9+' END as ms_type,
-- attributes:message:sender
FROM terra.core.fact_messages
WHERE not message_value:msg:max_voting_period is NULL
)
SELECT
-- date_trunc('day', block_timestamp) as day,
-- currency,
sum(amount/power(10,6)),
avg(amount/power(10,6)),
count(*)
from terra.core.ez_transfers
WHERE (SENDER in (SELECT multisig FROM tab1)
OR RECEIVER in (SELECT multisig FROM tab1))
and currency LIKE 'uluna'
--GROUP BY 1,2
--LIMIT 100
Run a query to Download Data