fix clas name and bytecode
This commit is contained in:
parent
17e1c71506
commit
99c04b405f
|
@ -305,7 +305,8 @@ class Deploy {
|
|||
let contractObject = new self.web3.eth.Contract(contract.abiDefinition);
|
||||
|
||||
try {
|
||||
deployObject = contractObject.deploy({arguments: contractParams, data: "0x" + contractCode});
|
||||
const dataCode = contractCode.startsWith('0x') ? contractCode : "0x" + contractCode;
|
||||
deployObject = contractObject.deploy({arguments: contractParams, data: dataCode});
|
||||
} catch(e) {
|
||||
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
|
||||
return next(new Error("attempted to deploy " + contract.className + " without specifying parameters"));
|
||||
|
|
|
@ -20,8 +20,8 @@ class Vyper {
|
|||
const compiled_object = {};
|
||||
async.each(contractFiles,
|
||||
function (file, fileCb) {
|
||||
const fileNameOnly = path.basename(file.filename);
|
||||
compiled_object[fileNameOnly] = {};
|
||||
const className = path.basename(file.filename).split('.')[0];
|
||||
compiled_object[className] = {};
|
||||
async.parallel([
|
||||
function getByteCode(paraCb) {
|
||||
shelljs.exec(`vyper ${file.filename}`, {silent: true}, (code, stdout, stderr) => {
|
||||
|
@ -29,12 +29,15 @@ class Vyper {
|
|||
return paraCb(stderr);
|
||||
}
|
||||
if (code !== 0) {
|
||||
return paraCb(`Vyper exited with error code ${code}`)
|
||||
return paraCb(`Vyper exited with error code ${code}`);
|
||||
}
|
||||
if (!stdout) {
|
||||
return paraCb('Execution returned no bytecode');
|
||||
}
|
||||
compiled_object[fileNameOnly].code = stdout.replace(/\n/g, '');
|
||||
const byteCode = stdout.replace(/\n/g, '');
|
||||
compiled_object[className].runtimeBytecode = byteCode;
|
||||
compiled_object[className].realRuntimeBytecode = byteCode;
|
||||
compiled_object[className].code = byteCode;
|
||||
paraCb();
|
||||
});
|
||||
},
|
||||
|
@ -44,7 +47,7 @@ class Vyper {
|
|||
return paraCb(stderr);
|
||||
}
|
||||
if (code !== 0) {
|
||||
return paraCb(`Vyper exited with error code ${code}`)
|
||||
return paraCb(`Vyper exited with error code ${code}`);
|
||||
}
|
||||
if (!stdout) {
|
||||
return paraCb('Execution returned no ABI');
|
||||
|
@ -55,7 +58,7 @@ class Vyper {
|
|||
} catch (e) {
|
||||
return paraCb('ABI is not valid JSON');
|
||||
}
|
||||
compiled_object[fileNameOnly].abiDefinition = ABI;
|
||||
compiled_object[className].abiDefinition = ABI;
|
||||
paraCb();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue