I'm getting an BigNumber overflow error when running hardhat tests. How do I fix this?

const ownerBalance = await MyToken.mint(
   { value: ethers.BigNumber.from(50000000000000000) }
  • 1
    Hello. Please provide the complete error with stack trace. Nov 8 '21 at 7:11
  • 1
    make sure that '50000000000000000' is a string
    – lain
    Nov 8 '21 at 8:30

If you are getting the error from the BigNumber part, then I suggest you construct the number like this: ethers.utils.parseUnits("5", 16).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.