SalehTop Providers-top 10 liquidity providers
    Updated 2022-01-25
    with lst_withdraw_prv as(
    select
    origin_address,tx_id,amount_usd
    ,FROM_ADDRESS_NAME as pool_name
    from ethereum.udm_events

    where from_label='sushiswap'
    and ORIGIN_FUNCTION_NAME='removeLiquidity'
    -- and symbol='SUSHI'
    -- and POOL_NAME!=''

    )

    ,lst_top_pool as (
    select
    round(sum(amount_usd),2) as tvl,
    CASE
    WHEN pool_name = '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5-DAI LP' THEN 'OHM-DAI SLP'
    ELSE pool_name
    END as pool_name,
    pool_address
    from ethereum.erc20_balances bal
    join ethereum.dex_liquidity_pools dex on
    bal.user_address = dex.pool_address
    where amount_usd > 0 and platform = 'sushiswap'
    and balance_date = (select max(balance_date) from ethereum.erc20_balances)
    group by 2,3
    order by tvl desc
    limit 3
    )
    ,lst_pools as (
    select TVL, POOL_NAME, POOL_ADDRESS from lst_top_pool
    )
    , lst_withdraw as (
    select ORIGIN_ADDRESS,POOL_NAME,sum(AMOUNT_USD) as remove_usd
    Run a query to Download Data