phu49. Sushi vs Uni on Polygon overtime
    Updated 2022-10-17
    with
    uni_v3_pool_cte as (
    select
    event_inputs:pool pool_address
    , event_inputs:token0 token0_address
    , event_inputs:token1 token1_address
    -- from arbitrum.core.fact_event_logs
    -- from optimism.core.fact_event_logs
    from polygon.core.fact_event_logs
    where 1=1
    and tx_status = 'SUCCESS'
    AND contract_address = '0x1f98431c8ad98523631ae4a59f267346ea31f984'
    and event_name = 'PoolCreated'
    )
    , uni_v3_cte as (
    select
    block_timestamp
    , ORIGIN_FROM_ADDRESS swapper_address
    , tx_hash
    -- from arbitrum.core.fact_event_logs a
    -- from optimism.core.fact_event_logs a
    from polygon.core.fact_event_logs a
    join uni_v3_pool_cte b on a.contract_address = b.pool_address
    where 1=1
    and tx_status = 'SUCCESS'
    and event_removed = 'false'
    and event_name = 'Swap'
    and block_timestamp::date >= '2022-06-01'
    and block_timestamp::date <= '2022-10-15'
    )
    , sushi_cte as (
    select
    block_timestamp
    , ORIGIN_FROM_ADDRESS swapper_address
    , tx_hash
    -- from arbitrum.sushi.ez_swaps
    Run a query to Download Data