with tab1 as (
select
ORIGIN_FROM_ADDRESS as swapper
,count(distinct TX_HASH) as swaps
,count(distinct BLOCK_TIMESTAMP::date) as active_days
from arbitrum.defi.ez_dex_swaps
where BLOCK_TIMESTAMP::date>='2023-07-01'
and PLATFORM='uniswap-v3'
group by 1
order by 2 desc
limit 20),
tab2 as (
select
ORIGIN_FROM_ADDRESS as swapper
,count(distinct TX_HASH) as swaps
,count(distinct BLOCK_TIMESTAMP::date) as active_days
from optimism.defi.ez_dex_swaps
where BLOCK_TIMESTAMP::date>='2023-07-01'
and PLATFORM='uniswap-v3'
group by 1
order by 2 desc
limit 20)
select 'Arbitrum' as chain
,sum(swaps) as swaps
from tab1
group by 1
union all
select 'Optimism' as chain
,sum(swaps) as swaps
from tab2