sarathmisover9
    Updated 2022-09-20
    WITH
    arbitrum_sushi AS (
    SELECT DISTINCT COUNT (SENDER) AS number_user_arbit,
    date_trunc('day', block_timestamp) AS date
    FROM arbitrum.sushi.ez_swaps
    WHERE BLOCK_TIMESTAMP >= CURRENT_DATE -7
    GROUP BY 2
    ORDER BY 2 ASC
    ),
    avalanche_sushi AS (
    SELECT DISTINCT COUNT (a.SENDER) AS number_user_ava,
    date_trunc('day', a.BLOCK_TIMESTAMP) AS date
    FROM avalanche.sushi.ez_swaps a
    LEFT JOIN arbitrum_sushi b ON date=b.date
    WHERE BLOCK_TIMESTAMP >= CURRENT_DATE -7
    group BY 2
    ORDER BY 2 ASC
    ),

    ethereum_sushi AS (
    SELECT DISTINCT COUNT (SENDER) AS number_user_eth,
    date_trunc('day', a.BLOCK_TIMESTAMP) AS date
    FROM ethereum.sushi.ez_swaps a
    LEFT JOIN arbitrum_sushi b ON date=b.date
    WHERE BLOCK_TIMESTAMP >= CURRENT_DATE -7
    GROUP BY 2
    ORDER BY 2 ASC
    ),

    optimism_sushi AS (
    SELECT DISTINCT COUNT (ORIGIN_FROM_ADDRESS) AS number_user_opt,
    date_trunc('day', a.BLOCK_TIMESTAMP) AS date
    --BLOCK_TIMESTAMP
    FROM optimism.sushi.ez_swaps a
    LEFT JOIN arbitrum_sushi b ON date=b.date
    Run a query to Download Data