-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Add a .call wrapper with Solidity function call checks #2260
Comments
Other options: So the function should return the |
Yes, exactly. |
What about something like |
|
@frangio @nventuro I'm working on this issue and I found out we may lose a bit of flexibility for setting the default revert message with this approach. For example in the Are you OK with this? Please let me know if I'm not clear enough. Also let me know if you think theres a solution to this that we can implement. Thanks! |
Some contracts need to perform function calls that can't be expressed as Solidity functions and so must resort to low level
.call
. In most of these cases Solidity function call semantics are still desired but it's tricky to get all the details right. There's a couple of instances of this in this library:ERC721._checkOnERC721Received
andSafeERC20
.We should provide a function that implements these details, possibly in the
Address
library. This function has to:Address.isContract
).call
with a specifiedbytes data
, and require the call to succeed, otherwise bubbling up the revert reason or using a default revert reason. (See the implementation of this inERC721
.)This function should then be used in the library in the places I linked above.
We have to come up with a name.
Address.checkedCall
comes to mind, but I'd like to see other options.The text was updated successfully, but these errors were encountered: