Moe0Sushi mg
    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
    tx_hash in (SELECT tx_hash
    FROM ethereum.core.fact_event_logs
    WHERE contract_address IN (SELECT pool_address FROM sushi_pools)
    AND event_name IN ('Mint'))
    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,
    Run a query to Download Data