When running truffle migrate or truffle test, how can I get the gas usage (for example, see below the log from testrpc)?
Transaction: 0x19d38e8d8418db2bcc569068ad756adf10edd77c39c2da1afd4639b30efdbe31
Contract created: 0x7589cbcd1d32fb4b6bac489453c58395c4cea3ff
Gas usage: 4308473 // <=== HOW DO I ACCESS THIS IN TRUFFLE?
Block Number: 14
Block Time: Sun Jan 14 2018 16:11:54 GMT-0800 (PST)
For example, if I had the transactionHash, I could just use web3.eth.getTransactionReceipt
and check receipt.gasUsed
.
I can not access the receipt since the instance of the Contract.deployed() does not have a transactionHash
.
Is there a way to access the equivalent of receipt.gasUsed
for a contract deployed by Truffle?