From 024ddef7f26f8ec45a49d23994f939edb86557ee Mon Sep 17 00:00:00 2001 From: Josselin Date: Wed, 8 May 2019 07:21:35 +0100 Subject: [PATCH] Incorrect ERC detectors: iterate over contracts_derived to avoid dupplicate --- slither/detectors/erc/incorrect_erc20_interface.py | 5 +++-- slither/detectors/erc/incorrect_erc721_interface.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/slither/detectors/erc/incorrect_erc20_interface.py b/slither/detectors/erc/incorrect_erc20_interface.py index 5333f089c..fab6d8aab 100644 --- a/slither/detectors/erc/incorrect_erc20_interface.py +++ b/slither/detectors/erc/incorrect_erc20_interface.py @@ -70,7 +70,8 @@ contract Token{ if contract.is_possible_erc721(): return [] - functions = [f for f in contract.functions if IncorrectERC20InterfaceDetection.incorrect_erc20_interface(f.signature)] + funcs = contract.functions + functions = [f for f in funcs if IncorrectERC20InterfaceDetection.incorrect_erc20_interface(f.signature)] return functions def _detect(self): @@ -80,7 +81,7 @@ contract Token{ dict: [contract name] = set(str) events """ results = [] - for c in self.contracts: + for c in self.slither.contracts_derived: functions = IncorrectERC20InterfaceDetection.detect_incorrect_erc20_interface(c) if functions: info = "{} ({}) has incorrect ERC20 function interface(s):\n" diff --git a/slither/detectors/erc/incorrect_erc721_interface.py b/slither/detectors/erc/incorrect_erc721_interface.py index 336d549db..0ee8063d8 100644 --- a/slither/detectors/erc/incorrect_erc721_interface.py +++ b/slither/detectors/erc/incorrect_erc721_interface.py @@ -71,7 +71,8 @@ contract Token{ if not contract.is_possible_erc721() or not contract.is_possible_erc20(): return [] - functions = [f for f in contract.functions if IncorrectERC721InterfaceDetection.incorrect_erc721_interface(f.signature)] + funcs = contract.functions + functions = [f for f in funcs if IncorrectERC721InterfaceDetection.incorrect_erc721_interface(f.signature)] return functions def _detect(self): @@ -81,7 +82,7 @@ contract Token{ dict: [contract name] = set(str) events """ results = [] - for c in self.contracts: + for c in self.slither.contracts_derived: functions = IncorrectERC721InterfaceDetection.detect_incorrect_erc721_interface(c) if functions: info = "{} ({}) has incorrect ERC721 function interface(s):\n"