|
|
|
@ -4,10 +4,12 @@ from mythril.exceptions import NoContractFoundError |
|
|
|
|
|
|
|
|
|
class SourceMapping: |
|
|
|
|
|
|
|
|
|
def __init__(self, solidity_file_idx, offset, length): |
|
|
|
|
def __init__(self, solidity_file_idx, offset, length, lineno): |
|
|
|
|
self.solidity_file_idx = solidity_file_idx |
|
|
|
|
self.offset = offset |
|
|
|
|
self.length = length |
|
|
|
|
self.lineno = lineno |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SolidityFile: |
|
|
|
|
|
|
|
|
@ -15,6 +17,7 @@ class SolidityFile: |
|
|
|
|
self.filename = filename |
|
|
|
|
self.data = data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SolidityContract(ETHContract): |
|
|
|
|
|
|
|
|
|
def __init__(self, input_file, contract_name = None): |
|
|
|
@ -60,6 +63,8 @@ class SolidityContract(ETHContract): |
|
|
|
|
if len(mapping) > 2 and len(mapping[2]) > 0: |
|
|
|
|
idx = int(mapping[2]) |
|
|
|
|
|
|
|
|
|
self.mappings.append(SourceMapping(idx, offset, length)) |
|
|
|
|
lineno = self.solidity_files[idx].data[0:offset].count('\n') + 1 |
|
|
|
|
|
|
|
|
|
self.mappings.append(SourceMapping(idx, offset, length, lineno)) |
|
|
|
|
|
|
|
|
|
super().__init__(self.code, self.creation_code, name) |
|
|
|
|