Is it possible to specify arguments to an arbitrary function?

great question.

It depends on what exactly you’re looking to do, but both of these solutions should work:

  1. Use filter. If you want to call only 3 specific function you can filter these methods in, so that calling f(e, args) will only invoke the functions you specified.
    In a similar manner you can filter functions out, which will invoke all functions beside the methods you specified.
    You can find information that will help you with filters in this thread

  2. You can use f.selector to specify the functions that are of interest to you, calling each of them with the appropriate args.
    If you are looking to call 3 specific functions with specific input args, you actually have to call the methods explicitly.
    You can (and should) still use filter to filter in/out only the methods that you are interested in to reduce run time and focus the rule on what’s important.

A more clean and clever way to use f.selector is by creating a helper function that you call within the rule, i.e. instead of calling f(e, args) you call `claim_functions(e, f, arg1, arg2, …).
The f you send is a general method that you actually filter in/out to posses only the functions that you are interested in.

You can find an example to such function in our verification project on the governance system of OpenZeppelin - here.
You can find more verification project in this thread here.

Try looking at the examples and read the other threads and see if it fulfills your needs.

2 Likes