MLDZMNWGF1
Updated 2022-11-28Copy 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
›
⌄
with tb1 as (select
distinct recipient as user1,
sum(amount) as total_recieved
from flow.core.ez_token_transfers
where token_contract = 'A.1654653399040a61.FlowToken'
and tx_succeeded = 'TRUE'
group by 1),
tb2 as (select
distinct sender as user2,
sum(amount) as total_sent
from flow.core.ez_token_transfers s left join tb1 b on s.sender=b.user1
where token_contract = 'A.1654653399040a61.FlowToken'
and tx_succeeded = 'TRUE'
and sender in (select user1 from tb1)
group by 1),
tb3 as (select
distinct user1 as users,
total_recieved - total_sent as net_flow
from tb1 s left join tb2 b on s.user1 = b.user2
left join flow.core.dim_contract_labels c on s.user1 = c.account_address
where total_recieved>total_sent
and CONTRACT_NAME is null
)
select
count(distinct users) as total_holders,
sum(net_flow) as total_hold_flow,
total_hold_flow/total_holders as average_hold_flow
from tb3 s
Run a query to Download Data