diff --git a/src/compute_engines/summary_stats/summary_stats.cairo b/src/compute_engines/summary_stats/summary_stats.cairo index 542f06dd..06c89640 100644 --- a/src/compute_engines/summary_stats/summary_stats.cairo +++ b/src/compute_engines/summary_stats/summary_stats.cairo @@ -78,6 +78,7 @@ mod SummaryStats { stop: u64, aggregation_mode: AggregationMode ) -> (u128, u32) { + assert(start < stop, 'start must be < stop'); let oracle_address = self.oracle_address.read(); let oracle_dispatcher = IOracleABIDispatcher { contract_address: oracle_address }; @@ -130,6 +131,7 @@ mod SummaryStats { num_samples: u64, aggregation_mode: AggregationMode, ) -> (u128, u32) { + assert(start_tick < end_tick, 'start_tick must be < end_tick'); let oracle_address = self.oracle_address.read(); assert(num_samples > 0, 'num_samples must be > 0'); @@ -140,7 +142,6 @@ mod SummaryStats { .get_latest_checkpoint_index(data_type, aggregation_mode); let (_start_cp, start_index) = oracle_dispatcher .get_last_checkpoint_before(data_type, start_tick, aggregation_mode); - let decimals = oracle_dispatcher.get_decimals(data_type); let mut end_index = 0; if (end_tick == 0) { @@ -168,8 +169,8 @@ mod SummaryStats { tick_arr.append(TickElem { tick: cp.timestamp, value: fixed_val }); idx += 1; }; - - (volatility(tick_arr.span()), decimals) + //the number of decimals is hardcoded to 8 by the volatilty computation in metrics.cairo + (volatility(tick_arr.span()), 8) }