Created
September 16, 2021 12:17
-
-
Save nathan-websculpt/9d89d60a8efd09c1fcaaee719e5d6385 to your computer and use it in GitHub Desktop.
Send Ether via call method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendViaCall(address payable _to) public payable { | |
(bool sent, bytes memory data) = _to.call{value:msg.value}(""); | |
require(sent, "Failed to send Ether"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used as an example in This Blog Post