diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-05-23 08:52:27 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-05-24 06:09:17 +0800 |
commit | b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96 (patch) | |
tree | 8ab5d6d7cbe3834f91947518898aba0ecd764d8e /packages/contracts/test/exchange | |
parent | f6b81f588d98e09e7a5806902d94e2892d029481 (diff) | |
download | dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar.gz dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar.bz2 dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar.lz dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar.xz dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.tar.zst dexon-sol-tools-b05a3b7aed9d2dcbc6ce4177eeb7db85675b7a96.zip |
Check transaction receipt status codes where applicable
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/core.ts | 12 | ||||
-rw-r--r-- | packages/contracts/test/exchange/dispatcher.ts | 26 | ||||
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 4 | ||||
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 12 |
5 files changed, 28 insertions, 28 deletions
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, }), |