bergUntitled Query
Updated 2022-11-29
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
deposited as (
select
event_contract,
event_data:to as user_address,
sum(event_data:amount) as inflow
from flow.core.fact_events
where event_type = 'TokensDeposited'
and tx_succeeded = 1
group by user_address, event_contract
),
withdrawn as (
select
event_contract,
event_data:from as user_address,
sum(event_data:amount) as outflow
from flow.core.fact_events
where event_type = 'TokensWithdrawn'
and tx_succeeded = 1
group by user_address, event_contract
),
main as (
select user_address,
inflow, outflow,
inflow - outflow as balance
from deposited
join withdrawn using(user_address, event_contract)
where
deposited.user_address != 'null'
and deposited.event_contract = 'A.1654653399040a61.FlowToken'
and balance > 0
),
price_flow as (
Run a query to Download Data