Soheil_MKUntitled Query
Updated 2022-11-26
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 withdraw as (
select
--BLOCK_TIMESTAMP::date as date,
EVENT_DATA:from as wallet,
sum(EVENT_DATA:amount) as Flow_amounts
from flow.core.fact_events
WHERE EVENT_TYPE ='TokensWithdrawn'
and EVENT_CONTRACT ='A.1654653399040a61.FlowToken'
and TX_SUCCEEDED='TRUE'
and WALLET is not null
and wallet !='null'
group by 1
),
deposit as (
select
--BLOCK_TIMESTAMP::date as date,
EVENT_DATA:to as wallet,
sum(EVENT_DATA:amount) as Flow_amounts
from flow.core.fact_events
WHERE EVENT_TYPE ='TokensDeposited'
and EVENT_CONTRACT ='A.1654653399040a61.FlowToken'
and TX_SUCCEEDED='TRUE'
and WALLET is not null
and wallet !='null'
group by 1
)
select
a.wallet::varchar,
round(sum(a.Flow_amounts-b.Flow_amounts)) as Flow_balance
from deposit a
join withdraw b
on a.wallet=b.wallet
Run a query to Download Data