1

I am sending ether to another smart contract and calling its fallback function with higher gas as like:

contractAddress.call.value(1 ether).gas(53000)();

It was working in solidity version 0.4.25 but it stopped working in 0.5.0 giving me error:

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.

If I try to add blank argument in call() as it says in the error, then it gives me another error:

TypeError: Member "value" not found or not visible after argument-dependent lookup in tuple(bool,bytes memory) - did you forget the "payable" modifier?

I studied the breaking change documentation but that still could not find the solution. Any help would be appreciated :)

3

Make sure contractAddress is of type address payable. And yes, you'll need to provide an argument. E.g.:

address payable contractAddress = ...;
contractAddress.call.value(1 ether).gas(53000)("");
  • This worked. Thanks again sir.. The mistake I was making was, that I was doing: contractAddress.call("").value(1 ether).gas(53000)(); means adding ("") after call which is incorrect. And as you suggested, I did: contractAddress.call.value(1 ether).gas(53000)(""); and that worked! – Yogesh - EtherAuthority.io Dec 1 '18 at 4:14
  • @smarx I am facing the same issue with the following code : require(msg.sender.call.value(rewardAmount).gas(36000)(""));. How would you specify the type of msg.sender ? Many thanks. – Stanislasdrg Dec 22 '18 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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