Updated on 2026-08-14

This commit is contained in:
Tangem 2024-04-12 17:17:39 +05:00
parent c9d28994b4
commit 00c8254540
2 changed files with 6 additions and 5 deletions

View file

@ -8,6 +8,7 @@ import com.tangem.core.ui.extensions.networkIconResId
import com.tangem.core.ui.utils.BigDecimalFormatter
import com.tangem.core.ui.utils.parseToBigDecimal
import com.tangem.domain.common.extensions.fromNetworkId
import com.tangem.domain.common.extensions.minimalAmount
import com.tangem.domain.tokens.GetBalanceNotEnoughForFeeWarningUseCase
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
@ -225,13 +226,14 @@ internal class SendNotificationFactory(
val cryptoCurrencyStatus = cryptoCurrencyStatusProvider()
val balance = cryptoCurrencyStatus.value.amount ?: BigDecimal.ZERO
val isTezos = cryptoCurrencyStatus.currency.network.id.value == Blockchain.Tezos.id
val threshold = Blockchain.Tezos.minimalAmount()
val isTotalBalance = feeAmount.plus(sendAmount) >= balance
if (!ignoreAmountReduce && isTotalBalance && isTezos) {
add(
SendNotification.Warning.HighFeeError(
amount = TEZOS_FEE_THRESHOLD.toPlainString(),
amount = threshold.toPlainString(),
onConfirmClick = {
val reduceTo = sendAmount.minus(TEZOS_FEE_THRESHOLD).toPlainString()
val reduceTo = sendAmount.minus(threshold).toPlainString()
clickIntents.onAmountReduceClick(reduceTo, SendNotification.Warning.HighFeeError::class.java)
},
onCloseClick = {
@ -372,7 +374,6 @@ internal class SendNotificationFactory(
companion object {
private const val DOGECOIN_MINIMUM = "0.01"
private val TEZOS_FEE_THRESHOLD = BigDecimal("0.01")
internal val FEE_MAX_DIFF = BigInteger("5")
}
}

View file

@ -10,6 +10,7 @@ import com.tangem.blockchain.common.transaction.TransactionFee
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
import com.tangem.domain.appcurrency.extenstions.unwrap
import com.tangem.domain.appcurrency.repository.AppCurrencyRepository
import com.tangem.domain.common.extensions.minimalAmount
import com.tangem.domain.tokens.GetCryptoCurrencyStatusesSyncUseCase
import com.tangem.domain.tokens.model.CryptoCurrency
import com.tangem.domain.tokens.model.CryptoCurrencyStatus
@ -433,7 +434,7 @@ internal class SwapInteractorImpl @Inject constructor(
) {
val isTezos = fromTokenStatus.currency.network.id.value == Blockchain.Tezos.id
if (isTezos && amount.value == fromTokenStatus.value.amount) {
warnings.add(Warning.ReduceAmountWarning(TEZOS_FEE_THRESHOLD))
warnings.add(Warning.ReduceAmountWarning(Blockchain.Tezos.minimalAmount()))
}
}
@ -1595,6 +1596,5 @@ internal class SwapInteractorImpl @Inject constructor(
private const val INCREASE_GAS_LIMIT_BY = 112 // 12%
private const val INCREASE_GAS_LIMIT_FOR_SEND = 105 // 5%
private const val INFINITY_SYMBOL = ""
private val TEZOS_FEE_THRESHOLD = BigDecimal("0.01")
}
}