nitsValidator based Distribution
Updated 2022-12-08
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
staking as (
SELECT tx_hash
FROM near.core.fact_actions_events_function_call
WHERE method_name in ('deposit_and_stake')
),
stakes as (
SELECT
block_timestamp,
tx_hash as tx,
tx_receiver as validator,
tx_signer as delegator,
tx:actions[0]:FunctionCall:deposit/pow(10,24) near_staked
FROM near.core.fact_transactions
WHERE tx_hash in (select * from staking)
),
monthly as (
SELECT
trunc(block_timestamp,'month') as months,
tx,
validator,
near_staked
--amount_staked/pow(10,24) as near_staked
FROM stakes WHERE near_staked is not null
),
totals as (
SELECT
months,
sum(near_staked) as month_near_staked,
sum(month_near_staked) over (order by months)as total_near_staked
from monthly
group by 1 order by 1
),
ranking as (
SELECT
months,
Run a query to Download Data