hessCirculating Supply
    Updated 2023-04-21
    with flow as ( select date(block_timestamp) as date,action,node_id, tx_id, delegator , amount
    from flow.core.ez_staking_actions
    where tx_succeeded = 'TRUE')
    ,
    final as ( select case when action in ('TokensCommitted','DelegatorTokensCommitted') then 'Stake'
    when action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn') then 'Unstake'
    when action in ('RewardTokensWithdrawn','DelegatorRewardTokensWithdrawn') then 'Rewards' end as type, count(DISTINCT(tx_id)) as total_tx, count(DISTINCT(delegator)) as total_user,
    sum(amount) as total_flow
    from flow
    group by 1)
    ,
    stake as ( select total_flow as stake_volume
    from final
    where type = 'Stake'
    )
    ,
    unstake as ( select total_flow as unstake_volume
    from final
    where type = 'Unstake'
    )

    select '1036200000'::number as circulate, stake_volume, unstake_volume , stake_volume-unstake_volume as net , (net/circulate)*100 as ratio
    from stake, unstake
    Run a query to Download Data