use of org.aion.solidity.CompilationResult.Contract in project aion by aionnetwork.
the class Api method processCompileRsp.
private Map<String, CompiledContr> processCompileRsp(Compiler.Result res, String source) {
Map<String, CompiledContr> compiledContracts = new HashMap<String, CompiledContr>();
if (res.isFailed()) {
LOG.info("contract compile error: [{}]", res.errors);
/*
Enhance performance by separating the log threads and kernel TODO: Implement a
queue for strings TODO: Put every LOG message onto the queue TODO: Use a thread
service to process these message
*/
CompiledContr ret = new CompiledContr();
ret.error = res.errors;
compiledContracts.put("compile-error", ret);
return compiledContracts;
}
CompilationResult result = CompilationResult.parse(res.output);
for (Entry<String, Contract> stringContractEntry : result.contracts.entrySet()) {
CompiledContr ret = new CompiledContr();
Contract Contract = stringContractEntry.getValue();
ret.code = StringUtils.toJsonHex(Contract.bin);
ret.info = new CompiContrInfo();
ret.info.source = source;
ret.info.language = "Solidity";
ret.info.languageVersion = "0";
ret.info.compilerVersion = result.version;
ret.info.abiDefinition = Abi.fromJSON(Contract.abi, new ExternalCapabilities()).getEntries();
compiledContracts.put(stringContractEntry.getKey(), ret);
}
return compiledContracts;
}
Aggregations