Solidity Send Ether To Address

[Solved] Solidity Send Ether To Address | Solidity - Code Explorer | yomemimo.com
Question : send eth to address solidity

Answered by : vovka-zol

{"tags":[{"tag":"textarea","content":"\tfunction sendViaTransfer(address payable _to) public payable {\n \/\/ This function is no longer recommended for sending Ether.\n _to.transfer(msg.value);\n }\n\n function sendViaSend(address payable _to) public payable {\n \/\/ Send returns a boolean value indicating success or failure.\n \/\/ This function is not recommended for sending Ether.\n bool sent = _to.send(msg.value);\n require(sent, \"Failed to send Ether\");\n }\n\n function sendViaCall(address payable _to) public payable {\n \/\/ Call returns a boolean value indicating success or failure.\n \/\/ This is the current recommended method to use.\n (bool sent, bytes memory data) = _to.call{value: msg.value}(\"\");\n require(sent, \"Failed to send Ether\");\n }","code_language":"whatever"}]}

Source : https://solidity-by-example.org/sending-ether/ | Last Update : Mon, 11 Dec 23

Answers related to solidity send ether to address

Code Explorer Popular Question For Solidity