diff --git a/mythril/ether/soliditycontract.py b/mythril/ether/soliditycontract.py index 14995b8b..fdf10fc0 100644 --- a/mythril/ether/soliditycontract.py +++ b/mythril/ether/soliditycontract.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 = [] diff --git a/mythril/mythril.py b/mythril/mythril.py index d5dbd76f..6477d3b2 100644 --- a/mythril/mythril.py +++ b/mythril/mythril.py @@ -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)