Updated 2025-02-03
    SELECT
    week,
    staked_amount,
    total_stakes,
    stakers,
    SUM(staked_amount) OVER (ORDER BY week) AS "cumulative_staked_amount",
    SUM(total_stakes) OVER (ORDER BY week) AS "cumulative_total_stakes",
    SUM(stakers) OVER (ORDER BY week) AS "cumulative_stakers"
    FROM (
    SELECT
    DATE_TRUNC('week', block_timestamp) AS week,
    SUM((DECODED_LOG:value::int) / 1e18) AS staked_amount,
    COUNT(DISTINCT tx_hash) AS total_stakes,
    COUNT(DISTINCT origin_from_address) AS stakers
    FROM
    kaia.core.ez_decoded_event_logs
    WHERE
    event_name = 'StakeKlay'
    AND block_timestamp >= '2024-08-29'
    GROUP BY
    week
    ) AS weekly_data
    ORDER BY
    week DESC;

    QueryRunArchived: QueryRun has been archived