I'd like to get the return value of a low level call.

(bool success, ) = address(0x1234...7890).call{value:0}(callData);

This post discusses a solution that sounds like it should work, but it doesn't have a checkmark and I was unable to get the source working because that last copy command in the toBytes function does not exist. I tried experimenting in solidity assembly with mload and mstore to make that copy command, but I could not.

copy(_addr, btsptr, _len);

Does anyone have a complete solution that actually works for this? Or can anyone help me finish that posted pseudo code from the above-linked post?

  • 1
    Why not (bool success, bytes memory data) = ..., then you can return data? Commented Jun 16, 2020 at 4:59
  • Is that supposed to work? I haven’t seen that documented anywhere. I will try it today.
    – LampShade
    Commented Jun 16, 2020 at 11:08
  • It works only from solc 0.5.x onward, where call returns two values - success status and the data returned from the function. And the fact that you have (bool success, ) in your code implies that your on solc 0.5.x or higher. Commented Jun 16, 2020 at 11:13
  • That's exactly what I was looking for. Thanks! That seems so obvious, I'm not sure how I missed that.
    – LampShade
    Commented Jun 16, 2020 at 13:27

1 Answer 1


Starting from solc 0.5, call returns two values:

  1. bool success, which indicates whether or not the function completed successfully
  2. bytes memory data, which is the actual data returned from the function

The comma in (bool success, ) = ... implies that you are already using solc 0.5 or higher.

So simply change it to (bool success, bytes memory data) = ..., and use data as desired.

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.