diff --git a/lib/contracts.js b/lib/contracts.js index c4c1eae2d..f3136f0bf 100644 --- a/lib/contracts.js +++ b/lib/contracts.js @@ -42,20 +42,24 @@ ContractsManager.prototype.build = function() { contract.gasEstimates = compiledContract.gasEstimates; contract.functionHashes = compiledContract.functionHashes; contract.abiDefinition = compiledContract.abiDefinition; + contract.gas = (contractConfig && contractConfig.gas) || this.contractsConfig.gas; - if (this.contractsConfig.gas === 'auto') { + if (contract.deploy === undefined) { + contract.deploy = true; + } + + if (contract.gas === 'auto') { var maxGas; if (contract.deploy) { maxGas = Math.max(contract.gasEstimates.creation[0], contract.gasEstimates.creation[1], 500000); } else { maxGas = 500000; } - var adjustedGas = Math.round(maxGas * 1.01); + // TODO: put a check so it doesn't go over the block limit + var adjustedGas = Math.round(maxGas * 1.40); contract.gas = adjustedGas; - } else { - contract.gas = this.contractsConfig.gas; } - contract.gasPrice = this.contractsConfig.gasPrice; + contract.gasPrice = contract.gasPrice || this.contractsConfig.gasPrice; contract.type = 'file'; contract.className = className; diff --git a/lib/deploy.js b/lib/deploy.js index 5651f130e..e5382ac05 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -117,7 +117,7 @@ Deploy.prototype.deployContract = function(contract, params, callback) { gasPrice: contract.gasPrice }); - self.logger.info("deploying " + contract.className); + self.logger.info("deploying " + contract.className + " with " + contract.gas + " gas"); contractParams.push(function(err, transaction) { self.logger.contractsState(self.contractsManager.contractsState()); @@ -129,6 +129,7 @@ Deploy.prototype.deployContract = function(contract, params, callback) { } else if (transaction.address !== undefined) { self.logger.info(contract.className + " deployed at " + transaction.address); contract.deployedAddress = transaction.address; + contract.transactionHash = transaction.transactionHash; callback(null, transaction.address); } });