Popex404Daily comparition Uniswap - Velodrome July 2022
    Updated 2022-08-04
    -- Query made by me with some help of Ponch / Nebychiquito, to merge both queries in one, and get a nice and clean Chart.

    with Uniswap as (Select date_trunc('day',block_timestamp) as date, count(*) as swap_number,
    count (distinct origin_from_address) as Unique_user,
    case when block_timestamp is not null then 'Uniswap' end as dex
    FROM optimism.core.fact_event_logs
    WHERE origin_to_address in ('0xe592427a0aece92de3edee1f18e0157c05861564','0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45')
    and event_name = 'Swap'
    AND block_timestamp between '2022-07-01' and '2022-07-31'
    group by 1, 4
    ),

    Velodrome as (SELECT date_trunc('day',block_timestamp) as date, count(*) as swap_number,
    count(distinct origin_from_address) as Unique_user,
    case when block_timestamp is not null then 'Velodrome' end as dex
    FROM optimism.velodrome.ez_swaps
    WHERE origin_to_address = lower('0xa132DAB612dB5cB9fC9Ac426A0Cc215A3423F9c9')
    AND block_timestamp between '2022-07-01' and '2022-07-31'
    group by 1, 4
    )
    select * from uniswap
    union ALL
    select * from velodrome
    Run a query to Download Data