Updated on 2026-08-14

This commit is contained in:
Tangem 2026-07-21 21:02:24 +05:00
parent d282e2648f
commit 64ea4f5df7
8 changed files with 301 additions and 23 deletions

View file

@ -1194,8 +1194,17 @@ internal class SwapModel @Inject constructor(
private suspend fun isHighNetworkFee(swapFee: SwapFee?): Boolean {
if (!swapFeatureToggles.isHighFeeWarningEnabled) return false
swapFee ?: return false
val feeAmount = swapFee.fee.amount.value ?: return false
return isHighNetworkFeeUseCase(swapFee.selectedFeeToken.currency, feeAmount)
val totalFeeAmount = swapFee.fee.amount.value ?: return false
// SwapFeeFactory folds otherNativeFee into fee.amount ONLY for native-coin fees. Recover the
// gas-only value by subtracting it back in exactly that case; for token-denominated (gasless)
// fees the bridge fee is not folded. Mirrors the guard
// in SwapFeeFactory.foldNativeFee; relevant once DEX gasless supports non-zero native amounts.
val gasFeeAmount = if (swapFee.selectedFeeToken.currency is CryptoCurrency.Coin) {
totalFeeAmount - swapFee.otherNativeFee
} else {
totalFeeAmount
}
return isHighNetworkFeeUseCase(swapFee.selectedFeeToken.currency, gasFeeAmount)
}
private fun sendAnalyticsForNotifications(

View file

@ -299,7 +299,8 @@ internal class SwapNotificationsFactory(
private fun formatFeeCoverageNotification(swapFee: SwapFee): NotificationUM.Warning.FeeCoverageNotification {
val feeAmount = swapFee.fee.amount
val totalFeeValue = (feeAmount.value ?: BigDecimal.ZERO) + swapFee.otherNativeFee
// fee.amount already includes the bridge fee (folded in SwapFeeFactory); no re-add.
val totalFeeValue = feeAmount.value ?: BigDecimal.ZERO
val cryptoAmount = totalFeeValue.format {
crypto(symbol = feeAmount.currencySymbol, decimals = feeAmount.decimals)
}

View file

@ -1324,7 +1324,8 @@ internal class StateBuilder(
private fun formatSwapFeeForSuccess(swapFee: SwapFee): TextReference {
val feeAmount = swapFee.fee.amount
val totalFeeValue = (feeAmount.value ?: BigDecimal.ZERO) + swapFee.otherNativeFee
// fee.amount already includes the bridge fee (folded in SwapFeeFactory); no re-add.
val totalFeeValue = feeAmount.value ?: BigDecimal.ZERO
val cryptoFormatted = totalFeeValue.format {
crypto(symbol = feeAmount.currencySymbol, decimals = feeAmount.decimals)
}