Skip to content

Commit

Permalink
modify the way to convert uint128 to decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki1frsh committed Aug 19, 2023
1 parent 415cd8c commit 89668cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/ibc-denom-resolver/src/execute/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fn fee_and_subtracted(
max: Uint128,
) -> Result<(Uint128, Uint128), ContractError> {
let fee = commission_rate
.checked_mul(Decimal::new(amount))?
.checked_mul(Decimal::from_atomics(amount, 0).unwrap())?
.to_uint_floor()
.min(min)
.max(max);
Expand Down
2 changes: 1 addition & 1 deletion contracts/packet-forward/src/execute/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fn fee_and_subtracted(
commission_rate: Decimal,
) -> Result<(Uint128, Uint128), ContractError> {
let fee = commission_rate
.checked_mul(Decimal::new(amount))?
.checked_mul(Decimal::from_atomics(amount, 0).unwrap())?
.to_uint_floor();
let subtracted = amount.checked_sub(fee)?;

Expand Down

0 comments on commit 89668cb

Please sign in to comment.