From 88926480dc6ed80658851309d6ec98534a5cf5f4 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Tue, 24 Jun 2025 15:11:15 +0300 Subject: [PATCH] Return finalAmount as a string with 0 decimal places (rounded) --- store/tokens.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/store/tokens.go b/store/tokens.go index a7770c7..ce8dd7d 100644 --- a/store/tokens.go +++ b/store/tokens.go @@ -38,11 +38,8 @@ func ParseAndScaleAmount(storedAmount, activeDecimal string) (string, error) { multiplier := new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(tokenDecimal)), nil)) finalAmount := new(big.Float).Mul(amount, multiplier) - // Convert finalAmount to a string - finalAmountStr := new(big.Int) - finalAmount.Int(finalAmountStr) - - return finalAmountStr.String(), nil + // Return finalAmount as a string with 0 decimal places (rounded) + return finalAmount.Text('f', 0), nil } func ReadTransactionData(ctx context.Context, store DataStore, sessionId string) (TransactionData, error) {