evm-bn icon indicating copy to clipboard operation
evm-bn copied to clipboard

Allow 0 for decimals

Open yann300 opened this issue 3 years ago • 3 comments

That way, toBn("100e6", 0) will return "100000000" which is the real mathematical value. I couldn't find any way to do that without this PR, but let me know otherwise.

yann300 avatar Apr 13 '23 07:04 yann300

this PR aimed to add scientific notation in remix but using from-exponential will just do the job. I will get back to you soonish

yann300 avatar Apr 13 '23 10:04 yann300

Oh, shoot. I was the one who suggested using evm-bn for Remix 😅

In any case, I've become more open to adding support for zero decimals. This would be useful for ERC-20 token management because some tokens have zero decimals.

PaulRBerg avatar Apr 13 '23 11:04 PaulRBerg

Thanks for re-opening this, @yann300. Before we can merge it, however, the tests must be updated to show that the function works properly with 0 decimals.

Also, shouldn't zero decimals be supported in fromBn, too?

PaulRBerg avatar Apr 16 '23 06:04 PaulRBerg