Skip to content

Commit

Permalink
Expose "indexed" attribute on event parameters (used to indicate incl…
Browse files Browse the repository at this point in the history
…usion in bloom filter).
  • Loading branch information
Xenomega committed Jan 21, 2019
1 parent affe958 commit c032328
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion slither/core/variables/event_variable.py
Original file line number Diff line number Diff line change
@@ -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

16 changes: 15 additions & 1 deletion slither/solc_parsing/variables/event_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit c032328

Please sign in to comment.