aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAlex Browne <stephenalexbrowne@gmail.com>2018-06-08 05:46:03 +0800
committerAlex Browne <stephenalexbrowne@gmail.com>2018-06-08 05:46:03 +0800
commit0ddaabe377bef4559e6f02a1f06b1017cc5b3978 (patch)
treea3668403d57eb0dc1f970a46dc3407b08c492d9d /packages/contracts
parent9bc6ebde4e4425799ed3ddfb50495029865e3ae8 (diff)
downloaddexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar.gz
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar.bz2
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar.lz
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar.xz
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.tar.zst
dexon-sol-tools-0ddaabe377bef4559e6f02a1f06b1017cc5b3978.zip
Add missing awaitTransactionSuccessAsync calls
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/test/exchange/transactions.ts6
-rw-r--r--packages/contracts/test/zrx_token.ts70
2 files changed, 53 insertions, 23 deletions
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 60e674a95..7897fa558 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -216,6 +216,7 @@ describe('Exchange transactions', () => {
await exchange.setSignatureValidatorApproval.sendTransactionAsync(whitelist.address, isApproved, {
from: takerAddress,
}),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const defaultOrderParams = {
...constants.STATIC_ORDER_PARAMS,
@@ -238,6 +239,7 @@ describe('Exchange transactions', () => {
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
@@ -258,6 +260,7 @@ describe('Exchange transactions', () => {
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
@@ -278,10 +281,12 @@ describe('Exchange transactions', () => {
const isApproved = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
@@ -295,6 +300,7 @@ describe('Exchange transactions', () => {
signedOrder.signature,
{ from: takerAddress },
),
+ constants.AWAIT_TRANSACTION_MINED_MS,
);
const newBalances = await erc20Wrapper.getBalancesAsync();
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index 996030000..0629c7a88 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -78,7 +78,10 @@ describe('ZRXToken', () => {
const receiver = spender;
const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
const amountToTransfer = new BigNumber(1);
- await zrxToken.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const finalOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
const finalReceiverBalance = await zrxToken.balanceOf.callAsync(receiver);
@@ -100,10 +103,13 @@ describe('ZRXToken', () => {
it('should return false if owner has insufficient balance', async () => {
const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
const amountToTransfer = ownerBalance.plus(1);
- await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer, {
- from: owner,
- gas: constants.MAX_TOKEN_APPROVE_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer, {
+ from: owner,
+ gas: constants.MAX_TOKEN_APPROVE_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
});
@@ -136,14 +142,20 @@ describe('ZRXToken', () => {
const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = MAX_UINT;
- await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance, {
- from: owner,
- gas: constants.MAX_TOKEN_APPROVE_GAS,
- });
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance, {
+ from: owner,
+ gas: constants.MAX_TOKEN_APPROVE_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
@@ -154,11 +166,17 @@ describe('ZRXToken', () => {
const initSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance);
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
const newSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
@@ -170,11 +188,17 @@ describe('ZRXToken', () => {
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
- await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer);
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);