-
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
feat: add wrapper function for low level calls #2264
feat: add wrapper function for low level calls #2264
Conversation
This is looking great! |
Thanks! I think I might need some guidance on the Tests to include. Which kind of |
We might want to also add a
Off the top of my head, interesting scenarios are the following (thought we might not need to test them all):
If we add a |
369f8b7
to
dde2161
Compare
@nventuro @frangio I've added the error message parameter so now we have the two options for I would like you to review the TESTS to see if this is the correct direction. I had to make too many decisions and is better for you to validate if this is OK. Feel free to let me know if this is not the correct way of doing this! So far I covered:
I was not able to test the case of a function that returns data with this approach. It is quite challenging as I get the Transaction info and not the returned value, to eventually decode. Do you know how this can be achieved? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code itself looks good.
By the way I asked the Solidity dev team on gitter if they think our checks are correct, and they gave us green light:
|
@julianmrodri we're looking into publishing the first release candidate of v3.1 today, and want to include this helper in that release. If you don't mind, I'll go ahead and continue working on this branch so we can merge this PR. I'm letting you know so we don't both end up working on the same thing :) |
@nventuro Sure please go ahead! Sorry not to be able to complete it before, some work duties came up quite some busy days. |
@julianmrodri no need to apologize! Your help is greatly appreciated :) |
For some reason the links are not working (see https://deploy-preview-2264--openzeppelin-contracts-docs.netlify.app/contracts/3.x/api/utils#Address-functionCall-address-bytes-string-). |
Wow you took this to the next level. Awesome! |
Co-authored-by: Francisco Giordano <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
@@ -233,9 +233,13 @@ describe('Address', function () { | |||
inputs: [], | |||
}, []); | |||
|
|||
const tracker = await balance.tracker(this.contractRecipient.address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
Congrats guys! Awesome job. Glad to be able to be part of this. 👍 |
Thanks a lot to you both! |
#2260
Fixes #2260
This PR creates a function
Address.functionCall
which can be used to wrap low level calls that need to be performed on other Smart contracts. .It also modifies the
ERC721.sol
andSafeERC20.sol
contracts to use this new function instead of performing directly the low level call. Tests for these contracts needed to be updated to match the new revert messages in certain situations.