Replies: 1 comment 3 replies
-
I don't know if the constants makes the most sense to keep them in, but the Interface object already parses out Panic events, I should add the Panic reasons to Panic errors. It probably won't make it into v5, but I'll add this in v6, so the Interface object will automatically add the extra property. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Since Solidity v0.8.0, a new invalid opcode is used instead of the revert opcode in certain cases (the compiler panics instead of reverting). Common cases include arithmetic overflow and underflow and division by zero.
The consequence for contract developers is that now we have to account for these panic codes in our tests. Thus I ended up defining them in a TypeScript enum:
https://github.com/hifi-finance/prb-math/blob/33d957a4dd56f63c8b098300d07a4e47ae376ded/packages/prb-math/test/shared/errors.ts
I think that these will become popular enough to deserve to be included in the
@ethersproject/constants
package.Beta Was this translation helpful? Give feedback.
All reactions