From 0e2c3311e6cc4f002b190a5818599c21c3807a98 Mon Sep 17 00:00:00 2001 From: Popo Date: Wed, 25 Feb 2026 16:04:52 +0800 Subject: [PATCH] fix(balance): use 4 decimal places for USDC formatting Fixes #36 - stats display showing incorrect precision Previously formatUSDC used toFixed(2) which rounded small amounts like 0.004 USDC to 0.00 or 0.01, causing display inconsistency with the stats dashboard that uses toFixed(4). Now using 4 decimal places consistently across the codebase. --- src/balance.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/balance.ts b/src/balance.ts index 0c84136..6e60089 100644 --- a/src/balance.ts +++ b/src/balance.ts @@ -149,12 +149,13 @@ export class BalanceMonitor { } /** - * Format USDC amount (in micros) as "$X.XX". + * Format USDC amount (in micros) as "$X.XXXX". + * Uses 4 decimal places for consistency with stats display. */ formatUSDC(amountMicros: bigint): string { // USDC has 6 decimals const dollars = Number(amountMicros) / 1_000_000; - return `$${dollars.toFixed(2)}`; + return `$${dollars.toFixed(4)}`; } /**