sarathwho got flow1
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
›
⌄
with
t1 as (
select event_data:to as user,
sum(event_data:amount) as amount_in
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken' and event_type = 'TokensDeposited' and tx_succeeded = 'TRUE'
group by 1
),
t2 as (
select event_data:from as user,
sum(event_data:amount) as amount_out
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken' and event_type = 'TokensWithdrawn' and tx_succeeded = 'TRUE'
group by 1
),
t3 as (
select
ifnull(t1.user,t2.user) as users,
ifnull(amount_in,0) as total_deposited, ifnull(amount_out,0) as total_withdrawn,
total_deposited-total_withdrawn as current_balance
from t1
join t2 on t1.user = t2.user
where t1.user <> 'null'
)
select
count(distinct users) as FLOW_holders,
sum(current_balance) as total_FLOW_tokens_in_balances,
avg(current_balance) as avg_FLOW_tokens_in_balances
from t3 where current_balance>0
Run a query to Download Data