Updated 2023-03-06
    with tab1 as (
    select
    *,
    case
    when contract_address ='0x3b475f6f2f41853706afc9fa6a6b8c5df1a2724c' then event_inputs:value/1e18
    when contract_address ='0xeff77e179f6abb49a5bf0ec25c920b495e110c3b' then event_inputs:undelyingDeposited/1e18
    end as ZYB_volume,
    case
    when contract_address ='0x82af49447d8a07e3bd95bd0d56f35241523fbab1' then event_inputs:value/1e18
    end as WETH_volume
    FROM arbitrum.core.fact_event_logs
    where origin_to_address = lower('0xEFf77E179f6abb49a5bf0EC25c920B495e110C3b')
    and origin_function_signature = '0xb6b55f25'
    and TX_STATUS='SUCCESS'
    and event_inputs is not null
    and (event_inputs:value/1e18 < 1e9 or event_inputs:undelyingDeposited/1e18 < 1e9)
    )

    select
    block_timestamp::date as date,
    count(DISTINCT tx_hash) as stakes,
    count(DISTINCT origin_from_address) as stakers,
    sum(ZYB_volume) as ZYB_volume,
    avg(ZYB_volume) as avg_ZYB_volume,
    sum(ZYB_volume*5.06) as ZYB_USD_volume,
    avg(ZYB_volume*5.06) as avg_ZYB_USD_volume,
    sum(stakes) over (order by date asc) as cum_stakes,
    sum(stakers) over (order by date asc) as cum_stakers_count,
    sum(ZYB_USD_volume) over (order by date asc) as cum_ZYB_USD_stake_volume
    from tab1
    group by date
    order by date asc



    -- deposit function signature = > 0xb6b55f25
    Run a query to Download Data