The documentation recommends sending Ether from a smart contract using the call
keyword:
function sendETH(address payable to, uint256 amount)
public
nonReentrant {
require(address(this).balance >= amount, "Insufficient funds");
(bool sent, bytes memory data) = to.call{value: amount}("");
require(sent, "Failed to send Ether");
}
But as I'm compiling this code I'm getting a warning:
Warning: Unused local variable.
--> contracts/MyContract.sol:110:21:
|
110 | (bool sent, bytes memory data) = to.call{value: amount}("");
| ^^^^^^^^^^^^^^^^^
Is there a way to send ether from a smart contract using the call
keyword (as this is the latest recommended method) and avoid this warning?