@@ -123,8 +123,9 @@ to receive their Ether - contracts cannot activate themselves.
123123
124124 // msg.sender is not of type `address payable` and must be
125125 // explicitly converted using `payable(msg.sender)` in order
126- // use the member function `send()`.
127- if (!payable(msg.sender).send(amount)) {
126+ // use the member function `call()`.
127+ (bool success, ) = payable(msg.sender).call{value: amount}("");
128+ if (!success) {
128129 // No need to call throw here, just reset the amount owing
129130 pendingReturns[msg.sender] = amount;
130131 return false;
@@ -160,7 +161,8 @@ to receive their Ether - contracts cannot activate themselves.
160161 emit AuctionEnded(highestBidder, highestBid);
161162
162163 // 3. Interaction
163- beneficiary.transfer(highestBid);
164+ (bool success, ) = beneficiary.call{value: highestBid}("");
165+ require(success);
164166 }
165167 }
166168
@@ -310,7 +312,8 @@ invalid bids.
310312 // the same deposit.
311313 bidToCheck.blindedBid = bytes32(0);
312314 }
313- payable(msg.sender).transfer(refund);
315+ (bool success, ) = payable(msg.sender).call{value: refund}("");
316+ require(success);
314317 }
315318
316319 /// Withdraw a bid that was overbid.
@@ -323,7 +326,8 @@ invalid bids.
323326 // conditions -> effects -> interaction).
324327 pendingReturns[msg.sender] = 0;
325328
326- payable(msg.sender).transfer(amount);
329+ (bool success, ) = payable(msg.sender).call{value: amount}("");
330+ require(success);
327331 }
328332 }
329333
@@ -336,7 +340,8 @@ invalid bids.
336340 if (ended) revert AuctionEndAlreadyCalled();
337341 emit AuctionEnded(highestBidder, highestBid);
338342 ended = true;
339- beneficiary.transfer(highestBid);
343+ (bool success, ) = beneficiary.call{value: highestBid}("");
344+ require(success);
340345 }
341346
342347 // This is an "internal" function which means that it
0 commit comments