Sniper2024-04-29 02:20 PM
Updated 2024-04-29
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
›
⌄
with tbl as (SELECT
trunc(BLOCK_TIMESTAMP,'day') AS date,
CASE when action = 'delegate' then amount
when action = 'undelegate' then amount*-1
-- when action = 'redelegate' then amount*-1
else amount*-1 end as volume,
sum(volume/pow(10,6)) AS total_amount
-- SUM(total_amount) OVER (PARTITION BY date ORDER BY total_amount DESC) AS address_balance,
-- row_number() OVER (PARTITION BY date ORDER BY total_amount DESC) AS rank
FROM
axelar.gov.fact_staking
WHERE
action IN ('delegate', 'undelegate')
GROUP BY 1,2
)
select
sum (total_amount) as balance
from tbl
QueryRunArchived: QueryRun has been archived