MoeUntitled Query
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 t3 as (
select
t1.block_timestamp::date as block_date,
t1.tx_hash,
t1.origin_function_signature,
t1.origin_from_address,
t2.address_name
from optimism.core.fact_token_transfers t1
join optimism.core.dim_labels t2 on t2.address = t1.origin_to_address
where t2.label_type = 'dex'
and t2.label_subtype = 'swap_contract'
and block_date >= '2022-06-10'
and address_name ilike '%uniswap%'
),
t4 as (select
*
from optimism.core.fact_event_logs
where tx_hash in (select tx_hash from t3))
SELECT
BLOCK_TIMESTAMP::date as day,
'Velodrome' as DEX,
count(distinct tx_hash) as swap_count,
count(distinct ORIGIN_FROM_ADDRESS) as count_swapper,
sum(swap_count) over (order by day) as cumulative_swap
FROM optimism.velodrome.ez_swaps
where BLOCK_TIMESTAMP>=CURRENT_DATE-30
group by 1
union ALL
select
BLOCK_TIMESTAMP::date as day,
'Uniswap' as DEX,
Run a query to Download Data