comply with linter

pull/7/head
Iuri Matias 7 years ago
parent e2f1d7407d
commit dc7741e9a8
  1. 6
      src/compiler.js
  2. 15
      src/deployer.js

@ -36,10 +36,10 @@ function compileFileOrFiles (filename, isDirectory, cb) {
compiler.compile(sources, filepath)
}
], function (err, result) {
let errors = result.errors.filter((e) => e.type === 'Error');
let errors = result.errors.filter((e) => e.type === 'Error')
if (errors.length > 0) {
console.dir(errors);
return cb("errors compiling");
console.dir(errors)
return cb(new Error('errors compiling'))
}
cb(err, result.contracts)
})

@ -31,7 +31,7 @@ function deployAll (compileResult, web3, callback) {
compiledObject[className].filename = filename
compiledObject[className].className = className
if (contractFile.indexOf("_test.sol") >=0 ) {
if (contractFile.indexOf('_test.sol') >= 0) {
compiledObject[className].isTest = true
}
}
@ -39,22 +39,22 @@ function deployAll (compileResult, web3, callback) {
next()
},
function determineContractsToDeploy (next) {
let contractsToDeploy = ['Assert'];
let allContracts = Object.keys(compiledObject);
let contractsToDeploy = ['Assert']
let allContracts = Object.keys(compiledObject)
for (let contractName of allContracts) {
if (contractName === 'Assert') {
continue;
continue
}
if (compiledObject[contractName].isTest) {
contractsToDeploy.push(contractName)
}
}
next(null, contractsToDeploy);
next(null, contractsToDeploy)
},
function deployContracts (contractsToDeploy, next) {
async.eachOfLimit(contractsToDeploy, 1, function (contractName, index, nextEach) {
let contract = compiledObject[contractName];
let contract = compiledObject[contractName]
let contractObject = new web3.eth.Contract(contract.abi)
let contractCode = '0x' + contract.code
@ -76,7 +76,7 @@ function deployAll (compileResult, web3, callback) {
contractCode = contractCode.replace(new RegExp(toReplace, 'g'), contractObj.deployedAddress.slice(2))
}
let deployObject = contractObject.deploy({arguments: [], data: contractCode});
let deployObject = contractObject.deploy({arguments: [], data: contractCode})
deployObject.estimateGas().then((gasValue) => {
deployObject.send({
@ -93,7 +93,6 @@ function deployAll (compileResult, web3, callback) {
nextEach()
})
})
}, function () {
next(null, contracts)
})

Loading…
Cancel
Save