Skip to content

Instantly share code, notes, and snippets.

@nathan-websculpt
Created September 16, 2021 12:36
Show Gist options
  • Save nathan-websculpt/7d03c792f752d22b6633a58e08128fb4 to your computer and use it in GitHub Desktop.
Save nathan-websculpt/7d03c792f752d22b6633a58e08128fb4 to your computer and use it in GitHub Desktop.
function withdrawFromAttackee() public {
uint senderBalance = attackeeBalances[msg.sender];
require(senderBalance > 0);
(bool success, ) = msg.sender.call{ value: senderBalance }("");
require(success, "withdrawFromAttackee failed to send");
attackeeBalances[msg.sender] = 0;
}
@nathan-websculpt
Copy link
Author

Used as an example in This Blog Post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment