mirror of https://github.com/crytic/slither
commit
65fcb4bf58
@ -0,0 +1,25 @@ |
||||
from typing import TYPE_CHECKING |
||||
|
||||
from slither.core.declarations.contract_level import ContractLevel |
||||
from slither.core.declarations import Event |
||||
|
||||
if TYPE_CHECKING: |
||||
from slither.core.declarations import Contract |
||||
|
||||
|
||||
class EventContract(Event, ContractLevel): |
||||
def is_declared_by(self, contract: "Contract") -> bool: |
||||
""" |
||||
Check if the element is declared by the contract |
||||
:param contract: |
||||
:return: |
||||
""" |
||||
return self.contract == contract |
||||
|
||||
@property |
||||
def canonical_name(self) -> str: |
||||
"""Return the function signature as a str |
||||
Returns: |
||||
str: contract.func_name(type1,type2) |
||||
""" |
||||
return self.contract.name + "." + self.full_name |
@ -0,0 +1,13 @@ |
||||
from typing import TYPE_CHECKING |
||||
|
||||
from slither.core.declarations import Event |
||||
from slither.core.declarations.top_level import TopLevel |
||||
|
||||
if TYPE_CHECKING: |
||||
from slither.core.scope.scope import FileScope |
||||
|
||||
|
||||
class EventTopLevel(Event, TopLevel): |
||||
def __init__(self, scope: "FileScope") -> None: |
||||
super().__init__() |
||||
self.file_scope: "FileScope" = scope |
Binary file not shown.
@ -0,0 +1,7 @@ |
||||
event MyEvent(uint256 a); |
||||
|
||||
contract T { |
||||
function a() public { |
||||
emit MyEvent(2); |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
{ |
||||
"T": { |
||||
"a()": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->1;\n1[label=\"Node Type: EXPRESSION 1\n\"];\n}\n" |
||||
} |
||||
} |
Loading…
Reference in new issue