CyberaResearchJUP Staking - v2 sw total v4
    Updated 1 day ago
    -- Enable recursive CTEs
    WITH RECURSIVE

    -- 1. Filter relevant transactions for all signers in the staking program
    filtered_signers AS (
    SELECT DISTINCT
    di.block_timestamp,
    di.block_id,
    di.tx_id,
    LOWER(di.signers[0]::STRING) AS signer, -- Use the first signer as the user's wallet
    di.program_id,
    di.event_type,
    di.decoded_instruction
    FROM
    solana.core.fact_decoded_instructions di
    WHERE
    di.program_id = 'voTpe3tHQ7AjQHMapgSue2HJFAh2cGsdokqN3XqmVSj'
    AND di.event_type IN (
    'mergePartialUnstaking',
    'openPartialUnstaking',
    'increaseLockedAmount',
    'toggleMaxLock',
    'newEscrow',
    'withdraw',
    'withdrawPartialUnstaking'
    )
    ),

    -- 2. Extract and sum withdrawal amounts per transaction and signer
    withdrawals AS (
    SELECT
    fe.tx_id,
    LOWER(fe.signers[0]::STRING) AS signer,
    SUM(
    CASE
    WHEN ed.event_type IN ('withdraw', 'withdrawPartialUnstaking') THEN
    Last run: about 15 hours ago
    SNAPSHOT_DATE
    Total Amount Being Unstaked
    Total Unique Signers from newEscrow
    1
    2025-04-21 00:00:00.00082081330.423566693040
    2
    2025-04-20 00:00:00.00081604951.365641692959
    3
    2025-04-19 00:00:00.00081153650.865961692835
    4
    2025-04-18 00:00:00.00080816685.263926692524
    5
    2025-04-17 00:00:00.00080707549.835777692420
    6
    2025-04-16 00:00:00.00081304954.237003692305
    7
    2025-04-15 00:00:00.00081795742.319206692157
    8
    2025-04-14 00:00:00.00085443472.321728692081
    9
    2025-04-13 00:00:00.00085429239.569116691942
    10
    2025-04-12 00:00:00.00084822436.781424691838
    11
    2025-04-11 00:00:00.00083769469.043754691687
    12
    2025-04-10 00:00:00.00083487448.693293691462
    13
    2025-04-09 00:00:00.00082926294.679169691235
    14
    2025-04-08 00:00:00.00081691120.876251691076
    15
    2025-04-07 00:00:00.00082562229.579697690095
    16
    2025-04-06 00:00:00.00082755429.293547689628
    17
    2025-04-05 00:00:00.00083876906.750863689530
    18
    2025-04-04 00:00:00.00087733823.097749689439
    19
    2025-04-03 00:00:00.00086610354.540779689353
    20
    2025-04-02 00:00:00.00081326901.535662689217
    ...
    423
    21KB
    63s