diff --git a/slither/core/declarations/contract.py b/slither/core/declarations/contract.py index eb2ac9a2e..ffd8a0862 100644 --- a/slither/core/declarations/contract.py +++ b/slither/core/declarations/contract.py @@ -953,6 +953,20 @@ class Contract(SourceMapping): # pylint: disable=too-many-public-methods """ return all((not f.is_implemented) for f in self.functions) + def generate_interface(self) -> str: + interface = f"interface I{self.name} {{\n" + for struct in self.structures: + interface += struct.interface_def_str() + for var in self.state_variables_entry_points: + interface += ( + f" function {var.signature_str.replace('returns', 'external returns ')};\n" + ) + for func in self.functions_entry_points: + if func.is_constructor or func.is_fallback or func.is_receive: + continue + interface += f" function {func.interface_signature_str};\n" + return interface + # endregion ################################################################################### ###################################################################################