fix: handle tokens with no decimals

Fixes #2432
This commit is contained in:
Richard Ramos 2021-04-27 11:04:52 -04:00 committed by Iuri Matias
parent b0a9a9ab06
commit 6fd68c10f3
1 changed files with 4 additions and 0 deletions

View File

@ -88,6 +88,10 @@ proc startWallet*(watchNewBlocks: bool) =
proc hex2Token*(input: string, decimals: int): string =
var value = fromHex(Stuint[256], input)
if decimals == 0:
return fmt"{value}"
var p = u256(10).pow(decimals)
var i = value.div(p)
var r = value.mod(p)