sagharkariOver-Time Charts
    Updated 2023-05-11
    with staketable as (
    select date_trunc(week,block_timestamp) as date,
    sum (amount) as Staked_Volume
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    and action in ('DelegatorTokensCommitted','TokensCommitted')
    group by 1),

    unstaketable as (
    select date_trunc(week,block_timestamp) as date,
    sum (amount) as UnStaked_Volume
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE'
    and action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn')
    group by 1)

    select t1.date,
    Staked_Volume - UnStaked_Volume as "Weekly Net Staked Volume",
    sum ("Weekly Net Staked Volume") over (order by t1.date) as "Cumulative Net Staked Volume"
    from staketable t1 join unstaketable t2 on t1.date = t2.date
    order by 1
    Run a query to Download Data