diff --git a/apps/main/src/llamalend/llama.utils.ts b/apps/main/src/llamalend/llama.utils.ts index 7a5641ac6..f1a98c8d3 100644 --- a/apps/main/src/llamalend/llama.utils.ts +++ b/apps/main/src/llamalend/llama.utils.ts @@ -109,6 +109,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/0795b2fa/app/services/controller.py#L90 + */ +const SOFT_LIQUIDATION_DUST_THRESHOLD = 0.1 + /** * healthNotFull is needed here because: * User full health can be > 0 @@ -130,7 +149,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 =