From e0fc02175dad3660de7f1348021aa05f4d6bb115 Mon Sep 17 00:00:00 2001 From: chambaz Date: Fri, 15 Nov 2024 13:34:45 -0500 Subject: [PATCH] fix: check shares rather than usd value to determine if lending. fixes reduce only 0 state oracle --- packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts b/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts index b0aabc1992..0ababa680f 100644 --- a/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts +++ b/packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts @@ -398,7 +398,7 @@ export function makeLendingPosition( const amounts = balance.computeQuantity(bank); const usdValues = balance.computeUsdValue(bank, oraclePrice, MarginRequirementType.Equity); const weightedUSDValues = balance.getUsdValueWithPriceBias(bank, oraclePrice, MarginRequirementType.Maintenance); - const isLending = usdValues.liabilities.isZero(); + const isLending = balance.liabilityShares.isZero(); const amount = isLending ? nativeToUi(amounts.assets.integerValue(BigNumber.ROUND_DOWN).toNumber(), bankInfo.mintDecimals)