0xHaM-dOptimism
    Updated 2022-10-24
    with swap as (
    SELECT
    sender as from_address,
    'Ethereum' as network,
    'Uniswap' as dex,
    count(distinct tx_hash) as Swaps_Cnt
    from ethereum.uniswapv3.ez_swaps
    WHERE block_timestamp::date > CURRENT_DATE - 181
    and block_timestamp::date <= CURRENT_DATE - 1
    group by 1,2,3
    UNION
    SELECT
    from_address,
    'Optimism' as network,
    'Uniswap' as dex,
    count(distinct tx_hash) as Swaps_Cnt
    from optimism.core.fact_transactions
    where tx_hash in ( SELECT tx_hash from optimism.core.fact_event_logs
    where origin_to_address in ('0xe592427a0aece92de3edee1f18e0157c05861564','0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45')
    and event_name = 'Swap'and tx_status = 'SUCCESS')
    and block_timestamp::date > CURRENT_DATE - 181
    and block_timestamp::date <= CURRENT_DATE - 1
    group by 1,2,3

    UNION
    SELECT
    origin_from_address as from_address,
    'Ethereum' as network,
    'Sushiswap' as dex,
    count(distinct tx_hash) as Swaps_Cnt
    from ethereum.sushi.ez_swaps
    WHERE block_timestamp::date > CURRENT_DATE - 181
    and block_timestamp::date <= CURRENT_DATE - 1
    Run a query to Download Data