Updated 2023-03-06
    --daily unstakes

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

    select
    block_timestamp::date as date,
    count(DISTINCT tx_hash) as UnStakes,
    case
    when ZYB_volume*5.06 < 100 then 'Less than $10'
    when ZYB_volume*5.06 >= 100 and ZYB_volume*5.06 < 500 then 'Between [100$-500$)'
    when ZYB_volume*5.06 >= 500 and ZYB_volume*5.06 < 1000 then 'Between [500$-1k$)'
    when ZYB_volume*5.06 >= 1000 and ZYB_volume*5.06 < 2000 then 'Between [1k$-2k$)'
    when ZYB_volume*5.06 >= 2000 and ZYB_volume*5.06 < 5000 then 'Between [2k$-5k$)'
    when ZYB_volume*5.06 >= 5000 and ZYB_volume*5.06 < 10000 then 'Between [5k$-10k$)'
    when ZYB_volume*5.06 >= 10000 then 'More than $10k'
    end as distribution
    from tab1
    where ZYB_volume is not null
    group by distribution,date


    -- select * from arbitrum.core.fact_event_logs
    -- where origin_function_signature = '0x2e1a7d4d'
    Run a query to Download Data