Skip to content

Commit

Permalink
Address comments and add Uniswap positions to health calcs
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenshively committed Feb 15, 2024
1 parent 8154475 commit c922989
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion earn/src/components/lend/BorrowingWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export default function BorrowingWidget(props: BorrowingWidgetProps) {
const hasNoCollateral =
account.assets.token0Raw === 0 &&
account.assets.token1Raw === 0 &&
(account.uniswapPositions?.length || 0) === 0;
(account.uniswapPositions ?? []).every((pos) => JSBI.EQ(pos.liquidity, '0'));
if (hasNoCollateral) return null;
const uniswapPosition = account.uniswapPositions?.at(0);
const collateral = account.assets.token0Raw > 0 ? account.token0 : account.token1;
Expand Down
4 changes: 2 additions & 2 deletions earn/src/components/lend/modal/content/BorrowModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default function BorrowModalContent(props: BorrowModalContentProps) {
const maxBorrowsBasedOnHealth = maxBorrowAndWithdraw(
borrower.assets,
borrower.liabilities,
[], // TODO: add uniswap positions
borrower.uniswapPositions ?? [],
borrower.sqrtPriceX96,
borrower.iv,
borrower.nSigma,
Expand All @@ -255,7 +255,7 @@ export default function BorrowModalContent(props: BorrowModalContentProps) {
const { health: newHealth } = isHealthy(
borrower.assets,
newLiabilities,
[], // TODO: add uniswap positions
borrower.uniswapPositions ?? [],
borrower.sqrtPriceX96,
borrower.iv,
borrower.nSigma,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export default function RepayModalContent(props: RepayModalContentProps) {
const { health: newHealth } = isHealthy(
borrower.assets,
newLiabilities,
[], // TODO: add uniswap positions
borrower.uniswapPositions ?? [],
borrower.sqrtPriceX96,
borrower.iv,
borrower.nSigma,
Expand Down

0 comments on commit c922989

Please sign in to comment.