@@ -402,7 +402,7 @@ fn map_price_aggregated(
402402
403403 let mut aggregated_total = Decimal :: zero ( ) ;
404404 let mut aggregated_count = 0 ;
405- let mut aggregated_weightage = 0u8 ;
405+ let mut aggregated_weightage = 0u32 ;
406406
407407 let oracles_len = oracles. len ( ) ;
408408 for oracle in oracles {
@@ -424,12 +424,7 @@ fn map_price_aggregated(
424424 let time_diff = Decimal :: from ( feed. time ) - Decimal :: from ( context. block . time ) ;
425425 if Decimal :: abs ( & time_diff) < dec ! ( 3600 ) {
426426 aggregated_count += 1 ;
427- aggregated_weightage =
428- aggregated_weightage
429- . checked_add ( oracle. weightage )
430- . context ( OtherSnafu {
431- msg : "Error adding oracle weightage" ,
432- } ) ?;
427+ aggregated_weightage += oracle. weightage as u32 ;
433428 log:: trace!(
434429 "SetOracleData weightage: {:?} * oracle_price.amount: {:?}" ,
435430 aggregated_weightage,
@@ -785,8 +780,8 @@ pub fn invalidate_oracle_interval(
785780 aggregated : OraclePriceAggregatedIntervalAggregated {
786781 amount : aggregated_amount. to_string ( ) ,
787782 weightage : aggregated_weightage
788- . to_u8 ( )
789- . context ( ToPrimitiveSnafu { msg : "to_u8 " } ) ?,
783+ . to_u32 ( )
784+ . context ( ToPrimitiveSnafu { msg : "to_u32 " } ) ?,
790785 count,
791786 oracles : OraclePriceAggregatedIntervalAggregatedOracles {
792787 active : aggregated_active
@@ -847,8 +842,8 @@ fn forward_aggregate(
847842 aggregated : OraclePriceAggregatedIntervalAggregated {
848843 amount : aggregated_amount. to_string ( ) ,
849844 weightage : aggregated_weightage
850- . to_u8 ( )
851- . context ( ToPrimitiveSnafu { msg : "to_u8 " } ) ?,
845+ . to_u32 ( )
846+ . context ( ToPrimitiveSnafu { msg : "to_u32 " } ) ?,
852847 count,
853848 oracles : OraclePriceAggregatedIntervalAggregatedOracles {
854849 active : aggregated_active
0 commit comments