From f03c020e4f1b96b65ed562c93aee4afca3d42049 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Thu, 14 Oct 2021 13:06:15 -0700 Subject: [PATCH] fix(generateGenesisOpReturn): Fixing bug when 0 decimal --- src/slp/tokentype1.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/slp/tokentype1.js b/src/slp/tokentype1.js index f828f75..46e1c23 100644 --- a/src/slp/tokentype1.js +++ b/src/slp/tokentype1.js @@ -287,9 +287,15 @@ class TokenType1 { try { // TODO: Add input validation. - let baseQty = new BigNumber(configObj.initialQty).times( - 10 ** configObj.decimals - ) + let baseQty + if (configObj.decimals !== 0) { + baseQty = new BigNumber(configObj.initialQty).times( + 10 ** configObj.decimals + ) + } else { + baseQty = new BigNumber(configObj.initialQty) + } + baseQty = baseQty.absoluteValue() baseQty = Math.floor(baseQty) baseQty = baseQty.toString()