Skip to content

Commit

Permalink
Update oracle.rs
Browse files Browse the repository at this point in the history
In the ERC20 interface, the maximum number of decimals is 18, but it is better to use `saturating_sub`
  • Loading branch information
zjb0807 authored Oct 17, 2024
1 parent 8c19bd7 commit 50f79fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/common/src/precompile/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ where
}
};

let maybe_adjustment_multiplier = 10u128.checked_pow((18 - decimals).into());
let maybe_adjustment_multiplier = 10u128.checked_pow((18u8.saturating_sub(decimals)).into());
let adjustment_multiplier = match maybe_adjustment_multiplier {
Some(adjustment_multiplier) => adjustment_multiplier,
None => {
Expand Down

0 comments on commit 50f79fc

Please sign in to comment.