nsa2000stake and unstake transactions users volume
    Updated 2022-11-22
    --this code is thankfully burrowed from 0xHaM☰d: https://app.flipsidecrypto.com/dashboard/fHME6k
    select
    date_trunc('{{Frequency}}', block_timestamp) as date,
    CASE
    WHEN action in ('DelegatorTokensCommitted', 'TokensCommitted') THEN 'Stake'
    WHEN action in ('DelegatorRewardTokensWithdrawn', 'DelegatorUnstakedTokensWithdraw') THEN 'UnStake'
    end as action_tyoe,
    count(DISTINCT TX_ID) as tx_cnt,
    count(DISTINCT DELEGATOR) as user_cnt,
    sum(amount) as amt,
    avg(amount) as avg_amt,
    sum(tx_cnt) over (partition by action_tyoe order by date) as cum_tx_cnt,
    sum(amt) over (partition by action_tyoe order by date) as cum_amt
    from flow.core.ez_staking_actions
    where block_timestamp::date >= CURRENT_DATE - INTERVAL '{{Past_Weeks}} WEEK'
    AND TX_SUCCEEDED = TRUE
    AND action_tyoe is not null
    GROUP by 1,2
    ORDER by 1

    Run a query to Download Data