Updated on 2026-08-14

This commit is contained in:
Tangem 2023-12-07 17:02:28 +03:00
parent 6303e0b5af
commit e2c5c7ec75
4 changed files with 20 additions and 12 deletions

View file

@ -878,9 +878,8 @@ internal class SwapViewModel @Inject constructor(
if (it.key != bestRateEntry.key) {
val amount = it.value.toTokenInfo.tokenAmount.value
val percentDiff = BigDecimal.ONE.minus(
amount.divide(bestRate, RoundingMode.HALF_UP)
.multiply(hundredPercent),
)
amount.divide(bestRate, RoundingMode.HALF_UP),
).multiply(hundredPercent)
percentDiff.setScale(2, RoundingMode.HALF_UP).toFloat().absoluteValue
} else {
null