From c0323282d65971e96b9bdf4e5825a9200447e785 Mon Sep 17 00:00:00 2001 From: David Pokora Date: Mon, 21 Jan 2019 16:25:08 -0500 Subject: [PATCH] Expose "indexed" attribute on event parameters (used to indicate inclusion in bloom filter). --- slither/core/variables/event_variable.py | 13 ++++++++++++- slither/solc_parsing/variables/event_variable.py | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/slither/core/variables/event_variable.py b/slither/core/variables/event_variable.py index a6ac7c0a3..293a3bdae 100644 --- a/slither/core/variables/event_variable.py +++ b/slither/core/variables/event_variable.py @@ -1,5 +1,16 @@ from .variable import Variable from slither.core.children.child_event import ChildEvent -class EventVariable(ChildEvent, Variable): pass +class EventVariable(ChildEvent, Variable): + def __init__(self): + super(EventVariable, self).__init__() + self._indexed = False + + @property + def indexed(self): + """ + Indicates whether the event variable is indexed in the bloom filter. + :return: Returns True if the variable is indexed in bloom filter, False otherwise. + """ + return self._indexed diff --git a/slither/solc_parsing/variables/event_variable.py b/slither/solc_parsing/variables/event_variable.py index 794f19fe1..8cf3aed9d 100644 --- a/slither/solc_parsing/variables/event_variable.py +++ b/slither/solc_parsing/variables/event_variable.py @@ -2,4 +2,18 @@ from .variable_declaration import VariableDeclarationSolc from slither.core.variables.event_variable import EventVariable -class EventVariableSolc(VariableDeclarationSolc, EventVariable): pass +class EventVariableSolc(VariableDeclarationSolc, EventVariable): + + def _analyze_variable_attributes(self, attributes): + """ + Analyze event variable attributes + :param attributes: The event variable attributes to parse. + :return: None + """ + + # Check for the indexed attribute + if 'indexed' in attributes: + self._indexed = attributes['indexed'] + + super(EventVariableSolc, self)._analyze_variable_attributes(attributes) +