diff --git a/components/TokenList.tsx b/components/TokenList.tsx index df23a32a..c1f90be9 100644 --- a/components/TokenList.tsx +++ b/components/TokenList.tsx @@ -160,8 +160,12 @@ const TokenList = () => { initContributions.find((val) => val.asset === bank.name) ?.contribution || 0 - const assetWeight = bank.initAssetWeight.toNumber() - const liabWeight = bank.initLiabWeight.toNumber() + const assetWeight = bank + .scaledInitAssetWeight(bank.price) + .toFixed(2) + const liabWeight = bank + .scaledInitLiabWeight(bank.price) + .toFixed(2) return ( @@ -182,14 +186,17 @@ const TokenList = () => {

- +

= 0 ? assetWeight : liabWeight + collateralValue <= -0.01 ? liabWeight : assetWeight } - decimals={2} /> x

@@ -299,8 +306,10 @@ const MobileTokenListItem = ({ bank }: { bank: BankWithBalance }) => { initContributions.find((val) => val.asset === tokenBank.name) ?.contribution || 0 - const assetWeight = tokenBank.initAssetWeight.toNumber() - const liabWeight = tokenBank.initLiabWeight.toNumber() + const assetWeight = tokenBank + .scaledInitAssetWeight(tokenBank.price) + .toFixed(2) + const liabWeight = tokenBank.scaledInitLiabWeight(tokenBank.price).toFixed(2) return ( @@ -358,12 +367,17 @@ const MobileTokenListItem = ({ bank }: { bank: BankWithBalance }) => {

- + {' '} = 0 ? assetWeight : liabWeight} - decimals={2} + value={ + collateralValue <= -0.01 ? liabWeight : assetWeight + } /> x diff --git a/components/shared/BalancesTable.tsx b/components/shared/BalancesTable.tsx index 17f42e80..df74c192 100644 --- a/components/shared/BalancesTable.tsx +++ b/components/shared/BalancesTable.tsx @@ -87,8 +87,10 @@ const BalancesTable = () => { initContributions.find((val) => val.asset === bank.name) ?.contribution || 0 - const assetWeight = bank.initAssetWeight.toNumber() - const liabWeight = bank.initLiabWeight.toNumber() + const assetWeight = bank + .scaledInitAssetWeight(bank.price) + .toFixed(2) + const liabWeight = bank.scaledInitLiabWeight(bank.price).toFixed(2) return ( @@ -111,12 +113,17 @@ const BalancesTable = () => {

- +

= 0 ? assetWeight : liabWeight} - decimals={2} + value={ + collateralValue <= -0.01 ? liabWeight : assetWeight + } /> x

@@ -145,8 +152,8 @@ const BalancesTable = () => { initContributions.find((val) => val.asset === bank.name) ?.contribution || 0 - const assetWeight = bank.initAssetWeight.toNumber() - const liabWeight = bank.initLiabWeight.toNumber() + const assetWeight = bank.scaledInitAssetWeight(bank.price).toFixed(2) + const liabWeight = bank.scaledInitLiabWeight(bank.price).toFixed(2) return ( @@ -200,16 +207,19 @@ const BalancesTable = () => {

- + {' '} = 0 - ? assetWeight - : liabWeight + collateralValue <= -0.01 + ? liabWeight + : assetWeight } - decimals={2} /> x