Skip to content

Commit

Permalink
Merge pull request #285 from alchemix-finance/hotfix/migrate-division…
Browse files Browse the repository at this point in the history
…-by-zero

HOTFIX: division by zero
  • Loading branch information
t0rbik authored Nov 27, 2024
2 parents 43aa0f5 + f221e17 commit 0a5949e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/components/vaults/row/Migrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,18 @@ export const Migrate = ({
writeMigrate();
};

const ltv = toString(
multiply(
divide(
[vault.alchemist.position.debt, 18],
[vault.alchemist.totalValue, 18],
),
100,
),
);
const ltv =
vault.alchemist.totalValue > 0
? toString(
multiply(
divide(
[vault.alchemist.position.debt, 18],
[vault.alchemist.totalValue, 18],
),
100,
),
)
: "0";

return (
<div className="space-y-4">
Expand Down

0 comments on commit 0a5949e

Please sign in to comment.