From 2d39454ce1a42b085523c0bccb402a5762f8c35b Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Mon, 10 Jun 2019 22:36:02 -0700 Subject: [PATCH] get logs when available, otherwise do not --- .../staking/test/utils/staking_wrapper.ts | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/contracts/staking/test/utils/staking_wrapper.ts b/contracts/staking/test/utils/staking_wrapper.ts index 1d1f9ce975..67ed13e90e 100644 --- a/contracts/staking/test/utils/staking_wrapper.ts +++ b/contracts/staking/test/utils/staking_wrapper.ts @@ -116,7 +116,7 @@ export class StakingWrapper { txDefaults, ); } - private async _executeTransactionAsync(calldata: string, from?: string, value?: BigNumber): Promise { + private async _executeTransactionAsync(calldata: string, from?: string, value?: BigNumber, includeLogs?: boolean): Promise { const txData = { from: (from ? from : this._ownerAddres), to: this.getStakingProxyContract().address, @@ -124,9 +124,11 @@ export class StakingWrapper { gas: 3000000, value } - const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync( - await this._web3Wrapper.sendTransactionAsync(txData) - ); + const txHash = await this._web3Wrapper.sendTransactionAsync(txData); + if (includeLogs) { + + } + const txReceipt = await (includeLogs ? this._logDecoder.getTxWithDecodedLogsAsync(txHash) : this._web3Wrapper.awaitTransactionSuccessAsync(txHash)); return txReceipt; } private async _callAsync(calldata: string, from?: string): Promise { @@ -268,11 +270,13 @@ export class StakingWrapper { ///// EPOCHS ///// public async goToNextEpochAsync(): Promise { const calldata = this.getStakingContract().goToNextEpoch.getABIEncodedTransactionData(); - const txReceipt = await this._executeTransactionAsync(calldata); - //console.log(JSON.stringify(txReceipt, null , 4)); - const l = txReceipt.logs[0] as LogWithDecodedArgs; - console.log(l.args); - console.log(`finalization: gasUsed = ${txReceipt.gasUsed} / cumulativeGasUsed = ${txReceipt.cumulativeGasUsed}`); + const txReceipt = await this._executeTransactionAsync(calldata, undefined, new BigNumber(0), true); + console.log(JSON.stringify(txReceipt, null , 4)); + //console.log((txReceipt.logs[0] as LogWithDecodedArgs).args); + //console.log((txReceipt.logs[1] as LogWithDecodedArgs).args); + //console.log((txReceipt.logs[2] as LogWithDecodedArgs).args); + + console.log(`finalization: gasUsed = ${txReceipt.gasUsed} / cumulativeGasUsed = ${txReceipt.cumulativeGasUsed}`); return txReceipt; } public async skipToNextEpochAsync(): Promise {