afonsoOP total Stats
Updated 2023-04-05Copy 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
›
⌄
with t as (
select
block_timestamp,
tx_hash,
origin_from_address,
iff(symbol_in = 'OP', amount_in_usd, 0) as outflow_usd,
iff(symbol_in = 'OP', amount_out_usd, 0) as inflow_usd,
inflow_usd - outflow_usd as netflow
from optimism.sushi.ez_swaps
where 'OP' in (symbol_in, symbol_out)
union all
select
block_timestamp,
tx_hash,
origin_from_address,
iff(symbol_in = 'OP', amount_in_usd, 0) as outflow_usd,
iff(symbol_in = 'OP', amount_out_usd, 0) as inflow_usd,
inflow_usd - outflow_usd as netflow
from optimism.velodrome.ez_swaps
where 'OP' in (symbol_in, symbol_out)
)
select
count(distinct tx_hash) as swaps_count,
count(distinct origin_from_address) as swappers_count,
sum(inflow_usd) as inflow_volume_usd,
sum(outflow_usd) as outflow_volume_usd,
inflow_volume_usd - outflow_volume_usd as netflow_volume_usd
from t
Run a query to Download Data