superflyUntitled Query
Updated 2022-11-15Copy Reference Fork
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 date_trunc('day', block_timestamp) as day,
sum(amount) as staked_flow,
avg(amount) as avg_stake_volume,
sum(staked_flow) over (order by day) as cumu_staked_flow,
count(distinct(tx_id)) as stake_tx,
sum(stake_tx) over (order by day) as cumu_stake_tx,
count(distinct(delegator)) as staker_count
from flow.core.ez_staking_actions
where tx_succeeded = 'TRUE'
and action in ('DelegatorTokensCommitted','TokensCommitted')
group by 1),
unstake as (select date_trunc('day', block_timestamp) as day,
sum(amount) as unstaked_flow,
sum(unstaked_flow) over (order by day) as cumu_unstaked_flow,
count(distinct(tx_id)) as unstake_tx,
sum(unstake_tx) over (order by day) as cumu_unstake_tx,
count(distinct(delegator)) as unstaker_count
from flow.core.ez_staking_actions
where tx_succeeded = 'TRUE'
and action in ('DelegatorUnstakedTokensWithdrawn','UnstakedTokensWithdrawn')
group by 1)
select a.day,
staked_flow,
unstaked_flow,
staked_flow - unstaked_flow as net_stake_amt,
(staked_flow/1036200000) * 100 as staked_ratio,
cumu_staked_flow,
cumu_unstaked_flow,
cumu_staked_flow - cumu_unstaked_flow as net_flow_staked,
stake_tx,
unstake_tx,
cumu_stake_tx,
cumu_unstake_tx,
staker_count,
Run a query to Download Data