jackguysushiswap graphs 1 copy
    Updated 2023-03-02
    -- forked from 57d3730f-1f83-4deb-8c76-99ef18326acf

    with tab1 as (
    SELECT
    pool_name,
    CONTRACT_ADDRESS as pool_address,
    sum(amount_in_usd) as swap_volume_usd,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT ORIGIN_FROM_ADDRESS) as users
    FROM ethereum.core.ez_dex_swaps
    WHERE amount_in_usd < amount_out_usd * 2
    AND platform LIKE 'sushiswap'
    GROUP BY 1,2
    ORDER BY 3 DESC
    LIMIT 5
    )


    SELECT
    date_trunc('week', block_timestamp) as week,
    CONTRACT_ADDRESS as pool_address,
    sum(amount_in_usd) as swap_volume_usd,
    count(DISTINCT tx_hash) as swaps,
    count(DISTINCT ORIGIN_FROM_ADDRESS) as users
    FROM ethereum.core.ez_dex_swaps
    WHERE amount_in_usd < amount_out_usd * 2
    AND platform LIKE 'sushiswap'
    AND pool_name IN (SELECT pool_name FROM tab1)
    GROUP BY 1,2




    Run a query to Download Data