Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function that allows the encoding of custom errors #1675

Closed
wants to merge 3 commits into from

Conversation

JoaoMorais96
Copy link

What I did

Function that allows the encoding of custom errors.
Can be used in testing as follows:
with brownie.reverts(.encode_custom_error(, [params_of_custom_error]))
Related issue: #1108

How I did it

  • Checks if the error is in the contract abi
  • Creates an incoded string that allows the "brownie.reverts" function to compare with the received message

How to verify it

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

Attempt to fix issue eth-brownie#1108 (eth-brownie#1108).
Can be used in testing as follows:
with brownie.reverts(<DeployedContract>.encode_custom_error(<nameOfCustomError>, [params_of_custom_error]))
@iamdefinitelyahuman
Copy link
Member

Implemented in #1728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants