Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 121967
1 vote

How can I decode a low-level return data from a reverting call?

abi.decode() needs to receive ABI-encoded data without signatures, but revert() returns a standard Error(string), resulting in ABI-encoded signature+data. …
ceseshi's user avatar
  • 765
2 votes
Accepted

How can I decode a low-level return data from a reverting call?

(abi.encodeWithSelector(plugins.reverter.withReasonString.selector)); /// Signature for "Error(string)" bytes4 errorSignature = 0x08c379a0; /// Make sure the response is from a standard revert … response2) = address(this).call(response); string errorText = abi.decode(response2, (string)); return errorText; } } And following this we define the function that can parse the revert
ceseshi's user avatar
  • 765
3 votes
Accepted

what is the correct way to define a custom error

If it's defined outside you can share it among your contracts and maintain consistency in your code, other than that I don't think there are any other relevant differences in deployment or execution c …
ceseshi's user avatar
  • 765