FatemeTheLadynear cl8
Updated 2022-11-08
999
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 stakes as (select
block_timestamp,
tx_id as tx,
stake_authority as validator,
post_tx_staked_balance/1e9 - pre_tx_staked_balance/1e9 as sol_delegated
from solana.core.ez_staking_lp_actions
where post_tx_staked_balance > pre_tx_staked_balance
and pre_tx_staked_balance = 0
and event_type = 'delegate'
and succeeded = 'TRUE'
and node_pubkey is not null
),
monthly as (
SELECT
trunc(block_timestamp,'day') as days,
tx,
validator,
sol_delegated
--amount_staked/pow(10,24) as sol_delegated
FROM stakes WHERE sol_delegated is not null
),
totals as (
SELECT
days,
sum(sol_delegated) as month_sol_delegated,
sum(month_sol_delegated) over (order by days)as total_sol_delegated
from monthly
group by 1 order by 1
),
ranking as (
SELECT
days,
validator,
count(distinct tx) as txs,
sum(sol_delegated) as total_near_delegated,
Run a query to Download Data