From ed7d2eff25221b040f0bdffa949d8c2f57793973 Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 20 Dec 2023 11:57:01 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/feature/swap/domain/SwapInteractorImpl.kt | 11 +++++------ .../java/com/tangem/feature/swap/ui/StateBuilder.kt | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt index 038f23b435..023399ec63 100644 --- a/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt +++ b/features/swap/domain/src/main/java/com/tangem/feature/swap/domain/SwapInteractorImpl.kt @@ -9,7 +9,6 @@ import com.tangem.blockchain.common.transaction.TransactionFee import com.tangem.domain.tokens.GetCryptoCurrencyStatusesSyncUseCase import com.tangem.domain.tokens.model.CryptoCurrency import com.tangem.domain.tokens.model.CryptoCurrencyStatus -import com.tangem.domain.tokens.model.Network import com.tangem.domain.tokens.model.Quote import com.tangem.domain.tokens.repository.QuotesRepository import com.tangem.domain.tokens.utils.convertToAmount @@ -63,7 +62,7 @@ internal class SwapInteractorImpl @Inject constructor( private val swapCurrencyConverter = SwapCurrencyConverter() private val amountFormatter = AmountFormatter() - private var network: Network? = null + private val hundredPercent = BigInteger("100") override suspend fun getTokensDataState(currency: CryptoCurrency): TokensDataStateExpress { val selectedWallet = getSelectedWalletSyncUseCase().fold( @@ -1249,15 +1248,15 @@ internal class SwapInteractorImpl @Inject constructor( val gasLimit = this.gasLimit val increasedGasPrice = this.amount.value?.movePointRight(this.amount.decimals) ?.divide(gasLimit.toBigDecimal(), RoundingMode.HALF_UP) - val increaseGasLimit = gasLimit + val increasedGasLimit = gasLimit .multiply(percentage.toBigInteger()) - .divide(BigInteger("100")) + .divide(hundredPercent) val increasedAmount = this.amount.copy( - value = increaseGasLimit.toBigDecimal().multiply(increasedGasPrice).movePointLeft(this.amount.decimals), + value = increasedGasLimit.toBigDecimal().multiply(increasedGasPrice).movePointLeft(this.amount.decimals), ) return this.copy( amount = increasedAmount, - gasLimit = increaseGasLimit, + gasLimit = increasedGasLimit, ) } diff --git a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt index 4e93debef0..5de6a8037d 100644 --- a/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt +++ b/features/swap/presentation/src/main/java/com/tangem/feature/swap/ui/StateBuilder.kt @@ -378,6 +378,7 @@ internal class StateBuilder( } private fun getSwapButtonEnabled(preparedSwapConfigState: PreparedSwapConfigState): Boolean { + if (preparedSwapConfigState.hasOutgoingTransaction) return false return when (preparedSwapConfigState.includeFeeInAmount) { IncludeFeeInAmount.BalanceNotEnough -> false IncludeFeeInAmount.Excluded ->