(with swap_txns as (
select
*
from optimism.sushi.ez_swaps
)
select
'SushiSwap' as "DEX",
symbol_out as "Asset Swapped From",
count(distinct tx_hash) as "# of Swap Transactions",
count(*) as "# of Swaps",
count(distinct origin_from_address) as "# of Swapper",
sum(coalesce(amount_in_usd,0)) as "Swap Volume (USD)"
from swap_txns
where block_timestamp < CURRENT_DATE
and block_timestamp >= CURRENT_DATE - 30
group by 2
having "Swap Volume (USD)" > 0
order by 3 desc
limit 10)
union all
(with contracts as (
(select * from optimism.core.dim_contracts)
union ( select
'0x1318811b1c6aed9c48623adb1ee22f81c6c6f876' as address,
'DC Token' as symbol,
'0' as decimals
)
union ( select
'0xe649951f6e18492fca574d6113bbf446269312ee' as address,
'US Token' as symbol,
'0' as decimals
)
),
token_price as (
select
date_trunc('day', hour) as date,