Browse Source

Avoid unnecessary trim

febo 8 months ago
parent
commit
0783ada535
1 changed files with 1 additions and 1 deletions
  1. 1 1
      p-token/src/processor/amount_to_ui_amount.rs

+ 1 - 1
p-token/src/processor/amount_to_ui_amount.rs

@@ -35,7 +35,7 @@ pub fn process_amount_to_ui_amount(
     // SAFETY: the logger is guaranteed to be a valid UTF-8 string.
     let mut s = unsafe { from_utf8_unchecked(&logger) };
 
-    if mint.decimals > 0 {
+    if mint.decimals > 0 && s.contains('.') {
         let zeros_trimmed = s.trim_end_matches('0');
         s = zeros_trimmed.trim_end_matches('.');
     }