banbannardSushiswap for L2
Updated 2022-10-16Copy 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
33
34
35
36
›
⌄
with base as (select '3. Optimism' as L2,
date_trunc(week, block_timestamp) as day,
count(distinct(tx_hash)) as swap_count,
count(distinct(origin_from_address)) as swapper_count,
sum(amount_in_usd) as swap_volume,
avg(amount_in_usd) as avg_swap_volume,
sum(swap_volume) over (order by day) as cum_swap_volume,
sum(swap_count) over (order by day) as cum_swap_count,
sum(swapper_count) over (order by day) as cum_swapper_count
from optimism.sushi.ez_swaps
group by 1,2
union
select '2. Polygon' as L2,
date_trunc(week, block_timestamp) as day,
count(distinct(tx_hash)) as swap_count,
count(distinct(origin_from_address)) as swapper_count,
sum(amount_in_usd) as swap_volume,
avg(amount_in_usd) as avg_swap_volume,
sum(swap_volume) over (order by day) as cum_swap_volume,
sum(swap_count) over (order by day) as cum_swap_count,
sum(swapper_count) over (order by day) as cum_swapper_count
from polygon.sushi.ez_swaps
group by 1,2
union
select '1. Arbitrum' as L2,
date_trunc(week, block_timestamp) as day,
count(distinct(tx_hash)) as swap_count,
count(distinct(origin_from_address)) as swapper_count,
sum(amount_in_usd) as swap_volume,
avg(amount_in_usd) as avg_swap_volume,
sum(swap_volume) over (order by day) as cum_swap_volume,
sum(swap_count) over (order by day) as cum_swap_count,
Run a query to Download Data