In Solidity v0.4.24 and below, I would send ether from contract to contract using the following code within a bigger function :

if (!_address.call.value(_ether)()){

After Solidity v0.5.0, this throws several errors on compile.

"TypeError: Wrong argument count for function call: 0 arguments given but expected 1. This function requires a single bytes argument. Use "" as argument to provide empty calldata."

"TypeError: Type tuple(bool,bytes memory) is not implicitly convertible to expected type bool."

"TypeError: Unary operator ! cannot be applied to type tuple(bool,bytes memory)"

Changing the previous code to:

if (!_address.call.value(_ether)("")){

removes the first error, but the other two remain.

Changing the code to:


leaves the following warning. "Warning: Return value of low-level calls not used."

It seems to work in practice, but shows warnings and error symbols on Etherscan.

What could I do to remove these warnings?

1 Answer 1


From https://solidity.readthedocs.io/en/v0.5.7/050-breaking-changes.html#semantic-and-syntactic-changes:

Functions .call(), .delegatecall() and .staticcall() now return (bool, bytes memory) to provide access to the return data. Change bool success = otherContract.call("f") to (bool success, bytes memory data) = otherContract.call("f").

So in your, case you want this:

(bool success, bytes memory) = _address.call.value(_ether)("");
require(success); // if (!success) { revert(); } is fine too, just needlessly long.

Note that I've omitted a variable name for the second return value because you're not using it. If you cared about the return value, you'd want (bool success, bytes memory data) = ....

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.