From 575dc2c27ac8baa718adc709b9463bbacc6d5f98 Mon Sep 17 00:00:00 2001 From: Ian Woodard <17186604+IanWoodard@users.noreply.github.com> Date: Mon, 4 Sep 2023 09:18:20 -0700 Subject: [PATCH] Fixing import boost (#623) --- earn/src/components/boost/ImportBoostWidget.tsx | 6 +++--- earn/src/pages/boost/ImportBoostPage.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/earn/src/components/boost/ImportBoostWidget.tsx b/earn/src/components/boost/ImportBoostWidget.tsx index d06b28f5..23cbb417 100644 --- a/earn/src/components/boost/ImportBoostWidget.tsx +++ b/earn/src/components/boost/ImportBoostWidget.tsx @@ -221,10 +221,10 @@ export default function ImportBoostWidget(props: ImportBoostWidgetProps) { if (!apr0 || !apr1) { return { dailyInterest0: null, dailyInterest1: null }; } - const dailyInterest0 = (apr0 / 365) * (cardInfo.borrower?.liabilities.amount0 || 0); - const dailyInterest1 = (apr1 / 365) * (cardInfo.borrower?.liabilities.amount1 || 0); + const dailyInterest0 = (apr0 / 365) * (cardInfo.amount0() * (boostFactor - 1)); + const dailyInterest1 = (apr1 / 365) * (cardInfo.amount1() * (boostFactor - 1)); return { dailyInterest0, dailyInterest1 }; - }, [apr0, apr1, cardInfo.borrower?.liabilities.amount0, cardInfo.borrower?.liabilities.amount1]); + }, [apr0, apr1, boostFactor, cardInfo]); const nftTokenId = ethers.BigNumber.from(cardInfo?.nftTokenId || 0); const initializationData = useMemo(() => { diff --git a/earn/src/pages/boost/ImportBoostPage.tsx b/earn/src/pages/boost/ImportBoostPage.tsx index c8e8ea16..46efc8d3 100644 --- a/earn/src/pages/boost/ImportBoostPage.tsx +++ b/earn/src/pages/boost/ImportBoostPage.tsx @@ -169,7 +169,7 @@ export default function ImportBoostPage() { ); }, [cardInfo, boostFactor]); - const isLoading = !updatedCardInfo || !tokenId; + const isLoading = !cardInfo || !updatedCardInfo || !tokenId; return (
@@ -180,7 +180,7 @@ export default function ImportBoostPage() {