carlesmontala2- Who's Got The Flow?
Updated 2022-11-28
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
›
⌄
with depositt as (
select event_data:to as flowuser,
sum (event_data:amount) as Deposit_Volume
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken'
and event_type = 'TokensDeposited'
and tx_succeeded = 'TRUE'
group by 1),
withdrawt as (
select event_data:from as flowuser,
sum (event_data:amount) as Withdraw_Volume
from flow.core.fact_events
where event_contract = 'A.1654653399040a61.FlowToken'
and event_type = 'TokensWithdrawn'
and tx_succeeded = 'TRUE'
group by 1),
maintable as (
select t1.flowuser,
sum (deposit_volume - withdraw_volume) as Balance
from depositt t1 join withdrawt t2 on t1.flowuser = t2.flowuser
where t1.flowuser != 'null'
group by 1)
select case when balance < 10 then 'Holding Less Than 10 $FLOW'
when balance >= 10 and balance < 100 then 'Holding 10 - 100 $FLOW'
when balance >= 100 and balance < 1000 then 'Holding 100 - 1000 $FLOW'
when balance >= 1000 and balance < 10000 then 'Holding 1000 - 10000 $FLOW'
else 'Holding More Than 10000 $FLOW' end as type,
count (distinct flowuser) as Holders_Count
from maintable
group by 1
order by 2 desc
Run a query to Download Data