Callables.with_arg_types()

with_arg_types(arg_types: List[str], sensitivity: bool = True) → Callable

Adds a filter to get callables having specified argument types like "address" or even non-elementary types like structs is strict ordering. Returns a filtered Callables child object. This method can be called on all Callables child classes: Functions and Modifiers.

To filter given a single argument type, refer to Callables.with_arg_type().

Note that the order of the argument types is important. I.e. calling .with_arg_types(["a", "b"]) is not equivalent to calling .with_arg_types(["b", "a"]) !

Note that the function will handle alias types, e.g. if uint256 is passed to the function, the results will also include the alias "uint" variables

Functions Example

from glider import *

def query():
  # Retrieve the functions that have `uint256` and `address` as argument types
  functions = Functions().with_arg_types(["uint256", "address"]).exec(100)

  # Return the first five functions
  return functions[:5]

Output:

Modifiers Example

from glider import *

def query():
  # Retrieve the modifiers that have `uint256` and `State` as their argument types
  modifiers = Modifiers().with_arg_types(["uint256", "State"]).exec(100)

  # Return the first five modifiers
  return modifiers[:5]

Output:

Last updated