From b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Tue, 22 May 2018 17:52:27 -0700 Subject: Check transaction receipt status codes where applicable --- packages/contracts/src/utils/exchange_wrapper.ts | 2 +- .../contracts/test/asset_proxy/authorizable.ts | 14 +++++------ packages/contracts/test/asset_proxy/proxies.ts | 24 +++++++++++-------- packages/contracts/test/ether_token.ts | 15 +++++++++--- packages/contracts/test/exchange/core.ts | 12 +++++----- packages/contracts/test/exchange/dispatcher.ts | 26 ++++++++++----------- packages/contracts/test/exchange/match_orders.ts | 4 ++-- packages/contracts/test/exchange/transactions.ts | 2 +- packages/contracts/test/exchange/wrapper.ts | 12 +++++----- .../contracts/test/multi_sig_with_time_lock.ts | 27 ++++++++++++++-------- packages/contracts/test/token_registry.ts | 6 ++--- .../contracts/test/unlimited_allowance_token.ts | 2 +- 12 files changed, 85 insertions(+), 61 deletions(-) (limited to 'packages/contracts') diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts index 0d0977ab8..c353442f3 100644 --- a/packages/contracts/src/utils/exchange_wrapper.ts +++ b/packages/contracts/src/utils/exchange_wrapper.ts @@ -247,7 +247,7 @@ export class ExchangeWrapper { return tx; } private async _getTxWithDecodedExchangeLogsAsync(txHash: string): Promise { - const tx = await this._web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const tx = await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); tx.logs = _.filter(tx.logs, log => log.address === this._exchange.address); tx.logs = _.map(tx.logs, log => this._logDecoder.decodeLogOrThrow(log)); return tx; diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts index 52e9ea87f..87f89c513 100644 --- a/packages/contracts/test/asset_proxy/authorizable.ts +++ b/packages/contracts/test/asset_proxy/authorizable.ts @@ -48,7 +48,7 @@ describe('Authorizable', () => { ).to.be.rejectedWith(constants.REVERT); }); it('should allow owner to add an authorized address', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -56,7 +56,7 @@ describe('Authorizable', () => { expect(isAuthorized).to.be.true(); }); it('should throw if owner attempts to authorize a duplicate address', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -68,7 +68,7 @@ describe('Authorizable', () => { describe('removeAuthorizedAddress', () => { it('should throw if not called by owner', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -80,11 +80,11 @@ describe('Authorizable', () => { }); it('should allow owner to remove an authorized address', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: owner, }), @@ -107,7 +107,7 @@ describe('Authorizable', () => { it('should return all authorized addresses', async () => { const initial = await authorizable.getAuthorizedAddresses.callAsync(); expect(initial).to.have.length(0); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner, }), @@ -117,7 +117,7 @@ describe('Authorizable', () => { expect(afterAdd).to.have.length(1); expect(afterAdd).to.include(address); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: owner, }), diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 4ee38db80..9bcdfa2b8 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -52,7 +52,7 @@ describe('Asset Transfer Proxies', () => { [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(); erc20Proxy = await erc20Wrapper.deployProxyAsync(); await erc20Wrapper.setBalancesAndAllowancesAsync(); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, { from: owner, }), @@ -64,7 +64,7 @@ describe('Asset Transfer Proxies', () => { await erc721Wrapper.setBalancesAndAllowancesAsync(); const erc721Balances = await erc721Wrapper.getBalancesAsync(); erc721MakerTokenId = erc721Balances[makerAddress][erc721Token.address][0]; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, { from: owner, }), @@ -85,7 +85,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(10); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, @@ -111,7 +111,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(0); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, @@ -137,7 +137,7 @@ describe('Asset Transfer Proxies', () => { // Create allowance less than transfer amount. Set allowance on proxy. const allowance = new BigNumber(0); const transferAmount = new BigNumber(10); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, allowance, { from: makerAddress, }), @@ -193,7 +193,10 @@ describe('Asset Transfer Proxies', () => { amounts, { from: exchangeAddress }, ); - const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const res = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(res.logs.length).to.equal(numTransfers); @@ -246,7 +249,7 @@ describe('Asset Transfer Proxies', () => { // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(1); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.transferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, @@ -314,7 +317,7 @@ describe('Asset Transfer Proxies', () => { erc721MakerTokenId, ); // Remove transfer approval for makerAddress. - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, false, { from: makerAddress, }), @@ -376,7 +379,10 @@ describe('Asset Transfer Proxies', () => { amounts, { from: exchangeAddress }, ); - const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const res = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); expect(res.logs.length).to.equal(numTransfers); const newOwnerMakerAssetA = await erc721Token.ownerOf.callAsync(makerTokenIdA); diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts index 9b04dd187..5c8a5e199 100644 --- a/packages/contracts/test/ether_token.ts +++ b/packages/contracts/test/ether_token.ts @@ -61,7 +61,10 @@ describe('EtherToken', () => { const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1))); const txHash = await contractWrappers.etherToken.depositAsync(etherTokenAddress, ethToDeposit, account); - const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const receipt = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); const ethSpentOnGas = gasPrice.times(receipt.gasUsed); const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); @@ -97,7 +100,10 @@ describe('EtherToken', () => { gasLimit: constants.MAX_ETHERTOKEN_WITHDRAW_GAS, }, ); - const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const receipt = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); const ethSpentOnGas = gasPrice.times(receipt.gasUsed); const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); @@ -124,7 +130,10 @@ describe('EtherToken', () => { gasPrice, }); - const receipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const receipt = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); const ethSpentOnGas = gasPrice.times(receipt.gasUsed); const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account); diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index f1d9a4156..4776216ca 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -94,13 +94,13 @@ describe('Exchange core', () => { await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), constants.AWAIT_TRANSACTION_MINED_MS, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), @@ -527,7 +527,7 @@ describe('Exchange core', () => { }); it('should throw if maker allowances are too low to fill order', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: makerAddress, }), @@ -539,7 +539,7 @@ describe('Exchange core', () => { await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith( constants.REVERT, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: makerAddress, }), @@ -548,7 +548,7 @@ describe('Exchange core', () => { }); it('should throw if taker allowances are too low to fill order', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: takerAddress, }), @@ -560,7 +560,7 @@ describe('Exchange core', () => { await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith( constants.REVERT, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: takerAddress, }), diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index a2238bd10..b9c7039bd 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -61,13 +61,13 @@ describe('AssetProxyDispatcher', () => { provider, txDefaults, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }), constants.AWAIT_TRANSACTION_MINED_MS, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, { from: owner, }), @@ -83,7 +83,7 @@ describe('AssetProxyDispatcher', () => { describe('registerAssetProxy', () => { it('should record proxy upon registration', async () => { const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -99,7 +99,7 @@ describe('AssetProxyDispatcher', () => { it('should be able to record multiple proxies', async () => { // Record first proxy const prevERC20ProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -112,7 +112,7 @@ describe('AssetProxyDispatcher', () => { expect(proxyAddress).to.be.equal(erc20Proxy.address); // Record another proxy const prevERC721ProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC721, erc721Proxy.address, @@ -128,7 +128,7 @@ describe('AssetProxyDispatcher', () => { it('should replace proxy address upon re-registration', async () => { // Initial registration const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -148,7 +148,7 @@ describe('AssetProxyDispatcher', () => { // Register new ERC20 Transfer Proxy contract const newAddress = newErc20TransferProxy.address; const currentAddress = erc20Proxy.address; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, newAddress, @@ -165,7 +165,7 @@ describe('AssetProxyDispatcher', () => { it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => { // Initial registration const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -190,7 +190,7 @@ describe('AssetProxyDispatcher', () => { it('should be able to reset proxy address to NULL', async () => { // Initial registration const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -203,7 +203,7 @@ describe('AssetProxyDispatcher', () => { expect(proxyAddress).to.be.equal(erc20Proxy.address); // The following transaction will reset the proxy address const newProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, newProxyAddress, @@ -244,7 +244,7 @@ describe('AssetProxyDispatcher', () => { describe('getAssetProxy', () => { it('should return correct address of registered proxy', async () => { const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -267,7 +267,7 @@ describe('AssetProxyDispatcher', () => { it('should dispatch transfer to registered proxy', async () => { // Register ERC20 proxy const prevProxyAddress = constants.NULL_ADDRESS; - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync( AssetProxyId.ERC20, erc20Proxy.address, @@ -281,7 +281,7 @@ describe('AssetProxyDispatcher', () => { // Perform a transfer from makerAddress to takerAddress const erc20Balances = await erc20Wrapper.getBalancesAsync(); const amount = new BigNumber(10); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync( encodedProxyMetadata, makerAddress, diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 8a3c91520..1834e929c 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -120,13 +120,13 @@ describe('matchOrders', () => { await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); // Authorize ERC20 and ERC721 trades by exchange - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), constants.AWAIT_TRANSACTION_MINED_MS, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 203c05e53..24f7230fa 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -82,7 +82,7 @@ describe('Exchange transactions', () => { exchangeWrapper = new ExchangeWrapper(exchange, provider); await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 39f861968..e7217c2a7 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -87,13 +87,13 @@ describe('Exchange wrappers', () => { await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), constants.AWAIT_TRANSACTION_MINED_MS, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner, }), @@ -256,14 +256,14 @@ describe('Exchange wrappers', () => { it('should not change erc20Balances if maker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: makerAddress, }), constants.AWAIT_TRANSACTION_MINED_MS, ); await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: makerAddress, }), @@ -276,14 +276,14 @@ describe('Exchange wrappers', () => { it('should not change erc20Balances if taker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { from: takerAddress, }), constants.AWAIT_TRANSACTION_MINED_MS, ); await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: takerAddress, }), diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts index 6f18de3e7..732077df2 100644 --- a/packages/contracts/test/multi_sig_with_time_lock.ts +++ b/packages/contracts/test/multi_sig_with_time_lock.ts @@ -79,7 +79,7 @@ describe('MultiSigWalletWithTimeLock', () => { args: [SECONDS_TIME_LOCKED.toNumber()], }; const txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); - const txReceipt = await web3Wrapper.awaitTransactionMinedAsync( + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync( txHash, constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -102,7 +102,7 @@ describe('MultiSigWalletWithTimeLock', () => { args: [SECONDS_TIME_LOCKED.toNumber()], }; let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); - const txReceipt = await web3Wrapper.awaitTransactionMinedAsync( + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync( txHash, constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -112,7 +112,10 @@ describe('MultiSigWalletWithTimeLock', () => { txId = log.args.transactionId; txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1] }); - const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const res = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); expect(res.logs).to.have.length(2); const blockNum = await web3Wrapper.getBlockNumberAsync(); @@ -132,7 +135,7 @@ describe('MultiSigWalletWithTimeLock', () => { args: [SECONDS_TIME_LOCKED.toNumber()], }; let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); - const txReceipt = await web3Wrapper.awaitTransactionMinedAsync( + const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync( txHash, constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -142,12 +145,15 @@ describe('MultiSigWalletWithTimeLock', () => { txId = log.args.transactionId; txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1] }); - await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); expect(initialSecondsTimeLocked).to.be.equal(0); txHash = await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }); - const res = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + const res = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); expect(res.logs).to.have.length(2); const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync()); @@ -182,7 +188,7 @@ describe('MultiSigWalletWithTimeLock', () => { args: [newSecondsTimeLocked], }; let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams); - let txReceipt = await web3Wrapper.awaitTransactionMinedAsync( + let txReceipt = await web3Wrapper.awaitTransactionSuccessAsync( txHash, constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -193,7 +199,10 @@ describe('MultiSigWalletWithTimeLock', () => { txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1], }); - txReceipt = await web3Wrapper.awaitTransactionMinedAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS); + txReceipt = await web3Wrapper.awaitTransactionSuccessAsync( + txHash, + constants.AWAIT_TRANSACTION_MINED_MS, + ); expect(txReceipt.logs).to.have.length(2); }); const newSecondsTimeLocked = 0; @@ -205,7 +214,7 @@ describe('MultiSigWalletWithTimeLock', () => { it('should execute if it has enough confirmations and is past the time lock', async () => { await web3Wrapper.increaseTimeAsync(SECONDS_TIME_LOCKED.toNumber()); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }), constants.AWAIT_TRANSACTION_MINED_MS, ); diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 49d4f3901..1cc519c53 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -142,7 +142,7 @@ describe('TokenRegistry', () => { }); it('should change the token name when called by owner', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner, }), @@ -184,7 +184,7 @@ describe('TokenRegistry', () => { }); it('should change the token symbol when called by owner', async () => { - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); @@ -228,7 +228,7 @@ describe('TokenRegistry', () => { it('should remove token metadata when called by owner', async () => { const index = new BigNumber(0); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await tokenReg.removeToken.sendTransactionAsync(token1.address, index, { from: owner, }), diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts index e831301e1..e3e3bd485 100644 --- a/packages/contracts/test/unlimited_allowance_token.ts +++ b/packages/contracts/test/unlimited_allowance_token.ts @@ -46,7 +46,7 @@ describe('UnlimitedAllowanceToken', () => { constants.DUMMY_TOKEN_DECIMALS, constants.DUMMY_TOKEN_TOTAL_SUPPLY, ); - await web3Wrapper.awaitTransactionMinedAsync( + await web3Wrapper.awaitTransactionSuccessAsync( await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); -- cgit v1.2.3