From 8f2020725fdcae50f2cf91041c380c454171bd4d Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 23 May 2026 00:15:19 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../feature/swap/domain/fee/PatchEthGasLimitForSwap.kt | 5 +++++ .../src/main/java/com/tangem/feature/swap/model/SwapModel.kt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/fee/PatchEthGasLimitForSwap.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/fee/PatchEthGasLimitForSwap.kt index 2a400b9c6b..c61dcf097f 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/fee/PatchEthGasLimitForSwap.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/fee/PatchEthGasLimitForSwap.kt @@ -2,6 +2,8 @@ package com.tangem.feature.swap.domain.fee import com.tangem.blockchain.common.transaction.Fee import com.tangem.blockchain.common.transaction.TransactionFee +import com.tangem.feature.swap.domain.fee.PatchEthGasLimitForSwap.Companion.DEX_PERCENTAGE +import com.tangem.feature.swap.domain.fee.PatchEthGasLimitForSwap.Companion.SEND_PERCENTAGE import java.math.BigInteger import java.math.RoundingMode @@ -59,6 +61,9 @@ class PatchEthGasLimitForSwap(private val percentage: Int) { private fun Fee.increaseGasLimitBy(percentage: Int): Fee { if (this !is Fee.Ethereum) return this val gasLimit = this.gasLimit + + if (gasLimit == BigInteger.ZERO) return this + val increasedGasPrice = this.amount.value?.movePointRight(this.amount.decimals) ?.divide(gasLimit.toBigDecimal(), RoundingMode.HALF_UP) val increasedGasLimit = gasLimit.multiply(percentage.toBigInteger()).divide(HUNDRED_PERCENT) diff --git a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt index 629e7eea51..216c311590 100644 --- a/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt +++ b/features/swap/impl/src/main/java/com/tangem/feature/swap/model/SwapModel.kt @@ -2067,7 +2067,7 @@ internal class SwapModel @Inject constructor( toStatus = toSwapCurrencyStatus, amount = swapAmount, swapData = swapDataForCall, - selectedFeeToken = null, + selectedFeeToken = dataState.feePaidCryptoCurrency, ).map { swapFee -> when (val res = swapFee.transactionFeeResult) { is TransactionFeeResult.LoadedExtended -> res.fee.transactionFee