banbannardOptimism-Velodrome
Updated 2022-10-26Copy 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
date_trunc('day', block_timestamp) as day,
'Velodrome',
count(distinct(tx_hash)) as count_tx,
count(distinct(origin_from_address)) as swapper,
sum(count_tx) over (order by day) as cumulative_count_tx,
sum(swapper) over (order by day) as cumulative_swapper,
(select count(distinct(origin_from_address)) from optimism.velodrome.ez_swaps where block_timestamp >= current_date - 30) as unique_swappers
from optimism.velodrome.ez_swaps
where day >= current_date - 30
group by 1),
base2 as (select *
from optimism.core.dim_labels
where project_name ilike '%uniswap%'),
base3 as (select tx_hash
from optimism.core.fact_event_logs
where event_name = 'Swap'
and origin_to_address in (select address from base2)
and block_timestamp >= current_date - 30),
base4 as (select date_trunc('day', block_timestamp) as day,
'Uniswap',
count(distinct(tx_hash)) as count_tx,
count(distinct(origin_from_address)) as swapper,
sum(count_tx) over (order by day) as cumulative_count_tx,
sum(swapper) over (order by day) as cumulative_swapper,
(select count(distinct(origin_from_address)) from optimism.core.fact_event_logs where event_name = 'Transfer' and tx_hash in (select tx_hash from base3) and event_inputs:value > 0) as unique_swappers
from optimism.core.fact_event_logs
where
event_name = 'Transfer'
and tx_hash in (select tx_hash from base3)
and event_inputs:value > 0
group by 1),
Run a query to Download Data