-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Add deprecation warnings for send(), transfer(), ABI coder v1, contract comparisons, virtual modifiers and memory-safe-assembly comment
#16174
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -692,16 +692,16 @@ and ``assert`` for internal error checking. | |
| :force: | ||
|
|
||
| // SPDX-License-Identifier: GPL-3.0 | ||
| pragma solidity >=0.5.0 <0.9.0; | ||
| pragma solidity >=0.6.2 <0.9.0; | ||
clonker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| contract Sharer { | ||
| function sendHalf(address payable addr) public payable returns (uint balance) { | ||
| require(msg.value % 2 == 0, "Even value required."); | ||
| uint balanceBeforeTransfer = address(this).balance; | ||
| addr.transfer(msg.value / 2); | ||
| // Since transfer throws an exception on failure and | ||
| // cannot call back here, there should be no way for us to | ||
| // still have half of the Ether. | ||
| (bool success, ) = addr.call{value: msg.value / 2}(""); | ||
| require(success); | ||
| // Since require will stop execution and revert if success is false, | ||
| // there should be no way for us to still have half of the Ether. | ||
| assert(address(this).balance == balanceBeforeTransfer - msg.value / 2); | ||
| return address(this).balance; | ||
| } | ||
|
|
@@ -775,7 +775,8 @@ together with ``revert`` and the equivalent ``require``: | |
| if (msg.sender != owner) | ||
| revert Unauthorized(); | ||
|
|
||
| payable(msg.sender).transfer(address(this).balance); | ||
| (bool success, ) = payable(msg.sender).call{value: address(this).balance}(""); | ||
| require(success); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -914,4 +915,4 @@ in scope in the block that follows. | |
| out-of-gas situation and not a deliberate error condition: | ||
| The caller always retains at least 1/64th of the gas in a call and thus | ||
| even if the called contract goes out of gas, the caller still | ||
| has some gas left. | ||
| has some gas left. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What changed here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No clue, maybe it needs a rebase.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe it's a newline at the end of the file. |
||
Uh oh!
There was an error while loading. Please reload this page.