Merge pull request #653 from ConsenSys/hotfix/solc-version-binary

Hotfix/solc version binary
pull/669/head
Nikhil Parasaram 6 years ago committed by GitHub
commit 47bf8a5ee8
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 self.code = code
def get_contracts_from_file(input_file, solc_args=None): def get_contracts_from_file(input_file, 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)
for key, contract in data["contracts"].items(): for key, contract in data["contracts"].items():
filename, name = key.split(":") filename, name = key.split(":")
if filename == input_file and len(contract["bin-runtime"]): 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): 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 = [] self.solidity_files = []

@ -375,13 +375,18 @@ class Mythril(object):
if contract_name is not None: if contract_name is not None:
contract = SolidityContract( 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) self.contracts.append(contract)
contracts.append(contract) contracts.append(contract)
else: else:
for contract in get_contracts_from_file( 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) self.contracts.append(contract)
contracts.append(contract) contracts.append(contract)

Loading…
Cancel
Save