messariaxelar_staking_metrics_daily
Updated 2024-11-25
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
›
⌄
with stake_action as
(select block_id,
sum(case when action = 'delegate' then amount else 0 end) as delegate,
sum(case when action = 'undelegate' then amount else 0 end) as undelegate
from axelar.gov.fact_staking
where tx_succeeded
group by block_id),
total_staked_by_block_id as
(select block_id,
sum(delegate-undelegate) over (order by block_id) as total_staked
from stake_action
order by block_id desc),
block_id_by_date as (
select date(block_timestamp) as date, max(block_id) as ending_block_id
from axelar.gov.fact_staking
group by 1
order by 1 desc)
select b.date
, b.ending_block_id
, t.total_staked
from block_id_by_date b
left join total_staked_by_block_id t
on b.ending_block_id = t.block_id
order by 1 desc
QueryRunArchived: QueryRun has been archived