aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test/exchange
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r--packages/contracts/test/exchange/core.ts68
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts169
-rw-r--r--packages/contracts/test/exchange/libs.ts6
-rw-r--r--packages/contracts/test/exchange/match_orders.ts24
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts6
-rw-r--r--packages/contracts/test/exchange/transactions.ts11
-rw-r--r--packages/contracts/test/exchange/wrapper.ts60
7 files changed, 237 insertions, 107 deletions
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index be3252800..1edd44aff 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -62,6 +62,12 @@ describe('Exchange core', () => {
let zeroEx: ZeroEx;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -93,12 +99,18 @@ describe('Exchange core', () => {
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
defaultMakerAssetAddress = erc20TokenA.address;
defaultTakerAssetAddress = erc20TokenB.address;
@@ -520,23 +532,39 @@ describe('Exchange core', () => {
});
it('should throw if maker allowances are too low to fill order', async () => {
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: makerAddress,
- });
- expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: makerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
+ constants.REVERT,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
});
it('should throw if taker allowances are too low to fill order', async () => {
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: takerAddress,
- });
- expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(constants.REVERT);
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: takerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
+ constants.REVERT,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
});
it('should not change erc20Balances if an order is expired', async () => {
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index db2f18ddc..a1c37d8c8 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -37,6 +37,12 @@ describe('AssetProxyDispatcher', () => {
let erc721Wrapper: ERC721Wrapper;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
// Setup accounts & addresses
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, notOwner, makerAddress, takerAddress] = accounts);
@@ -56,12 +62,18 @@ describe('AssetProxyDispatcher', () => {
provider,
txDefaults,
);
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
- from: owner,
- });
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -72,11 +84,14 @@ describe('AssetProxyDispatcher', () => {
describe('registerAssetProxy', () => {
it('should record proxy upon registration', async () => {
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
@@ -85,21 +100,27 @@ describe('AssetProxyDispatcher', () => {
it('should be able to record multiple proxies', async () => {
// Record first proxy
const prevERC20ProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevERC20ProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevERC20ProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// Record another proxy
const prevERC721ProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC721,
- erc721Proxy.address,
- prevERC721ProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC721,
+ erc721Proxy.address,
+ prevERC721ProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721);
expect(proxyAddress).to.be.equal(erc721Proxy.address);
@@ -108,11 +129,14 @@ describe('AssetProxyDispatcher', () => {
it('should replace proxy address upon re-registration', async () => {
// Initial registration
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
@@ -125,11 +149,14 @@ describe('AssetProxyDispatcher', () => {
// Register new ERC20 Transfer Proxy contract
const newAddress = newErc20TransferProxy.address;
const currentAddress = erc20Proxy.address;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- newAddress,
- currentAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ newAddress,
+ currentAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
// Verify new asset proxy has replaced initial version
proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
@@ -139,11 +166,14 @@ describe('AssetProxyDispatcher', () => {
it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => {
// Initial registration
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
@@ -161,21 +191,27 @@ describe('AssetProxyDispatcher', () => {
it('should be able to reset proxy address to NULL', async () => {
// Initial registration
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// The following transaction will reset the proxy address
const newProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- newProxyAddress,
- erc20Proxy.address,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ newProxyAddress,
+ erc20Proxy.address,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const finalProxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(finalProxyAddress).to.be.equal(newProxyAddress);
@@ -209,11 +245,14 @@ describe('AssetProxyDispatcher', () => {
describe('getAssetProxy', () => {
it('should return correct address of registered proxy', async () => {
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
@@ -229,23 +268,29 @@ describe('AssetProxyDispatcher', () => {
it('should dispatch transfer to registered proxy', async () => {
// Register ERC20 proxy
const prevProxyAddress = ZeroEx.NULL_ADDRESS;
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
- AssetProxyId.ERC20,
- erc20Proxy.address,
- prevProxyAddress,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
+ AssetProxyId.ERC20,
+ erc20Proxy.address,
+ prevProxyAddress,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
// Construct metadata for ERC20 proxy
const encodedProxyMetadata = assetProxyUtils.encodeERC20ProxyData(zrxToken.address);
// Perform a transfer from makerAddress to takerAddress
const erc20Balances = await erc20Wrapper.getBalancesAsync();
const amount = new BigNumber(10);
- await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedProxyMetadata,
- makerAddress,
- takerAddress,
- amount,
- { from: owner },
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
+ encodedProxyMetadata,
+ makerAddress,
+ takerAddress,
+ amount,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
// Verify transfer was successful
const newBalances = await erc20Wrapper.getBalancesAsync();
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
index 1036cb815..883de7a12 100644
--- a/packages/contracts/test/exchange/libs.ts
+++ b/packages/contracts/test/exchange/libs.ts
@@ -26,6 +26,12 @@ describe('Exchange libs', () => {
let libs: TestLibsContract;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const makerAddress = accounts[0];
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index 94cdf4598..b08b9e763 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -79,6 +79,12 @@ describe('matchOrders', () => {
let zeroEx: ZeroEx;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
// Create accounts
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([
@@ -119,12 +125,18 @@ 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 erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
// Set default addresses
defaultERC20MakerAssetAddress = erc20TokenA.address;
defaultERC20TakerAssetAddress = erc20TokenB.address;
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index edff3abc6..d96b9e3fb 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -26,6 +26,12 @@ describe('MixinSignatureValidator', () => {
let signatureValidator: TestSignatureValidatorContract;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const makerAddress = accounts[0];
signatureValidator = await TestSignatureValidatorContract.deployFrom0xArtifactAsync(
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 482475554..798c8283b 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -62,6 +62,12 @@ describe('Exchange transactions', () => {
let zeroEx: ZeroEx;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, senderAddress, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -84,7 +90,10 @@ describe('Exchange transactions', () => {
exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
defaultMakerTokenAddress = erc20TokenA.address;
defaultTakerTokenAddress = erc20TokenB.address;
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 0b79308dd..caaceb460 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -57,6 +57,12 @@ describe('Exchange wrappers', () => {
let zeroEx: ZeroEx;
before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -88,12 +94,18 @@ describe('Exchange wrappers', () => {
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
defaultMakerAssetAddress = erc20TokenA.address;
defaultTakerAssetAddress = erc20TokenB.address;
@@ -251,13 +263,19 @@ describe('Exchange wrappers', () => {
it('should not change erc20Balances if maker allowances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder();
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: makerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: makerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances).to.be.deep.equal(erc20Balances);
@@ -265,13 +283,19 @@ describe('Exchange wrappers', () => {
it('should not change erc20Balances if taker allowances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder();
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: takerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: takerAddress,
- });
+ await web3Wrapper.awaitTransactionMinedAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances).to.be.deep.equal(erc20Balances);