0xHaM-dStablecoins TVL on Sushiswap vs. Uniswap
    Updated 2022-06-07
    with all_sushipools as (
    select POOL_ADDRESS , token0, platform
    from ethereum.core.dim_dex_liquidity_pools
    where platform in ('sushiswap', 'uniswap-v2', 'uniswap-v3')
    and token0 in ('0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f')
    union
    select POOL_ADDRESS , token1, platform
    from ethereum.core.dim_dex_liquidity_pools
    where platform in ('sushiswap', 'uniswap-v2', 'uniswap-v3')
    and token1 in ('0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f')
    )
    select
    balance_date::date as "balance date",
    CASE
    WHEN platform = 'uniswap-v3' or platform = 'uniswap-v2' THEN 'uniswap'
    ELSE 'sushiswap'
    END as "main platform",
    case
    when token0 = '0xdac17f958d2ee523a2206206994597c13d831ec7' then 'USDT'
    when token0 = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' then 'USDC'
    when token0 = '0x6b175474e89094c44da98b954eedeac495271d0f' then 'DAI'
    end as token,
    sum(amount_usd) as "amount in usd"
    from ethereum.erc20_balances, all_sushipools
    where user_address = POOL_ADDRESS
    and contract_address = token0
    and balance_date >= '2022-01-01'
    and has_price = true
    group by 1, 2, 3
    order by 1
    Run a query to Download Data