Assign addresses to Solidity contracts

pull/62/merge
Bernhard Mueller 7 years ago
parent 402563a636
commit 993164e6df
  1. 7
      myth
  2. 4
      mythril/ether/soliditycontract.py

@ -275,6 +275,8 @@ elif (len(args.solidity_file)):
if(args.graph and len(args.solidity_file) > 1):
exitWithError(args.outform, "Cannot generate call graphs from multiple input files. Please do it one at a time.")
idx = 0
for file in args.solidity_file:
if ":" in file:
@ -286,7 +288,10 @@ elif (len(args.solidity_file)):
try:
signatures.add_signatures_from_file(file, sigs) # Parse file for new function signatures
contract = SolidityContract(file, contract_name)
print(util.get_indexed_address(idx))
contract = SolidityContract(file, contract_name, util.get_indexed_address(idx))
idx += 1
logging.info("Analyzing contract %s:%s" % (file, contract.name))

@ -20,7 +20,7 @@ class SolidityFile:
class SolidityContract(ETHContract):
def __init__(self, input_file, contract_name=None):
def __init__(self, input_file, contract_name=None, address=""):
data = get_solc_json(input_file)
@ -81,4 +81,4 @@ class SolidityContract(ETHContract):
self.mappings.append(SourceMapping(idx, offset, length, lineno))
super().__init__(self.code, self.creation_code, name)
super().__init__(self.code, self.creation_code, name, address)

Loading…
Cancel
Save