I'm getting this error:

Error: invalid type (arg="type", value="function")

when trying to call this method on the contract IntOption:

function create(
    address target,
    string memory name,
    int initialValue,
    function (address, string memory, int) external view validate
) public {

from my unit test. I'm trying to pass this function defined in Config4AccessControl as argument for validate:

function anyValue(address, string memory, int value) public pure {
    // any value is ok

This is the unit test:

it("should not be defined after it's created", async () => {
    const intOptions = await IntOption.new();
    const ac = await Config4AccessControl.new();
    await intOptions.create(addr1, 'foo', 1, ac.anyValue.address);
  • I believe that the function pointer must be to an internal function (though the fact that you haven't reported any compilation error implies that I'm wrong here). Dec 5, 2019 at 12:39
  • I was surprised as well but you can a) define function pointers with the syntax above and then pass any matching method from any visible (imported) contract. Dec 5, 2019 at 14:32
  • That it compiles doesn't mean it is supported. I see no reference to function pointers in Solidity's ABI.
    – Ismael
    Dec 5, 2019 at 18:48
  • 1
    @Ismael The documentation mentions them: solidity.readthedocs.io/en/v0.4.24/types.html#function-types "function parameters of function type can be used to pass functions to and return functions from function calls." Dec 6, 2019 at 8:54
  • 1
    @Ismael So I need to open a bug report against web3? Dec 9, 2019 at 10:45

1 Answer 1


This doesn't seem to be supported by web3 (at the time of writing: 1.2.4): https://github.com/ethereum/web3.js/issues/2826

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.