danhanUntitled Query
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 unstaketx as(
SELECT BLOCK_TIMESTAMP,
SIGNERS[0] as wallet,
INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:amount/1e9 * -1 as am
from solana.core.fact_transactions
WHERE INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:source::string = 'FysGks3izhgVhrUkub9QQWCTEVAdhkZKYSNK2F25maGD'
and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:accounts[0] = 'AURYydfxJib1ZkTir1Jn1J9ECYUtjb6rKQVmtYaixWPP'
and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:programId = 'STkwf3sbMapjy7KV3hgrJtcVvY4SvRxWQ8pj4Enw1i5'
and BLOCK_TIMESTAMP >= CURRENT_DATE - 60
),
unstake as(
select
sum(am) as total_staked,
COUNT(DISTINCT wallet) as wallets
from unstaketx
),
staketx as(
SELECT BLOCK_TIMESTAMP,
SIGNERS[0] as wallet,
INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:amount/1e9 as am
from solana.core.fact_transactions
where INNER_INSTRUCTIONS[array_size(INNER_INSTRUCTIONS)-1]:instructions[1]:parsed:info:destination::string = 'FysGks3izhgVhrUkub9QQWCTEVAdhkZKYSNK2F25maGD'
and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:accounts[0] = 'AURYydfxJib1ZkTir1Jn1J9ECYUtjb6rKQVmtYaixWPP'
and INSTRUCTIONS[array_size(INSTRUCTIONS)-1]:programId = 'STkwf3sbMapjy7KV3hgrJtcVvY4SvRxWQ8pj4Enw1i5'
and BLOCK_TIMESTAMP >= CURRENT_DATE - 60
),
stake as(
select
sum(am) as total_staked,
COUNT(DISTINCT wallet) as wallets
from staketx
)
select s.total_staked as "Total Staked",
Run a query to Download Data