diff --git a/src/components/Account/AccountDetails/AccountDetailsLeverage.tsx b/src/components/Account/AccountDetails/AccountDetailsLeverage.tsx
new file mode 100644
index 00000000..8fa3137e
--- /dev/null
+++ b/src/components/Account/AccountDetails/AccountDetailsLeverage.tsx
@@ -0,0 +1,54 @@
+import classNames from 'classnames'
+
+import { FormattedNumber } from 'components/FormattedNumber'
+import { ArrowRight } from 'components/Icons'
+
+interface Props {
+ leverage: BigNumber
+ updatedLeverage: BigNumber | null
+}
+
+export default function AccountDetailsLeverage(props: Props) {
+ const { leverage, updatedLeverage } = props
+
+ if (!updatedLeverage) {
+ return (
+
+ )
+ }
+
+ return (
+
+ )
+}
diff --git a/src/components/Account/AccountDetails.tsx b/src/components/Account/AccountDetails/index.tsx
similarity index 91%
rename from src/components/Account/AccountDetails.tsx
rename to src/components/Account/AccountDetails/index.tsx
index 8bc48c65..590b5d71 100644
--- a/src/components/Account/AccountDetails.tsx
+++ b/src/components/Account/AccountDetails/index.tsx
@@ -3,6 +3,7 @@ import { useMemo } from 'react'
import AccountBalancesTable from 'components/Account/AccountBalancesTable'
import AccountComposition from 'components/Account/AccountComposition'
+import AccountDetailsLeverage from 'components/Account/AccountDetails/AccountDetailsLeverage'
import { glowElement } from 'components/Button/utils'
import Card from 'components/Card'
import DisplayCurrency from 'components/DisplayCurrency'
@@ -55,10 +56,15 @@ function AccountDetails(props: Props) {
[updatedAccount, account, prices],
)
const coin = BNCoin.fromDenomAndBigNumber(ORACLE_DENOM, accountBalanceValue)
- const leverage = useMemo(
- () => calculateAccountLeverage(updatedAccount ?? account, prices),
- [account, updatedAccount, prices],
- )
+ const leverage = useMemo(() => calculateAccountLeverage(account, prices), [account, prices])
+ const updatedLeverage = useMemo(() => {
+ if (!updatedAccount) return null
+ const updatedLeverage = calculateAccountLeverage(updatedAccount, prices)
+
+ if (updatedLeverage.eq(leverage)) return null
+ return updatedLeverage
+ }, [updatedAccount, prices, leverage])
+
const { availableAssets: borrowAvailableAssets, accountBorrowedAssets } =
useBorrowMarketAssetsTableData()
const { availableAssets: lendingAvailableAssets, accountLentAssets } =
@@ -75,6 +81,7 @@ function AccountDetails(props: Props) {
() => calculateAccountApr(account, borrowAssetsData, lendingAssetsData, prices),
[account, borrowAssetsData, lendingAssetsData, prices],
)
+
return (
diff --git a/src/components/Modals/BorrowModal.tsx b/src/components/Modals/BorrowModal.tsx
index 3abf1a62..551db4cb 100644
--- a/src/components/Modals/BorrowModal.tsx
+++ b/src/components/Modals/BorrowModal.tsx
@@ -26,7 +26,7 @@ import { BNCoin } from 'types/classes/BNCoin'
import { byDenom } from 'utils/array'
import { formatPercent, formatValue } from 'utils/formatters'
import { BN } from 'utils/helpers'
-import {getDebtAmountWithInterest} from 'utils/tokens'
+import { getDebtAmountWithInterest } from 'utils/tokens'
function getDebtAmount(modal: BorrowModal) {
return BN((modal.marketData as BorrowMarketTableData)?.debt ?? 0).toString()
@@ -264,4 +264,4 @@ function BorrowModal(props: Props) {
)
-}
\ No newline at end of file
+}
diff --git a/src/utils/tokens.ts b/src/utils/tokens.ts
index 321965f1..8d66d763 100644
--- a/src/utils/tokens.ts
+++ b/src/utils/tokens.ts
@@ -23,4 +23,4 @@ export function getTokenPrice(denom: string, prices: BNCoin[]): BigNumber {
export function getDebtAmountWithInterest(debt: BigNumber, apr: number) {
return debt.times(1 + apr / 365 / 24).integerValue()
-}
\ No newline at end of file
+}