From f61c59ae6c1de66b91131fc035e57a32e5bbc069 Mon Sep 17 00:00:00 2001 From: webthethird Date: Mon, 27 Mar 2023 11:43:16 -0500 Subject: [PATCH] Handle arrays of user-defined types in params/returns --- slither/utils/code_generation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/slither/utils/code_generation.py b/slither/utils/code_generation.py index 718410fb7..e7647bfcc 100644 --- a/slither/utils/code_generation.py +++ b/slither/utils/code_generation.py @@ -15,12 +15,12 @@ if TYPE_CHECKING: def generate_interface( - contract: "Contract", - unroll_structs: bool = True, - skip_events: bool = False, - skip_errors: bool = False, - skip_enums: bool = False, - skip_structs: bool = False + contract: "Contract", + unroll_structs: bool = True, + skip_events: bool = False, + skip_errors: bool = False, + skip_enums: bool = False, + skip_structs: bool = False, ) -> str: """ Generates code for a Solidity interface to the contract. @@ -116,6 +116,7 @@ def generate_interface_function_signature( returns = [ convert_type_for_solidity_signature_to_string(ret.type).replace("(", "").replace(")", "") if unroll_structs + or (isinstance(ret.type, ArrayType) and isinstance(ret.type.type, UserDefinedType)) else f"{str(ret.type.type)} memory" if isinstance(ret.type, UserDefinedType) and isinstance(ret.type.type, (Structure, Enum)) else "address" @@ -126,6 +127,7 @@ def generate_interface_function_signature( parameters = [ convert_type_for_solidity_signature_to_string(param.type).replace("(", "").replace(")", "") if unroll_structs + or (isinstance(param.type, ArrayType) and isinstance(param.type.type, UserDefinedType)) else f"{str(param.type.type)} memory" if isinstance(param.type, UserDefinedType) and isinstance(param.type.type, (Structure, Enum))