Moesmg 0
    Updated 2022-10-02
    select
    case when days >='2022-09-15' then 'Post Merge' else 'Pre Merge'end as date_type,* from
    (with sushi_pools as
    (select
    POOL_ADDRESS
    from
    ethereum.core.dim_dex_liquidity_pools
    where PLATFORM ilike 'sushiswap')


    select
    BLOCK_TIMESTAMP::date as days , 'Deposit' as type,
    SYMBOL,
    count(distinct tx_hash) as txs,
    count(distinct from_address) as users,
    sum(amount_usd) as amount_usd
    from
    ethereum.core.ez_token_transfers
    where days between '2022-09-01' and '2022-09-29'
    and origin_function_signature in ('0xf305d719','0xe8e33700')
    and
    to_address in (SELECT * from sushi_pools)
    group by 1,2,3

    union all

    select
    BLOCK_TIMESTAMP::date as days , 'Withdraw' as type,
    SYMBOL,
    -1*count(distinct tx_hash) as txs,
    -1*count(distinct to_address) as users,
    -1*sum(amount_usd) as amount_usd
    from
    ethereum.core.ez_token_transfers
    where days between '2022-09-01' and '2022-09-29'