|
|
@ -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 = [] |
|
|
|
|
|
|
|
|
|
|
|