Skip to content

Commit

Permalink
fix: check shares rather than usd value to determine if lending. fixe…
Browse files Browse the repository at this point in the history
…s reduce only 0 state oracle
  • Loading branch information
chambaz committed Nov 15, 2024
1 parent bf73052 commit 099cde2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/marginfi-v2-ui-state/src/lib/mrgnlend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 099cde2

Please sign in to comment.