set log function as trace if silent for contract deployer

This commit is contained in:
Jonathan Rainville 2018-08-07 15:30:02 -04:00 committed by Iuri Matias
parent e5c498b59d
commit 2edd45ef55
2 changed files with 13 additions and 5 deletions

View File

@ -145,6 +145,7 @@ class ContractDeployer {
let contractParams = (contract.realArgs || contract.args).slice();
let deploymentAccount = self.blockchain.defaultAccount();
let deployObject;
const logFunction = contract.silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
async.waterfall([
// TODO: can potentially go to a beforeDeploy plugin
@ -241,7 +242,8 @@ class ContractDeployer {
},
function deployTheContract(next) {
let estimatedCost = contract.gas * contract.gasPrice;
self.logger.info(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green);
logFunction(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green);
self.blockchain.deployContractFromObject(deployObject, {
from: contract.deploymentAccount,
@ -253,7 +255,7 @@ class ContractDeployer {
self.events.emit("deploy:contract:error", contract);
return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
}
self.logger.info(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green);
logFunction(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green);
contract.deployedAddress = receipt.contractAddress;
contract.transactionHash = receipt.transactionHash;
receipt.className = contract.className;

View File

@ -216,10 +216,12 @@ class ENS {
"contracts": {
"ENSRegistry": {
"deploy": true,
"silent": true,
"args": []
},
"Resolver": {
"deploy": true,
"silent": true,
"args": ["$ENSRegistry"]
},
"FIFSRegistrar": {
@ -230,7 +232,8 @@ class ENS {
"ropsten": {
"contracts": {
"ENSRegistry": {
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010"
"address": "0x112234455c3a32fd11230c42e7bccd4a84e02010",
"silent": true
},
"Resolver": {
"deploy": false
@ -243,7 +246,8 @@ class ENS {
"rinkeby": {
"contracts": {
"ENSRegistry": {
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A"
"address": "0xe7410170f87102DF0055eB195163A03B7F2Bff4A",
"silent": true
},
"Resolver": {
"deploy": false
@ -256,7 +260,8 @@ class ENS {
"livenet": {
"contracts": {
"ENSRegistry": {
"address": "0x314159265dd8dbb310642f98f50c066173c1259b"
"address": "0x314159265dd8dbb310642f98f50c066173c1259b",
"silent": true
},
"Resolver": {
"deploy": false
@ -273,6 +278,7 @@ class ENS {
const rootNode = namehash.hash(this.registration.rootDomain);
config.development.contracts['FIFSRegistrar'] = {
"deploy": true,
"silent": true,
"args": ["$ENSRegistry", rootNode],
"onDeploy": [
`ENSRegistry.methods.setOwner('${rootNode}', web3.eth.defaultAccount).send().then(() => {