Afonso_DiazRoute
Updated 2025-02-13
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
main as (
select
tx_hash,
block_timestamp,
origin_from_address as swapper,
a.contract_address as token_in,
b.contract_address as token_out,
a.amount as amount_in,
b.amount as amount_out,
a.amount_usd as amount_in_usd,
b.amount_usd as amount_out_usd,
a.symbol as symbol_in,
b.symbol as symbol_out,
nvl(amount_in_usd, amount_out_usd) as amount_usd
from
ronin.core.ez_token_transfers a
join
ronin.core.ez_token_transfers b using (tx_hash, block_timestamp)
where
a.contract_address != b.contract_address
and b.to_address = origin_from_address
and a.to_address != '0x22cefc91e9b7c0f3890ebf9527ea89053490694e'
and b.to_address != '0x22cefc91e9b7c0f3890ebf9527ea89053490694e'
and a.from_address != '0x0000000000000000000000000000000000000000'
and b.from_address != '0x0000000000000000000000000000000000000000'
and tx_hash not in (select distinct tx_hash from ronin.core.fact_transactions where input_data = '0x')
)
select
symbol_in || ' -> ' || symbol_out as token_pair,
count(distinct tx_hash) as swaps,
count(distinct swapper) as swappers,
sum(amount_usd) as volume_usd,
avg(amount_usd) as average_amount_usd
QueryRunArchived: QueryRun has been archived