0xHaM-dSwap Metrics in Total
Updated 2023-04-06Copy 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 velodrome as (
select
'Velodrome' as dex,
count(distinct tx_hash) as "Swaps Tx Cnt",
count(distinct origin_from_address) as "Swappers"
from optimism.velodrome.ez_swaps
where block_timestamp::date >= '2022-01-01'
and block_timestamp::date <= CURRENT_DATE - 1
group by 1
)
, uniswap as (
select
'Uniswap' as dex,
count(distinct tx_hash) as "Swaps Tx Cnt",
count(distinct origin_from_address) as "Swappers"
from optimism.core.fact_event_logs
where origin_to_address IN ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45',
'0xe592427a0aece92de3edee1f18e0157c05861564') -- I found two addresses for Uniswap: both yield a lot of transactions.
and event_name = 'Swap'
and tx_status = 'SUCCESS'
and block_timestamp::date >= '2022-01-01'
and block_timestamp::date <= CURRENT_DATE - 1
group by 1
)
, balancer as (
select
'Balancer' as dex,
count(distinct tx_hash) as "Swaps Tx Cnt",
count(distinct origin_from_address) as "Swappers"
from optimism.core.fact_event_logs
where origin_to_address = lower('0xba12222222228d8ba445958a75a0704d566bf2c8') --Balancer contract
and event_name = 'Swap'
and tx_status = 'SUCCESS'
and block_timestamp::date >= '2022-01-01'
and block_timestamp::date <= CURRENT_DATE - 1
group by 1
Run a query to Download Data