namanasync2023-05-20 07:47 PM copy
Updated 2024-08-30
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
›
⌄
-- forked from Afonso_Diaz / 2023-05-20 07:47 PM @ https://flipsidecrypto.xyz/Afonso_Diaz/q/rt2r9fQSOBI1/2023-05-20-07-47-pm
with t as (
select
tx_hash,
block_timestamp,
'Outflow' as type,
to_address as user,
amount_usd
from ethereum.core.ez_token_transfers
join ethereum.core.dim_labels
on address = from_address
where symbol = 'UNI'
and label_type = 'dex'
union all
select
tx_hash,
block_timestamp,
'Inflow' as type,
to_address as user,
amount_usd
from ethereum.core.ez_token_transfers
join ethereum.core.dim_labels
on address = to_address
where symbol = 'UNI'
and label_type = 'dex'
)
select
count(distinct tx_hash) as transactions,
count(distinct iff(type = 'Inflow', tx_hash, null)) as inflow_transactions,
count(distinct iff(type = 'Outflow', tx_hash, null)) as outflow_transactions,
inflow_transactions - outflow_transactions as netflow_transactions,
count(distinct user) as users,
QueryRunArchived: QueryRun has been archived