nsa2000Weekly variation of the Osmosis Nakamoto Coefficient
Updated 2022-11-10
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 tab1 as (
SELECT
date_trunc('week', block_timestamp) as day,
validator_address,
sum(CASE WHEN action LIKE 'undelegate' THEN (amount / power(10,6)) * -1
else (amount / power(10,6)) end) as token_flow
FROM osmosis.core.fact_staking
--WHERE action LIKE 'undelegate'
where currency LIKE 'uosmo'
AND REDELEGATE_SOURCE_VALIDATOR_ADDRESS is NULL
GROUP BY 1,2
), tab2 as (
SELECT
date_trunc('week', block_timestamp) as day,
REDELEGATE_SOURCE_VALIDATOR_ADDRESS as validator_address,
sum((amount / power(10,6)) * -1 ) as token_flow
FROM osmosis.core.fact_staking
--WHERE action LIKE 'undelegate'
where currency LIKE 'uosmo'
AND NOT REDELEGATE_SOURCE_VALIDATOR_ADDRESS is NULL
GROUP BY 1,2
), tab3 AS (
SELECT *
FROM TAB1
UNION
SELECT *
FROM TAB2
), tab4 as (
SELECT
DAY,
validator_address,
SUM(token_flow) AS TOKEN_FLOW_TOTAL
Run a query to Download Data