-
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
Use Address.sendValue instead of address.tranfer in RefundEscrow #2480
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Well this is a good moment to discuss, why do you prefer this syntax for using libraries?
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.
Because it avoid any ambiguity over the fact that this is a library being called, and not a builtin function. Imagine if
Address
contained atransfer
function (good thing it doesn't) ... then what would address.transfer be ? The library, the built-in function ?I think the
using for
syntax is great for safemath. I also think it is acceptable when the first type is clearly not a contract (EnumerableMap/EnumerableSet) ... For addresses I'm not sure ... for contracts I think it's a terrible idea.In
TokenTimelock
there is an IERC20 token that is called using_token.safeTransfer(beneficiary(), amount);
. I think there is a real ambiguity between a potentialsafeTransfer
function included in IERC20, and a safeTransfer library function that is used for IERC20 (which is the case here).TLDR:
In the particular case, I wouldn't oppose doing
_beneficiary.sendValue(address(this).balance);
, but there are cases where I think this syntax is to be avoided.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.
I noticed that
using XXX for address;
andusing XXX for address payable;
are two separate things.EDIT: in the code above, if we replace
using Address for address;
withusing Address for address payable;
, send1 compilation gives an error (member not unique).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.
They're good points. I agree that for contracts it's confusing. For this case I would leave the
using for
syntax for consistency with the rest of the library.