dannyamahHourly Cloud Staking
    Updated 2025-03-06
    WITH stake AS (
    SELECT
    date_trunc('hour', t.block_timestamp) as hour,
    'stake' as type,
    amount as stake_amount
    FROM solana.core.fact_transfers t
    join solana.core.fact_events e
    On t.tx_id = e.tx_id
    WHERE 1 = 1
    AND program_id = 'bon4Kh3x1uQK16w9b9DKgz3Aw4AP1pZxBJk55Q6Sosb'
    AND mint = 'CLoUDKc4Ane7HeQcPpE3YHnznRxhMimJ4MyaUqyHFzAu'
    -- AND t.tx_id = '2rz4azpEkTzkcmuN2j3eyut32yWd2cWSgm2bKhf9uUBYdcKurxDFB4J5jgKmoN1WgoMBiNaZVDFevh25RK26VA5A'
    AND succeeded
    AND t.block_timestamp >= '2025-02-20'
    ),

    unstake AS (
    SELECT
    date_trunc('hour', t.block_timestamp) as hour,
    'unstake' as type,
    - amount as unstake_amount
    FROM solana.core.fact_transfers t
    join solana.core.fact_events e
    On t.tx_id = e.tx_id
    WHERE 1 = 1
    AND program_id = 'bon4Kh3x1uQK16w9b9DKgz3Aw4AP1pZxBJk55Q6Sosb'
    AND mint = 'sc1dNAxRBj5CNWaGC26AR7PEW75R36Umzt1V8vuP8kZ'
    -- AND t.tx_id = '4NJzcukr2kbVy8LT17cNJmCz5MXCSA8p69cCSCtsbFpCbDQkaLg3rQtT11mT7DJn99qj6JpktrBJPhGHZjL1bMix'
    AND succeeded
    AND t.block_timestamp >= '2025-02-20'
    ),

    -- Unstaking takes 30 days. sCLOUD gradually converts to CLOUD over this period.
    -- You can cancel the unstaking anytime to instantly claim your available CLOUD and remaining sCLOUD.
    cancel_unstake AS (
    select
    QueryRunArchived: QueryRun has been archived