princefarzamFlow staking
Updated 2022-11-16
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
›
⌄
WITH Staking AS (
SELECT
date_trunc('day',BLOCK_TIMESTAMP) AS DAY,
sum(AMOUNT) AS Staked_FLOW_Volume
FROM flow.core.ez_staking_actions
WHERE ACTION IN ('DelegatorTokensCommitted','TokensCommitted')
AND TX_SUCCEEDED = TRUE
AND BLOCK_TIMESTAMP BETWEEN '2022-11-07'and '2022-11-14'
GROUP BY DAY
ORDER BY DAY),
Unstaking AS(
SELECT
date_trunc('day',BLOCK_TIMESTAMP) AS DAY,
sum(AMOUNT) AS Unstaked_FLOW_Volume
FROM flow.core.ez_staking_actions
WHERE ACTION IN ('UnstakedTokensWithdrawn', 'DelegatorUnstakedTokensWithdrawn' , 'DelegatorRewardTokensWithdrawn', 'RewardTokensWithdrawn')
AND TX_SUCCEEDED = TRUE
AND BLOCK_TIMESTAMP BETWEEN '2022-11-07'and '2022-11-14'
GROUP BY DAY
ORDER BY DAY)
SELECT
S.DAY,
Staked_FLOW_Volume,
-Unstaked_FLOW_Volume,
Staked_FLOW_Volume - Unstaked_FLOW_Volume AS Net_Staked_Amount
FROM Staking S LEFT JOIN Unstaking U on S.DAY=U.DAY