adambalai14
Updated 2022-12-11
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 proposaltx as (
select tx_id,
attribute_value as Proposal_ID
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY= 'proposal_id'
and tx_succeeded = 'TRUE'),
depositvolume as (
select block_timestamp,
tx_id,
sum (split(ATTRIBUTE_VALUE,'uatom')[0]::numeric/1e6) as Deposit_Amount
from cosmos.core.fact_msg_attributes
where msg_type = 'proposal_deposit'
and attribute_key = 'amount'
and tx_id in (select tx_id from proposaltx)
and tx_succeeded = 'TRUE'
group by 1,2),
depositor as (
select block_timestamp,
tx_id,
attribute_value as Depositor
from cosmos.core.fact_msg_attributes
where ATTRIBUTE_KEY= 'spender'
and tx_id in (select tx_id from proposaltx)
and tx_succeeded = 'TRUE'),
mergetable as (
select distinct t1.tx_id,
t2.block_timestamp,
Depositor,
Deposit_Amount,
proposal_id
from proposaltx t1 join depositor t2 on t1.tx_id = t2.tx_id
join depositvolume t3 on t1.tx_id = t3.tx_id)
Run a query to Download Data