nitsPolygon TVL
    Updated 2022-04-06
    -- Sushi on Polygon

    -- Q57. What are the 10 largest sushi liquidity pools on Polygon? What is their volume and TVL?

    -- Payout 11.36 SUSHI
    -- Grand Prize 34.08 SUSHI
    -- Level Beginner

    with
    top_pools_to as (
    select
    to_address_name as pool_name,
    to_address as pool_address
    ,*
    from polygon.udm_events
    where to_label ilike 'sushiswap' and to_label_subtype = 'pool'
    and amount_usd > 0
    ),
    top_pools_from as (
    select
    from_address_name as pool_name,
    from_address as pool_address
    ,*
    from polygon.udm_events
    where from_label ilike 'sushiswap' and from_label_subtype = 'pool'
    and amount_usd > 0
    ),
    top_pools_to_ as
    (select pool_name, pool_address, sum(IFF(amount_usd > pow(10,9), amount_usd/pow(10,18), amount_usd)) as liquidity_added from top_pools_to
    GROUP by 1,2 ),
    top_pools_from_ as
    (select pool_name, pool_address, (-1)*sum(IFF(amount_usd > pow(10,9), amount_usd/pow(10,18), amount_usd)) as liquidity_added from top_pools_from
    GROUP by 1,2 )

    SELECT pool_name, sum(liquidity_added) as tvl from
    (SELECT * from top_pools_to_
    Run a query to Download Data