Updated on 2026-08-14
This commit is contained in:
parent
3531c95908
commit
8f2020725f
2 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue