CyberaResearchEverything in 1 table + wallet submission by user
Updated 2025-01-03
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
›
⌄
-- Combined Query for JUP Voters: Staking and Voting Insights with Unified User Address
WITH
-- -------------------------------
-- CTEs for Staking Insights
-- -------------------------------
-- CTE for Staking Events (Inflows only)
stak_staking_events AS (
SELECT
signers[0] AS user_wallet,
decoded_instruction:args:amount::int / POW(10, 6) AS amount,
event_type,
block_timestamp
FROM
solana.core.ez_events_decoded
WHERE
program_id = 'voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj' -- JUP staking program ID
AND event_type IN ('increaseLockedAmount') -- Only inflows
AND block_timestamp::date BETWEEN '2024-03-01' AND '2024-11-01' -- Inclusive date range
),
-- CTE to Calculate Total Inflows per User
stak_total_inflows AS (
SELECT
user_wallet,
SUM(amount) AS current_jup_inflows
FROM
stak_staking_events
GROUP BY
user_wallet
),
-- CTE for Wallet Withdrawals (including 'withdrawPartialUnstaking')
stak_wallet_withdrawals AS (
QueryRunArchived: QueryRun has been archived