adambalaSaber Locked Over Time
    Updated 2022-04-02
    with
    lock as (
    SELECT SIGNER as locker,min(block_timestamp) as date
    FROM solana.fact_gov_actions
    WHERE (mint) = ('Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1')
    and block_timestamp>'2022-01-01' and action='LOCK'
    group by 1
    ),
    unlock as (
    SELECT SIGNER as unlocker,min(block_timestamp) as dat
    FROM solana.fact_gov_actions
    WHERE (mint) = ('Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1')
    and block_timestamp>'2022-01-01' and action='EXIT'
    group by 1
    ),
    sabor as(
    select
    datediff(day,date,dat) as date_diff,
    locker
    FROM lock
    inner JOIN unlock
    ON locker = unlocker
    group by date_diff,locker HAVING date_diff >=0
    )
    select
    count(distinct locker) as locker,
    case when date_diff BETWEEN 0 and 10 then '0-10 days'
    when date_diff BETWEEN 10 and 40 then '10-40 days'
    when date_diff BETWEEN 40 and 80 then '40-80 days'
    when date_diff BETWEEN 80 and 120 then '80-120 days'
    when date_diff BETWEEN 120 and 1200 then 'More than 100 days'
    end as days

    FROM sabor