Adds a filter to get callables whose names match any of the regex expressions from the given list. Returns a filtered Callables child object. This method can be called on all Callables child classes: Functions and Modifiers.
from glider import*defquery():"""Retrieve the functions that: - Start with `any` and end with a number - Have `bbb` in their name but not `bbbb` or more consecutive b """ functions =Functions()\.with_name_regexes([r"^any.*\d$",r"(?<!b)b{3}(?!b)" ])\.exec(100)# Return the first five functionsreturn functions[0:5]
Output:
[ {"contract":"0xca007cDf7393c8234d337A467C396dAE2E4543da","contract_name":"BoredApeYachtClub","sol_function":"function bbb() internal{\n \n }" }, {"contract":"0x21e6086BE615C4061aA96b63f473cDf0838acbc7","contract_name":"MyFlashLoan", "sol_function": "function anySwap0(address[] memory _targets,bytes[] memory _payloads) public onlyExecutor payable {\n require (_targets.length == _payloads.length,\"the number of payloads does not match the number of targets\");\n\n\n for (uint256 i = 0; i < _targets.length; i++) {\n (bool _success,bytes memory _response) = _targets[i].call(_payloads[i]);\n require(_success); _response;\n }\n\n\n\n\n\n \n\n }"
}]
Modifiers Example
from glider import*defquery():"""Retrieve the modifiers that: - Start with `p` and end with `d` - Start with `l` and end with `d` """ modifiers =Modifiers()\.with_name_regexes([r"^p.*d$",r"^l.*d$" ])\.exec(100)# Return the first five modifiersreturn modifiers[0:5]