Skip to content

Commit

Permalink
use .call instead of .transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeary committed Oct 12, 2023
1 parent 8ca17b4 commit 770d9f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PixieChessAuctionMinter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ contract PixieChessAuctionMinter is AccessControl {
delete auctions[auctionId];

if (refundRecipient != address(0) && refundAmount != 0) {
payable(refundRecipient).transfer(refundAmount);
(bool success,) = payable(refundRecipient).call{ value: refundAmount }("");
require(success, "Auction: ETH transfer failed");
}

emit AuctionCanceled(auctionId);
Expand Down Expand Up @@ -120,7 +121,8 @@ contract PixieChessAuctionMinter is AccessControl {

// transfer the previous highest bid to the previous highest bidder
if (refundRecipient != address(0) && refundAmount != 0) {
payable(refundRecipient).transfer(refundAmount);
(bool success,) = payable(refundRecipient).call{ value: refundAmount }("");
require(success, "Auction: ETH transfer failed");
}

emit Bid(auctionId, msg.sender, msg.value, auction.duration);
Expand All @@ -143,7 +145,8 @@ contract PixieChessAuctionMinter is AccessControl {
IPixieChessToken(tokenAddress).mint(auction.highestBidder, auction.tokenId, 1, "");

// transfer the ETH to the funds recipient
fundsRecipient.transfer(auction.highestBid);
(bool success,) = fundsRecipient.call{ value: auction.highestBid }("");
require(success, "Auction: ETH transfer failed");

emit AuctionFinalized(auctionId, auction.highestBidder, auction.highestBid);

Expand Down

0 comments on commit 770d9f1

Please sign in to comment.