Query editor
-- Daily Gas Cost breakdown (from chain launch) — explicit formula + smoothingWITH daily AS (SELECTblock_date,SUM(computation_cost) AS computation_cost,SUM(storage_cost) AS storage_cost, -- refundable + non_refundableSUM(non_refundable_storage_fee) AS non_ref_fee,SUM(storage_rebate) AS storage_rebateFROM sui_daily.statsWHERE block_date >= DATE '2023-05-03'GROUP BY block_date)SELECTblock_date,-- Componentscomputation_cost AS "Computation Cost",(storage_cost - non_ref_fee) AS "Refundable Storage Cost",non_ref_fee AS "Non-Refundable Storage Fee",-storage_rebate AS "Storage Rebate (negative)",-- Totals (all equivalent to the stated formula)(computation_cost + (storage_cost - non_ref_fee) + non_ref_fee - storage_rebate)AS "Total Daily Gas Cost (raw)",GREATEST(computation_cost + storage_cost - storage_rebate, 0)AS "Total Daily Gas Cost (>=0)",AVG(computation_cost + storage_cost - storage_rebate)OVER (ORDER BY block_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW)AS "Total Daily Gas Cost (7D MA)"FROM dailyORDER BY block_date;