kiacryptosushiswap tvl farms on Ethereum and Polygon
    Updated 2022-04-07
    with
    eth as (
    select
    pool_address,
    pool_name,
    sum(iff(amount_usd is null, 0, amount_usd)) as tvl
    from ethereum.erc20_balances, ethereum.dex_liquidity_pools
    where user_address = pool_address and platform = 'sushiswap'
    and balance_date >= current_date -1
    group by 1, 2
    ),
    poly as (
    select
    address,
    address_name,
    sum(case when from_address = address then iff(amount_usd is null, 0, -amount_usd) else iff(amount_usd is null, 0, amount_usd) end) as net_change
    from polygon.udm_events, polygon.labels
    where (to_address = address or from_address = address) and label = 'sushiswap' and label_subtype = 'pool'
    group by 1, 2
    )

    select *,'ethereum' as network from eth
    union all
    select *,'polygon' as network from poly


    Run a query to Download Data