Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-25 14:14:09 +05:00
commit 65de183f73
2 changed files with 6 additions and 1 deletions

View file

@ -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)

View file

@ -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