aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/asset_proxy_owner.ts12
-rw-r--r--packages/contracts/test/ether_token.ts5
-rw-r--r--packages/contracts/test/exchange/core.ts3
-rw-r--r--packages/contracts/test/exchange/match_orders.ts3
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts3
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts2
-rw-r--r--packages/contracts/test/token_registry.ts2
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts2
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts58
9 files changed, 63 insertions, 27 deletions
diff --git a/packages/contracts/test/asset_proxy_owner.ts b/packages/contracts/test/asset_proxy_owner.ts
index 43c5da512..4c16b5cff 100644
--- a/packages/contracts/test/asset_proxy_owner.ts
+++ b/packages/contracts/test/asset_proxy_owner.ts
@@ -1,7 +1,7 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
import * as Web3 from 'web3';
@@ -66,8 +66,14 @@ describe('AssetProxyOwner', () => {
SECONDS_TIME_LOCKED,
);
multiSigWrapper = new MultiSigWrapper(multiSig, provider);
- await erc20Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner });
- await erc721Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.transferOwnership.sendTransactionAsync(multiSig.address, { from: initialOwner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
diff --git a/packages/contracts/test/ether_token.ts b/packages/contracts/test/ether_token.ts
index 10dd635fe..4e52b658f 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -83,7 +83,10 @@ describe('EtherToken', () => {
it('should convert ether tokens to ether with sufficient balance', async () => {
const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
- await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
const ethTokensToWithdraw = initEthTokenBalance;
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index adc57c7a4..8320e97d6 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -1,9 +1,10 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { assetProxyUtils, crypto, orderHashUtils } from '@0xproject/order-utils';
-import { AssetProxyId, LogWithDecodedArgs, SignedOrder } from '@0xproject/types';
+import { AssetProxyId, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import 'make-promises-safe';
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index 67281a915..07295d78a 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -1,9 +1,10 @@
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { assetProxyUtils, crypto } from '@0xproject/order-utils';
-import { AssetProxyId, LogWithDecodedArgs, SignedOrder } from '@0xproject/types';
+import { AssetProxyId, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index 32b319e56..26cfa8291 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -1,9 +1,10 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
-import { AssetProxyId, LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
+import { AssetProxyId } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import BN = require('bn.js');
import * as chai from 'chai';
+import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as Web3 from 'web3';
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index 7b7885a00..1302d0fa0 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -1,8 +1,8 @@
import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils';
-import { LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
import * as Web3 from 'web3';
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
index 7980977c8..64caac387 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -35,7 +35,7 @@ describe('TokenRegistry', () => {
owner = accounts[0];
notOwner = accounts[1];
tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults);
- tokenRegWrapper = new TokenRegWrapper(tokenReg);
+ tokenRegWrapper = new TokenRegWrapper(tokenReg, provider);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index e5787d5b8..df01f31bb 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -1,6 +1,6 @@
// import { ECSignature, SignedOrder, ZeroEx } from '0x.js';
// import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
-// import { ExchangeContractErrs } from '@0xproject/types';
+// import { ExchangeContractErrs } from 'ethereum-types';
// import { BigNumber } from '@0xproject/utils';
// import { Web3Wrapper } from '@0xproject/web3-wrapper';
// import * as chai from 'chai';
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index c68d8bdcf..b2acdebaa 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -64,7 +64,10 @@ describe('UnlimitedAllowanceToken', () => {
const receiver = spender;
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = new BigNumber(1);
- await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const finalOwnerBalance = await token.balanceOf.callAsync(owner);
const finalReceiverBalance = await token.balanceOf.callAsync(receiver);
@@ -86,7 +89,10 @@ describe('UnlimitedAllowanceToken', () => {
it('should throw if owner has insufficient balance', async () => {
const ownerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = ownerBalance.plus(1);
- await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
return expect(
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
@@ -121,11 +127,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
@@ -135,11 +147,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newOwnerBalance = await token.balanceOf.callAsync(owner);
const newSpenderBalance = await token.balanceOf.callAsync(spender);
@@ -152,11 +170,17 @@ describe('UnlimitedAllowanceToken', () => {
const initOwnerBalance = await token.balanceOf.callAsync(owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner });
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);