Skip to content

Commit

Permalink
safe add
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Oct 25, 2024
1 parent 0d16235 commit 3b90b85
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ain-ocean/src/indexer/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ fn map_price_aggregated(
let weighted_amount = Decimal::from(feed.amount)
.checked_mul(Decimal::from(oracle.weightage))
.context(ArithmeticOverflowSnafu)?;
aggregated_total += weighted_amount;
aggregated_total = aggregated_total
.checked_add(weighted_amount)
.context(ArithmeticOverflowSnafu)?;
}
}

Expand Down

0 comments on commit 3b90b85

Please sign in to comment.