Updated on 2026-08-14

This commit is contained in:
Tangem 2025-10-17 14:27:13 +05:00
parent 56b509927c
commit 6afae8e619
4 changed files with 16 additions and 10 deletions

View file

@ -64,4 +64,9 @@ sealed class ExpressDataError {
override val code: Int = -2
override val message: String = "tooLargeSolanaTransaction"
}
data object DexActiveSupplyError : ExpressDataError() {
override val code: Int = -3
override val message: String = "dexActiveSupplyError"
}
}

View file

@ -334,6 +334,14 @@ internal class SwapInteractorImpl @AssistedInject constructor(
isBalanceWithoutFeeEnough: Boolean,
expressOperationType: ExpressOperationType,
): Pair<SwapProvider, SwapState> {
if (fromToken.value.yieldSupplyStatus?.isActive == true) {
return provider to produceDexSwapDataError(
error = ExpressDataError.DexActiveSupplyError,
fromToken = fromToken,
amount = amount,
)
}
val maybeQuotes = repository.findBestQuote(
userWallet = userWallet,
fromContractAddress = fromToken.currency.getContractAddress(),

View file

@ -1267,16 +1267,7 @@ internal class SwapModel @Inject constructor(
toToken.currency.id.value
}
return groupToFind.available.find { idToFind == it.currencyStatus.currency.id.value }?.providers
?.filter { provider ->
// !!!WARNING!!! Filter out dex provider if yield supply is active
val yieldSupplyStatus = fromToken.value.yieldSupplyStatus
if (yieldSupplyStatus != null && yieldSupplyStatus.isActive) {
provider.type == ExchangeProviderType.CEX
} else {
true
}
}.orEmpty()
return groupToFind.available.find { idToFind == it.currencyStatus.currency.id.value }?.providers.orEmpty()
}
private fun Map<SwapProvider, SwapState>.getLastLoadedSuccessStates(): SuccessLoadedSwapData {