hessTop Symbol Out of SushiSwap Qualified Pools
    Updated 2022-07-07
    with pool_address as ( select platform, pool_address , pool_name
    from ethereum.core.dim_dex_liquidity_pools
    where platform in ( 'sushiswap', 'uniswap-v2', 'uniswap-v3'))
    ,
    final as ( select platform , pool_address , pool_name , sum(AMOUNT_USD) as tvl
    from flipside_prod_db.ethereum.erc20_balances a join pool_address b on a.user_address = b.pool_address
    where balance_date = '2022-07-05'
    group by 1,2,3
    )
    ,
    final1 as ( select 'Sushiswap' as platform , pool_address , tvl
    from final
    where tvl >= 100000 and platform = 'sushiswap'
    UNION
    select 'Uniswap' as platform ,pool_address , tvl
    from final
    where tvl >= 100000 and platform in ( 'uniswap-v2', 'uniswap-v3')
    )

    select symbol_out , sum(amount_in_usd) as total_volume
    from ethereum.core.ez_dex_swaps
    where CONTRACT_ADDRESS in ( select pool_address from final1)
    and BLOCK_NUMBER > 100000 and platform = 'sushiswap' and event_name = 'Swap'
    group by 1




    Run a query to Download Data