diff --git a/apps/marginfi-v2-ui/src/components/desktop/AssetList/components/AssetCells.tsx b/apps/marginfi-v2-ui/src/components/desktop/AssetList/components/AssetCells.tsx index 265fae591..65da881bb 100644 --- a/apps/marginfi-v2-ui/src/components/desktop/AssetList/components/AssetCells.tsx +++ b/apps/marginfi-v2-ui/src/components/desktop/AssetList/components/AssetCells.tsx @@ -35,6 +35,19 @@ export const getAssetCell = (asset: AssetData) => ( ); +const formatPrice = (price: number) => { + if (price >= 1) return usdFormatter.format(price); + if (price >= 0.0000001) { + return `$${dynamicNumeralFormatter(price, { + minDisplay: 0.0000001, + tokenPrice: price, + forceDecimals: true, + })}`; + } + if (price > 0) return `$${price.toExponential(2)}`; + return 0; +}; + export const getAssetPriceCell = ({ oracle, assetPrice, @@ -46,16 +59,7 @@ export const getAssetPriceCell = ({ }: AssetPriceData) => (
- {/* {assetPrice >= 0.01 ? usdFormatter.format(assetPrice) : `$${assetPrice.toExponential(2)}`} */} - {assetPrice >= 1 - ? usdFormatter.format(assetPrice) - : assetPrice >= 0.0000001 - ? `$${dynamicNumeralFormatter(assetPrice, { - minDisplay: 0.0000001, - tokenPrice: assetPrice, - forceDecimals: true, - })}` - : `$${assetPrice.toExponential(2)}`} + {formatPrice(assetPrice)} {assetPriceOffset > assetPrice * 0.1 && (