aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/test
diff options
context:
space:
mode:
authorAugust Skare <post@augustskare.no>2018-11-13 16:52:41 +0800
committerAugust Skare <post@augustskare.no>2018-11-13 16:52:41 +0800
commite43988aa44225ef66c95d0b26764de57b3d26c3a (patch)
tree5f2bdff05e3e6a336b600bcb7a766da4793afc76 /packages/contracts/test
parentee91f56bbe69534885da47f58a81302bf3c37f28 (diff)
parentc41622c20aea8ba89dc9899ff8b3ab6f22f53503 (diff)
downloaddexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar.gz
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar.bz2
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar.lz
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar.xz
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.tar.zst
dexon-sol-tools-e43988aa44225ef66c95d0b26764de57b3d26c3a.zip
Merge branch 'development' into dev-tools-pages
Diffstat (limited to 'packages/contracts/test')
-rw-r--r--packages/contracts/test/asset_proxy/authorizable.ts10
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts26
-rw-r--r--packages/contracts/test/exchange/core.ts31
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts18
-rw-r--r--packages/contracts/test/exchange/fill_order.ts2
-rw-r--r--packages/contracts/test/exchange/internal.ts10
-rw-r--r--packages/contracts/test/exchange/libs.ts14
-rw-r--r--packages/contracts/test/exchange/match_orders.ts26
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts16
-rw-r--r--packages/contracts/test/exchange/transactions.ts20
-rw-r--r--packages/contracts/test/exchange/wrapper.ts24
-rw-r--r--packages/contracts/test/extensions/forwarder.ts289
-rw-r--r--packages/contracts/test/extensions/order_validator.ts22
-rw-r--r--packages/contracts/test/global_hooks.ts2
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts12
-rw-r--r--packages/contracts/test/multisig/asset_proxy_owner.ts14
-rw-r--r--packages/contracts/test/multisig/multi_sig_with_time_lock.ts12
-rw-r--r--packages/contracts/test/token_registry.ts255
-rw-r--r--packages/contracts/test/tokens/erc721_token.ts14
-rw-r--r--packages/contracts/test/tokens/unlimited_allowance_token.ts10
-rw-r--r--packages/contracts/test/tokens/weth9.ts (renamed from packages/contracts/test/tokens/ether_token.ts)12
-rw-r--r--packages/contracts/test/tokens/zrx_token.ts12
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts6
-rw-r--r--packages/contracts/test/utils/address_utils.ts4
-rw-r--r--packages/contracts/test/utils/artifacts.ts69
-rw-r--r--packages/contracts/test/utils/assertions.ts6
-rw-r--r--packages/contracts/test/utils/asset_wrapper.ts6
-rw-r--r--packages/contracts/test/utils/combinatorial_utils.ts2
-rw-r--r--packages/contracts/test/utils/constants.ts4
-rw-r--r--packages/contracts/test/utils/coverage.ts4
-rw-r--r--packages/contracts/test/utils/erc20_wrapper.ts12
-rw-r--r--packages/contracts/test/utils/erc721_wrapper.ts12
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts14
-rw-r--r--packages/contracts/test/utils/fill_order_combinatorial_utils.ts16
-rw-r--r--packages/contracts/test/utils/formatters.ts4
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts17
-rw-r--r--packages/contracts/test/utils/log_decoder.ts7
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts6
-rw-r--r--packages/contracts/test/utils/multi_sig_wrapper.ts8
-rw-r--r--packages/contracts/test/utils/order_factory.ts6
-rw-r--r--packages/contracts/test/utils/order_factory_from_scenario.ts8
-rw-r--r--packages/contracts/test/utils/order_utils.ts4
-rw-r--r--packages/contracts/test/utils/profiler.ts4
-rw-r--r--packages/contracts/test/utils/revert_trace.ts4
-rw-r--r--packages/contracts/test/utils/signing_utils.ts2
-rw-r--r--packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts4
-rw-r--r--packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts15
-rw-r--r--packages/contracts/test/utils/token_registry_wrapper.ts66
-rw-r--r--packages/contracts/test/utils/transaction_factory.ts6
-rw-r--r--packages/contracts/test/utils/type_encoding_utils.ts2
-rw-r--r--packages/contracts/test/utils/types.ts4
-rw-r--r--packages/contracts/test/utils/web3_wrapper.ts8
52 files changed, 533 insertions, 648 deletions
diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts
index 0c0da46b3..e21af9b81 100644
--- a/packages/contracts/test/asset_proxy/authorizable.ts
+++ b/packages/contracts/test/asset_proxy/authorizable.ts
@@ -1,11 +1,11 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable';
-import { artifacts } from '../utils/artifacts';
+import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
index 4d70031d1..b8305993e 100644
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ b/packages/contracts/test/asset_proxy/proxies.ts
@@ -1,19 +1,19 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils } from '@0xproject/order-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721ReceiverContract } from '../../generated_contract_wrappers/dummy_erc721_receiver';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { DummyMultipleReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_multiple_return_erc20_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
-import { IAssetProxyContract } from '../../generated_contract_wrappers/i_asset_proxy';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721ReceiverContract } from '../../generated-wrappers/dummy_erc721_receiver';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { DummyMultipleReturnERC20TokenContract } from '../../generated-wrappers/dummy_multiple_return_erc20_token';
+import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { IAssetProxyContract } from '../../generated-wrappers/i_asset_proxy';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index acb99eed1..fc8dc5346 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -1,25 +1,22 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
-import { RevertReason, SignatureType, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import {
- DummyERC20TokenContract,
- DummyERC20TokenTransferEventArgs,
-} from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
-import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token';
-import { TestStaticCallReceiverContract } from '../../generated_contract_wrappers/test_static_call_receiver';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract, DummyERC20TokenTransferEventArgs } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated-wrappers/exchange';
+import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
+import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
import { chaiSetup } from '../utils/chai_setup';
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
index a8ae897a8..3d3aa42c2 100644
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ b/packages/contracts/test/exchange/dispatcher.ts
@@ -1,19 +1,19 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils } from '@0xproject/order-utils';
-import { AssetProxyId, RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId, RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import {
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
TestAssetProxyDispatcherContract,
-} from '../../generated_contract_wrappers/test_asset_proxy_dispatcher';
-import { artifacts } from '../utils/artifacts';
+} from '../../generated-wrappers/test_asset_proxy_dispatcher';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts
index b1e08324f..37efaad2b 100644
--- a/packages/contracts/test/exchange/fill_order.ts
+++ b/packages/contracts/test/exchange/fill_order.ts
@@ -1,4 +1,4 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
import * as _ from 'lodash';
import { chaiSetup } from '../utils/chai_setup';
diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts
index 156e086af..109be29c6 100644
--- a/packages/contracts/test/exchange/internal.ts
+++ b/packages/contracts/test/exchange/internal.ts
@@ -1,11 +1,11 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { Order, RevertReason, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { Order, RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals';
-import { artifacts } from '../utils/artifacts';
+import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
+import { artifacts } from '../../src/artifacts';
import { getRevertReasonOrErrorMessageForSendTransactionAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from '../utils/combinatorial_utils';
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
index 049b7f37a..503ef0e0f 100644
--- a/packages/contracts/test/exchange/libs.ts
+++ b/packages/contracts/test/exchange/libs.ts
@@ -1,13 +1,13 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
-import { SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
-import { TestConstantsContract } from '../../generated_contract_wrappers/test_constants';
-import { TestLibsContract } from '../../generated_contract_wrappers/test_libs';
+import { TestConstantsContract } from '../../generated-wrappers/test_constants';
+import { TestLibsContract } from '../../generated-wrappers/test_libs';
+import { artifacts } from '../../src/artifacts';
import { addressUtils } from '../utils/address_utils';
-import { artifacts } from '../utils/artifacts';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
import { OrderFactory } from '../utils/order_factory';
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
index c6e7b494f..eea9992d9 100644
--- a/packages/contracts/test/exchange/match_orders.ts
+++ b/packages/contracts/test/exchange/match_orders.ts
@@ -1,19 +1,19 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils } from '@0xproject/order-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token';
-import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
+import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
index 192ed3ca9..756c72766 100644
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ b/packages/contracts/test/exchange/signature_validator.ts
@@ -1,6 +1,6 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, orderHashUtils, signatureUtils } from '@0xproject/order-utils';
-import { RevertReason, SignatureType, SignedOrder } from '@0xproject/types';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
+import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
@@ -8,12 +8,12 @@ import ethUtil = require('ethereumjs-util');
import {
TestSignatureValidatorContract,
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
-} from '../../generated_contract_wrappers/test_signature_validator';
-import { TestStaticCallReceiverContract } from '../../generated_contract_wrappers/test_static_call_receiver';
-import { ValidatorContract } from '../../generated_contract_wrappers/validator';
-import { WalletContract } from '../../generated_contract_wrappers/wallet';
+} from '../../generated-wrappers/test_signature_validator';
+import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
+import { ValidatorContract } from '../../generated-wrappers/validator';
+import { WalletContract } from '../../generated-wrappers/wallet';
+import { artifacts } from '../../src/artifacts';
import { addressUtils } from '../utils/address_utils';
-import { artifacts } from '../utils/artifacts';
import { expectContractCallFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
index 2bdd96b16..1b5eef295 100644
--- a/packages/contracts/test/exchange/transactions.ts
+++ b/packages/contracts/test/exchange/transactions.ts
@@ -1,16 +1,16 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { ExchangeWrapperContract } from '../../generated_contract_wrappers/exchange_wrapper';
-import { WhitelistContract } from '../../generated_contract_wrappers/whitelist';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper';
+import { WhitelistContract } from '../../generated-wrappers/whitelist';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
index aadb5ab59..6b660aac5 100644
--- a/packages/contracts/test/exchange/wrapper.ts
+++ b/packages/contracts/test/exchange/wrapper.ts
@@ -1,18 +1,18 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
-import { RevertReason, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync } from '../utils/assertions';
import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
import { chaiSetup } from '../utils/chai_setup';
diff --git a/packages/contracts/test/extensions/forwarder.ts b/packages/contracts/test/extensions/forwarder.ts
index 8424d01fd..c006be0fe 100644
--- a/packages/contracts/test/extensions/forwarder.ts
+++ b/packages/contracts/test/extensions/forwarder.ts
@@ -1,17 +1,17 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils } from '@0xproject/order-utils';
-import { RevertReason, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { ForwarderContract } from '../../generated_contract_wrappers/forwarder';
-import { WETH9Contract } from '../../generated_contract_wrappers/weth9';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { ForwarderContract } from '../../generated-wrappers/forwarder';
+import { WETH9Contract } from '../../generated-wrappers/weth9';
+import { artifacts } from '../../src/artifacts';
import {
expectContractCreationFailedAsync,
expectTransactionFailedAsync,
@@ -45,6 +45,7 @@ describe(ContractName.Forwarder, () => {
let weth: DummyERC20TokenContract;
let zrxToken: DummyERC20TokenContract;
+ let erc20TokenA: DummyERC20TokenContract;
let erc721Token: DummyERC721TokenContract;
let forwarderContract: ForwarderContract;
let wethContract: WETH9Contract;
@@ -77,7 +78,6 @@ describe(ContractName.Forwarder, () => {
erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
const numDummyErc20ToDeploy = 3;
- let erc20TokenA;
[erc20TokenA, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
numDummyErc20ToDeploy,
constants.DUMMY_TOKEN_DECIMALS,
@@ -91,7 +91,7 @@ describe(ContractName.Forwarder, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
erc20Wrapper.addDummyTokenContract(weth);
@@ -902,6 +902,269 @@ describe(ContractName.Forwarder, () => {
);
expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
});
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded', async () => {
+ // The 0x Protocol contracts round the exchange rate in favor of the Maker.
+ // In this case, the taker must round up how much they're going to spend, which
+ // in turn increases the amount of MakerAsset being purchased.
+ // Example:
+ // The taker wants to buy 5 units of the MakerAsset at a rate of 3M/2T.
+ // For every 2 units of TakerAsset, the taker will receive 3 units of MakerAsset.
+ // To purchase 5 units, the taker must spend 10/3 = 3.33 units of TakerAssset.
+ // However, the Taker can only spend whole units.
+ // Spending floor(10/3) = 3 units will yield a profit of Floor(3*3/2) = Floor(4.5) = 4 units of MakerAsset.
+ // Spending ceil(10/3) = 4 units will yield a profit of Floor(4*3/2) = 6 units of MakerAsset.
+ //
+ // The forwarding contract will opt for the second option, which overbuys, to ensure the taker
+ // receives at least the amount of MakerAsset they requested.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('20'),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const desiredMakerAssetFillAmount = new BigNumber('5');
+ const makerAssetFillAmount = new BigNumber('6');
+ const ethValue = new BigNumber('4');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX', async () => {
+ // See the test case above for a detailed description of this case.
+ // The difference here is that the MakerAsset is ZRX. We expect the same result as above,
+ // but this tests a different code path.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('20'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const desiredMakerAssetFillAmount = new BigNumber('5');
+ const makerAssetFillAmount = new BigNumber('6');
+ const ethValue = new BigNumber('4');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded (Regression Test)', async () => {
+ // Order taken from a transaction on mainnet that failed due to a rounding error.
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('268166666666666666666'),
+ takerAssetAmount: new BigNumber('219090625878836371'),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ // The taker will receive more than the desired amount of makerAsset due to rounding
+ const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
+ const ethValue = new BigNumber('4084971271824171');
+ const makerAssetFillAmount = ethValue
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX (Regression Test)', async () => {
+ // Order taken from a transaction on mainnet that failed due to a rounding error.
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('268166666666666666666'),
+ takerAssetAmount: new BigNumber('219090625878836371'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ // The taker will receive more than the desired amount of makerAsset due to rounding
+ const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
+ const ethValue = new BigNumber('4084971271824171');
+ const makerAssetFillAmount = ethValue
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy correct MakerAsset when exchange rate is NOT rounded, and MakerAsset is ZRX (Regression Test)', async () => {
+ // An extra unit of TakerAsset was sent to the exchange contract to account for rounding errors, in Forwarder v1.
+ // Specifically, the takerFillAmount was calculated using Floor(desiredMakerAmount * exchangeRate) + 1
+ // We have since changed this to be Ceil(desiredMakerAmount * exchangeRate)
+ // These calculations produce different results when `desiredMakerAmount * exchangeRate` is an integer.
+ //
+ // This test verifies that `ceil` is sufficient:
+ // Let TakerAssetAmount = MakerAssetAmount * 2
+ // -> exchangeRate = TakerAssetAmount / MakerAssetAmount = (2*MakerAssetAmount)/MakerAssetAmount = 2
+ // .: desiredMakerAmount * exchangeRate is an integer.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('60'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = new BigNumber('5');
+ const ethValue = new BigNumber('10');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
});
describe('marketBuyOrdersWithEth with extra fees', () => {
it('should buy an asset and send fee to feeRecipient', async () => {
diff --git a/packages/contracts/test/extensions/order_validator.ts b/packages/contracts/test/extensions/order_validator.ts
index 3a57cfc37..37bd1b0e2 100644
--- a/packages/contracts/test/extensions/order_validator.ts
+++ b/packages/contracts/test/extensions/order_validator.ts
@@ -1,17 +1,17 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
-import { SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
-import { OrderValidatorContract } from '../../generated_contract_wrappers/order_validator';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
+import { artifacts } from '../../src/artifacts';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts
index cf7c52efd..2e9ac9e21 100644
--- a/packages/contracts/test/global_hooks.ts
+++ b/packages/contracts/test/global_hooks.ts
@@ -1,4 +1,4 @@
-import { env, EnvVars } from '@0xproject/dev-utils';
+import { env, EnvVars } from '@0x/dev-utils';
import { coverage } from './utils/coverage';
import { profiler } from './utils/profiler';
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
index 13640a761..b1a389f00 100644
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ b/packages/contracts/test/libraries/lib_bytes.ts
@@ -1,14 +1,14 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { generatePseudoRandomSalt } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import BN = require('bn.js');
import * as chai from 'chai';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import { TestLibBytesContract } from '../../generated_contract_wrappers/test_lib_bytes';
-import { artifacts } from '../utils/artifacts';
+import { TestLibBytesContract } from '../../generated-wrappers/test_lib_bytes';
+import { artifacts } from '../../src/artifacts';
import { expectContractCallFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/multisig/asset_proxy_owner.ts b/packages/contracts/test/multisig/asset_proxy_owner.ts
index 299707512..087152316 100644
--- a/packages/contracts/test/multisig/asset_proxy_owner.ts
+++ b/packages/contracts/test/multisig/asset_proxy_owner.ts
@@ -1,6 +1,6 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
@@ -10,10 +10,10 @@ import {
AssetProxyOwnerExecutionEventArgs,
AssetProxyOwnerExecutionFailureEventArgs,
AssetProxyOwnerSubmissionEventArgs,
-} from '../../generated_contract_wrappers/asset_proxy_owner';
-import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable';
-import { TestAssetProxyOwnerContract } from '../../generated_contract_wrappers/test_asset_proxy_owner';
-import { artifacts } from '../utils/artifacts';
+} from '../../generated-wrappers/asset_proxy_owner';
+import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
+import { TestAssetProxyOwnerContract } from '../../generated-wrappers/test_asset_proxy_owner';
+import { artifacts } from '../../src/artifacts';
import {
expectContractCallFailedAsync,
expectContractCreationFailedAsync,
diff --git a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts b/packages/contracts/test/multisig/multi_sig_with_time_lock.ts
index 0b17c298b..1c0cb0515 100644
--- a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts
+++ b/packages/contracts/test/multisig/multi_sig_with_time_lock.ts
@@ -1,11 +1,11 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import {
MultiSigWalletWithTimeLockConfirmationEventArgs,
MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs,
@@ -13,8 +13,8 @@ import {
MultiSigWalletWithTimeLockExecutionEventArgs,
MultiSigWalletWithTimeLockExecutionFailureEventArgs,
MultiSigWalletWithTimeLockSubmissionEventArgs,
-} from '../../generated_contract_wrappers/multi_sig_wallet_with_time_lock';
-import { artifacts } from '../utils/artifacts';
+} from '../../generated-wrappers/multi_sig_wallet_with_time_lock';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
import { increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
import { chaiSetup } from '../utils/chai_setup';
diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts
deleted file mode 100644
index 7cc43be9b..000000000
--- a/packages/contracts/test/token_registry.ts
+++ /dev/null
@@ -1,255 +0,0 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { BigNumber, NULL_BYTES } from '@0xproject/utils';
-import * as chai from 'chai';
-import ethUtil = require('ethereumjs-util');
-import * as _ from 'lodash';
-
-import { TokenRegistryContract } from '../generated_contract_wrappers/token_registry';
-
-import { artifacts } from './utils/artifacts';
-import { expectTransactionFailedWithoutReasonAsync } from './utils/assertions';
-import { chaiSetup } from './utils/chai_setup';
-import { constants } from './utils/constants';
-import { TokenRegWrapper } from './utils/token_registry_wrapper';
-import { provider, txDefaults, web3Wrapper } from './utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('TokenRegistry', () => {
- let owner: string;
- let notOwner: string;
- let tokenReg: TokenRegistryContract;
- let tokenRegWrapper: TokenRegWrapper;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owner = accounts[0];
- notOwner = accounts[1];
- tokenReg = await TokenRegistryContract.deployFrom0xArtifactAsync(artifacts.TokenRegistry, provider, txDefaults);
- tokenRegWrapper = new TokenRegWrapper(tokenReg, provider);
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- const tokenAddress1 = `0x${ethUtil.setLength(ethUtil.toBuffer('0x1'), 20, false).toString('hex')}`;
- const tokenAddress2 = `0x${ethUtil.setLength(ethUtil.toBuffer('0x2'), 20, false).toString('hex')}`;
-
- const token1 = {
- address: tokenAddress1,
- name: 'testToken1',
- symbol: 'TT1',
- decimals: 18,
- ipfsHash: `0x${ethUtil.sha3('ipfs1').toString('hex')}`,
- swarmHash: `0x${ethUtil.sha3('swarm1').toString('hex')}`,
- };
-
- const token2 = {
- address: tokenAddress2,
- name: 'testToken2',
- symbol: 'TT2',
- decimals: 18,
- ipfsHash: `0x${ethUtil.sha3('ipfs2').toString('hex')}`,
- swarmHash: `0x${ethUtil.sha3('swarm2').toString('hex')}`,
- };
-
- const nullToken = {
- address: constants.NULL_ADDRESS,
- name: '',
- symbol: '',
- decimals: 0,
- ipfsHash: NULL_BYTES,
- swarmHash: NULL_BYTES,
- };
-
- describe('addToken', () => {
- it('should throw when not called by owner', async () => {
- return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, notOwner));
- });
-
- it('should add token metadata when called by owner', async () => {
- await tokenRegWrapper.addTokenAsync(token1, owner);
- const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address);
- expect(tokenData).to.be.deep.equal(token1);
- });
-
- it('should throw if token already exists', async () => {
- await tokenRegWrapper.addTokenAsync(token1, owner);
-
- return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(token1, owner));
- });
-
- it('should throw if token address is null', async () => {
- return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(nullToken, owner));
- });
-
- it('should throw if name already exists', async () => {
- await tokenRegWrapper.addTokenAsync(token1, owner);
- const duplicateNameToken = _.assign({}, token2, { name: token1.name });
-
- return expectTransactionFailedWithoutReasonAsync(tokenRegWrapper.addTokenAsync(duplicateNameToken, owner));
- });
-
- it('should throw if symbol already exists', async () => {
- await tokenRegWrapper.addTokenAsync(token1, owner);
- const duplicateSymbolToken = _.assign({}, token2, {
- symbol: token1.symbol,
- });
-
- return expectTransactionFailedWithoutReasonAsync(
- tokenRegWrapper.addTokenAsync(duplicateSymbolToken, owner),
- );
- });
- });
-
- describe('after addToken', () => {
- beforeEach(async () => {
- await tokenRegWrapper.addTokenAsync(token1, owner);
- });
-
- describe('getTokenByName', () => {
- it('should return token metadata when given the token name', async () => {
- const tokenData = await tokenRegWrapper.getTokenByNameAsync(token1.name);
- expect(tokenData).to.be.deep.equal(token1);
- });
- });
-
- describe('getTokenBySymbol', () => {
- it('should return token metadata when given the token symbol', async () => {
- const tokenData = await tokenRegWrapper.getTokenBySymbolAsync(token1.symbol);
- expect(tokenData).to.be.deep.equal(token1);
- });
- });
-
- describe('setTokenName', () => {
- it('should throw when not called by owner', async () => {
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: notOwner }),
- );
- });
-
- it('should change the token name when called by owner', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [newData, oldData] = await Promise.all([
- tokenRegWrapper.getTokenByNameAsync(token2.name),
- tokenRegWrapper.getTokenByNameAsync(token1.name),
- ]);
-
- const expectedNewData = _.assign({}, token1, { name: token2.name });
- const expectedOldData = nullToken;
- expect(newData).to.be.deep.equal(expectedNewData);
- expect(oldData).to.be.deep.equal(expectedOldData);
- });
-
- it('should throw if the name already exists', async () => {
- await tokenRegWrapper.addTokenAsync(token2, owner);
-
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenName.sendTransactionAsync(token1.address, token2.name, { from: owner }),
- );
- });
-
- it('should throw if token does not exist', async () => {
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenName.sendTransactionAsync(nullToken.address, token2.name, { from: owner }),
- );
- });
- });
-
- describe('setTokenSymbol', () => {
- it('should throw when not called by owner', async () => {
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
- from: notOwner,
- }),
- );
- });
-
- it('should change the token symbol when called by owner', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [newData, oldData] = await Promise.all([
- tokenRegWrapper.getTokenBySymbolAsync(token2.symbol),
- tokenRegWrapper.getTokenBySymbolAsync(token1.symbol),
- ]);
-
- const expectedNewData = _.assign({}, token1, { symbol: token2.symbol });
- const expectedOldData = nullToken;
- expect(newData).to.be.deep.equal(expectedNewData);
- expect(oldData).to.be.deep.equal(expectedOldData);
- });
-
- it('should throw if the symbol already exists', async () => {
- await tokenRegWrapper.addTokenAsync(token2, owner);
-
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenSymbol.sendTransactionAsync(token1.address, token2.symbol, {
- from: owner,
- }),
- );
- });
-
- it('should throw if token does not exist', async () => {
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.setTokenSymbol.sendTransactionAsync(nullToken.address, token2.symbol, {
- from: owner,
- }),
- );
- });
- });
-
- describe('removeToken', () => {
- it('should throw if not called by owner', async () => {
- const index = new BigNumber(0);
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.removeToken.sendTransactionAsync(token1.address, index, { from: notOwner }),
- );
- });
-
- it('should remove token metadata when called by owner', async () => {
- const index = new BigNumber(0);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await tokenReg.removeToken.sendTransactionAsync(token1.address, index, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address);
- expect(tokenData).to.be.deep.equal(nullToken);
- });
-
- it('should throw if token does not exist', async () => {
- const index = new BigNumber(0);
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.removeToken.sendTransactionAsync(nullToken.address, index, { from: owner }),
- );
- });
-
- it('should throw if token at given index does not match address', async () => {
- await tokenRegWrapper.addTokenAsync(token2, owner);
- const incorrectIndex = new BigNumber(0);
- return expectTransactionFailedWithoutReasonAsync(
- tokenReg.removeToken.sendTransactionAsync(token2.address, incorrectIndex, { from: owner }),
- );
- });
- });
- });
-});
diff --git a/packages/contracts/test/tokens/erc721_token.ts b/packages/contracts/test/tokens/erc721_token.ts
index e61fd7d51..72407748f 100644
--- a/packages/contracts/test/tokens/erc721_token.ts
+++ b/packages/contracts/test/tokens/erc721_token.ts
@@ -1,19 +1,19 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import {
DummyERC721ReceiverContract,
DummyERC721ReceiverTokenReceivedEventArgs,
-} from '../../generated_contract_wrappers/dummy_erc721_receiver';
+} from '../../generated-wrappers/dummy_erc721_receiver';
import {
DummyERC721TokenContract,
DummyERC721TokenTransferEventArgs,
-} from '../../generated_contract_wrappers/dummy_erc721_token';
-import { InvalidERC721ReceiverContract } from '../../generated_contract_wrappers/invalid_erc721_receiver';
-import { artifacts } from '../utils/artifacts';
+} from '../../generated-wrappers/dummy_erc721_token';
+import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
+import { artifacts } from '../../src/artifacts';
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/tokens/unlimited_allowance_token.ts b/packages/contracts/test/tokens/unlimited_allowance_token.ts
index 63680fe9b..ea5a50522 100644
--- a/packages/contracts/test/tokens/unlimited_allowance_token.ts
+++ b/packages/contracts/test/tokens/unlimited_allowance_token.ts
@@ -1,10 +1,10 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { RevertReason } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { artifacts } from '../utils/artifacts';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { artifacts } from '../../src/artifacts';
import { expectContractCallFailedAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
diff --git a/packages/contracts/test/tokens/ether_token.ts b/packages/contracts/test/tokens/weth9.ts
index a104fc915..9a31dc3f2 100644
--- a/packages/contracts/test/tokens/ether_token.ts
+++ b/packages/contracts/test/tokens/weth9.ts
@@ -1,10 +1,10 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { WETH9Contract } from '../../generated_contract_wrappers/weth9';
-import { artifacts } from '../utils/artifacts';
+import { WETH9Contract } from '../../generated-wrappers/weth9';
+import { artifacts } from '../../src/artifacts';
import { expectInsufficientFundsAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
@@ -29,7 +29,7 @@ describe('EtherToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
account = accounts[0];
- etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.EtherToken, provider, {
+ etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, {
gasPrice,
...txDefaults,
});
diff --git a/packages/contracts/test/tokens/zrx_token.ts b/packages/contracts/test/tokens/zrx_token.ts
index a0d77c924..cab62c205 100644
--- a/packages/contracts/test/tokens/zrx_token.ts
+++ b/packages/contracts/test/tokens/zrx_token.ts
@@ -1,10 +1,10 @@
-import { BlockchainLifecycle } from '@0xproject/dev-utils';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { ZRXTokenContract } from '../../generated_contract_wrappers/zrx_token';
-import { artifacts } from '../utils/artifacts';
+import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
+import { artifacts } from '../../src/artifacts';
import { chaiSetup } from '../utils/chai_setup';
import { constants } from '../utils/constants';
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
@@ -29,7 +29,7 @@ describe('ZRXToken', () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
owner = accounts[0];
spender = accounts[1];
- zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRX, provider, txDefaults);
+ zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults);
MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
});
beforeEach(async () => {
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
index 6851483cc..78e0bc238 100644
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ b/packages/contracts/test/tutorials/arbitrage.ts
@@ -1,8 +1,8 @@
// import { ECSignature, SignedOrder, ZeroEx } from '0x.js';
-// import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
+// import { BlockchainLifecycle, devConstants, web3Factory } from '@0x/dev-utils';
// import { ExchangeContractErrs } from 'ethereum-types';
-// import { BigNumber } from '@0xproject/utils';
-// import { Web3Wrapper } from '@0xproject/web3-wrapper';
+// import { BigNumber } from '@0x/utils';
+// import { Web3Wrapper } from '@0x/web3-wrapper';
// import * as chai from 'chai';
// import ethUtil = require('ethereumjs-util');
// import * as Web3 from 'web3';
diff --git a/packages/contracts/test/utils/address_utils.ts b/packages/contracts/test/utils/address_utils.ts
index 3cf8ec786..634da0c16 100644
--- a/packages/contracts/test/utils/address_utils.ts
+++ b/packages/contracts/test/utils/address_utils.ts
@@ -1,5 +1,5 @@
-import { generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { crypto } from '@0xproject/order-utils/lib/src/crypto';
+import { generatePseudoRandomSalt } from '@0x/order-utils';
+import { crypto } from '@0x/order-utils/lib/src/crypto';
export const addressUtils = {
generatePseudoRandomAddress(): string {
diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts
deleted file mode 100644
index 53f2a4e4e..000000000
--- a/packages/contracts/test/utils/artifacts.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json';
-import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json';
-import * as DummyERC721Receiver from '../../artifacts/DummyERC721Receiver.json';
-import * as DummyERC721Token from '../../artifacts/DummyERC721Token.json';
-import * as DummyMultipleReturnERC20Token from '../../artifacts/DummyMultipleReturnERC20Token.json';
-import * as DummyNoReturnERC20Token from '../../artifacts/DummyNoReturnERC20Token.json';
-import * as ERC20Proxy from '../../artifacts/ERC20Proxy.json';
-import * as ERC721Proxy from '../../artifacts/ERC721Proxy.json';
-import * as Exchange from '../../artifacts/Exchange.json';
-import * as ExchangeWrapper from '../../artifacts/ExchangeWrapper.json';
-import * as Forwarder from '../../artifacts/Forwarder.json';
-import * as IAssetProxy from '../../artifacts/IAssetProxy.json';
-import * as InvalidERC721Receiver from '../../artifacts/InvalidERC721Receiver.json';
-import * as MixinAuthorizable from '../../artifacts/MixinAuthorizable.json';
-import * as MultiSigWallet from '../../artifacts/MultiSigWallet.json';
-import * as MultiSigWalletWithTimeLock from '../../artifacts/MultiSigWalletWithTimeLock.json';
-import * as OrderValidator from '../../artifacts/OrderValidator.json';
-import * as ReentrantERC20Token from '../../artifacts/ReentrantERC20Token.json';
-import * as TestAssetProxyDispatcher from '../../artifacts/TestAssetProxyDispatcher.json';
-import * as TestAssetProxyOwner from '../../artifacts/TestAssetProxyOwner.json';
-import * as TestConstants from '../../artifacts/TestConstants.json';
-import * as TestExchangeInternals from '../../artifacts/TestExchangeInternals.json';
-import * as TestLibBytes from '../../artifacts/TestLibBytes.json';
-import * as TestLibs from '../../artifacts/TestLibs.json';
-import * as TestSignatureValidator from '../../artifacts/TestSignatureValidator.json';
-import * as TestStaticCallReceiver from '../../artifacts/TestStaticCallReceiver.json';
-import * as TokenRegistry from '../../artifacts/TokenRegistry.json';
-import * as Validator from '../../artifacts/Validator.json';
-import * as Wallet from '../../artifacts/Wallet.json';
-import * as EtherToken from '../../artifacts/WETH9.json';
-import * as Whitelist from '../../artifacts/Whitelist.json';
-import * as ZRX from '../../artifacts/ZRXToken.json';
-
-export const artifacts = {
- AssetProxyOwner: (AssetProxyOwner as any) as ContractArtifact,
- DummyERC20Token: (DummyERC20Token as any) as ContractArtifact,
- DummyERC721Receiver: (DummyERC721Receiver as any) as ContractArtifact,
- DummyERC721Token: (DummyERC721Token as any) as ContractArtifact,
- DummyMultipleReturnERC20Token: (DummyMultipleReturnERC20Token as any) as ContractArtifact,
- DummyNoReturnERC20Token: (DummyNoReturnERC20Token as any) as ContractArtifact,
- ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
- ERC721Proxy: (ERC721Proxy as any) as ContractArtifact,
- Exchange: (Exchange as any) as ContractArtifact,
- ExchangeWrapper: (ExchangeWrapper as any) as ContractArtifact,
- EtherToken: (EtherToken as any) as ContractArtifact,
- Forwarder: (Forwarder as any) as ContractArtifact,
- IAssetProxy: (IAssetProxy as any) as ContractArtifact,
- InvalidERC721Receiver: (InvalidERC721Receiver as any) as ContractArtifact,
- MixinAuthorizable: (MixinAuthorizable as any) as ContractArtifact,
- MultiSigWallet: (MultiSigWallet as any) as ContractArtifact,
- MultiSigWalletWithTimeLock: (MultiSigWalletWithTimeLock as any) as ContractArtifact,
- OrderValidator: (OrderValidator as any) as ContractArtifact,
- ReentrantERC20Token: (ReentrantERC20Token as any) as ContractArtifact,
- TestAssetProxyOwner: (TestAssetProxyOwner as any) as ContractArtifact,
- TestAssetProxyDispatcher: (TestAssetProxyDispatcher as any) as ContractArtifact,
- TestConstants: (TestConstants as any) as ContractArtifact,
- TestLibBytes: (TestLibBytes as any) as ContractArtifact,
- TestLibs: (TestLibs as any) as ContractArtifact,
- TestExchangeInternals: (TestExchangeInternals as any) as ContractArtifact,
- TestSignatureValidator: (TestSignatureValidator as any) as ContractArtifact,
- TestStaticCallReceiver: (TestStaticCallReceiver as any) as ContractArtifact,
- Validator: (Validator as any) as ContractArtifact,
- Wallet: (Wallet as any) as ContractArtifact,
- TokenRegistry: (TokenRegistry as any) as ContractArtifact,
- Whitelist: (Whitelist as any) as ContractArtifact,
- ZRX: (ZRX as any) as ContractArtifact,
-};
diff --git a/packages/contracts/test/utils/assertions.ts b/packages/contracts/test/utils/assertions.ts
index 3361a751a..5b1cedfcc 100644
--- a/packages/contracts/test/utils/assertions.ts
+++ b/packages/contracts/test/utils/assertions.ts
@@ -1,6 +1,6 @@
-import { RevertReason } from '@0xproject/types';
-import { logUtils } from '@0xproject/utils';
-import { NodeType } from '@0xproject/web3-wrapper';
+import { RevertReason } from '@0x/types';
+import { logUtils } from '@0x/utils';
+import { NodeType } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceipt, TransactionReceiptStatus, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts
index e3a4800c6..4e7696066 100644
--- a/packages/contracts/test/utils/asset_wrapper.ts
+++ b/packages/contracts/test/utils/asset_wrapper.ts
@@ -1,6 +1,6 @@
-import { assetDataUtils } from '@0xproject/order-utils';
-import { AssetProxyId } from '@0xproject/types';
-import { BigNumber, errorUtils } from '@0xproject/utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId } from '@0x/types';
+import { BigNumber, errorUtils } from '@0x/utils';
import * as _ from 'lodash';
import { AbstractAssetWrapper } from './abstract_asset_wrapper';
diff --git a/packages/contracts/test/utils/combinatorial_utils.ts b/packages/contracts/test/utils/combinatorial_utils.ts
index d72b41f8a..bb1b55b4d 100644
--- a/packages/contracts/test/utils/combinatorial_utils.ts
+++ b/packages/contracts/test/utils/combinatorial_utils.ts
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber } from '@0x/utils';
import * as combinatorics from 'js-combinatorics';
import { testWithReferenceFuncAsync } from './test_with_reference';
diff --git a/packages/contracts/test/utils/constants.ts b/packages/contracts/test/utils/constants.ts
index b9ba8ccb9..cd21330e9 100644
--- a/packages/contracts/test/utils/constants.ts
+++ b/packages/contracts/test/utils/constants.ts
@@ -1,5 +1,5 @@
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
diff --git a/packages/contracts/test/utils/coverage.ts b/packages/contracts/test/utils/coverage.ts
index de29a3ecc..5becfa1b6 100644
--- a/packages/contracts/test/utils/coverage.ts
+++ b/packages/contracts/test/utils/coverage.ts
@@ -1,5 +1,5 @@
-import { devConstants } from '@0xproject/dev-utils';
-import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov';
+import { devConstants } from '@0x/dev-utils';
+import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-cov';
import * as _ from 'lodash';
let coverageSubprovider: CoverageSubprovider;
diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts
index 526ffe9f8..c281a2abf 100644
--- a/packages/contracts/test/utils/erc20_wrapper.ts
+++ b/packages/contracts/test/utils/erc20_wrapper.ts
@@ -1,13 +1,13 @@
-import { assetDataUtils } from '@0xproject/order-utils';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { assetDataUtils } from '@0x/order-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token';
-import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy';
+import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { artifacts } from '../../src/artifacts';
-import { artifacts } from './artifacts';
import { constants } from './constants';
import { ERC20BalancesByOwner } from './types';
import { txDefaults } from './web3_wrapper';
diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts
index 743d10706..3ef4e701d 100644
--- a/packages/contracts/test/utils/erc721_wrapper.ts
+++ b/packages/contracts/test/utils/erc721_wrapper.ts
@@ -1,13 +1,13 @@
-import { generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { generatePseudoRandomSalt } from '@0x/order-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
-import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { artifacts } from '../../src/artifacts';
-import { artifacts } from './artifacts';
import { constants } from './constants';
import { ERC721TokenIdsByOwner } from './types';
import { txDefaults } from './web3_wrapper';
diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts
index 619d43994..c28989d3f 100644
--- a/packages/contracts/test/utils/exchange_wrapper.ts
+++ b/packages/contracts/test/utils/exchange_wrapper.ts
@@ -1,9 +1,9 @@
-import { SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { ExchangeContract } from '../../generated_contract_wrappers/exchange';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
import { formatters } from './formatters';
import { LogDecoder } from './log_decoder';
@@ -212,13 +212,17 @@ export class ExchangeWrapper {
return tx;
}
public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
- const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex));
+ const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
return filledAmount;
}
public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
return isCancelled;
}
+ public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
+ const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
+ return orderEpoch;
+ }
public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
return orderInfo;
diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
index 92d0f4003..8046771f9 100644
--- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
+++ b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
@@ -5,19 +5,19 @@ import {
orderHashUtils,
OrderStateUtils,
OrderValidationUtils,
-} from '@0xproject/order-utils';
-import { AssetProxyId, RevertReason, SignatureType, SignedOrder } from '@0xproject/types';
-import { BigNumber, errorUtils, logUtils } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+} from '@0x/order-utils';
+import { AssetProxyId, RevertReason, SignatureType, SignedOrder } from '@0x/types';
+import { BigNumber, errorUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
-import { ExchangeContract, ExchangeFillEventArgs } from '../../generated_contract_wrappers/exchange';
-import { TestLibsContract } from '../../generated_contract_wrappers/test_libs';
+import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
+import { TestLibsContract } from '../../generated-wrappers/test_libs';
+import { artifacts } from '../../src/artifacts';
-import { artifacts } from './artifacts';
import { expectTransactionFailedAsync } from './assertions';
import { AssetWrapper } from './asset_wrapper';
import { chaiSetup } from './chai_setup';
@@ -392,7 +392,7 @@ export class FillOrderCombinatorialUtils {
);
// 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected?
- const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher);
+ const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher, provider);
const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher);
const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore);
diff --git a/packages/contracts/test/utils/formatters.ts b/packages/contracts/test/utils/formatters.ts
index 32e4787d6..813eb45db 100644
--- a/packages/contracts/test/utils/formatters.ts
+++ b/packages/contracts/test/utils/formatters.ts
@@ -1,5 +1,5 @@
-import { SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import { constants } from './constants';
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
index de247a878..a0bfcfe1d 100644
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ b/packages/contracts/test/utils/forwarder_wrapper.ts
@@ -1,10 +1,10 @@
-import { SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
import * as _ from 'lodash';
-import { ForwarderContract } from '../../generated_contract_wrappers/forwarder';
+import { ForwarderContract } from '../../generated-wrappers/forwarder';
import { constants } from './constants';
import { formatters } from './formatters';
@@ -26,9 +26,12 @@ export class ForwarderWrapper {
_.forEach(feeOrders, feeOrder => {
const feeAvailable = feeOrder.makerAssetAmount.minus(feeOrder.takerFee);
if (!remainingFeeAmount.isZero() && feeAvailable.gt(remainingFeeAmount)) {
- wethAmount = wethAmount
- .plus(feeOrder.takerAssetAmount.times(remainingFeeAmount).dividedToIntegerBy(feeAvailable))
- .plus(1);
+ wethAmount = wethAmount.plus(
+ feeOrder.takerAssetAmount
+ .times(remainingFeeAmount)
+ .dividedBy(feeAvailable)
+ .ceil(),
+ );
remainingFeeAmount = new BigNumber(0);
} else if (!remainingFeeAmount.isZero()) {
wethAmount = wethAmount.plus(feeOrder.takerAssetAmount);
diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts
index 144a18dd1..05b0a9204 100644
--- a/packages/contracts/test/utils/log_decoder.ts
+++ b/packages/contracts/test/utils/log_decoder.ts
@@ -1,5 +1,5 @@
-import { AbiDecoder, BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { AbiDecoder, BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import {
AbiDefinition,
ContractArtifact,
@@ -11,7 +11,8 @@ import {
} from 'ethereum-types';
import * as _ from 'lodash';
-import { artifacts } from './artifacts';
+import { artifacts } from '../../src/artifacts';
+
import { constants } from './constants';
export class LogDecoder {
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
index e0c55b834..6c2c84959 100644
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ b/packages/contracts/test/utils/match_order_tester.ts
@@ -1,6 +1,6 @@
-import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
-import { AssetProxyId, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { AssetProxyId, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts
index e12a58695..74fd3b4d6 100644
--- a/packages/contracts/test/utils/multi_sig_wrapper.ts
+++ b/packages/contracts/test/utils/multi_sig_wrapper.ts
@@ -1,10 +1,10 @@
-import { BigNumber } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
-import { AssetProxyOwnerContract } from '../../generated_contract_wrappers/asset_proxy_owner';
-import { MultiSigWalletContract } from '../../generated_contract_wrappers/multi_sig_wallet';
+import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
+import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
import { LogDecoder } from './log_decoder';
diff --git a/packages/contracts/test/utils/order_factory.ts b/packages/contracts/test/utils/order_factory.ts
index 63a893695..2449d1a8a 100644
--- a/packages/contracts/test/utils/order_factory.ts
+++ b/packages/contracts/test/utils/order_factory.ts
@@ -1,6 +1,6 @@
-import { generatePseudoRandomSalt, orderHashUtils } from '@0xproject/order-utils';
-import { Order, SignatureType, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { generatePseudoRandomSalt, orderHashUtils } from '@0x/order-utils';
+import { Order, SignatureType, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import { getLatestBlockTimestampAsync } from './block_timestamp';
import { constants } from './constants';
diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts
index 8e04db588..60c8606c4 100644
--- a/packages/contracts/test/utils/order_factory_from_scenario.ts
+++ b/packages/contracts/test/utils/order_factory_from_scenario.ts
@@ -1,8 +1,8 @@
-import { assetDataUtils, generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { Order } from '@0xproject/types';
-import { BigNumber, errorUtils } from '@0xproject/utils';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { Order } from '@0x/types';
+import { BigNumber, errorUtils } from '@0x/utils';
-import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token';
+import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { constants } from './constants';
import {
diff --git a/packages/contracts/test/utils/order_utils.ts b/packages/contracts/test/utils/order_utils.ts
index 444e27c44..4f7a34011 100644
--- a/packages/contracts/test/utils/order_utils.ts
+++ b/packages/contracts/test/utils/order_utils.ts
@@ -1,5 +1,5 @@
-import { OrderWithoutExchangeAddress, SignedOrder } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import { constants } from './constants';
import { CancelOrder, MatchOrder } from './types';
diff --git a/packages/contracts/test/utils/profiler.ts b/packages/contracts/test/utils/profiler.ts
index 85ee24f22..2c7c1d66c 100644
--- a/packages/contracts/test/utils/profiler.ts
+++ b/packages/contracts/test/utils/profiler.ts
@@ -1,5 +1,5 @@
-import { devConstants } from '@0xproject/dev-utils';
-import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov';
+import { devConstants } from '@0x/dev-utils';
+import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-cov';
import * as _ from 'lodash';
let profilerSubprovider: ProfilerSubprovider;
diff --git a/packages/contracts/test/utils/revert_trace.ts b/packages/contracts/test/utils/revert_trace.ts
index 0bf8384bc..3f74fd28b 100644
--- a/packages/contracts/test/utils/revert_trace.ts
+++ b/packages/contracts/test/utils/revert_trace.ts
@@ -1,5 +1,5 @@
-import { devConstants } from '@0xproject/dev-utils';
-import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0xproject/sol-cov';
+import { devConstants } from '@0x/dev-utils';
+import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-cov';
import * as _ from 'lodash';
let revertTraceSubprovider: RevertTraceSubprovider;
diff --git a/packages/contracts/test/utils/signing_utils.ts b/packages/contracts/test/utils/signing_utils.ts
index 9c711c72c..21f864bfa 100644
--- a/packages/contracts/test/utils/signing_utils.ts
+++ b/packages/contracts/test/utils/signing_utils.ts
@@ -1,4 +1,4 @@
-import { SignatureType } from '@0xproject/types';
+import { SignatureType } from '@0x/types';
import * as ethUtil from 'ethereumjs-util';
export const signingUtils = {
diff --git a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
index 598ee6d29..64b7dedbe 100644
--- a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
@@ -1,5 +1,5 @@
-import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils';
-import { BigNumber } from '@0xproject/utils';
+import { AbstractBalanceAndProxyAllowanceFetcher } from '@0x/order-utils';
+import { BigNumber } from '@0x/utils';
import { AssetWrapper } from './asset_wrapper';
diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
index ed69ecc63..af959e00e 100644
--- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
@@ -1,5 +1,6 @@
-import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
-import { BigNumber } from '@0xproject/utils';
+import { AbstractOrderFilledCancelledFetcher, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import { ExchangeWrapper } from './exchange_wrapper';
@@ -14,9 +15,15 @@ export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCan
const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash));
return filledTakerAmount;
}
- public async isOrderCancelledAsync(orderHash: string): Promise<boolean> {
+ public async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean> {
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash);
- return isCancelled;
+ const orderEpoch = await this._exchangeWrapper.getOrderEpochAsync(
+ signedOrder.makerAddress,
+ signedOrder.senderAddress,
+ );
+ const isCancelledByOrderEpoch = orderEpoch > signedOrder.salt;
+ return isCancelled || isCancelledByOrderEpoch;
}
public getZRXAssetData(): string {
return this._zrxAssetData;
diff --git a/packages/contracts/test/utils/token_registry_wrapper.ts b/packages/contracts/test/utils/token_registry_wrapper.ts
deleted file mode 100644
index f1c40e8ff..000000000
--- a/packages/contracts/test/utils/token_registry_wrapper.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
-import { Provider } from 'ethereum-types';
-
-import { TokenRegistryContract } from '../../generated_contract_wrappers/token_registry';
-
-import { Token } from './types';
-
-import { constants } from './constants';
-
-export class TokenRegWrapper {
- private readonly _tokenReg: TokenRegistryContract;
- private readonly _web3Wrapper: Web3Wrapper;
- constructor(tokenRegContract: TokenRegistryContract, provider: Provider) {
- this._tokenReg = tokenRegContract;
- this._web3Wrapper = new Web3Wrapper(provider);
- }
- public async addTokenAsync(token: Token, from: string): Promise<string> {
- const txHash = await this._tokenReg.addToken.sendTransactionAsync(
- token.address as string,
- token.name,
- token.symbol,
- token.decimals,
- token.ipfsHash,
- token.swarmHash,
- { from },
- );
- await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
- return txHash;
- }
- public async getTokenMetaDataAsync(tokenAddress: string): Promise<Token> {
- const data = await this._tokenReg.getTokenMetaData.callAsync(tokenAddress);
- const token: Token = {
- address: data[0],
- name: data[1],
- symbol: data[2],
- decimals: data[3],
- ipfsHash: data[4],
- swarmHash: data[5],
- };
- return token;
- }
- public async getTokenByNameAsync(tokenName: string): Promise<Token> {
- const data = await this._tokenReg.getTokenByName.callAsync(tokenName);
- const token: Token = {
- address: data[0],
- name: data[1],
- symbol: data[2],
- decimals: data[3],
- ipfsHash: data[4],
- swarmHash: data[5],
- };
- return token;
- }
- public async getTokenBySymbolAsync(tokenSymbol: string): Promise<Token> {
- const data = await this._tokenReg.getTokenBySymbol.callAsync(tokenSymbol);
- const token: Token = {
- address: data[0],
- name: data[1],
- symbol: data[2],
- decimals: data[3],
- ipfsHash: data[4],
- swarmHash: data[5],
- };
- return token;
- }
-}
diff --git a/packages/contracts/test/utils/transaction_factory.ts b/packages/contracts/test/utils/transaction_factory.ts
index 9ed4c5a31..dbab3ade4 100644
--- a/packages/contracts/test/utils/transaction_factory.ts
+++ b/packages/contracts/test/utils/transaction_factory.ts
@@ -1,6 +1,6 @@
-import { eip712Utils, generatePseudoRandomSalt } from '@0xproject/order-utils';
-import { SignatureType } from '@0xproject/types';
-import { signTypedDataUtils } from '@0xproject/utils';
+import { eip712Utils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { SignatureType } from '@0x/types';
+import { signTypedDataUtils } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { signingUtils } from './signing_utils';
diff --git a/packages/contracts/test/utils/type_encoding_utils.ts b/packages/contracts/test/utils/type_encoding_utils.ts
index 75307b9bd..bfd9c9ef5 100644
--- a/packages/contracts/test/utils/type_encoding_utils.ts
+++ b/packages/contracts/test/utils/type_encoding_utils.ts
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber } from '@0x/utils';
import BN = require('bn.js');
import ethUtil = require('ethereumjs-util');
diff --git a/packages/contracts/test/utils/types.ts b/packages/contracts/test/utils/types.ts
index 598fb5393..9fc9e1570 100644
--- a/packages/contracts/test/utils/types.ts
+++ b/packages/contracts/test/utils/types.ts
@@ -1,5 +1,5 @@
-import { OrderWithoutExchangeAddress } from '@0xproject/types';
-import { BigNumber } from '@0xproject/utils';
+import { OrderWithoutExchangeAddress } from '@0x/types';
+import { BigNumber } from '@0x/utils';
import { AbiDefinition } from 'ethereum-types';
export interface ERC20BalancesByOwner {
diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts
index d1cd3d387..f7b1a732a 100644
--- a/packages/contracts/test/utils/web3_wrapper.ts
+++ b/packages/contracts/test/utils/web3_wrapper.ts
@@ -1,7 +1,7 @@
-import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils';
-import { prependSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
-import { logUtils } from '@0xproject/utils';
-import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import { devConstants, env, EnvVars, web3Factory } from '@0x/dev-utils';
+import { prependSubprovider, Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import { coverage } from './coverage';