zakkisyedCumulative LST Withdrawals [Hourly] copy
    Updated 2024-05-06
    SELECT
    hourly,
    asset,
    SUM(withdraw_amount) OVER (PARTITION BY asset ORDER BY hourly ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_withdraw_amount
    FROM (
    SELECT
    DATE_TRUNC('hour', block_timestamp) AS hourly,
    CASE
    WHEN decoded_log:asset = '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' THEN 'ETHx'
    WHEN decoded_log:asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' THEN 'stETH'
    WHEN decoded_log:asset = '0xac3e018457b222d93114458476f3e3416abbe38f' THEN 'sfrxETH'
    END AS asset,
    SUM(decoded_log:rsETHUnstaked/POW(10,18)) AS withdraw_amount
    FROM
    ethereum.core.ez_decoded_event_logs
    WHERE
    event_name = 'AssetWithdrawalQueued'
    GROUP BY
    hourly,
    CASE
    WHEN decoded_log:asset = '0xa35b1b31ce002fbf2058d22f30f95d405200a15b' THEN 'ETHx'
    WHEN decoded_log:asset = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' THEN 'stETH'
    WHEN decoded_log:asset = '0xac3e018457b222d93114458476f3e3416abbe38f' THEN 'sfrxETH'
    END
    ) AS subquery
    ORDER BY
    hourly DESC, asset;

    QueryRunArchived: QueryRun has been archived