Skip to content

Commit

Permalink
Withdraw.sol: actually send value
Browse files Browse the repository at this point in the history
  • Loading branch information
d-xo committed Sep 26, 2023
1 parent 977a06d commit 9f3f8bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions solitidy/Withdraw.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

pragma solidity >=0.8.2 <0.9.0;

/**
Expand All @@ -23,6 +22,8 @@ contract Piggybank {
function retrieve(uint256 _amount) public {
require(_balance >= _amount, "insufficient funds.");
_balance = _balance - _amount;
msg.sender.call{value: _amount};
(bool res, ) = msg.sender.call{value: _amount}("");
require(res, "transfer failed!");
}
}

0 comments on commit 9f3f8bc

Please sign in to comment.