Yousefi_1994Sushiswap and Uniswap TVL
    Updated 2022-09-30
    with sushiswap_pools as (
    select
    pool_address,
    token0,
    token1
    from ethereum.core.dim_dex_liquidity_pools
    where platform = 'sushiswap'
    ),
    uniswap_pools as (
    select
    pool_address,
    token0,
    token1
    from ethereum.core.dim_dex_liquidity_pools
    where platform = 'uniswap-v3' or platform = 'uniswap-v2'
    ),
    sushiswap_tvl as (
    select
    sum(amount_usd) as total_tvl
    from ethereum.erc20_balances, sushiswap_pools
    where user_address = pool_address
    and contract_address in (token0, token1)
    and balance_date = current_date - 1
    and amount_usd < 500000000
    ),
    uniswap_tvl as (
    select
    sum(amount_usd) as total_tvl
    from ethereum.erc20_balances, uniswap_pools
    where user_address = pool_address
    and contract_address in (token0, token1)
    and balance_date = current_date -1
    and amount_usd < 500000000
    )

    select 'Uniswap' as platform, * from uniswap_tvl
    Run a query to Download Data