Updated 2024-11-20
    WITH staking AS (
    SELECT
    tx_hash,
    staker_address,
    amount_usd,
    DATE_TRUNC('week', block_timestamp) AS staking_date
    FROM
    crosschain.olas.ez_olas_staking
    ),
    daily_aggregates AS (
    SELECT
    staking_date,
    SUM(amount_usd) AS "total amount usd",
    COUNT(DISTINCT tx_hash) AS "total stakes",
    COUNT(DISTINCT staker_address) AS "total stakers"
    FROM
    staking
    GROUP BY
    staking_date
    )
    SELECT
    staking_date,
    "total amount usd",
    "total stakes",
    "total stakers",
    SUM("total amount usd") OVER (
    ORDER BY
    staking_date
    ) AS "cumulative total amount usd",
    SUM("total stakes") OVER (
    ORDER BY
    staking_date
    ) AS "cumulative total stakes",
    SUM("total stakers") OVER (
    ORDER BY
    staking_date
    QueryRunArchived: QueryRun has been archived