1

when I used 0.4.25, it compiles successfully.

function callByFun(address addr)returns (bool){
    bytes4 methodId = bytes4(keccak256("increaseAge(string,uint256)"));
    return addr.call(methodId,"jack", 1);
}

Due to some reasons, I have to change to 0.5.0

function callByFun(address addr)returns (bool){
    return addr.call(abi.encodeWithSignature("increaseAge(string,uint256)", "jack", 1));
}

and it compiles error

browser/ERC865.sol:577:9: TypeError: Different number of arguments in return statement than in returns declaration.
        return addr.call(abi.encodeWithSignature("increaseAge(string,uint256)", "jack", 1));
        ^---------------------------------------------------------------------------------^

How do I revise? Thanks a lot.

0

Change it to:

(bool success,) = addr.call(abi.encodeWithSignature("increaseAge(string,uint256)", "jack", 1));
return success;
| improve this answer | |

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.