John_GaltPrism Forge Query - date and address
Updated 2022-04-23
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 deposit1 as (select
tx_id
from terra.msg_events
where date(block_timestamp) > '2022-01-01'
and event_attributes:contract_address= 'terra1angxk38zehp0k09m0wqrrxf0r3ces6qjj432l8'
and event_attributes:action = 'deposit'
and event_index = 6
),
deposit2 as (select
block_timestamp as date,
event_attributes:sender as address,
fl.value:amount / pow(10, 6) as deposit_amount,
tx_id
from terra.msg_events,
lateral flatten(input => event_attributes:amount) fl
where date(block_timestamp) > '2022-01-01'
and event_attributes:recipient = 'terra1angxk38zehp0k09m0wqrrxf0r3ces6qjj432l8'
and event_index = 5
),
deposit_final as (select
date_trunc('hour', deposit2.date) as Day_Hour, deposit2.address, deposit2.deposit_amount
from deposit2
inner join deposit1 on deposit1.tx_id = deposit2.tx_id
),
withdraw1 as (select
tx_id
from terra.msg_events
where date(block_timestamp) > '2022-01-01'
and event_attributes:contract_address = 'terra1angxk38zehp0k09m0wqrrxf0r3ces6qjj432l8'
and event_attributes:action = 'withdraw'
and event_index = 6
),