aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/contracts/package.json6
-rw-r--r--packages/contracts/src/utils/address_utils.ts4
-rw-r--r--packages/contracts/src/utils/constants.ts15
-rw-r--r--packages/contracts/src/utils/erc721_wrapper.ts4
-rw-r--r--packages/contracts/src/utils/exchange_wrapper.ts11
-rw-r--r--packages/contracts/src/utils/order_factory.ts9
-rw-r--r--packages/contracts/src/utils/transaction_factory.ts4
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts11
-rw-r--r--packages/contracts/test/ether_token.ts7
-rw-r--r--packages/contracts/test/exchange/core.ts51
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts29
-rw-r--r--packages/contracts/test/exchange/libs.ts2
-rw-r--r--packages/contracts/test/exchange/match_orders.ts163
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts2
-rw-r--r--packages/contracts/test/exchange/transactions.ts12
-rw-r--r--packages/contracts/test/exchange/wrapper.ts37
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts2
-rw-r--r--packages/contracts/test/multi_sig_with_time_lock.ts17
-rw-r--r--packages/contracts/test/token_registry.ts3
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts4
-rw-r--r--packages/contracts/test/unlimited_allowance_token.ts50
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts2
-rw-r--r--packages/contracts/test/zrx_token.ts56
-rw-r--r--packages/tslint-config/package.json2
-rw-r--r--yarn.lock117
25 files changed, 353 insertions, 267 deletions
diff --git a/packages/contracts/package.json b/packages/contracts/package.json
index 9c7142cdb..b19f0cd50 100644
--- a/packages/contracts/package.json
+++ b/packages/contracts/package.json
@@ -28,8 +28,7 @@
"test:circleci": "yarn test:coverage"
},
"config": {
- "abis":
- "../migrations/artifacts/2.0.0/@(DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TestAssetProxyDispatcher|TestLibBytes|TestLibs|TestSignatureValidator|TokenRegistry|WETH9|ZRXToken).json"
+ "abis": "../migrations/artifacts/2.0.0/@(DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress|TestAssetProxyDispatcher|TestLibBytes|TestLibs|TestSignatureValidator|TokenRegistry|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
@@ -64,8 +63,9 @@
"yargs": "^10.0.3"
},
"dependencies": {
- "0x.js": "^0.37.2",
"@0xproject/base-contract": "^0.3.1",
+ "@0xproject/contract-wrappers": "^0.0.2",
+ "@0xproject/order-utils": "^0.0.4",
"@0xproject/sol-compiler": "^0.4.3",
"@0xproject/types": "^0.6.3",
"@0xproject/typescript-typings": "^0.3.1",
diff --git a/packages/contracts/src/utils/address_utils.ts b/packages/contracts/src/utils/address_utils.ts
index 01a7a6fd4..dc63459f9 100644
--- a/packages/contracts/src/utils/address_utils.ts
+++ b/packages/contracts/src/utils/address_utils.ts
@@ -1,10 +1,10 @@
-import { ZeroEx } from '0x.js';
+import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { crypto } from './crypto';
export const addressUtils = {
generatePseudoRandomAddress(): string {
- const randomBigNum = ZeroEx.generatePseudoRandomSalt();
+ const randomBigNum = generatePseudoRandomSalt();
const randomBuff = crypto.solSHA3([randomBigNum]);
const randomAddress = `0x${randomBuff.slice(0, 20).toString('hex')}`;
return randomAddress;
diff --git a/packages/contracts/src/utils/constants.ts b/packages/contracts/src/utils/constants.ts
index 3fd2a0a3b..e45e51c04 100644
--- a/packages/contracts/src/utils/constants.ts
+++ b/packages/contracts/src/utils/constants.ts
@@ -1,5 +1,5 @@
-import { ZeroEx } from '0x.js';
import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3_wrapper';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -30,13 +30,14 @@ export const constants = {
NUM_DUMMY_ERC20_TO_DEPLOY: 3,
NUM_DUMMY_ERC721_TO_DEPLOY: 1,
NUM_ERC721_TOKENS_TO_MINT: 2,
+ NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
- INITIAL_ERC20_BALANCE: ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18),
- INITIAL_ERC20_ALLOWANCE: ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18),
+ INITIAL_ERC20_BALANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
+ INITIAL_ERC20_ALLOWANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
STATIC_ORDER_PARAMS: {
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
- makerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- takerFee: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
},
};
diff --git a/packages/contracts/src/utils/erc721_wrapper.ts b/packages/contracts/src/utils/erc721_wrapper.ts
index 5b5de262f..bf8953a49 100644
--- a/packages/contracts/src/utils/erc721_wrapper.ts
+++ b/packages/contracts/src/utils/erc721_wrapper.ts
@@ -1,4 +1,4 @@
-import { ZeroEx } from '0x.js';
+import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { Provider } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
@@ -54,7 +54,7 @@ export class ERC721Wrapper {
_.forEach(this._dummyTokenContracts, dummyTokenContract => {
_.forEach(this._tokenOwnerAddresses, tokenOwnerAddress => {
_.forEach(_.range(constants.NUM_ERC721_TOKENS_TO_MINT), () => {
- const tokenId = ZeroEx.generatePseudoRandomSalt();
+ const tokenId = generatePseudoRandomSalt();
setBalancePromises.push(
dummyTokenContract.mint.sendTransactionAsync(tokenOwnerAddress, tokenId, {
from: this._contractOwnerAddress,
diff --git a/packages/contracts/src/utils/exchange_wrapper.ts b/packages/contracts/src/utils/exchange_wrapper.ts
index 46531fa3f..98d5e27f9 100644
--- a/packages/contracts/src/utils/exchange_wrapper.ts
+++ b/packages/contracts/src/utils/exchange_wrapper.ts
@@ -1,5 +1,6 @@
-import { TransactionReceiptWithDecodedLogs, ZeroEx } from '0x.js';
+import { TransactionReceiptWithDecodedLogs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -14,10 +15,8 @@ import { AssetProxyId, OrderInfo, SignedOrder, SignedTransaction } from './types
export class ExchangeWrapper {
private _exchange: ExchangeContract;
private _logDecoder: LogDecoder = new LogDecoder(constants.TESTRPC_NETWORK_ID);
- private _zeroEx: ZeroEx;
- constructor(exchangeContract: ExchangeContract, zeroEx: ZeroEx) {
+ constructor(exchangeContract: ExchangeContract) {
this._exchange = exchangeContract;
- this._zeroEx = zeroEx;
}
public async fillOrderAsync(
signedOrder: SignedOrder,
@@ -196,7 +195,7 @@ export class ExchangeWrapper {
opts: { oldAssetProxyAddressIfExists?: string } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const oldAssetProxyAddress = _.isUndefined(opts.oldAssetProxyAddressIfExists)
- ? ZeroEx.NULL_ADDRESS
+ ? constants.NULL_ADDRESS
: opts.oldAssetProxyAddressIfExists;
const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(
assetProxyId,
@@ -246,7 +245,7 @@ export class ExchangeWrapper {
return tx;
}
private async _getTxWithDecodedExchangeLogsAsync(txHash: string) {
- const tx = await this._zeroEx.awaitTransactionMinedAsync(txHash);
+ const tx = await Web3Wrapper.awaitTransactionMinedAsync(txHash);
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/src/utils/order_factory.ts b/packages/contracts/src/utils/order_factory.ts
index 044e9b865..86b3d5ac7 100644
--- a/packages/contracts/src/utils/order_factory.ts
+++ b/packages/contracts/src/utils/order_factory.ts
@@ -1,7 +1,8 @@
-import { ZeroEx } from '0x.js';
+import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
+import { constants } from './constants';
import { orderUtils } from './order_utils';
import { signingUtils } from './signing_utils';
import { SignatureType, SignedOrder, UnsignedOrder } from './types';
@@ -19,10 +20,10 @@ export class OrderFactory {
): SignedOrder {
const randomExpiration = new BigNumber(Math.floor((Date.now() + Math.random() * 100000000000) / 1000));
const order = ({
- senderAddress: ZeroEx.NULL_ADDRESS,
+ senderAddress: constants.NULL_ADDRESS,
expirationTimeSeconds: randomExpiration,
- salt: ZeroEx.generatePseudoRandomSalt(),
- takerAddress: ZeroEx.NULL_ADDRESS,
+ salt: generatePseudoRandomSalt(),
+ takerAddress: constants.NULL_ADDRESS,
...this._defaultOrderParams,
...customOrderParams,
} as any) as UnsignedOrder;
diff --git a/packages/contracts/src/utils/transaction_factory.ts b/packages/contracts/src/utils/transaction_factory.ts
index 3a4f48330..941bff96d 100644
--- a/packages/contracts/src/utils/transaction_factory.ts
+++ b/packages/contracts/src/utils/transaction_factory.ts
@@ -1,4 +1,4 @@
-import { ZeroEx } from '0x.js';
+import { generatePseudoRandomSalt } from '@0xproject/order-utils';
import { BigNumber } from '@0xproject/utils';
import * as ethUtil from 'ethereumjs-util';
@@ -20,7 +20,7 @@ export class TransactionFactory {
data: string,
signatureType: SignatureType = SignatureType.Ecrecover,
): SignedTransaction {
- const salt = ZeroEx.generatePseudoRandomSalt();
+ const salt = generatePseudoRandomSalt();
const txHash = crypto.solSHA3([this._exchangeAddress, salt, ethUtil.toBuffer(data)]);
const signature = signingUtils.signMessage(txHash, this._privateKey, signatureType);
const signedTx = {
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index e7ef9a0d3..3c72968d3 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -37,8 +36,6 @@ describe('Asset Transfer Proxies', () => {
let erc721Wrapper: ERC721Wrapper;
let erc721MakerTokenId: BigNumber;
- let zeroEx: ZeroEx;
-
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, notAuthorized, exchangeAddress, makerAddress, takerAddress] = accounts);
@@ -61,10 +58,6 @@ describe('Asset Transfer Proxies', () => {
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, {
from: owner,
});
-
- zeroEx = new ZeroEx(provider, {
- networkId: constants.TESTRPC_NETWORK_ID,
- });
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -179,7 +172,7 @@ describe('Asset Transfer Proxies', () => {
amounts,
{ from: exchangeAddress },
);
- const res = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const res = await web3Wrapper.awaitTransactionMinedAsync(txHash);
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(res.logs.length).to.equal(numTransfers);
@@ -356,7 +349,7 @@ describe('Asset Transfer Proxies', () => {
amounts,
{ from: exchangeAddress },
);
- const res = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const res = await web3Wrapper.awaitTransactionMinedAsync(txHash);
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 418fbc45e..a71d96cb8 100644
--- a/packages/contracts/test/ether_token.ts
+++ b/packages/contracts/test/ether_token.ts
@@ -1,7 +1,8 @@
-import { ContractWrappersError, ZeroEx } from '0x.js';
+import { ContractWrappersError } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { Web3Wrapper } from '@0xproject/web3_wrapper';
import * as chai from 'chai';
import 'make-promises-safe';
@@ -17,7 +18,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('EtherToken', () => {
let account: string;
- const gasPrice = ZeroEx.toBaseUnitAmount(new BigNumber(20), 9);
+ const gasPrice = Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 9);
let zeroEx: ZeroEx;
let etherTokenAddress: string;
before(async () => {
@@ -103,7 +104,7 @@ describe('EtherToken', () => {
const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
const initEthTokenBalance = await zeroEx.token.getBalanceAsync(etherTokenAddress, account);
- const ethToDeposit = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
+ const ethToDeposit = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18);
const txHash = await web3Wrapper.sendTransactionAsync({
from: account,
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index be3252800..a8a402555 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -1,6 +1,7 @@
-import { LogWithDecodedArgs, ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
+import { LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web-wrapper';
import * as chai from 'chai';
import ethUtil = require('ethereumjs-util');
import 'make-promises-safe';
@@ -89,7 +90,7 @@ describe('Exchange core', () => {
exchangeContractAddress: exchange.address,
networkId: constants.TESTRPC_NETWORK_ID,
});
- exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
+ exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
@@ -166,8 +167,8 @@ describe('Exchange core', () => {
it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
});
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
@@ -219,8 +220,8 @@ describe('Exchange core', () => {
it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
});
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
@@ -272,8 +273,8 @@ describe('Exchange core', () => {
it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
});
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
@@ -326,8 +327,8 @@ describe('Exchange core', () => {
it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
signedOrder = orderFactory.newSignedOrder({
takerAddress,
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
});
const takerAssetFilledAmountBefore = await exchangeWrapper.getTakerAssetFilledAmountAsync(
@@ -445,8 +446,8 @@ describe('Exchange core', () => {
it('should throw when taker is specified and order is claimed by other', async () => {
signedOrder = orderFactory.newSignedOrder({
takerAddress: feeRecipientAddress,
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
});
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
constants.REVERT,
@@ -455,7 +456,7 @@ describe('Exchange core', () => {
it('should throw if signature is invalid', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
});
const invalidR = ethUtil.sha3('invalidR');
@@ -501,7 +502,7 @@ describe('Exchange core', () => {
it('should throw if maker erc20Balances are too low to fill order', async () => {
signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
});
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
@@ -511,7 +512,7 @@ describe('Exchange core', () => {
it('should throw if taker erc20Balances are too low to fill order', async () => {
signedOrder = orderFactory.newSignedOrder({
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
});
return expect(exchangeWrapper.fillOrderAsync(signedOrder, takerAddress)).to.be.rejectedWith(
@@ -681,23 +682,23 @@ describe('Exchange core', () => {
erc20Balances = await erc20Wrapper.getBalancesAsync();
const signedOrders = await Promise.all([
orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(9), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
salt: new BigNumber(0),
}),
orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(79), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
salt: new BigNumber(1),
}),
orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(979), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
salt: new BigNumber(2),
}),
orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(7979), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
salt: new BigNumber(3),
}),
]);
@@ -873,7 +874,7 @@ describe('Exchange core', () => {
const makerAssetId = erc721MakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
makerAssetAmount: new BigNumber(1),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
makerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, makerAssetId),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultTakerAssetAddress),
});
@@ -913,7 +914,7 @@ describe('Exchange core', () => {
const takerAssetId = erc721TakerAssetIds[0];
signedOrder = orderFactory.newSignedOrder({
takerAssetAmount: new BigNumber(1),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
takerAssetData: assetProxyUtils.encodeERC721ProxyData(erc721Token.address, takerAssetId),
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultMakerAssetAddress),
});
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index db2f18ddc..3a09eb122 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -71,7 +70,7 @@ describe('AssetProxyDispatcher', () => {
});
describe('registerAssetProxy', () => {
it('should record proxy upon registration', async () => {
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -84,7 +83,7 @@ describe('AssetProxyDispatcher', () => {
it('should be able to record multiple proxies', async () => {
// Record first proxy
- const prevERC20ProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevERC20ProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -94,7 +93,7 @@ describe('AssetProxyDispatcher', () => {
let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// Record another proxy
- const prevERC721ProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevERC721ProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
erc721Proxy.address,
@@ -107,7 +106,7 @@ describe('AssetProxyDispatcher', () => {
it('should replace proxy address upon re-registration', async () => {
// Initial registration
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -138,7 +137,7 @@ describe('AssetProxyDispatcher', () => {
it('should throw if registering with incorrect "currentAssetProxyAddress" field', async () => {
// Initial registration
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -147,12 +146,12 @@ describe('AssetProxyDispatcher', () => {
);
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
expect(proxyAddress).to.be.equal(erc20Proxy.address);
- // The following transaction will throw because the currentAddress is no longer ZeroEx.NULL_ADDRESS
+ // The following transaction will throw because the currentAddress is no longer constants.NULL_ADDRESS
return expect(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
- ZeroEx.NULL_ADDRESS,
+ constants.NULL_ADDRESS,
{ from: owner },
),
).to.be.rejectedWith(constants.REVERT);
@@ -160,7 +159,7 @@ describe('AssetProxyDispatcher', () => {
it('should be able to reset proxy address to NULL', async () => {
// Initial registration
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -170,7 +169,7 @@ describe('AssetProxyDispatcher', () => {
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;
+ const newProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
newProxyAddress,
@@ -182,7 +181,7 @@ describe('AssetProxyDispatcher', () => {
});
it('should throw if requesting address is not owner', async () => {
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
return expect(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
@@ -194,7 +193,7 @@ describe('AssetProxyDispatcher', () => {
});
it('should throw if attempting to register a proxy to the incorrect id', async () => {
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
return expect(
assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC721,
@@ -208,7 +207,7 @@ describe('AssetProxyDispatcher', () => {
describe('getAssetProxy', () => {
it('should return correct address of registered proxy', async () => {
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
@@ -221,14 +220,14 @@ describe('AssetProxyDispatcher', () => {
it('should return NULL address if requesting non-existent proxy', async () => {
const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(ZeroEx.NULL_ADDRESS);
+ expect(proxyAddress).to.be.equal(constants.NULL_ADDRESS);
});
});
describe('dispatchTransferFrom', () => {
it('should dispatch transfer to registered proxy', async () => {
// Register ERC20 proxy
- const prevProxyAddress = ZeroEx.NULL_ADDRESS;
+ const prevProxyAddress = constants.NULL_ADDRESS;
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(
AssetProxyId.ERC20,
erc20Proxy.address,
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
index 1036cb815..9af5916dd 100644
--- a/packages/contracts/test/exchange/libs.ts
+++ b/packages/contracts/test/exchange/libs.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -29,7 +28,6 @@ describe('Exchange libs', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const makerAddress = accounts[0];
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
- const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
const defaultOrderParams = {
...constants.STATIC_ORDER_PARAMS,
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index 94cdf4598..bdf4f54fb 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -1,6 +1,7 @@
-import { LogWithDecodedArgs, ZeroEx } from '0x.js';
import { BlockchainLifecycle } 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 ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
@@ -76,8 +77,6 @@ describe('matchOrders', () => {
let matchOrderTester: MatchOrderTester;
- let zeroEx: ZeroEx;
-
before(async () => {
// Create accounts
const accounts = await web3Wrapper.getAvailableAddressesAsync();
@@ -111,11 +110,7 @@ describe('matchOrders', () => {
txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
);
- zeroEx = new ZeroEx(provider, {
- exchangeContractAddress: exchange.address,
- networkId: constants.TESTRPC_NETWORK_ID,
- });
- exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
+ exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
// Authorize ERC20 and ERC721 trades by exchange
@@ -161,16 +156,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match signedOrderLeft with signedOrderRight
@@ -195,16 +190,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Store original taker balance
@@ -240,16 +235,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(20), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(4), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -274,16 +269,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -308,16 +303,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -347,8 +342,8 @@ describe('matchOrders', () => {
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match signedOrderLeft with signedOrderRight2
@@ -377,8 +372,8 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
@@ -386,8 +381,8 @@ describe('matchOrders', () => {
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -417,8 +412,8 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(50), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
// Match signedOrderLeft2 with signedOrderRight
@@ -450,16 +445,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress,
});
// Match orders
@@ -478,16 +473,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -507,16 +502,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -536,16 +531,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -565,16 +560,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -594,16 +589,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: makerAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: makerAddressRight,
});
// Match orders
@@ -622,16 +617,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Cancel left order
@@ -648,16 +643,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Cancel right order
@@ -674,16 +669,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -704,16 +699,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -734,16 +729,16 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(2), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
@@ -766,14 +761,14 @@ describe('matchOrders', () => {
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
makerAssetAmount: new BigNumber(1),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressLeft,
});
const signedOrderRight = orderFactoryRight.newSignedOrder({
makerAddress: makerAddressRight,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20TakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: new BigNumber(1),
feeRecipientAddress: feeRecipientAddressRight,
});
@@ -800,7 +795,7 @@ describe('matchOrders', () => {
makerAddress: makerAddressLeft,
makerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
takerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
takerAssetAmount: new BigNumber(1),
feeRecipientAddress: feeRecipientAddressLeft,
});
@@ -809,7 +804,7 @@ describe('matchOrders', () => {
makerAssetData: assetProxyUtils.encodeERC721ProxyData(defaultERC721AssetAddress, erc721TokenToTransfer),
takerAssetData: assetProxyUtils.encodeERC20ProxyData(defaultERC20MakerAssetAddress),
makerAssetAmount: new BigNumber(1),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
feeRecipientAddress: feeRecipientAddressRight,
});
// Match orders
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index 489ed32c5..7dac28c17 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -33,7 +32,6 @@ describe('MixinSignatureValidator', () => {
provider,
txDefaults,
);
- const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
const defaultOrderParams = {
...constants.STATIC_ORDER_PARAMS,
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 482475554..cd18b60ed 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -1,5 +1,3 @@
-import { ZeroEx } from '0x.js';
-
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
@@ -59,8 +57,6 @@ describe('Exchange transactions', () => {
let defaultMakerTokenAddress: string;
let defaultTakerTokenAddress: string;
- let zeroEx: ZeroEx;
-
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, senderAddress, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -77,11 +73,7 @@ describe('Exchange transactions', () => {
txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
);
- zeroEx = new ZeroEx(provider, {
- exchangeContractAddress: exchange.address,
- networkId: constants.TESTRPC_NETWORK_ID,
- });
- exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
+ exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner });
@@ -179,7 +171,7 @@ describe('Exchange transactions', () => {
it('should reset the currentContextAddress', async () => {
await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
const currentContextAddress = await exchange.currentContextAddress.callAsync();
- expect(currentContextAddress).to.equal(ZeroEx.NULL_ADDRESS);
+ expect(currentContextAddress).to.equal(constants.NULL_ADDRESS);
});
});
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index 0b79308dd..4ff530874 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -54,8 +53,6 @@ describe('Exchange wrappers', () => {
let defaultMakerAssetAddress: string;
let defaultTakerAssetAddress: string;
- let zeroEx: ZeroEx;
-
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
@@ -80,11 +77,7 @@ describe('Exchange wrappers', () => {
txDefaults,
assetProxyUtils.encodeERC20ProxyData(zrxToken.address),
);
- zeroEx = new ZeroEx(provider, {
- exchangeContractAddress: exchange.address,
- networkId: constants.TESTRPC_NETWORK_ID,
- });
- exchangeWrapper = new ExchangeWrapper(exchange, zeroEx);
+ exchangeWrapper = new ExchangeWrapper(exchange);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner);
await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner);
@@ -119,8 +112,8 @@ describe('Exchange wrappers', () => {
describe('fillOrKillOrder', () => {
it('should transfer the correct amounts', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
});
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
@@ -187,8 +180,8 @@ describe('Exchange wrappers', () => {
describe('fillOrderNoThrow', () => {
it('should transfer the correct amounts', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
});
const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
@@ -231,7 +224,7 @@ describe('Exchange wrappers', () => {
it('should not change erc20Balances if maker erc20Balances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder({
- makerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
@@ -241,7 +234,7 @@ describe('Exchange wrappers', () => {
it('should not change erc20Balances if taker erc20Balances are too low to fill order', async () => {
const signedOrder = orderFactory.newSignedOrder({
- takerAssetAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
});
await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
@@ -620,7 +613,7 @@ describe('Exchange wrappers', () => {
});
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
- const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
defaultMakerAssetAddress
@@ -663,7 +656,7 @@ describe('Exchange wrappers', () => {
return expect(
exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
@@ -709,7 +702,7 @@ describe('Exchange wrappers', () => {
});
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
- const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
defaultMakerAssetAddress
@@ -752,7 +745,7 @@ describe('Exchange wrappers', () => {
return expect(
exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
@@ -798,7 +791,7 @@ describe('Exchange wrappers', () => {
});
it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
- const makerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
defaultMakerAssetAddress
@@ -841,7 +834,7 @@ describe('Exchange wrappers', () => {
return expect(
exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
@@ -887,7 +880,7 @@ describe('Exchange wrappers', () => {
});
it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
- const takerAssetFillAmount = ZeroEx.toBaseUnitAmount(new BigNumber(100000), 18);
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
_.forEach(signedOrders, signedOrder => {
erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
defaultMakerAssetAddress
@@ -930,7 +923,7 @@ describe('Exchange wrappers', () => {
return expect(
exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerAssetFillAmount: ZeroEx.toBaseUnitAmount(new BigNumber(1000), 18),
+ makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
}),
).to.be.rejectedWith(constants.REVERT);
});
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index 5ed5c356f..d0e553939 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -1,5 +1,5 @@
-import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs, ZeroEx } from '0x.js';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+import { LogWithDecodedArgs, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import BN = require('bn.js');
diff --git a/packages/contracts/test/multi_sig_with_time_lock.ts b/packages/contracts/test/multi_sig_with_time_lock.ts
index 8e58006ac..771bae8af 100644
--- a/packages/contracts/test/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multi_sig_with_time_lock.ts
@@ -1,5 +1,5 @@
-import { LogWithDecodedArgs, ZeroEx } from '0x.js';
import { BlockchainLifecycle, web3Factory } from '@0xproject/dev-utils';
+import { LogWithDecodedArgs } from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
@@ -20,7 +20,6 @@ const MULTI_SIG_ABI = artifacts.MultiSigWalletWithTimeLock.compilerOutput.abi;
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-const zeroEx = new ZeroEx(provider, { networkId: constants.TESTRPC_NETWORK_ID });
const abiDecoder = new AbiDecoder([MULTI_SIG_ABI]);
describe('MultiSigWalletWithTimeLock', () => {
@@ -74,7 +73,7 @@ describe('MultiSigWalletWithTimeLock', () => {
args: [SECONDS_TIME_LOCKED.toNumber()],
};
const txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
- const subRes = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const subRes = await web3Wrapper.awaitTransactionMinedAsync(txHash);
const log = abiDecoder.tryToDecodeLogOrNoop(subRes.logs[0]) as LogWithDecodedArgs<
SubmissionContractEventArgs
>;
@@ -94,14 +93,14 @@ describe('MultiSigWalletWithTimeLock', () => {
args: [SECONDS_TIME_LOCKED.toNumber()],
};
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
- const subRes = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const subRes = await web3Wrapper.awaitTransactionMinedAsync(txHash);
const log = abiDecoder.tryToDecodeLogOrNoop(subRes.logs[0]) as LogWithDecodedArgs<
SubmissionContractEventArgs
>;
txId = log.args.transactionId;
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, { from: owners[1] });
- const res = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const res = await web3Wrapper.awaitTransactionMinedAsync(txHash);
expect(res.logs).to.have.length(2);
const blockNum = await web3Wrapper.getBlockNumberAsync();
@@ -121,7 +120,7 @@ describe('MultiSigWalletWithTimeLock', () => {
args: [SECONDS_TIME_LOCKED.toNumber()],
};
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
- const subRes = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const subRes = await web3Wrapper.awaitTransactionMinedAsync(txHash);
const log = abiDecoder.tryToDecodeLogOrNoop(subRes.logs[0]) as LogWithDecodedArgs<
SubmissionContractEventArgs
>;
@@ -132,7 +131,7 @@ describe('MultiSigWalletWithTimeLock', () => {
expect(initialSecondsTimeLocked).to.be.equal(0);
txHash = await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] });
- const res = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const res = await web3Wrapper.awaitTransactionMinedAsync(txHash);
expect(res.logs).to.have.length(2);
const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
@@ -161,7 +160,7 @@ describe('MultiSigWalletWithTimeLock', () => {
args: [newSecondsTimeLocked],
};
let txHash = await multiSigWrapper.submitTransactionAsync(destination, from, dataParams);
- const subRes = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const subRes = await web3Wrapper.awaitTransactionMinedAsync(txHash);
const log = abiDecoder.tryToDecodeLogOrNoop(subRes.logs[0]) as LogWithDecodedArgs<
SubmissionContractEventArgs
>;
@@ -169,7 +168,7 @@ describe('MultiSigWalletWithTimeLock', () => {
txHash = await multiSig.confirmTransaction.sendTransactionAsync(txId, {
from: owners[1],
});
- const confRes = await zeroEx.awaitTransactionMinedAsync(txHash);
+ const confRes = await web3Wrapper.awaitTransactionMinedAsync(txHash);
expect(confRes.logs).to.have.length(2);
});
const newSecondsTimeLocked = 0;
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
index 9e4f7ca3b..f2c0f5bc7 100644
--- a/packages/contracts/test/token_registry.ts
+++ b/packages/contracts/test/token_registry.ts
@@ -1,4 +1,3 @@
-import { ZeroEx } from '0x.js';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber, NULL_BYTES } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -60,7 +59,7 @@ describe('TokenRegistry', () => {
};
const nullToken = {
- address: ZeroEx.NULL_ADDRESS,
+ address: constants.NULL_ADDRESS,
name: '',
symbol: '',
decimals: 0,
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index 723ddb066..1a53871cd 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -38,7 +38,7 @@
// let amountGive: BigNumber;
// let makerTokenAmount: BigNumber;
// let takerTokenAmount: BigNumber;
-// const feeRecipient = ZeroEx.NULL_ADDRESS;
+// const feeRecipient = constants.NULL_ADDRESS;
// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
@@ -115,7 +115,7 @@
// exchangeContractAddress: exchange.address,
// networkId: constants.TESTRPC_NETWORK_ID,
// });
-// exWrapper = new ExchangeWrapper(exchange, zeroEx);
+// exWrapper = new ExchangeWrapper(exchange);
// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
// takerTokenAmount = makerTokenAmount;
diff --git a/packages/contracts/test/unlimited_allowance_token.ts b/packages/contracts/test/unlimited_allowance_token.ts
index 5ad9321e8..147f77ab1 100644
--- a/packages/contracts/test/unlimited_allowance_token.ts
+++ b/packages/contracts/test/unlimited_allowance_token.ts
@@ -1,4 +1,4 @@
-import { ZeroEx } from '0x.js';
+import { ContractWrappers } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -19,7 +19,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('UnlimitedAllowanceToken', () => {
let owner: string;
let spender: string;
- const zeroEx = new ZeroEx(provider, {
+ const contractWrappers = new ContractWrappers(provider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
@@ -51,7 +51,7 @@ describe('UnlimitedAllowanceToken', () => {
});
describe('transfer', () => {
it('should throw if owner has insufficient balance', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = ownerBalance.plus(1);
return expect(token.transfer.callAsync(spender, amountToTransfer, { from: owner })).to.be.rejectedWith(
constants.REVERT,
@@ -60,11 +60,11 @@ describe('UnlimitedAllowanceToken', () => {
it('should transfer balance from sender to receiver', async () => {
const receiver = spender;
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = new BigNumber(1);
- await zeroEx.token.transferAsync(tokenAddress, owner, receiver, amountToTransfer);
- const finalOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
- const finalReceiverBalance = await zeroEx.token.getBalanceAsync(tokenAddress, receiver);
+ await contractWrappers.token.transferAsync(tokenAddress, owner, receiver, amountToTransfer);
+ const finalOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
+ const finalReceiverBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, receiver);
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
const expectedFinalReceiverBalance = amountToTransfer;
@@ -82,9 +82,9 @@ describe('UnlimitedAllowanceToken', () => {
describe('transferFrom', () => {
it('should throw if owner has insufficient balance', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = ownerBalance.plus(1);
- await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, amountToTransfer);
+ await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, amountToTransfer);
return expect(
token.transferFrom.callAsync(owner, spender, amountToTransfer, {
from: spender,
@@ -93,10 +93,10 @@ describe('UnlimitedAllowanceToken', () => {
});
it('should throw if spender has insufficient allowance', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = ownerBalance;
- const spenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
+ const spenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
expect(isSpenderAllowanceInsufficient).to.be.true();
@@ -116,44 +116,44 @@ describe('UnlimitedAllowanceToken', () => {
});
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
+ const initSpenderAllowance = contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
+ await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
+ await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
+ const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
});
it('should transfer the correct balances if spender has sufficient allowance', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
+ await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
+ await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
- const newSpenderBalance = await zeroEx.token.getBalanceAsync(tokenAddress, spender);
+ const newOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
+ const newSpenderBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, spender);
expect(newOwnerBalance).to.be.bignumber.equal(0);
expect(newSpenderBalance).to.be.bignumber.equal(initOwnerBalance);
});
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(tokenAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(tokenAddress, owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await zeroEx.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
+ await contractWrappers.token.setAllowanceAsync(tokenAddress, owner, spender, initSpenderAllowance);
+ await contractWrappers.token.transferFromAsync(tokenAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(tokenAddress, owner, spender);
+ const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(tokenAddress, owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);
});
});
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index 14930de08..6dbd7bfbc 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -1,5 +1,5 @@
-import { LogWithDecodedArgs, ZeroEx } from '0x.js';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
+import { LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import ethUtil = require('ethereumjs-util');
diff --git a/packages/contracts/test/zrx_token.ts b/packages/contracts/test/zrx_token.ts
index 48b8f6e36..d621d9065 100644
--- a/packages/contracts/test/zrx_token.ts
+++ b/packages/contracts/test/zrx_token.ts
@@ -1,4 +1,4 @@
-import { ZeroEx } from '0x.js';
+import { ContractWrappers } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
@@ -19,7 +19,7 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('ZRXToken', () => {
let owner: string;
let spender: string;
- let zeroEx: ZeroEx;
+ let contractWrappers: ContractWrappers;
let MAX_UINT: BigNumber;
@@ -30,12 +30,12 @@ describe('ZRXToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- zeroEx = new ZeroEx(provider, {
+ contractWrappers = new ContractWrappers(provider, {
networkId: constants.TESTRPC_NETWORK_ID,
});
zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
zrxAddress = zrxToken.address;
- MAX_UINT = zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
+ MAX_UINT = contractWrappers.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -53,7 +53,7 @@ describe('ZRXToken', () => {
it('should have a total supply of 1 billion tokens', async () => {
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
const expectedTotalSupply = 1000000000;
- expect(ZeroEx.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
+ expect(Web3Wrapper.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
});
it('should be named 0x Protocol Token', async () => {
@@ -71,7 +71,7 @@ describe('ZRXToken', () => {
describe('constructor', () => {
it('should initialize owner balance to totalSupply', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
expect(totalSupply).to.be.bignumber.equal(ownerBalance);
});
@@ -80,11 +80,11 @@ describe('ZRXToken', () => {
describe('transfer', () => {
it('should transfer balance from sender to receiver', async () => {
const receiver = spender;
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = new BigNumber(1);
- await zeroEx.token.transferAsync(zrxAddress, owner, receiver, amountToTransfer);
- const finalOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
- const finalReceiverBalance = await zeroEx.token.getBalanceAsync(zrxAddress, receiver);
+ await contractWrappers.token.transferAsync(zrxAddress, owner, receiver, amountToTransfer);
+ const finalOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
+ const finalReceiverBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, receiver);
const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
const expectedFinalReceiverBalance = amountToTransfer;
@@ -102,9 +102,9 @@ describe('ZRXToken', () => {
describe('transferFrom', () => {
it('should return false if owner has insufficient balance', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = ownerBalance.plus(1);
- await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, {
+ await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
});
const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
@@ -114,10 +114,10 @@ describe('ZRXToken', () => {
});
it('should return false if spender has insufficient allowance', async () => {
- const ownerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const ownerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = ownerBalance;
- const spenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
+ const spenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
expect(isSpenderAllowanceInsufficient).to.be.true();
@@ -136,46 +136,46 @@ describe('ZRXToken', () => {
});
it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = MAX_UINT;
- await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
+ await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance, {
gasLimit: constants.MAX_TOKEN_APPROVE_GAS,
});
- await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
+ await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
+ const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
});
it('should transfer the correct balances if spender has sufficient allowance', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
- const initSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
+ const initSpenderBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, spender);
const amountToTransfer = initOwnerBalance;
const initSpenderAllowance = initOwnerBalance;
- await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
- await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
+ await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, initSpenderAllowance);
+ await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
- const newSpenderBalance = await zeroEx.token.getBalanceAsync(zrxAddress, spender);
+ const newOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
+ const newSpenderBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, spender);
expect(newOwnerBalance).to.be.bignumber.equal(0);
expect(newSpenderBalance).to.be.bignumber.equal(initSpenderBalance.plus(initOwnerBalance));
});
it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
- const initOwnerBalance = await zeroEx.token.getBalanceAsync(zrxAddress, owner);
+ const initOwnerBalance = await contractWrappers.token.getBalanceAsync(zrxAddress, owner);
const amountToTransfer = initOwnerBalance;
- await zeroEx.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
- await zeroEx.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
+ await contractWrappers.token.setAllowanceAsync(zrxAddress, owner, spender, amountToTransfer);
+ await contractWrappers.token.transferFromAsync(zrxAddress, owner, spender, spender, amountToTransfer, {
gasLimit: constants.MAX_TOKEN_TRANSFERFROM_GAS,
});
- const newSpenderAllowance = await zeroEx.token.getAllowanceAsync(zrxAddress, owner, spender);
+ const newSpenderAllowance = await contractWrappers.token.getAllowanceAsync(zrxAddress, owner, spender);
expect(newSpenderAllowance).to.be.bignumber.equal(0);
});
});
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
index 75cf03b05..799f716f3 100644
--- a/packages/tslint-config/package.json
+++ b/packages/tslint-config/package.json
@@ -46,7 +46,7 @@
"tslint": "5.8.0",
"tslint-eslint-rules": "^4.1.1",
"tslint-react": "^3.2.0",
- "tsutils": "^2.12.1"
+ "tsutils": "2.22.2"
},
"publishConfig": {
"access": "public"
diff --git a/yarn.lock b/yarn.lock
index 6f1b7b931..4b4e0dba0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6,12 +6,98 @@
version "0.3.9"
resolved "https://registry.yarnpkg.com/8fold-marked/-/8fold-marked-0.3.9.tgz#bb89c645612f8ccfaffac1ca6e3c11f168c9cf59"
+"@0xproject/assert@^0.2.10":
+ version "0.2.10"
+ resolved "https://registry.yarnpkg.com/@0xproject/assert/-/assert-0.2.10.tgz#733bcf7f9483ac65f1d68fbc6534322242c4b919"
+ dependencies:
+ "@0xproject/json-schemas" "^0.7.24"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ lodash "^4.17.4"
+ valid-url "^1.0.9"
+
+"@0xproject/base-contract@^0.3.2":
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/@0xproject/base-contract/-/base-contract-0.3.2.tgz#d7ffdc6ae26fc73bbd43b62dafcfae019d8f984a"
+ dependencies:
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ "@0xproject/web3-wrapper" "^0.6.4"
+ ethers "^3.0.15"
+ lodash "^4.17.4"
+
+"@0xproject/contract-wrappers@^0.0.2":
+ version "0.0.2"
+ resolved "https://registry.yarnpkg.com/@0xproject/contract-wrappers/-/contract-wrappers-0.0.2.tgz#6e297db4650eeabc7d3d2f7c39d64561c021eab6"
+ dependencies:
+ "@0xproject/assert" "^0.2.10"
+ "@0xproject/base-contract" "^0.3.2"
+ "@0xproject/fill-scenarios" "^0.0.2"
+ "@0xproject/json-schemas" "^0.7.24"
+ "@0xproject/order-utils" "^0.0.5"
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ "@0xproject/web3-wrapper" "^0.6.4"
+ ethereumjs-blockstream "^2.0.6"
+ ethereumjs-util "^5.1.1"
+ ethers "^3.0.15"
+ js-sha3 "^0.7.0"
+ lodash "^4.17.4"
+ uuid "^3.1.0"
+
+"@0xproject/fill-scenarios@^0.0.2":
+ version "0.0.2"
+ resolved "https://registry.yarnpkg.com/@0xproject/fill-scenarios/-/fill-scenarios-0.0.2.tgz#176ac2cba13f527e84346fbf06da84965a852bab"
+ dependencies:
+ "@0xproject/base-contract" "^0.3.2"
+ "@0xproject/order-utils" "^0.0.5"
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ "@0xproject/web3-wrapper" "^0.6.4"
+ ethers "^3.0.15"
+ lodash "^4.17.4"
+
+"@0xproject/json-schemas@^0.7.24":
+ version "0.7.24"
+ resolved "https://registry.yarnpkg.com/@0xproject/json-schemas/-/json-schemas-0.7.24.tgz#21a12b43ab0ab4aa302d02c4891668cda36b6c64"
+ dependencies:
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@types/node" "^8.0.53"
+ jsonschema "^1.2.0"
+ lodash.values "^4.3.0"
+
+"@0xproject/order-utils@^0.0.5":
+ version "0.0.5"
+ resolved "https://registry.yarnpkg.com/@0xproject/order-utils/-/order-utils-0.0.5.tgz#c8d92a112740b0020e08f13137844f8c183c863b"
+ dependencies:
+ "@0xproject/assert" "^0.2.10"
+ "@0xproject/json-schemas" "^0.7.24"
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ "@0xproject/web3-wrapper" "^0.6.4"
+ "@types/node" "^8.0.53"
+ bn.js "^4.11.8"
+ ethereumjs-abi "^0.6.4"
+ ethereumjs-util "^5.1.1"
+ lodash "^4.17.4"
+
"@0xproject/types@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@0xproject/types/-/types-0.5.0.tgz#ba3cfbc11a8c6344b57c9680aa7df2ea84b9bf05"
dependencies:
bignumber.js "~4.1.0"
+"@0xproject/types@^0.7.0":
+ version "0.7.0"
+ resolved "https://registry.yarnpkg.com/@0xproject/types/-/types-0.7.0.tgz#fad13925ee92ad4ee1980668a5cb2bed4dcaab8f"
+ dependencies:
+ "@types/node" "^8.0.53"
+ bignumber.js "~4.1.0"
+
"@0xproject/typescript-typings@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-0.0.3.tgz#3272080bde00ade0a970b0d236686b483b08a1d0"
@@ -19,6 +105,37 @@
"@0xproject/types" "^0.5.0"
bignumber.js "~4.1.0"
+"@0xproject/typescript-typings@^0.3.2":
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/@0xproject/typescript-typings/-/typescript-typings-0.3.2.tgz#abc360b441afda993100450ca8369dfabf75936b"
+ dependencies:
+ "@0xproject/types" "^0.7.0"
+ bignumber.js "~4.1.0"
+
+"@0xproject/utils@^0.6.2":
+ version "0.6.2"
+ resolved "https://registry.yarnpkg.com/@0xproject/utils/-/utils-0.6.2.tgz#79056a0a7be88581bcb92bce01a0f1f1b3074397"
+ dependencies:
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@types/node" "^8.0.53"
+ bignumber.js "~4.1.0"
+ ethers "^3.0.15"
+ js-sha3 "^0.7.0"
+ lodash "^4.17.4"
+ web3 "^0.20.0"
+
+"@0xproject/web3-wrapper@^0.6.4":
+ version "0.6.4"
+ resolved "https://registry.yarnpkg.com/@0xproject/web3-wrapper/-/web3-wrapper-0.6.4.tgz#fb15b71cdf4e5001c2b2e0d316b0de485a2be5f8"
+ dependencies:
+ "@0xproject/types" "^0.7.0"
+ "@0xproject/typescript-typings" "^0.3.2"
+ "@0xproject/utils" "^0.6.2"
+ ethers "^3.0.15"
+ lodash "^4.17.4"
+ web3 "^0.20.0"
+
"@ledgerhq/hw-app-eth@^4.3.0":
version "4.7.3"
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-eth/-/hw-app-eth-4.7.3.tgz#d352e19658ae296532e522c53c8ec2a1a77b64e5"