Updated on 2026-08-14
This commit is contained in:
parent
748793e67d
commit
8c258d0b7c
22 changed files with 192 additions and 163 deletions
|
|
@ -274,6 +274,14 @@ sealed class NotificationUM(val config: NotificationConfig) {
|
|||
title = resourceReference(id = R.string.yield_module_balance_info_sheet_title, wrappedList(tokenName)),
|
||||
subtitle = resourceReference(id = R.string.yield_module_balance_info_sheet_subtitle),
|
||||
)
|
||||
|
||||
data class YieldSupplyNotAllAmountSupplied(val formattedAmount: String, val symbol: String) : Warning(
|
||||
title = resourceReference(
|
||||
id = R.string.yield_module_amount_not_transfered_to_aave_title,
|
||||
formatArgs = wrappedList(formattedAmount, symbol),
|
||||
),
|
||||
subtitle = TextReference.EMPTY,
|
||||
)
|
||||
}
|
||||
|
||||
open class Info(
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import com.tangem.domain.models.StatusSource
|
|||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.currency.yieldSupplyKey
|
||||
import com.tangem.domain.models.currency.yieldSupplyNotAllAmountSupplied
|
||||
import com.tangem.domain.models.staking.YieldBalance
|
||||
import com.tangem.domain.staking.utils.getTotalWithRewardsStakingBalance
|
||||
import com.tangem.utils.StringsSigns.DASH_SIGN
|
||||
|
|
@ -271,8 +270,7 @@ class TokenItemStateConverter(
|
|||
isFlickering = status.value.isFlickering(),
|
||||
icons = buildList {
|
||||
if (status.value.yieldSupplyStatus?.isActive == true &&
|
||||
status.value.yieldSupplyStatus?.isAllowedToSpend == false ||
|
||||
status.yieldSupplyNotAllAmountSupplied()
|
||||
status.value.yieldSupplyStatus?.isAllowedToSpend == false
|
||||
) {
|
||||
TokenItemState.FiatAmountState.Content.IconUM(
|
||||
iconRes = R.drawable.ic_alert_triangle_20,
|
||||
|
|
|
|||
|
|
@ -1679,6 +1679,7 @@
|
|||
<string name="yield_module_deposit_error_notification_title">Der erhaltene Betrag %1$s %2$s wurde nicht auf Aave eingezahlt.</string>
|
||||
<string name="yield_module_fee_policy_sheet_current_fee_title">Aktuelle Gebühr</string>
|
||||
<string name="yield_module_fee_policy_sheet_max_fee_title">Maximale Gebühr</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">Dies ist die niedrigste Einzahlung, die an Aave gesendet werden kann. Um Einzahlungen rentabel zu halten, verarbeiten wir sie nicht, wenn die Netzwerkgebühren 4 % des Betrags übersteigen.</string>
|
||||
<string name="yield_module_fee_policy_sheet_title">Gebührenpolitik</string>
|
||||
<string name="yield_module_high_fee_error">Die Netzwerkgebühr ist derzeit zu hoch. Warte, bis sie unter Dein Limit fällt.</string>
|
||||
<string name="yield_module_historical_returns">Historische Renditen</string>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<string name="account_details_archive_description">このアカウントをアーカイブしますが、いつでも復元できます。</string>
|
||||
<string name="account_details_title">アカウント</string>
|
||||
<string name="account_edit_success_message">アカウントが保存されました</string>
|
||||
<string name="account_for_rewards">報酬用のアカウント</string>
|
||||
<string name="account_form_account_index">アカウント番号%s — アドレス導出に使用されます。</string>
|
||||
<string name="account_form_create_button">アカウントを追加</string>
|
||||
<string name="account_form_edit_button">保存</string>
|
||||
|
|
@ -969,6 +970,10 @@
|
|||
<string name="reset_card_to_factory_condition_2">このカードを使用して、現在のウォレットの他のカードのアクセスコードを回復させられないことを認識しています。</string>
|
||||
<string name="reset_card_with_backup_to_factory_message">工場出荷時設定にリセットすると、選択したカードやリングからウォレットが完全に削除されます。現在のウォレットを復元したり、カードやリングを使用してアクセスコードを復元することはできません。</string>
|
||||
<string name="reset_card_without_backup_to_factory_message">工場出荷時の状態にリセットすると、選択したカードやリングからウォレットが完全に削除され、アプリから削除されます。現在のウォレットを復元することはできません。</string>
|
||||
<string name="reset_cards_dialog_complete_description">すべてのTangemデバイスがリセットされました。</string>
|
||||
<string name="reset_cards_dialog_first_description">アクティベーション処理中に問題が発生しました。カードを1枚ずつリセットしてください。</string>
|
||||
<string name="reset_cards_dialog_first_title">カード認証に失敗しました</string>
|
||||
<string name="reset_cards_dialog_next_device_description">続行するには次のデバイスをリセットしてください</string>
|
||||
<string name="ring_promo_text">Tangem Ringユーザーは、11/15日までChangelly経由でスワップを3回手数料ゼロで行えます!</string>
|
||||
<string name="ring_promo_title">今すぐ手数料0% でスワップしましょう!</string>
|
||||
<string name="save_user_wallet_agreement_access_description">アプリにログインして、カードまたはリングをスキャンせずに残高を確認できます</string>
|
||||
|
|
@ -1728,8 +1733,8 @@
|
|||
<string name="xtz_withdrawal_message_ignore">いいえ、すべて送信します</string>
|
||||
<string name="xtz_withdrawal_message_reduce">%s XTZを減らす</string>
|
||||
<string name="xtz_withdrawal_message_warning">次回ウォレットにチャージするときに手数料の増加を避けるには、金額を%s XTZ減らしてください。</string>
|
||||
<string name="yield_module_alert_description">資産残高に関するテキスト [プレースホルダー]</string>
|
||||
<string name="yield_module_alert_title">%sはAaveに預けられています</string>
|
||||
<string name="yield_module_amount_not_transfered_to_aave_title">受け取った金額%1$s %2$sはAaveに入金されませんでした。</string>
|
||||
<string name="yield_module_approve_needed_notification_cta">承認する</string>
|
||||
<string name="yield_module_approve_needed_notification_description">前回の承認に問題があったため、新しい承認が必要です。手続き方法を選択してください。</string>
|
||||
<string name="yield_module_approve_needed_notification_title">承認が必要</string>
|
||||
|
|
@ -1743,6 +1748,8 @@
|
|||
<string name="yield_module_earn_badge">年利%1$s%%</string>
|
||||
<string name="yield_module_earn_sheet_available_title">利用可能</string>
|
||||
<string name="yield_module_earn_sheet_current_apy_title">現在のAPY</string>
|
||||
<string name="yield_module_earn_sheet_fee_description">貸付のためにチャージする際は、ネットワーク手数料が金額から差し引かれます(手数料は常に%1$s以下です)。</string>
|
||||
<string name="yield_module_earn_sheet_high_fee_description">現在、ネットワーク手数料が高すぎるため貸付を実行できません。手数料が%1$s以下に下がり次第、資金が供給されます。</string>
|
||||
<string name="yield_module_earn_sheet_my_funds_title">私の資金</string>
|
||||
<string name="yield_module_earn_sheet_provider_description">あなたの%1$sはAaveに預けられ、利息が付きます。あなたは%2$sトークンを保有しており、これは残高を表し、時間の経過とともに増加します。入金すると、資金はAaveに預け入れられ、取引手数料を差し引いた利息が付きます。</string>
|
||||
<string name="yield_module_earn_sheet_title">利回りを得る</string>
|
||||
|
|
@ -1758,7 +1765,7 @@
|
|||
<string name="yield_module_fee_policy_sheet_min_amount_title">最低入金額</string>
|
||||
<string name="yield_module_fee_policy_sheet_title">手数料ポリシー</string>
|
||||
<string name="yield_module_fee_policy_tangem_service_fee_title">Tangemはまた、得られた利回りに対して3%のサービス手数料を差し引きます。</string>
|
||||
<string name="yield_module_high_fee_error">ネットワーク手数料が現在高すぎます。設定した上限を下回るまで待機しています。</string>
|
||||
<string name="yield_module_high_fee_error">ネットワーク手数料が下がるか、残高が必要な最低額に達すると、自動的にAaveへ送金されます。</string>
|
||||
<string name="yield_module_historical_returns">過去のリターン</string>
|
||||
<string name="yield_module_main_view_approve_notification_description">ここに説明を入力してください。1〜3行が理想的です。[プレースホルダー]</string>
|
||||
<string name="yield_module_main_view_approve_notification_title">トークン承認が必要</string>
|
||||
|
|
@ -1787,14 +1794,14 @@
|
|||
<string name="yield_module_start_earning_sheet_next_deposits">次回以降の入金は自動的にAaveに供給されます。</string>
|
||||
<string name="yield_module_status_active">アクティブ</string>
|
||||
<string name="yield_module_status_paused">停止中</string>
|
||||
<string name="yield_module_stop_earning">収益を停止する</string>
|
||||
<string name="yield_module_stop_earning">利回りモードを無効にする</string>
|
||||
<string name="yield_module_stop_earning_sheet_description">オフにすると、Aaveから資金が引き出され、ウォレットの%sに戻され、報酬の獲得が停止されます。</string>
|
||||
<string name="yield_module_stop_earning_sheet_fee_note">出金金額からネットワーク手数料が差し引かれます。</string>
|
||||
<string name="yield_module_supply_apr">供給APY</string>
|
||||
<string name="yield_module_token_details_earn_notification_apy">APY</string>
|
||||
<string name="yield_module_token_details_earn_notification_description">あなたの資産を眠らせない — 残高を運用して利息を得ましょう。</string>
|
||||
<string name="yield_module_token_details_earn_notification_description">自分で管理しながら、資金をバックグラウンドで運用しましょう。</string>
|
||||
<string name="yield_module_token_details_earn_notification_earning_on_your_balance_subtitle">利息は自動的に発生します</string>
|
||||
<string name="yield_module_token_details_earn_notification_earning_on_your_balance_title">Aaveの利回り</string>
|
||||
<string name="yield_module_token_details_earn_notification_earning_on_your_balance_title">利回りモード</string>
|
||||
<string name="yield_module_token_details_earn_notification_processing">入金の処理中</string>
|
||||
<string name="yield_module_token_details_earn_notification_title">残高を活用</string>
|
||||
<string name="yield_module_transfer_mode_automatic">自動</string>
|
||||
|
|
|
|||
|
|
@ -1569,6 +1569,7 @@
|
|||
<string name="xtz_withdrawal_message_ignore">Нет, отправить все</string>
|
||||
<string name="xtz_withdrawal_message_reduce">Уменьшить на %s XTZ</string>
|
||||
<string name="xtz_withdrawal_message_warning">Чтобы не платить повышенную комиссию при следующем пополнении кошелька, уменьшите сумму на %s XTZ</string>
|
||||
<string name="yield_module_alert_description">Ваши средства сейчас размещены в протоколе AAVE, но вы можете управлять ими в любое время.</string>
|
||||
<string name="yield_module_alert_title">Ваш %s внесён в Aave</string>
|
||||
<string name="yield_module_approve_needed_notification_cta">Выдать разрешение</string>
|
||||
<string name="yield_module_approve_needed_notification_description">Что-то пошло не так с вашим предыдущим разрешением, поэтому требуется новое. Выберите, как хотите продолжить.</string>
|
||||
|
|
@ -1592,7 +1593,7 @@
|
|||
<string name="yield_module_fee_policy_sheet_description">Все следующие пополнения %s автоматически поступят в Aave с удержанием комиссии за транзакцию.</string>
|
||||
<string name="yield_module_fee_policy_sheet_max_fee_note">Если комиссия сети превысит максимальный лимит, транзакция не будет выполнена до тех пор, пока комиссия не снизится. Вы сможете изменить этот лимит позже.</string>
|
||||
<string name="yield_module_fee_policy_sheet_max_fee_title">Максимальная комиссия</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">Комиссия за транзакцию должна быть ниже 4% от суммы депозита. Tangem переведёт средства в Aave, как только это условие будет выполнено.</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">Это минимальный депозит, который можно отправить в Aave. Чтобы депозиты оставались прибыльными, мы не обрабатываем их, когда комиссия сети превышает 4% от суммы.</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_title">Минимальный депозит</string>
|
||||
<string name="yield_module_fee_policy_sheet_title">Политика комиссий</string>
|
||||
<string name="yield_module_fee_policy_tangem_service_fee_title">Tangem взимает комиссию за обслуживание в размере 3% от полученного дохода.</string>
|
||||
|
|
@ -1602,7 +1603,7 @@
|
|||
<string name="yield_module_network_fee_unreachable_notification_description">Проверьте ваше интернет соединение</string>
|
||||
<string name="yield_module_network_fee_unreachable_notification_title">Информация о комиссии недоступна</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_subtitle">Каждое пополнение вашего адреса автоматически будет отправляться в Aave.</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_title">Ваш баланс работает автоматически</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_title">Автоперевод в AAVE</string>
|
||||
<string name="yield_module_promo_screen_cash_out_subtitle">Отправляйте, обменивайте или продавайте свои средства мгновенно, когда захотите.</string>
|
||||
<string name="yield_module_promo_screen_cash_out_title">Мгновенный вывод средств</string>
|
||||
<string name="yield_module_promo_screen_how_it_works_button_title">Как это работает?</string>
|
||||
|
|
|
|||
|
|
@ -1430,4 +1430,5 @@
|
|||
<string name="xtz_withdrawal_message_ignore">Ні, відправити все</string>
|
||||
<string name="xtz_withdrawal_message_reduce">Зменшити на %s XTZ</string>
|
||||
<string name="xtz_withdrawal_message_warning">Щоб не платити підвищену комісію при наступному поповненні гаманця, зменште суму на %s XTZ</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">Це найменший депозит, який можна надіслати в Aave. Щоб депозити залишалися прибутковими, ми не обробляємо їх, коли комісія мережі перевищує 4% від суми.</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
<string name="account_archived_recover_error_title">Can\'t recover account</string>
|
||||
<string name="account_archived_title">Archived</string>
|
||||
<string name="account_could_not_archive">We couldn’t archive account. Please try again later.</string>
|
||||
<string name="account_could_not_archive_referral_program_message">This account participates in the referral program.</string>
|
||||
<string name="account_could_not_archive_referral_program_title">This account cannot be archived.</string>
|
||||
<string name="account_could_not_create">We couldn’t create account. Please try again later.</string>
|
||||
<string name="account_create_success_message">Account created</string>
|
||||
<string name="account_details_archive">Archive account</string>
|
||||
|
|
@ -555,6 +557,7 @@
|
|||
<string name="hw_backup_section_other_title">Other methods</string>
|
||||
<string name="hw_backup_seed_description">Physical devices that securely store your private key offline.</string>
|
||||
<string name="hw_backup_seed_title">Recovery phrase</string>
|
||||
<string name="hw_backup_to_upgrade_description">To upgrade your wallet to hardware, back it up first.</string>
|
||||
<string name="hw_create_keys_description">Your private keys are securely encrypted and stored on your phone</string>
|
||||
<string name="hw_create_keys_title">Keys are stored in the app</string>
|
||||
<string name="hw_create_seed_description">Create or restore your wallet using a recovery phrase — your built-in backup.</string>
|
||||
|
|
@ -993,7 +996,7 @@
|
|||
<string name="reset_card_with_backup_to_factory_message">Factory Reset will completely delete the wallet from the selected card or ring. You will not be able to restore the current wallet or use the card or ring to recover the access code.</string>
|
||||
<string name="reset_card_without_backup_to_factory_message">Factory Reset will completely delete the wallet from the selected card or ring and remove it from the app. You will not be able to restore the current wallet.</string>
|
||||
<string name="reset_cards_dialog_complete_description">All Tangem devices have been reset.</string>
|
||||
<string name="reset_cards_dialog_first_description">Something went wrong with activation process. Please reset cards one by one.</string>
|
||||
<string name="reset_cards_dialog_first_description">Something went wrong with the activation process. Please reset the cards one by one.</string>
|
||||
<string name="reset_cards_dialog_first_title">Card verification failed</string>
|
||||
<string name="reset_cards_dialog_next_device_description">Please reset the next device to continue</string>
|
||||
<string name="ring_promo_text">Ring owners get 3 commission-free swaps on Changelly until 15.11!</string>
|
||||
|
|
@ -1326,6 +1329,8 @@
|
|||
<string name="tangem_pay_transaction_fee_notification_text">This fee goes to cover the cost of handling your transfer.</string>
|
||||
<string name="tangem_pay_withdrawal">Withdrawal</string>
|
||||
<string name="tangempay_card_details_change_pin">Change PIN</string>
|
||||
<string name="tangempay_card_details_change_pin_success_description">The card is fully ready for payments.</string>
|
||||
<string name="tangempay_card_details_change_pin_success_title">PIN code created</string>
|
||||
<string name="tangempay_card_details_error_text">Failed to load data. Try again later.</string>
|
||||
<string name="tangempay_card_details_freeze_card">Freeze Card</string>
|
||||
<string name="tangempay_card_details_hide_text">Hide</string>
|
||||
|
|
@ -1805,9 +1810,9 @@
|
|||
<string name="xtz_withdrawal_message_ignore">No, send all</string>
|
||||
<string name="xtz_withdrawal_message_reduce">Reduce by %s XTZ</string>
|
||||
<string name="xtz_withdrawal_message_warning">To avoid paying an increased commission the next time you top up your wallet, reduce the amount by %s XTZ</string>
|
||||
<string name="yield_module_alert_description">Text about your money in balance [PLACEHOLDER]</string>
|
||||
<string name="yield_module_alert_title">Your %s is deposited in Aave</string>
|
||||
<string name="yield_module_amount_not_transfered_to_aave_title">The amount received, %1$s %2$s was not deposited to Aave.</string>
|
||||
<string name="yield_module_alert_description">Your funds are currently supplied to the Aave protocol, but you can manage them at any time.</string>
|
||||
<string name="yield_module_alert_title">Your %s is supplied to Aave</string>
|
||||
<string name="yield_module_amount_not_transfered_to_aave_title">Supplying %1$s %2$s to Aave is pending</string>
|
||||
<string name="yield_module_approve_needed_notification_cta">Give Approve</string>
|
||||
<string name="yield_module_approve_needed_notification_description">Something went wrong with your previous approval, so we need a new one. Choose how you’d like to proceed.</string>
|
||||
<string name="yield_module_approve_needed_notification_title">Approve needed</string>
|
||||
|
|
@ -1817,66 +1822,66 @@
|
|||
<string name="yield_module_balance_info_sheet_subtitle">Text about your money in balance [PLACEHOLDER]</string>
|
||||
<string name="yield_module_balance_info_sheet_title">Your %s is deposited in Aave</string>
|
||||
<string name="yield_module_chart_loading_error">Unable to load chart...</string>
|
||||
<string name="yield_module_deposit_error_notification_title">The amount received, %1$s %2$s was not deposited to Aave.</string>
|
||||
<string name="yield_module_deposit_error_notification_title">The amount received, %1$s %2$s was not supplied to Aave.</string>
|
||||
<string name="yield_module_earn_badge">APY %1$s%%</string>
|
||||
<string name="yield_module_earn_sheet_available_title">Available</string>
|
||||
<string name="yield_module_earn_sheet_current_apy_title">Current APY</string>
|
||||
<string name="yield_module_earn_sheet_fee_description">When topping up for lending, a network fee will be deducted from the amount — never more than %1$s</string>
|
||||
<string name="yield_module_earn_sheet_fee_description">When topping up for lending, a network fee not exceeding %1$s will be deducted from the balance.</string>
|
||||
<string name="yield_module_earn_sheet_high_fee_description">The network fee is currently too high to execute lending. Funds will be supplied once it drops to %1$s or below. </string>
|
||||
<string name="yield_module_earn_sheet_my_funds_title">My funds</string>
|
||||
<string name="yield_module_earn_sheet_provider_description">Your %1$s is now deposited in Aave and earning interest. You hold a%2$s token, which represents your balance and grows over time. When you top up, funds go to Aave to earn interest, minus a transaction fee.</string>
|
||||
<string name="yield_module_earn_sheet_provider_description">Your %1$s is now deposited in Aave and earning interest. You hold a%2$s token, which represents your balance and grows over time. When you deposit more funds, they\'ll be supplied to Aave to earn interest, minus a transaction fee.</string>
|
||||
<string name="yield_module_earn_sheet_title">Earn</string>
|
||||
<string name="yield_module_earn_sheet_total_earnings_title">Total earnings</string>
|
||||
<string name="yield_module_earn_sheet_transfers_title">Transfers to Aave</string>
|
||||
<string name="yield_module_explore_sheet_explore_aave_button_title">Explore Aave</string>
|
||||
<string name="yield_module_fee_policy_sheet_current_fee_note">This is the current supply fee on %s. The live cost will be shown on the Receive Screen.</string>
|
||||
<string name="yield_module_fee_policy_sheet_current_fee_note">This is the current supply fee on %s. The actual cost will be shown on the activation tab.</string>
|
||||
<string name="yield_module_fee_policy_sheet_current_fee_title">Current fee</string>
|
||||
<string name="yield_module_fee_policy_sheet_description">All future %s top-ups will be supplied to Aave automatically, with the transaction fee deducted.</string>
|
||||
<string name="yield_module_fee_policy_sheet_description">All future %s deposits will be supplied to Aave automatically, with the transaction fee deducted.</string>
|
||||
<string name="yield_module_fee_policy_sheet_max_fee_note">If network fees rise above maximum fee, the transaction won’t go through until they decrease. You can change this limit later.</string>
|
||||
<string name="yield_module_fee_policy_sheet_max_fee_title">Maximum fee</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">The transaction fee must stay below 4% of your deposit. Tangem will transfer funds to Aave only once your balance is large enough to meet this condition.</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_title">Minimal top-up</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_note">This is the lowest amount that can be supplied to Aave. To keep the yield mode profitable, we won’t supply assets when network fees exceed 4% of the amount.</string>
|
||||
<string name="yield_module_fee_policy_sheet_min_amount_title">Minimal deposit</string>
|
||||
<string name="yield_module_fee_policy_sheet_title">Fee policy</string>
|
||||
<string name="yield_module_fee_policy_tangem_service_fee_title">Tangem also takes a 3% service fee on the yield earned.</string>
|
||||
<string name="yield_module_high_fee_error">Your funds will be automatically transferred to Aave once network fees are lower or your balance meets the minimum required amount.</string>
|
||||
<string name="yield_module_fee_policy_tangem_service_fee_title">Tangem also takes a 3% service fee on yield earned.</string>
|
||||
<string name="yield_module_high_fee_error">Your funds will be automatically supplied to Aave once network fees are lower or your balance meets the minimum required amount.</string>
|
||||
<string name="yield_module_historical_returns">Historical returns</string>
|
||||
<string name="yield_module_main_view_approve_notification_description">Write description here. In one, two or three lines will be awesome. [PLACEHOLDER]</string>
|
||||
<string name="yield_module_main_view_approve_notification_title">Some token approve needed</string>
|
||||
<string name="yield_module_main_view_approve_notification_title">Token approvals needed</string>
|
||||
<string name="yield_module_network_fee_unreachable_notification_description">Check your network connection</string>
|
||||
<string name="yield_module_network_fee_unreachable_notification_title">Network fee info unreachable</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_subtitle">Every top-up of your account will be lended to Aave automatically.</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_title">Your balance works automatically</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_subtitle">Every deposit you make will be suplied to Aave automatically.</string>
|
||||
<string name="yield_module_promo_screen_auto_balance_title">Auto-Transfer to Aave</string>
|
||||
<string name="yield_module_promo_screen_cash_out_subtitle">Send, swap, or sell your funds instantly, anytime you want.</string>
|
||||
<string name="yield_module_promo_screen_cash_out_title">Access to funds at any time</string>
|
||||
<string name="yield_module_promo_screen_cash_out_title">Access your funds anytime</string>
|
||||
<string name="yield_module_promo_screen_how_it_works_button_title">How it works?</string>
|
||||
<string name="yield_module_promo_screen_self_custodial_subtitle">Aave is a decentralized protocol managing over $81.9 billion in total value.</string>
|
||||
<string name="yield_module_promo_screen_self_custodial_title">Decentralized and self-custodial</string>
|
||||
<string name="yield_module_promo_screen_terms_disclaimer">By using service, you agree with provider\n%1$s and %2$s</string>
|
||||
<string name="yield_module_promo_screen_terms_disclaimer">By using this service, you agree with provider\n%1$s and %2$s</string>
|
||||
<string name="yield_module_promo_screen_title">Connect Aave</string>
|
||||
<string name="yield_module_promo_screen_variable_rate_info">Aave %1$s%% • Variable Interest Rate</string>
|
||||
<string name="yield_module_provider">Aave</string>
|
||||
<string name="yield_module_rate_info_sheet_chart_average">Avg %s</string>
|
||||
<string name="yield_module_rate_info_sheet_chart_title">Last year returns</string>
|
||||
<string name="yield_module_rate_info_sheet_description">Current interest rate is always variable and automatically computed by AAVE on-chain smart-contract based on real-time supply and demand.</string>
|
||||
<string name="yield_module_rate_info_sheet_chart_title">Last year\'s returns</string>
|
||||
<string name="yield_module_rate_info_sheet_description">Current interest rate is always variable and automatically computed by the Aave on-chain smart-contract, based on real-time supply and demand.</string>
|
||||
<string name="yield_module_rate_info_sheet_powered_by">Powered by</string>
|
||||
<string name="yield_module_rate_info_sheet_title">Interest rate is variable</string>
|
||||
<string name="yield_module_receive_sheet_description">When you top up, your funds will be automatically sent to Aave to start earning interest. A small fee equal to %s will be deducted to cover the transaction.</string>
|
||||
<string name="yield_module_receive_sheet_description">When you top up, your funds will be automatically sent to Aave to start earning interest. %s will be deducted to cover the transaction fee.</string>
|
||||
<string name="yield_module_start_earning">Supply assets</string>
|
||||
<string name="yield_module_start_earning_sheet_description">Your %s will be supplied to Aave and will stay instantly available</string>
|
||||
<string name="yield_module_start_earning_sheet_description">Your %s will be supplied to Aave, but will remain manageable.</string>
|
||||
<string name="yield_module_start_earning_sheet_fee_policy">See fee policy</string>
|
||||
<string name="yield_module_start_earning_sheet_next_deposits">Your next top-ups will be automatically supplied to Aave.</string>
|
||||
<string name="yield_module_start_earning_sheet_next_deposits">Your next deposits will be automatically supplied to Aave.</string>
|
||||
<string name="yield_module_status_active">Active</string>
|
||||
<string name="yield_module_status_paused">Paused</string>
|
||||
<string name="yield_module_stop_earning">Disable yield mode</string>
|
||||
<string name="yield_module_stop_earning_sheet_description">Turning off will withdraw your funds from Aave, return them to %s in your wallet, and stop earning rewards.</string>
|
||||
<string name="yield_module_stop_earning_sheet_description">Turning this off will withdraw your funds from Aave to %s in your wallet and it will stop earning rewards.</string>
|
||||
<string name="yield_module_stop_earning_sheet_fee_note">The network fee will be deducted from the amount you withdraw.</string>
|
||||
<string name="yield_module_supply_apr">Supply APY</string>
|
||||
<string name="yield_module_token_details_earn_notification_apy">APY</string>
|
||||
<string name="yield_module_token_details_earn_notification_description">Let your funds work in the background while you stay in control.</string>
|
||||
<string name="yield_module_token_details_earn_notification_description">Let your funds do the work while you stay in control.</string>
|
||||
<string name="yield_module_token_details_earn_notification_earning_on_your_balance_subtitle">Interest accrues automatically</string>
|
||||
<string name="yield_module_token_details_earn_notification_earning_on_your_balance_title">Yield mode</string>
|
||||
<string name="yield_module_token_details_earn_notification_processing">Processing your deposit</string>
|
||||
<string name="yield_module_token_details_earn_notification_title">Make your balance work for you</string>
|
||||
<string name="yield_module_token_details_earn_notification_title">Make your assets work for you</string>
|
||||
<string name="yield_module_transfer_mode_automatic">Automatic</string>
|
||||
<string name="yield_module_unable_to_cover_fee_description">Deposit some %1$s %2$s to cover the network fee for transactions</string>
|
||||
<string name="yield_module_unable_to_cover_fee_title">Unable to cover %s fee</string>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.tangem.data.tokens.repository
|
|||
|
||||
import com.tangem.blockchain.blockchains.polkadot.ExistentialDepositProvider
|
||||
import com.tangem.blockchain.common.*
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.data.tokens.converters.UtxoConverter
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
|
|
@ -19,7 +18,6 @@ import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
|||
import com.tangem.utils.extensions.isZero
|
||||
import com.tangem.utils.extensions.orZero
|
||||
import kotlinx.coroutines.withContext
|
||||
import timber.log.Timber
|
||||
import java.math.BigDecimal
|
||||
|
||||
internal class DefaultCurrencyChecksRepository(
|
||||
|
|
@ -168,27 +166,4 @@ internal class DefaultCurrencyChecksRepository(
|
|||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun getProtocolBalance(
|
||||
userWalletId: UserWalletId,
|
||||
cryptoCurrencyStatus: CryptoCurrencyStatus,
|
||||
): BigDecimal? {
|
||||
val token = cryptoCurrencyStatus.currency as? CryptoCurrency.Token ?: return null
|
||||
val isActive = cryptoCurrencyStatus.value.yieldSupplyStatus?.isActive ?: false
|
||||
if (!isActive) return null
|
||||
return runCatching {
|
||||
val walletManager = walletManagersFacade.getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = token.network.toBlockchain(),
|
||||
derivationPath = token.network.derivationPath.value,
|
||||
) ?: error("Wallet manager not found")
|
||||
walletManager.getEffectiveProtocolBalance(
|
||||
token = Token(
|
||||
symbol = token.symbol,
|
||||
contractAddress = token.contractAddress,
|
||||
decimals = token.decimals,
|
||||
),
|
||||
)
|
||||
}.onFailure(Timber::e).getOrThrow()
|
||||
}
|
||||
}
|
||||
|
|
@ -73,10 +73,4 @@ sealed class CryptoCurrencyWarning {
|
|||
val requiredAmount: BigDecimal,
|
||||
val currencyDecimals: Int,
|
||||
) : CryptoCurrencyWarning()
|
||||
|
||||
data class YieldSupplyNotDepositedAmount(
|
||||
val currency: CryptoCurrency,
|
||||
val currencySymbol: String,
|
||||
val amount: BigDecimal,
|
||||
) : CryptoCurrencyWarning()
|
||||
}
|
||||
|
|
@ -51,8 +51,7 @@ class GetCurrencyWarningsUseCase(
|
|||
flowOf(currencyChecksRepository.getRentInfoWarning(userWalletId, currencyStatus)),
|
||||
flowOf(currencyChecksRepository.getExistentialDeposit(userWalletId, currency.network)),
|
||||
flowOf(currencyChecksRepository.getFeeResourceAmount(userWalletId, currency.network)),
|
||||
flowOf(currencyChecksRepository.getProtocolBalance(userWalletId, currencyStatus)),
|
||||
) { coinRelatedWarnings, maybeRentWarning, maybeEdWarning, maybeFeeResource, yieldSupplyProtocolBalance ->
|
||||
) { coinRelatedWarnings, maybeRentWarning, maybeEdWarning, maybeFeeResource ->
|
||||
setOfNotNull(
|
||||
maybeRentWarning,
|
||||
maybeEdWarning?.let { getExistentialDepositWarning(currency, it) },
|
||||
|
|
@ -63,7 +62,6 @@ class GetCurrencyWarningsUseCase(
|
|||
getBeaconChainShutdownWarning(rawId = currency.network.id.rawId),
|
||||
getAssetRequirementsWarning(userWalletId = userWalletId, currency = currency),
|
||||
getMigrationFromMaticToPolWarning(currency),
|
||||
getYieldSupplyWarning(cryptoCurrencyStatus = currencyStatus, yieldSupplyProtocolBalance),
|
||||
)
|
||||
}.flowOn(dispatchers.io)
|
||||
}
|
||||
|
|
@ -263,28 +261,6 @@ class GetCurrencyWarningsUseCase(
|
|||
}
|
||||
}
|
||||
|
||||
private fun getYieldSupplyWarning(
|
||||
cryptoCurrencyStatus: CryptoCurrencyStatus,
|
||||
protocolBalance: BigDecimal?,
|
||||
): CryptoCurrencyWarning? {
|
||||
val value = cryptoCurrencyStatus.value
|
||||
val isActive = value.yieldSupplyStatus?.isActive == true
|
||||
val amount = value.amount
|
||||
|
||||
if (!isActive || protocolBalance == null || amount == null) return null
|
||||
|
||||
val notDepositedAmount = amount.minus(protocolBalance)
|
||||
return if (notDepositedAmount > BigDecimal.ZERO) {
|
||||
CryptoCurrencyWarning.YieldSupplyNotDepositedAmount(
|
||||
currency = cryptoCurrencyStatus.currency,
|
||||
amount = notDepositedAmount,
|
||||
currencySymbol = cryptoCurrencyStatus.currency.symbol,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun BigDecimal?.isZero(): Boolean {
|
||||
return this?.signum() == 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,11 +61,4 @@ interface CurrencyChecksRepository {
|
|||
currencyStatus: CryptoCurrencyStatus,
|
||||
balanceAfterTransaction: BigDecimal,
|
||||
): CryptoCurrencyWarning.Rent?
|
||||
|
||||
/**
|
||||
* Returns the YieldSupplied protocol balance in Aave for the given `cryptoCurrency`.
|
||||
* This represents the amount supplied to the protocol for the specified `userWalletId`
|
||||
* (e.g., aTokens balance). Returns null if not applicable or unknown.
|
||||
*/
|
||||
suspend fun getProtocolBalance(userWalletId: UserWalletId, cryptoCurrencyStatus: CryptoCurrencyStatus): BigDecimal?
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import arrow.core.Either
|
|||
import arrow.core.Either.Companion.catch
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.currency.yieldSupplyKey
|
||||
import com.tangem.domain.models.quote.QuoteStatus
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.quotes.QuotesRepository
|
||||
|
|
@ -51,7 +52,9 @@ class YieldSupplyGetMaxFeeUseCase(
|
|||
?: error("Native fiat rate is missing")
|
||||
require(nativeFiatRate > BigDecimal.ZERO) { "Native fiat rate must be > 0" }
|
||||
|
||||
val marketToken = yieldSupplyRepository.getTokenStatus(token)
|
||||
val cachedMarketToken = yieldSupplyRepository.getCachedMarkets().orEmpty()
|
||||
.firstOrNull { it.yieldSupplyKey == token.yieldSupplyKey() }
|
||||
val marketToken = cachedMarketToken ?: yieldSupplyRepository.getTokenStatus(token)
|
||||
val maxFeeNative = marketToken.maxFeeNative.toBigDecimal()
|
||||
|
||||
val rateRatio = nativeFiatRate.divide(
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import com.tangem.features.tokenreceive.entity.ReceiveAddress.Type.Ens
|
|||
import com.tangem.features.tokenreceive.entity.ReceiveAddress.Type.Primary
|
||||
import com.tangem.features.tokenreceive.ui.state.TokenReceiveUM
|
||||
import com.tangem.utils.Provider
|
||||
import com.tangem.utils.extensions.addIf
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
|
|
@ -138,12 +137,7 @@ internal class TokenReceiveStateFactory(
|
|||
tokenName: String,
|
||||
tokenReceiveNotification: List<TokenReceiveNotification>,
|
||||
): List<NotificationUM> {
|
||||
val yieldSupplyNotification: TokenReceiveNotification? =
|
||||
tokenReceiveNotification.firstOrNull { it.isYieldSupplyNotification }
|
||||
return buildList {
|
||||
addIf(yieldSupplyNotification != null) {
|
||||
NotificationUM.Warning.YieldSupplyIsActive(tokenName)
|
||||
}
|
||||
add(
|
||||
NotificationUM.Info(
|
||||
title = resourceReference(
|
||||
|
|
|
|||
|
|
@ -156,10 +156,6 @@ internal class TokenDetailsNotificationConverter(
|
|||
)
|
||||
is CryptoCurrencyWarning.MigrationMaticToPol -> MigrationMaticToPol
|
||||
is CryptoCurrencyWarning.UsedOutdatedDataWarning -> UsedOutdatedData
|
||||
is CryptoCurrencyWarning.YieldSupplyNotDepositedAmount -> YieldSupplyNotTransferedToAave(
|
||||
tokenName = warning.currencySymbol,
|
||||
amount = warning.amount.format { crypto(symbol = "", decimals = warning.currency.decimals) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ internal sealed class YieldSupplyUM {
|
|||
val subtitle: TextReference,
|
||||
val rewardsApy: TextReference,
|
||||
val onClick: () -> Unit,
|
||||
val isAllowedToSpend: Boolean,
|
||||
val showWarningIcon: Boolean,
|
||||
) : YieldSupplyUM()
|
||||
|
||||
@Immutable
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.tangem.core.ui.extensions.stringReference
|
|||
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.models.currency.yieldSupplyNotAllAmountSupplied
|
||||
import com.tangem.domain.models.network.TxInfo
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.models.yield.supply.YieldSupplyStatus
|
||||
|
|
@ -238,28 +239,29 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
yieldSupplyStatus?.isActive == true -> {
|
||||
val cryptoCurrencyToken = cryptoCurrency as? CryptoCurrency.Token ?: return
|
||||
if (!yieldSupplyStatus.isAllowedToSpend) {
|
||||
analyticsEventsHandler.send(
|
||||
YieldSupplyAnalytics.NoticeApproveNeeded(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
loadActiveState(
|
||||
cryptoCurrencyToken = cryptoCurrencyToken,
|
||||
cryptoCurrencyStatus = cryptoCurrencyStatus,
|
||||
yieldSupplyStatus = yieldSupplyStatus,
|
||||
)
|
||||
}
|
||||
|
||||
else -> {
|
||||
loadTokenStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadActiveState(cryptoCurrencyToken: CryptoCurrency.Token, yieldSupplyStatus: YieldSupplyStatus) {
|
||||
private fun loadActiveState(cryptoCurrencyStatus: CryptoCurrencyStatus, yieldSupplyStatus: YieldSupplyStatus) {
|
||||
val cryptoCurrencyToken = cryptoCurrency as? CryptoCurrency.Token ?: return
|
||||
val showWarningIcon = !yieldSupplyStatus.isAllowedToSpend ||
|
||||
cryptoCurrencyStatus.yieldSupplyNotAllAmountSupplied()
|
||||
if (!yieldSupplyStatus.isAllowedToSpend) {
|
||||
analyticsEventsHandler.send(
|
||||
YieldSupplyAnalytics.NoticeApproveNeeded(
|
||||
token = cryptoCurrency.symbol,
|
||||
blockchain = cryptoCurrency.network.name,
|
||||
),
|
||||
)
|
||||
}
|
||||
modelScope.launch(dispatchers.default) {
|
||||
yieldSupplyGetTokenStatusUseCase(cryptoCurrencyToken)
|
||||
.onRight { tokenStatus ->
|
||||
|
|
@ -278,7 +280,7 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
stringReference(" ${tokenStatus.apy}%"),
|
||||
),
|
||||
onClick = ::onActiveClick,
|
||||
isAllowedToSpend = yieldSupplyStatus.isAllowedToSpend,
|
||||
showWarningIcon = showWarningIcon,
|
||||
apy = tokenStatus.apy.toString(),
|
||||
)
|
||||
}
|
||||
|
|
@ -294,7 +296,7 @@ internal class YieldSupplyModel @Inject constructor(
|
|||
),
|
||||
rewardsApy = TextReference.EMPTY,
|
||||
onClick = ::onActiveClick,
|
||||
isAllowedToSpend = yieldSupplyStatus.isAllowedToSpend,
|
||||
showWarningIcon = showWarningIcon,
|
||||
apy = "",
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ private fun SupplyContent(supplyUM: YieldSupplyUM.Content) {
|
|||
)
|
||||
}
|
||||
SpacerW8()
|
||||
AnimatedVisibility(supplyUM.isAllowedToSpend.not()) {
|
||||
AnimatedVisibility(supplyUM.showWarningIcon) {
|
||||
Icon(
|
||||
imageVector = ImageVector.vectorResource(R.drawable.ic_alert_triangle_20),
|
||||
contentDescription = null,
|
||||
|
|
@ -317,7 +317,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
|
|||
rewardsApy = stringReference("5.1 % APY"),
|
||||
onClick = {},
|
||||
apy = "5.1",
|
||||
isAllowedToSpend = false,
|
||||
showWarningIcon = false,
|
||||
),
|
||||
YieldSupplyUM.Content(
|
||||
title = stringReference("Aave lending is active"),
|
||||
|
|
@ -325,7 +325,7 @@ private class PreviewProvider : PreviewParameterProvider<YieldSupplyUM> {
|
|||
rewardsApy = stringReference("5.1 % APY"),
|
||||
onClick = {},
|
||||
apy = "5.1",
|
||||
isAllowedToSpend = true,
|
||||
showWarningIcon = true,
|
||||
),
|
||||
YieldSupplyUM.Loading,
|
||||
YieldSupplyUM.Processing.Enter,
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ internal class YieldSupplyActiveComponent(
|
|||
state = state,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
chartComponent = chartComponent,
|
||||
onReadMoreClick = params.callback::onReadMoreClick,
|
||||
modifier = Modifier,
|
||||
)
|
||||
}
|
||||
|
|
@ -76,5 +77,6 @@ internal class YieldSupplyActiveComponent(
|
|||
fun onBackClick()
|
||||
fun onStopEarning()
|
||||
fun onApprove()
|
||||
fun onReadMoreClick()
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.tangem.features.yield.supply.impl.subcomponents.active.entity
|
|||
|
||||
import com.tangem.common.ui.notifications.NotificationUM
|
||||
import com.tangem.core.ui.extensions.TextReference
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
internal data class YieldSupplyActiveContentUM(
|
||||
val totalEarnings: TextReference,
|
||||
|
|
@ -9,7 +10,7 @@ internal data class YieldSupplyActiveContentUM(
|
|||
val providerTitle: TextReference,
|
||||
val subtitle: TextReference,
|
||||
val subtitleLink: TextReference,
|
||||
val notificationUM: NotificationUM?,
|
||||
val notifications: ImmutableList<NotificationUM>,
|
||||
val minAmount: TextReference?,
|
||||
val currentFee: TextReference?,
|
||||
val feeDescription: TextReference?,
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@ import com.tangem.core.decompose.di.ModelScoped
|
|||
import com.tangem.core.decompose.model.Model
|
||||
import com.tangem.core.decompose.model.ParamsContainer
|
||||
import com.tangem.core.decompose.navigation.Router
|
||||
import com.tangem.core.navigation.url.UrlOpener
|
||||
import com.tangem.features.yield.supply.impl.subcomponents.active.YieldSupplyActiveComponent
|
||||
import com.tangem.features.yield.supply.impl.subcomponents.active.YieldSupplyActiveEntryComponent
|
||||
import com.tangem.features.yield.supply.impl.subcomponents.approve.YieldSupplyApproveComponent
|
||||
import com.tangem.features.yield.supply.impl.subcomponents.stopearning.YieldSupplyStopEarningComponent
|
||||
import com.tangem.utils.TangemBlogUrlBuilder
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
@ -16,6 +18,7 @@ internal class YieldSupplyActiveEntryModel @Inject constructor(
|
|||
override val dispatchers: CoroutineDispatcherProvider,
|
||||
paramsContainer: ParamsContainer,
|
||||
private val router: Router,
|
||||
private val urlOpener: UrlOpener,
|
||||
) : Model(), YieldSupplyActiveComponent.ModelCallback,
|
||||
YieldSupplyStopEarningComponent.ModelCallback,
|
||||
YieldSupplyApproveComponent.ModelCallback {
|
||||
|
|
@ -37,4 +40,8 @@ internal class YieldSupplyActiveEntryModel @Inject constructor(
|
|||
override fun onApprove() {
|
||||
router.push(YieldSupplyActiveRoute.Approve)
|
||||
}
|
||||
|
||||
override fun onReadMoreClick() {
|
||||
urlOpener.openUrl(TangemBlogUrlBuilder.YIELD_SUPPLY_HOW_IT_WORKS_URL)
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import com.tangem.core.ui.format.bigdecimal.format
|
|||
import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetProtocolBalanceUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyGetTokenStatusUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.YieldSupplyMinAmountUseCase
|
||||
|
|
@ -29,9 +30,13 @@ import com.tangem.features.yield.supply.impl.subcomponents.active.YieldSupplyAct
|
|||
import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM
|
||||
import com.tangem.utils.StringsSigns.DASH_SIGN
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toPersistentList
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
import java.math.BigDecimal
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("LongParameterList")
|
||||
|
|
@ -65,7 +70,7 @@ internal class YieldSupplyActiveModel @Inject constructor(
|
|||
formatArgs = wrappedList(cryptoCurrency.symbol, cryptoCurrency.symbol),
|
||||
),
|
||||
subtitleLink = resourceReference(R.string.common_read_more),
|
||||
notificationUM = null,
|
||||
notifications = persistentListOf(),
|
||||
minAmount = null,
|
||||
currentFee = null,
|
||||
feeDescription = null,
|
||||
|
|
@ -108,27 +113,13 @@ internal class YieldSupplyActiveModel @Inject constructor(
|
|||
cryptoCurrency = cryptoCurrency,
|
||||
).getOrNull()
|
||||
|
||||
val approvalNotification = if (cryptoCurrencyStatus.value.yieldSupplyStatus?.isAllowedToSpend != true) {
|
||||
NotificationUM.Error(
|
||||
title = resourceReference(R.string.yield_module_approve_needed_notification_title),
|
||||
subtitle = resourceReference(R.string.yield_module_approve_needed_notification_description),
|
||||
iconResId = R.drawable.ic_alert_triangle_20,
|
||||
buttonState = NotificationConfig.ButtonsState.PrimaryButtonConfig(
|
||||
text = resourceReference(R.string.yield_module_approve_needed_notification_cta),
|
||||
onClick = params.callback::onApprove,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
loadApy()
|
||||
loadMinAmount()
|
||||
loadFees()
|
||||
|
||||
uiState.update {
|
||||
it.copy(
|
||||
notificationUM = approvalNotification,
|
||||
notifications = getNotifications(cryptoCurrencyStatus),
|
||||
availableBalance = stringReference(
|
||||
protocolBalance.format {
|
||||
crypto(
|
||||
|
|
@ -153,11 +144,58 @@ internal class YieldSupplyActiveModel @Inject constructor(
|
|||
)
|
||||
}
|
||||
}.onLeft {
|
||||
uiState.update {
|
||||
it.copy(
|
||||
apy = TextReference.Str(DASH_SIGN),
|
||||
)
|
||||
}
|
||||
Timber.e("Error loading token status")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getNotifications(cryptoCurrencyStatus: CryptoCurrencyStatus): ImmutableList<NotificationUM> {
|
||||
val approvalNotification = if (cryptoCurrencyStatus.value.yieldSupplyStatus?.isAllowedToSpend != true) {
|
||||
NotificationUM.Error(
|
||||
title = resourceReference(R.string.yield_module_approve_needed_notification_title),
|
||||
subtitle = resourceReference(R.string.yield_module_approve_needed_notification_description),
|
||||
iconResId = R.drawable.ic_alert_triangle_20,
|
||||
buttonState = NotificationConfig.ButtonsState.PrimaryButtonConfig(
|
||||
text = resourceReference(R.string.yield_module_approve_needed_notification_cta),
|
||||
onClick = params.callback::onApprove,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val notSuppliedNotification = getNotSuppliedNotification(cryptoCurrencyStatus)
|
||||
return listOfNotNull(
|
||||
approvalNotification,
|
||||
notSuppliedNotification,
|
||||
).toPersistentList()
|
||||
}
|
||||
|
||||
private fun getNotSuppliedNotification(cryptoCurrencyStatus: CryptoCurrencyStatus): NotificationUM? {
|
||||
val value = cryptoCurrencyStatus.value
|
||||
val isActive = value.yieldSupplyStatus?.isActive == true
|
||||
val effectiveProtocolBalance = value.yieldSupplyStatus?.effectiveProtocolBalance ?: null
|
||||
val amount = value.amount
|
||||
|
||||
if (!isActive || effectiveProtocolBalance == null || amount == null) return null
|
||||
|
||||
val notDepositedAmount = amount.minus(effectiveProtocolBalance)
|
||||
return if (notDepositedAmount > BigDecimal.ZERO) {
|
||||
val formattedAmount =
|
||||
notDepositedAmount.format { crypto(symbol = "", decimals = cryptoCurrencyStatus.currency.decimals) }
|
||||
NotificationUM.Warning.YieldSupplyNotAllAmountSupplied(
|
||||
formattedAmount = formattedAmount,
|
||||
symbol = cryptoCurrency.symbol,
|
||||
)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadMinAmount() {
|
||||
modelScope.launch(dispatchers.default) {
|
||||
yieldSupplyMinAmountUseCase(
|
||||
|
|
|
|||
|
|
@ -28,17 +28,20 @@ import androidx.compose.ui.unit.dp
|
|||
import com.tangem.common.ui.notifications.NotificationUM
|
||||
import com.tangem.core.ui.components.*
|
||||
import com.tangem.core.ui.components.notifications.Notification
|
||||
import com.tangem.core.ui.components.notifications.NotificationConfig
|
||||
import com.tangem.core.ui.decompose.ComposableContentComponent
|
||||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.features.yield.supply.impl.R
|
||||
import com.tangem.features.yield.supply.impl.subcomponents.active.entity.YieldSupplyActiveContentUM
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
@Composable
|
||||
internal fun YieldSupplyActiveContent(
|
||||
state: YieldSupplyActiveContentUM,
|
||||
isBalanceHidden: Boolean,
|
||||
onReadMoreClick: () -> Unit,
|
||||
chartComponent: ComposableContentComponent,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
|
|
@ -61,16 +64,23 @@ internal fun YieldSupplyActiveContent(
|
|||
chartComponent.Content(Modifier.padding(bottom = 12.dp))
|
||||
}
|
||||
|
||||
AnimatedVisibility(state.notificationUM != null) {
|
||||
val wrappedNotification = remember(this) { requireNotNull(state.notificationUM) }
|
||||
Notification(
|
||||
config = wrappedNotification.config,
|
||||
iconTint = null,
|
||||
containerColor = TangemTheme.colors.background.action,
|
||||
)
|
||||
AnimatedVisibility(state.notifications.isNotEmpty()) {
|
||||
val notifications = remember(state.notifications) { state.notifications }
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
notifications.forEach { notificationUM ->
|
||||
Notification(
|
||||
config = notificationUM.config,
|
||||
containerColor = TangemTheme.colors.background.action,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
YieldSupplyActiveMyFunds(state = state, isBalanceHidden = isBalanceHidden)
|
||||
YieldSupplyActiveMyFunds(
|
||||
state = state,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
onReadMoreClick = onReadMoreClick,
|
||||
)
|
||||
|
||||
AnimatedVisibility(state.feeDescription != null) {
|
||||
Text(
|
||||
|
|
@ -108,7 +118,7 @@ private fun CurrentApy(apy: TextReference?, modifier: Modifier = Modifier) {
|
|||
TextShimmer(
|
||||
modifier = modifier.width(94.dp),
|
||||
text = "",
|
||||
style = TangemTheme.typography.head,
|
||||
style = TangemTheme.typography.h2,
|
||||
)
|
||||
} else {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
|
|
@ -123,7 +133,7 @@ private fun CurrentApy(apy: TextReference?, modifier: Modifier = Modifier) {
|
|||
Text(
|
||||
modifier = modifier,
|
||||
text = apyText,
|
||||
style = TangemTheme.typography.body1,
|
||||
style = TangemTheme.typography.h2,
|
||||
color = TangemTheme.colors.text.accent,
|
||||
)
|
||||
}
|
||||
|
|
@ -134,7 +144,11 @@ private fun CurrentApy(apy: TextReference?, modifier: Modifier = Modifier) {
|
|||
|
||||
@Suppress("LongMethod")
|
||||
@Composable
|
||||
private fun YieldSupplyActiveMyFunds(state: YieldSupplyActiveContentUM, isBalanceHidden: Boolean) {
|
||||
private fun YieldSupplyActiveMyFunds(
|
||||
state: YieldSupplyActiveContentUM,
|
||||
onReadMoreClick: () -> Unit,
|
||||
isBalanceHidden: Boolean,
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
|
|
@ -164,7 +178,7 @@ private fun YieldSupplyActiveMyFunds(state: YieldSupplyActiveContentUM, isBalanc
|
|||
)
|
||||
}
|
||||
SpacerH8()
|
||||
DescriptionText(state = state)
|
||||
DescriptionText(state = state, onReadMoreClick = onReadMoreClick)
|
||||
SpacerH8()
|
||||
HorizontalDivider(
|
||||
thickness = 0.5.dp,
|
||||
|
|
@ -206,14 +220,14 @@ private fun YieldSupplyActiveMyFunds(state: YieldSupplyActiveContentUM, isBalanc
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun DescriptionText(state: YieldSupplyActiveContentUM) {
|
||||
private fun DescriptionText(state: YieldSupplyActiveContentUM, onReadMoreClick: () -> Unit) {
|
||||
val subtitle = annotatedReference {
|
||||
append(state.subtitle.resolveReference())
|
||||
appendSpace()
|
||||
withLink(
|
||||
LinkAnnotation.Clickable(
|
||||
tag = "LINK_TAG",
|
||||
linkInteractionListener = {},
|
||||
linkInteractionListener = { onReadMoreClick() },
|
||||
),
|
||||
{
|
||||
appendColored(
|
||||
|
|
@ -324,6 +338,7 @@ private fun YieldSupplyActiveBottomSheet_Preview(
|
|||
state = params,
|
||||
isBalanceHidden = true,
|
||||
chartComponent = ComposableContentComponent.EMPTY,
|
||||
onReadMoreClick = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -340,15 +355,27 @@ private class YieldSupplyActiveBottomSheetPreviewProvider : PreviewParameterProv
|
|||
wrappedList("USDT", "USDT"),
|
||||
),
|
||||
subtitleLink = resourceReference(R.string.common_read_more),
|
||||
notificationUM = NotificationUM.Error.InvalidAmount,
|
||||
apy = stringReference("5,14%"),
|
||||
notifications = persistentListOf(
|
||||
NotificationUM.Error.InvalidAmount,
|
||||
NotificationUM.Info(
|
||||
title = resourceReference(
|
||||
R.string.yield_module_amount_not_transfered_to_aave_title,
|
||||
wrappedList(
|
||||
"0,03",
|
||||
),
|
||||
),
|
||||
subtitle = TextReference.EMPTY,
|
||||
iconTint = NotificationConfig.IconTint.Accent,
|
||||
),
|
||||
),
|
||||
minAmount = stringReference("50 USDT"),
|
||||
isHighFee = true,
|
||||
currentFee = stringReference("30 USDT"),
|
||||
feeDescription = stringReference(
|
||||
"The network fee is currently too high to execute lending." +
|
||||
"Funds will be supplied once it drops to \$12 or below. ",
|
||||
),
|
||||
currentFee = stringReference("30 USDT"),
|
||||
apy = stringReference("5,14%"),
|
||||
isHighFee = true,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue