Constants for minimum and maximum signed integer values #1576
Labels
enhancement
New feature or improvement.
fixed/complete
This Bug is fixed or Enhancement is complete and published.
minor-bump
Planned for the next minor version bump.
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.MaxInt256
ethers.constants.MinInt256
Describe alternatives you've considered
Clear documentation on how else to coerce a minimum signed 256-bit integer.
Additional context
N/A
The text was updated successfully, but these errors were encountered: