MultipartiteTesting3
    Updated 2024-10-24
    WITH
    bond_rewards AS (
    SELECT DATE(block_timestamp) AS date,
    SUM(bond_e8) AS rune_e8
    FROM thorchain.defi.fact_rewards_events
    GROUP BY date
    ),
    other_rewards AS (
    SELECT DATE(block_timestamp) AS date,
    SUM(rune_e8) AS rune_e8
    FROM thorchain.defi.fact_rewards_event_entries
    GROUP BY date
    )
    SELECT DISTINCT date,
    SUM(rune_e8) OVER(PARTITION BY date) / 1e8 AS block_rewards,
    SUM(rune_e8) OVER(ORDER BY date ASC) / 1e8 AS cumulative_block_rewards
    FROM (
    (SELECT * from bond_rewards)
    UNION ALL
    (SELECT * from other_rewards)
    )
    ORDER BY date DESC
    QueryRunArchived: QueryRun has been archived