BigNumber error on small value
See original GitHub issueethers.utils.parseEther('0.0007000000000000001')
throws Error: underflow occurred (operation=“division”, fault=“underflow”, version=4.0.39)
How can I fix it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Unable to call contract function from web3 with big number as ...
I am trying to call a custom function of a contract that expects a parameter of unit256. I'm calling this function from web3...
Read more >Ethers JS BigNumber Errors - Ethereum Stack Exchange
Ethers JS BigNumber Errors ... I read that this should be done using BigNumber , using the following ... can you try it...
Read more >bignumber.js API - GitHub Pages
If value is a BigNumber instance and BigNumber.DEBUG is true , then this method will also check if value is well-formed, and throw...
Read more >How to fix EthersJS "underflow" error | BigNumber.from Error
I got this EthersJS underflow error that referenced the function BigNumber.from, and was confused because I never called BigNumber.from.
Read more >BigNumber - ethers
Most operations which need to return a value will return a BigNumber and ... easy to make mistakes, which is not possible on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For what it’s worth, I ended up building my own solution for this problem.
It’s a tiny npm package called evm-bn, which works like this;
Since this still comes up when searching, here my solution: Do not do
.mul
with a number < 1, instead do.div
with a number > 1