abbasian342023-04-22 01:56 AM
Updated 2023-04-21
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
27
28
29
30
31
32
33
34
35
36
›
⌄
with stake as (
select
Sum (AMOUNT) as Volume_Stake,
DELEGATOR,
VALIDATOR_TYPE,
sta.NODE_ID
from flow.core.ez_staking_actions as sta
left join flow.core.dim_validator_labels as b
on sta.NODE_ID = b.NODE_ID
where TX_SUCCEEDED = 'true' and action in ('DelegatorTokensCommitted','TokensCommitted')
group by DELEGATOR, VALIDATOR_TYPE, sta.NODE_ID
),
Unstake as (
select
Sum (AMOUNT) as Volume_unstake,
DELEGATOR,
VALIDATOR_TYPE,
sta.NODE_ID
from flow.core.ez_staking_actions as sta
left join flow.core.dim_validator_labels as b
on sta.NODE_ID = b.NODE_ID
where TX_SUCCEEDED = 'true' and action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn')
group by DELEGATOR, VALIDATOR_TYPE, sta.NODE_ID
)
SELECT
T1.DELEGATOR,
T2.VALIDATOR_TYPE,
Round (Volume_Stake - Volume_unstake) as "Net Staked Volume"
from stake as T1
join Unstake as T2
on T1.NODE_ID = T2.NODE_ID
WHERE Volume_Stake > 0 and "Net Staked Volume" is not NULL
ORDER BY "Net Staked Volume" DESC
Run a query to Download Data