Abbas_ra21sushiswap Vs uniswap on L2 pt2
    Updated 2022-10-16
    with tB AS (select BLOCK_TIMESTAMP,TX_HASH,ORIGIN_FROM_ADDRESS,CONTRACT_ADDRESS AS pool_address from optimism.core.fact_event_logs
    where EVENT_NAME='Swap' and ORIGIN_TO_ADDRESS in ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45','0xe592427a0aece92de3edee1f18e0157c05861564')),
    tB2 AS (select BLOCK_TIMESTAMP,TX_HASH,ORIGIN_FROM_ADDRESS,CONTRACT_ADDRESS AS pool_address from arbitrum.core.fact_event_logs
    where EVENT_NAME='Swap' and ORIGIN_TO_ADDRESS in ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45','0xe592427a0aece92de3edee1f18e0157c05861564')),
    tB3 AS (select BLOCK_TIMESTAMP,TX_HASH,ORIGIN_FROM_ADDRESS,CONTRACT_ADDRESS AS pool_address from polygon.core.fact_event_logs
    where EVENT_NAME='Swap' and ORIGIN_TO_ADDRESS in ('0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45','0xe592427a0aece92de3edee1f18e0157c05861564'))
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'optimism' as chain,'uniswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from tb group by 1
    union ALL
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'optimism' as chain,'sushiswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from optimism.sushi.ez_swaps group by 1
    union ALL
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'Arbirtrum' as chain,'uniswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from tb2 group by 1
    union ALL
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'Arbirtrum' as chain,'sushiswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from arbitrum.sushi.ez_swaps group by 1
    union ALL
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'Polygon' as chain,'uniswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from tb3 group by 1
    union ALL
    select date_trunc('month',BLOCK_TIMESTAMP) AS date,'Polygon' as chain,'sushiswap' AS platform,count(distinct TX_HASH) AS "swap numbers",count(distinct ORIGIN_FROM_ADDRESS) AS "traders number" from polygon.sushi.ez_swaps group by 1

    Run a query to Download Data