Skip to content

Commit e5419cc

Browse files
authored
Merge pull request #245 from leonardoalt/callBytesReturn
Adjust (new) syntax for bare calls
2 parents 14b4b37 + 15497ad commit e5419cc

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

test/DAO/DAO.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@ contract DAO is DAOInterface, Token, TokenCreation {
587587
// multiple times out of the DAO
588588
p.proposalPassed = true;
589589

590-
if (!p.recipient.call.value(p.amount)(_transactionData))
590+
(bool success,) = p.recipient.call.value(p.amount)(_transactionData);
591+
if (!success)
591592
revert();
592593

593594
_success = true;
@@ -696,7 +697,8 @@ contract DAO is DAOInterface, Token, TokenCreation {
696697
function newContract(address _newContract) public {
697698
if (msg.sender != address(this) || !allowedRecipients[_newContract]) return;
698699
// move all ether
699-
if (!_newContract.call.value(address(this).balance)("")) {
700+
(bool success,) = _newContract.call.value(address(this).balance)("");
701+
if (!success) {
700702
revert();
701703
}
702704

test/DAO/ManagedAccount.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ contract ManagedAccount is ManagedAccountInterface{
5757
function payOut(address _recipient, uint _amount) public returns (bool) {
5858
if (msg.sender != owner || (payOwnerOnly && _recipient != owner))
5959
revert();
60-
if (_recipient.call.value(_amount)("")) {
60+
(bool success,) = _recipient.call.value(_amount)("");
61+
if (success) {
6162
emit PayOut(_recipient, _amount);
6263
return true;
6364
} else {

test/DAO/TokenCreation.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ contract TokenCreation is TokenCreationInterface, Token {
126126
extraBalance.payOut(address(this), extraBalance.accumulatedInput());
127127

128128
// Execute refund
129-
if (msg.sender.call.value(weiGiven[msg.sender])("")) {
129+
(bool success,) = msg.sender.call.value(weiGiven[msg.sender])("");
130+
if (success) {
130131
emit Refund(msg.sender, weiGiven[msg.sender]);
131132
totalSupply -= balances[msg.sender];
132133
balances[msg.sender] = 0;

0 commit comments

Comments
 (0)