Merge branch 'develop' into concretion_bugfix_651

pull/655/head
Nikhil Parasaram 6 years ago committed by GitHub
commit 16ea6d7ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      mythril/ether/soliditycontract.py
  2. 9
      mythril/mythril.py

@ -25,18 +25,23 @@ class SourceCodeInfo:
self.code = code
def get_contracts_from_file(input_file, solc_args=None):
data = get_solc_json(input_file, solc_args=solc_args)
def get_contracts_from_file(input_file, solc_args=None, solc_binary="solc"):
data = get_solc_json(input_file, solc_args=solc_args, solc_binary=solc_binary)
for key, contract in data["contracts"].items():
filename, name = key.split(":")
if filename == input_file and len(contract["bin-runtime"]):
yield SolidityContract(input_file, name, solc_args)
yield SolidityContract(
input_file=input_file,
name=name,
solc_args=solc_args,
solc_binary=solc_binary,
)
class SolidityContract(ETHContract):
def __init__(self, input_file, name=None, solc_args=None):
def __init__(self, input_file, name=None, solc_args=None, solc_binary="solc"):
data = get_solc_json(input_file, solc_args=solc_args)
data = get_solc_json(input_file, solc_args=solc_args, solc_binary=solc_binary)
self.solidity_files = []

@ -375,13 +375,18 @@ class Mythril(object):
if contract_name is not None:
contract = SolidityContract(
file, contract_name, solc_args=self.solc_args
input_file=file,
name=contract_name,
solc_args=self.solc_args,
solc_binary=self.solc_binary,
)
self.contracts.append(contract)
contracts.append(contract)
else:
for contract in get_contracts_from_file(
file, solc_args=self.solc_args
input_file=file,
solc_args=self.solc_args,
solc_binary=self.solc_binary,
):
self.contracts.append(contract)
contracts.append(contract)

Loading…
Cancel
Save