From 7053ff7b56b1768625b16e38383b7e2a1d31f362 Mon Sep 17 00:00:00 2001 From: Alunara Date: Sun, 23 Nov 2025 02:03:20 +0100 Subject: [PATCH 1/2] fix: add dust threshold to soft liquidation check --- apps/main/src/llamalend/llama.utils.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/apps/main/src/llamalend/llama.utils.ts b/apps/main/src/llamalend/llama.utils.ts index f6e0a41bb..1cfce34ed 100644 --- a/apps/main/src/llamalend/llama.utils.ts +++ b/apps/main/src/llamalend/llama.utils.ts @@ -92,6 +92,25 @@ export const updateUserEventsApi = ( void updateEvents(wallet.account.address, networkId as Chain, address as Address, txHash as Hex) } +/** + * It’s possible that when a user briefly enters and then exits soft liquidation, + * one or more bands may be left with a tiny amount of crvUSD (dust). There is a + * dust-sweeping bot that cleans this up, but there can be a delay before those + * remnants are collected. + * + * The current front-end check is rudimentary and can sometimes conclude that a + * user is still in soft liquidation even though their overall health is healthy, + * which is confusing. + * + * As a pragmatic, short-term mitigation to reduce false positives, we only mark + * loans as being in soft liquidation when the crvUSD balance of a band exceeds + * a small threshold. This prevents trivial dust amounts from triggering the UI. + * + * If somebody wants to tackle this properly, they can find the bot code here: + * https://github.com/curvefi/dust-cleaner-bot/blob/master/app/services/controller.py#L90 + */ +const SOFT_LIQUIDATION_DUST_THRESHOLD = 0.1 + /** * healthNotFull is needed here because: * User full health can be > 0 @@ -113,7 +132,7 @@ export function getLiquidationStatus( userStatus.colorKey = 'hard_liquidation' userStatus.tooltip = 'Hard liquidation is like a usual liquidation, which can happen only if you experience significant losses in soft liquidation so that you get below 0 health.' - } else if (+userStateStablecoin > 0) { + } else if (+userStateStablecoin > SOFT_LIQUIDATION_DUST_THRESHOLD) { userStatus.label = 'Soft liquidation' userStatus.colorKey = 'soft_liquidation' userStatus.tooltip = From 04df88f7175a4ffaacbf405cb1d5139d516bf5ca Mon Sep 17 00:00:00 2001 From: 0xAlunara <88008691+0xAlunara@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:43:58 +0100 Subject: [PATCH 2/2] Update apps/main/src/llamalend/llama.utils.ts Co-authored-by: Daniel Schiavini --- apps/main/src/llamalend/llama.utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/main/src/llamalend/llama.utils.ts b/apps/main/src/llamalend/llama.utils.ts index 1cfce34ed..1d85b89c8 100644 --- a/apps/main/src/llamalend/llama.utils.ts +++ b/apps/main/src/llamalend/llama.utils.ts @@ -107,7 +107,7 @@ export const updateUserEventsApi = ( * a small threshold. This prevents trivial dust amounts from triggering the UI. * * If somebody wants to tackle this properly, they can find the bot code here: - * https://github.com/curvefi/dust-cleaner-bot/blob/master/app/services/controller.py#L90 + * https://github.com/curvefi/dust-cleaner-bot/blob/0795b2fa/app/services/controller.py#L90 */ const SOFT_LIQUIDATION_DUST_THRESHOLD = 0.1