Is your feature request related to a problem? Please describe.
When testing smart contracts, a common requirement is to test the boundaries of the domain of a given type. For example, a signed 256-bit integer (int256 in Solidity's type system) would have a domain of [-2**255-1, 2**255-1]. Currently, Ethers' BigNumber implementation has a constant for the maximum legal value of a 256-bit unsigned integer, ethers.constants.MaxUint256. While the minimum for unsigned integers is trivially zero, the case isn't the same for signed integers.
Describe the solution you'd like
Ethers should expose additional constants for both the minimum and maximum legal values of signed 256-bit integers (i.e., int256), like so:
ethers.constants.MaxInt256ethers.constants.MinInt256Describe alternatives you've considered
Clear documentation on how else to coerce a minimum signed 256-bit integer.
Additional context
N/A
These make sense to add and I鈥檒l get to them on my next low-hanging-fruit sweep. :)
This will be going into the upcoming EIP-1559 minor bump. I've already added it locally.
Added in 5.3.0. Try it out and let me know how it works.
Thanks! :)
Most helpful comment
These make sense to add and I鈥檒l get to them on my next low-hanging-fruit sweep. :)