Callable.get_contract()

Returns the parent contract of the function/modifier if exists, otherwise (global functions) returns NoneObject.

get_contract() → Contract | NoneObject

The function may return NoneObject in cases where it does not belong to any contract and is a global function, as Solidity supports that type of functions.

Example

from glider import *
def query():
  functions = Functions().without_modifier_names(["onlyOwner"]).exec(100)

  contracts = []
  for function in functions:
    # For each function without an "onlyOwner" modifier, return the contract
    contracts.append(function.get_contract())

  return contracts

Example output

Last updated