def compile_with_solc(sol_file, contract_name, output_path): """ compile with solc """ print("INFO >> compile with solc compiler") # sol_file command = "{} --bin --abi {} -o {} --overwrite".format( Compiler.compiler_path, sol_file, output_path) common.execute_cmd(command)
def compile_with_js(sol_path, contract_name, output_path="temp"): """ compile with nodejs compiler """ print("INFO >> compile with nodejs compiler") command = "{} --bin --abi {} -o {}".format(Compiler.js_compiler_path, sol_path, output_path) common.execute_cmd(command) # get oupput_prefix output_list = output_path.split('/') output_prefix = "" for field in output_list: output_prefix = output_prefix + field + "_" # get gen path gen_path = "{}/{}{}_sol_{}".format(output_path, output_prefix, contract_name, contract_name) target_path = "{}/{}".format(output_path, contract_name) bin_file = gen_path + ".bin" target_bin_file = target_path + ".bin" if os.path.exists(bin_file): command = "mv {} {}".format(bin_file, target_bin_file) common.execute_cmd(command) abi_file = gen_path + ".abi" target_abi_file = target_path + ".abi" if os.path.exists(abi_file): command = "mv {} {}".format(abi_file, target_abi_file) common.execute_cmd(command)