From f221e17a855c1cffbf0ab080bcd2ff302b4fd90b Mon Sep 17 00:00:00 2001 From: t0rbik Date: Wed, 27 Nov 2024 12:16:40 +0100 Subject: [PATCH] hotfix division by zero --- src/components/vaults/row/Migrate.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/components/vaults/row/Migrate.tsx b/src/components/vaults/row/Migrate.tsx index 57e29c83..796bae8a 100644 --- a/src/components/vaults/row/Migrate.tsx +++ b/src/components/vaults/row/Migrate.tsx @@ -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 (