Added source code to submission, but fails with

This commit is contained in:
Sebastian Mueller 2019-04-20 00:44:28 +02:00
parent 3f66e5fa95
commit f8e22177fe
1 changed files with 15 additions and 6 deletions

View File

@ -40,7 +40,12 @@ const buildRequestData = contractObjects => {
Object.keys(contractObjects.contracts).forEach(function(fileKey, index) {
const contractFile = contractObjects.contracts[fileKey];
const source = contractObjects.sources[fileKey];
const sources = contractObjects.sources[fileKey];
// Read source code from file
const source = fs.readFileSync(fileKey, 'utf8')
console.log("source", source)
Object.keys(contractFile).forEach(function(contractKey, index) {
const contractJSON = contractFile[contractKey]
@ -51,9 +56,10 @@ const buildRequestData = contractObjects => {
deployedBytecode: contractJSON.evm.deployedBytecode.object,
sourceMap: contractJSON.evm.bytecode.sourceMap,
deployedSourceMap: contractJSON.evm.deployedBytecode.sourceMap,
ast: source.ast,
legacyAST: source.legacyAST,
sourcePath: fileKey
ast: sources.ast,
legacyAST: sources.legacyAST,
sourcePath: fileKey,
source: source
};
console.log("comes out", contract)
@ -128,7 +134,7 @@ const truffle2MythXJSON = function(truffleJSON, toolId = 'truffle-security') {
sourceMap = srcmap.zeroedSourceMap(sourceMap);
deployedSourceMap = srcmap.zeroedSourceMap(deployedSourceMap);
return {
const mythXJSON = {
contractName,
bytecode,
deployedBytecode,
@ -143,7 +149,10 @@ const truffle2MythXJSON = function(truffleJSON, toolId = 'truffle-security') {
},
},
toolId
};
}
console.log("mythXJSON", mythXJSON)
return mythXJSON;
};
const remapMythXOutput = mythObject => {