Callables.with_globals()

Filter functions/modifiers satisfying the given expression of global variables.

with_globals(expr: Any) → Callables

Returns a list of Callables given a list of global filters.

The argument represents an expression of GlobalFilter constants and is a bitmask of flags. For example, to find Functions that call msg.value, we will need to pass in the GlobalFilters.MSG_VALUE expression:

Functions().with_globals(GlobalFilters.MSG_VALUE).exec(1)

If we want to find Functions that call msg.value and msg.sender, we will need to pass in the GlobalFilters.MSG_VALUE & GlobalFilters.MSG_SENDER expression:

Functions().with_globals(GlobalFilters.MSG_VALUE & GlobalFilters.MSG_SENDER).exec(1)

If we want to find Functions that call msg.data but not msg.sender, we will need to pass in the following GlobalFilters.MSG_DATA & ~GlobalFilters.MSG_SENDER expression:

Functions().with_globals(GlobalFilters.MSG_DATA & ~GlobalFilters.MSG_SENDER).exec(1)

Finally, if we want to find functions that either call msg.sender or tx.origin, we will need to pass in the following GlobalFilters.TX_ORIGIN | GlobalFilters.MSG_SENDER expression:

Functions().with_globals(GlobalFilters.TX_ORIGIN | GlobalFilters.MSG_SENDER).exec(1)

Example Query

from glider import *


def query():
  functions = Functions().with_globals(GlobalFilters.TX_ORIGIN).exec(1,2)
  
  return functions

Query Output

Last updated