I was looking into the contract code for a "Deposit Ether" game on https://cryptomarketpool.com/deposit-14-eth-game-in-a-solidity-smart-contract/ and noticed this line of code:

    function claimReward() public {
        require(msg.sender == winner, "Not Winner");
        //this will send all the ether in this contract to the winner
        (bool sent, ) = msg.sender.call{value: address(this).balance}("");
        require(sent, "Failed to send Ether");

I have no idea how the (bool sent, ) = msg.sender.call{value: address(this).balance}("") line works and am wondering if there's an explanation, especially for the first part regarding (bool sent, ). Thanks

1 Answer 1


From call() method return more than one values. For retrieve the first value about when call() executed, he uses the statement that you shared. From documentation:

address.call(bytes memory) returns (bool, bytes memory)

issue low-level CALL with the given payload, returns success condition and return data, forwards all available gas, adjustable

You can see that call method return two values: a bool and bytes. If I want to retrieve only bool parameter, I'll write a function similar to this:

function isSend(address _to) public payable {
    (bool firstParameter, ) = _to.call{value: msg.value}(""); 

And this way I'll have only the first parameter that return from this call function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.