Afonso_DiazAverage Unlock Time copy
    Updated 2024-11-20
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    unlock_timestamp,
    account_address as user,
    olas_amount,
    olas_amount_usd,
    datediff('day', block_timestamp, unlock_timestamp) as unlock_days
    from
    crosschain.olas.ez_olas_locking
    where
    block_timestamp between '{{ start_date }}' and '{{ end_date }}'
    and event_name = 'Deposit'
    )

    select
    case
    when unlock_days <= 7 then 'a. 1 days - 1 week'
    when unlock_days <= 14 then 'b. 1 week - 2 weeks'
    when unlock_days <= 30 then 'c. 2 weeks - 1 month'
    when unlock_days <= 90 then 'd. 1 month - 3 months'
    when unlock_days <= 180 then 'e. 3 months - 6 months'
    when unlock_days <= 364 then 'f. 6 months - 1 year'
    else 'g. > 1 year'
    end as type,
    count(distinct tx_hash) as transactions,
    count(distinct user) as users,
    sum(olas_amount) as olas_volume
    from
    main
    group by 1
    order by 1
    QueryRunArchived: QueryRun has been archived