dan-smith2023-12-18 03:21 PM
    Updated 2023-12-18
    SELECT
    dt
    ,net_burn
    ,SUM(net_burn) OVER(ORDER BY dt) AS total_burn
    FROM (
    SELECT
    date_trunc('week',block_timestamp) AS dt
    ,SUM(CASE WHEN supply = 'mint' THEN ASSET_E8 / 1e8
    WHEN supply = 'burn' THEN ASSET_E8 / -1e8
    END) AS net_burn
    FROM thorchain.defi.fact_mint_burn_events
    WHERE asset = 'THOR.RUNE' AND block_timestamp < date_trunc('week',CURRENT_DATE)
    GROUP BY 1
    )
    ORDER BY 1 DESC
    QueryRunArchived: QueryRun has been archived