KuramaQuery for cosmos sankey
Updated 2022-12-12Copy Reference Fork
999
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 table_8 as (
select distinct tx_id from cosmos.core.fact_msg_attributes
where tx_succeeded = 'TRUE'
and msg_type = 'message'
and attribute_key = 'action'
and attribute_value = '/cosmos.staking.v1beta1.MsgBeginRedelegate'
and to_date(block_timestamp) between '2022-10-31' and current_date
),
table_9 as (select distinct tx_id, attribute_value as address from cosmos.core.fact_msg_attributes
where tx_succeeded = 'TRUE'
and msg_type = 'transfer'
and attribute_key = 'sender'
and msg_index = '2'
and tx_id in (select * from table_8)),
table_10 as (select distinct tx_id, attribute_value as validator_from from cosmos.core.fact_msg_attributes
where tx_succeeded = 'TRUE'
and msg_type = 'redelegate'
and attribute_key = 'source_validator'
and tx_id in (select * from table_8)),
table_11 as (select distinct tx_id, attribute_value as validator_to from cosmos.core.fact_msg_attributes
where tx_succeeded = 'TRUE'
and msg_type = 'redelegate'
and attribute_key = 'destination_validator'
and tx_id in (select * from table_8)),
table_12 as (select distinct tx_id, to_number(SUBSTRING(attribute_value,0,CHARINDEX('uatom',attribute_value)-1))/pow(10,6) as amount from cosmos.core.fact_msg_attributes
where tx_succeeded = 'TRUE'
and msg_type = 'redelegate'
and attribute_key = 'amount'
and tx_id in (select * from table_8))
Run a query to Download Data