select
case when
LOWER(symbol_in)>LOWER(symbol_out) then concat(SYMBOL_OUT,'/',SYMBOL_in) else concat(SYMBOL_in,'/',SYMBOL_OUT) end AS pair,
symbol_in,
symbol_out,
count(distinct tx_hash) as n_swaps,
count(distinct origin_from_address) as n_wallets,
sum(coalesce(amount_out_usd,0)) as swapped_amount_usd
from optimism.sushi.ez_swaps
where block_timestamp >= CURRENT_DATE - 30
group by pair, symbol_in, symbol_out
order by swapped_amount_usd DESC
limit 10