kiacryptoCumulative number of unique users
    Updated 2022-11-14
    with min_stake as (
    select
    address,
    min(block_timestamp) as min_date
    from solana.core.fact_stake_pool_actions
    where
    block_timestamp::date >= current_date - 7 and
    action ilike '%deposit%' and
    succeeded = 'TRUE'
    group by 1
    ),
    min_unstake as (
    select
    address,
    min(block_timestamp) as min_date
    from solana.core.fact_stake_pool_actions
    where
    block_timestamp::date >= current_date - 7 and
    (action ilike '%unstake%' or action ilike '%withdraw%') and
    succeeded = 'TRUE'
    group by 1
    )
    select
    date_trunc('day', min_date) as date,
    'stake' as type,
    count(distinct address) as unique_user,
    sum(unique_user) over (order by date) as cum_unique_user
    from min_stake
    group by 1

    union all

    select
    date_trunc('day', min_date) as date,
    'unstake' as type,
    count(distinct address) as unique_user,
    Run a query to Download Data