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 contractParams = (contract.realArgs || contract.args).slice();
let deploymentAccount = self.blockchain.defaultAccount(); let deploymentAccount = self.blockchain.defaultAccount();
let deployObject; let deployObject;
const logFunction = contract.silent ? self.logger.trace.bind(self.logger) : self.logger.info.bind(self.logger);
async.waterfall([ async.waterfall([
// TODO: can potentially go to a beforeDeploy plugin // TODO: can potentially go to a beforeDeploy plugin
@ -241,7 +242,8 @@ class ContractDeployer {
}, },
function deployTheContract(next) { function deployTheContract(next) {
let estimatedCost = contract.gas * contract.gasPrice; 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, { self.blockchain.deployContractFromObject(deployObject, {
from: contract.deploymentAccount, from: contract.deploymentAccount,
@ -253,7 +255,7 @@ class ContractDeployer {
self.events.emit("deploy:contract:error", contract); self.events.emit("deploy:contract:error", contract);
return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message)); 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.deployedAddress = receipt.contractAddress;
contract.transactionHash = receipt.transactionHash; contract.transactionHash = receipt.transactionHash;
receipt.className = contract.className; receipt.className = contract.className;

View File

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