Added duplicated contract warning
This commit is contained in:
parent
98890beb46
commit
f852bf3da0
|
@ -59,16 +59,20 @@ function compileSolc(embark, contractFiles, cb) {
|
||||||
|
|
||||||
for (let contractFile in json.contracts) {
|
for (let contractFile in json.contracts) {
|
||||||
let className = contractFile.substr( contractFile.indexOf(":") + 1);
|
let className = contractFile.substr( contractFile.indexOf(":") + 1);
|
||||||
let fileName = contractFile.substr(0, contractFile.indexOf(":"));
|
let filename = contractFile.substr(0, contractFile.indexOf(":"));
|
||||||
|
|
||||||
let contract = json.contracts[contractFile];
|
let contract = json.contracts[contractFile];
|
||||||
|
if(compiled_object[className] && compiled_object[className].filename != filename){
|
||||||
|
logger.warn(`Duplicated contract '${className}' found. Using '${compiled_object[className].filename}' instead of '${file.filename}'`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
compiled_object[className] = {};
|
compiled_object[className] = {};
|
||||||
compiled_object[className].code = contract.bin
|
compiled_object[className].code = contract.bin
|
||||||
compiled_object[className].runtimeBytecode = contract["bin-runtime"];
|
compiled_object[className].runtimeBytecode = contract["bin-runtime"];
|
||||||
compiled_object[className].functionHashes = contract.hashes;
|
compiled_object[className].functionHashes = contract.hashes;
|
||||||
compiled_object[className].abiDefinition = JSON.parse(contract.abi);
|
compiled_object[className].abiDefinition = JSON.parse(contract.abi);
|
||||||
compiled_object[className].filename = fileName;
|
compiled_object[className].filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileCb();
|
fileCb();
|
||||||
|
|
Loading…
Reference in New Issue