mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 01:37:26 +00:00
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);
|
let contractObject = new self.web3.eth.Contract(contract.abiDefinition);
|
||||||
|
|
||||||
try {
|
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) {
|
} catch(e) {
|
||||||
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
|
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
|
||||||
return next(new Error("attempted to deploy " + contract.className + " without specifying parameters"));
|
return next(new Error("attempted to deploy " + contract.className + " without specifying parameters"));
|
||||||
|
@ -20,8 +20,8 @@ class Vyper {
|
|||||||
const compiled_object = {};
|
const compiled_object = {};
|
||||||
async.each(contractFiles,
|
async.each(contractFiles,
|
||||||
function (file, fileCb) {
|
function (file, fileCb) {
|
||||||
const fileNameOnly = path.basename(file.filename);
|
const className = path.basename(file.filename).split('.')[0];
|
||||||
compiled_object[fileNameOnly] = {};
|
compiled_object[className] = {};
|
||||||
async.parallel([
|
async.parallel([
|
||||||
function getByteCode(paraCb) {
|
function getByteCode(paraCb) {
|
||||||
shelljs.exec(`vyper ${file.filename}`, {silent: true}, (code, stdout, stderr) => {
|
shelljs.exec(`vyper ${file.filename}`, {silent: true}, (code, stdout, stderr) => {
|
||||||
@ -29,12 +29,15 @@ class Vyper {
|
|||||||
return paraCb(stderr);
|
return paraCb(stderr);
|
||||||
}
|
}
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return paraCb(`Vyper exited with error code ${code}`)
|
return paraCb(`Vyper exited with error code ${code}`);
|
||||||
}
|
}
|
||||||
if (!stdout) {
|
if (!stdout) {
|
||||||
return paraCb('Execution returned no bytecode');
|
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();
|
paraCb();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -44,7 +47,7 @@ class Vyper {
|
|||||||
return paraCb(stderr);
|
return paraCb(stderr);
|
||||||
}
|
}
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
return paraCb(`Vyper exited with error code ${code}`)
|
return paraCb(`Vyper exited with error code ${code}`);
|
||||||
}
|
}
|
||||||
if (!stdout) {
|
if (!stdout) {
|
||||||
return paraCb('Execution returned no ABI');
|
return paraCb('Execution returned no ABI');
|
||||||
@ -55,7 +58,7 @@ class Vyper {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
return paraCb('ABI is not valid JSON');
|
return paraCb('ABI is not valid JSON');
|
||||||
}
|
}
|
||||||
compiled_object[fileNameOnly].abiDefinition = ABI;
|
compiled_object[className].abiDefinition = ABI;
|
||||||
paraCb();
|
paraCb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user