Moesmg
    Updated 2022-10-02
    select * , amount_dep - amount_with as net_amount
    from (with sushi_pools as
    (select
    POOL_ADDRESS ,pool_name
    from
    ethereum.core.dim_dex_liquidity_pools
    where PLATFORM ilike 'sushiswap')

    ,deps as
    (select
    'Deposit' as type,
    pool_name,

    sum(amount_usd) as amount_dep
    from
    ethereum.core.ez_token_transfers t
    join sushi_pools p on to_address = pool_address
    where AMOUNT_USD is not null
    and block_timestamp::date between '2022-09-01' and '2022-09-29'
    and origin_function_signature in ('0xf305d719','0xe8e33700')
    group by 1,2)

    ,wits as
    (
    select

    'Withdraw' as type,
    pool_name,

    sum(amount_usd) as amount_with
    from
    ethereum.core.ez_token_transfers t
    join sushi_pools p on from_address = pool_address
    where
    block_timestamp between '2022-09-01' and '2022-09-29'
    Run a query to Download Data