Yousefi_1994Total number of distinct swap pair
Updated 2022-07-21
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 concat_sushi_swap_pair as (
select
concat(event_inputs:recipient, ',', event_inputs:toToken) as pari_address
from optimism.core.fact_event_logs
where origin_to_address = '0xbe811a0d44e2553d25d11cb8dc0d3f0d0e6430e6'
and event_name = 'Swap'
and event_inputs:recipient is not null
and event_inputs:toToken is not null
group by pari_address
),
split_sushi_swap_pair as (
select
split(pari_address, ',')[0] as token0,
split(pari_address, ',')[1] as token1
from concat_sushi_swap_pair
),
get_token0_symbol as (
select
pair.token0,
case
when pair.token0 = '0x1318811b1c6aed9c48623adb1ee22f81c6c6f876' then 'DC'
when pair.token0 = '0xe649951f6e18492fca574d6113bbf446269312ee' then 'US'
else contract0.symbol
end as symbol0,
case
when pair.token0 = '0x1318811b1c6aed9c48623adb1ee22f81c6c6f876' then 6
when pair.token0 = '0xe649951f6e18492fca574d6113bbf446269312ee' then 6
else contract0.decimals
end as decimals0,
pair.token1
from split_sushi_swap_pair pair
left join optimism.core.dim_contracts contract0
on pair.token0 = contract0.address
),
get_token1_symbol as (
select
Run a query to Download Data