Skip to content

Commit

Permalink
fix: collateral info supply format
Browse files Browse the repository at this point in the history
  • Loading branch information
tadejpodrekar committed Jan 7, 2025
1 parent 9c311a4 commit 9c121bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ const CollateralTableRow = ({
collateralConfiguration.supply_cap.toString()
),
decimals
)
),
2
)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
<div className="text-md flex justify-between">
<div className="text-lavender">Total Supplied</div>
<div className="font-semibold text-moon">
{getFormattedNumber(collateralAmount)}{' '}
{getFormattedNumber(collateralAmount, 2)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
Expand Down Expand Up @@ -229,7 +230,8 @@ const CollateralTableRow = ({
collateralConfiguration.supply_cap.toString()
),
decimals
)
),
2
)}{' '}
{appConfig.assets[assetId]}
</div>
Expand All @@ -251,7 +253,7 @@ const CollateralTableRow = ({
<div className="text-md flex justify-between">
<div className="text-lavender">Total Supplied</div>
<div className="font-semibold text-moon">
{getFormattedNumber(collateralAmount)}{' '}
{getFormattedNumber(collateralAmount, 2)}{' '}
{appConfig.assets[assetId]}
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/src/utils/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const getFormattedPrice = (number: BigNumber): string => {

export const getFormattedNumber = (
number: BigNumber,
decimals = 4,
positive?: boolean
): string => {
if (!number || number.isNaN() || number.eq(0)) return '0.0';
Expand All @@ -35,5 +36,5 @@ export const getFormattedNumber = (
return '0.0';
}

return `${number.toFixed(4, BigNumber.ROUND_FLOOR)}`;
return `${number.toFixed(decimals, BigNumber.ROUND_FLOOR)}`;
};

0 comments on commit 9c121bb

Please sign in to comment.