azerbaijanUntitled Query
Updated 2022-10-16Copy 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 inflow as(
select
block_timestamp :: date as day,
case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
sum(inner_instruction : instructions[0] : parsed : info : amount / 1e9) as amount_in
from solana.fact_events
Where program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
AND inner_instruction : instructions[0] : parsed : info : destination = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
and block_timestamp >= '2022-10-01'
group by 1
),
outflow as(
select
block_timestamp :: date as day,
case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
sum(inner_instruction : instructions[0] : parsed : info : amount / 1e9) as amount_out
from solana.fact_events
Where program_id = 'mv3ekLzLbnVPNxjSKvqBpU3ZeZXPQdEC3bp5MDEBG68'
AND inner_instruction : instructions[0] : parsed : info : source = 'AVn3JRGhifPCxjxZsU3tQuo4U4dTHizHzBDGW983tx47'
and block_timestamp >= '2022-10-01'
group by 1),
final as(
select
a.day as day,
amount_in as inflow,
amount_out as outflow
from inflow a join outflow b on a.day = b.day
)
select
case when day >= '2022-09-11' and day < '2022-10-11 23:00:00.000' then 'Before Mango Hack'
when day >= '2022-10-11 23:00:00.000' then 'After Mango Hack' else null end as time,
avg(inflow),
Run a query to Download Data