Updated on 2026-08-14
This commit is contained in:
parent
097b9ec463
commit
82e3fc2451
17 changed files with 64 additions and 88 deletions
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<SmellBaseline>
|
||||
<ManuallySuppressedIssues/>
|
||||
<CurrentIssues>
|
||||
<ID>NestedScopeFunctions:YieldSupplyGetRewardsBalanceUseCase.kt$YieldSupplyGetRewardsBalanceUseCase$let { rate -> amt.multiply(rate) }</ID>
|
||||
<ID>UnnecessaryNotNullCheck:YieldSupplyGetProtocolBalanceUseCase.kt$YieldSupplyGetProtocolBalanceUseCase$requireNotNull(cryptoCurrency as CryptoCurrency.Token)</ID>
|
||||
</CurrentIssues>
|
||||
</SmellBaseline>
|
||||
|
|
@ -17,7 +17,7 @@ class YieldSupplyGetProtocolBalanceUseCase(
|
|||
userWalletId: UserWalletId,
|
||||
cryptoCurrency: CryptoCurrency,
|
||||
): Either<YieldSupplyError, BigDecimal?> = Either.catch {
|
||||
requireNotNull(cryptoCurrency as CryptoCurrency.Token)
|
||||
requireNotNull(cryptoCurrency as? CryptoCurrency.Token)
|
||||
|
||||
yieldSupplyTransactionRepository.getEffectiveProtocolBalance(
|
||||
userWalletId = userWalletId,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.tangem.domain.yield.supply.usecase
|
||||
|
||||
import com.tangem.core.ui.format.bigdecimal.format
|
||||
import com.tangem.core.ui.format.bigdecimal.anyDecimals
|
||||
import com.tangem.core.ui.format.bigdecimal.fiat
|
||||
import com.tangem.core.ui.format.bigdecimal.format
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
|
|
@ -23,10 +23,14 @@ class YieldSupplyGetRewardsBalanceUseCase(
|
|||
) {
|
||||
|
||||
operator fun invoke(status: CryptoCurrencyStatus, appCurrency: AppCurrency): Flow<String> = flow {
|
||||
val amount: BigDecimal? = status.value.amount?.let { amt ->
|
||||
status.value.fiatRate?.let { rate -> amt.multiply(rate) }
|
||||
val cryptoAmount = status.value.amount
|
||||
val fiatRate = status.value.fiatRate
|
||||
|
||||
val amount = if (cryptoAmount != null && fiatRate != null) {
|
||||
cryptoAmount.multiply(fiatRate)
|
||||
} else {
|
||||
return@flow
|
||||
}
|
||||
if (amount == null) return@flow
|
||||
|
||||
val tokenAddress = (status.currency as? CryptoCurrency.Token)?.contractAddress ?: return@flow
|
||||
val apy = try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue