HeminUntitled Query
Updated 2022-12-10Copy 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 as (
select *
from cosmos.core.fact_msg_attributes
where TX_SUCCEEDED = 'TRUE'
AND ATTRIBUTE_KEY = 'proposal_id'
AND MSG_TYPE = 'proposal_vote'
and ATTRIBUTE_VALUE = '82'
),
voter as (
SELECT t1.*,t2.MSG_GROUP,t2.MSG_INDEX,t2.ATTRIBUTE_INDEX
FROM cosmos.core.fact_transactions t1 JOIN proposal t2 on t1.TX_ID = t2.TX_ID
),
r as (SELECT
row_number() over (partition by tx_from order by BLOCK_TIMESTAMP::date desc) as rank,
TX_ID,
TX_FROM,
FEE,
FEE_DENOM,
GAS_USED,
GAS_WANTED,
TX_CODE,
TX_LOG,
MSG_GROUP,
MSG_INDEX,
ATTRIBUTE_INDEX
FROM voter),
amounts as(
SELECT
(REGEXP_substr(ATTRIBUTE_VALUE,'.*[0-9]')/1e6) as amount
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY = 'amount'
and MSG_TYPE = 'proposal_deposit'
),
percent as (SELECT
try_parse_json(try_parse_json(TX_LOG)[0]:events[1]:attributes[0]:value):option as op,
Run a query to Download Data