From 4d8181ee0e8e5b767c84b93d9b24a510169b6e97 Mon Sep 17 00:00:00 2001 From: webthethird Date: Fri, 17 Mar 2023 14:29:01 -0500 Subject: [PATCH] Check `contract.functions_entry_points` instead of `function.visibility` --- slither/utils/code_generation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/slither/utils/code_generation.py b/slither/utils/code_generation.py index c0ece478c..8b3a267b1 100644 --- a/slither/utils/code_generation.py +++ b/slither/utils/code_generation.py @@ -5,7 +5,7 @@ from slither.core.declarations.contract import Contract from slither.core.solidity_types.user_defined_type import UserDefinedType if TYPE_CHECKING: - from slither.core.declarations import Function, Structure + from slither.core.declarations import FunctionContract, Structure def generate_interface(contract: "Contract") -> str: @@ -36,13 +36,13 @@ def generate_interface(contract: "Contract") -> str: return interface -def generate_interface_function_signature(func: "Function") -> Optional[str]: +def generate_interface_function_signature(func: "FunctionContract") -> Optional[str]: """ Generates a string of the form: func_name(type1,type2) external {payable/view/pure} returns (type3) Args: - func: A Function object + func: A FunctionContract object Returns: The function interface as a str (contains the return values). @@ -50,9 +50,8 @@ def generate_interface_function_signature(func: "Function") -> Optional[str]: """ name, parameters, return_vars = func.signature - visibility = func.visibility if ( - visibility in ["private", "internal"] + func not in func.contract.functions_entry_points or func.is_constructor or func.is_fallback or func.is_receive