Skip to content

Instantly share code, notes, and snippets.

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
nathan-websculpt / SendEther.sol
Created September 16, 2021 12:17
Send Ether via call method
function sendViaCall(address payable _to) public payable {
(bool sent, bytes memory data) = _to.call{value:msg.value}("");
require(sent, "Failed to send Ether");
}