aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml20
-rw-r--r--.gitignore6
-rw-r--r--.prettierignore6
-rw-r--r--contracts/asset-proxy/package.json4
-rw-r--r--contracts/asset-proxy/test/authorizable.ts3
-rw-r--r--contracts/asset-proxy/test/proxies.ts53
-rw-r--r--contracts/asset-proxy/test/utils/erc20_wrapper.ts2
-rw-r--r--contracts/asset-proxy/test/utils/erc721_wrapper.ts2
-rw-r--r--contracts/erc20/.solhintignore1
-rw-r--r--contracts/erc20/CHANGELOG.json (renamed from contracts/tokens/CHANGELOG.json)0
-rw-r--r--contracts/erc20/CHANGELOG.md (renamed from contracts/tokens/CHANGELOG.md)0
-rw-r--r--contracts/erc20/DEPLOYS.json (renamed from contracts/tokens/DEPLOYS.json)0
-rw-r--r--contracts/erc20/README.md (renamed from contracts/tokens/README.md)0
-rw-r--r--contracts/erc20/compiler.json (renamed from contracts/tokens/compiler.json)10
-rw-r--r--contracts/erc20/contracts/src/ERC20Token.sol (renamed from contracts/tokens/contracts/ERC20Token/ERC20Token.sol)2
-rw-r--r--contracts/erc20/contracts/src/MintableERC20Token.sol (renamed from contracts/tokens/contracts/ERC20Token/MintableERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol (renamed from contracts/tokens/contracts/ERC20Token/UnlimitedAllowanceERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/src/WETH9.sol (renamed from contracts/tokens/contracts/EtherToken/WETH9.sol)0
-rw-r--r--contracts/erc20/contracts/src/ZRXToken.sol150
-rw-r--r--contracts/erc20/contracts/src/interfaces/IERC20Token.sol (renamed from contracts/tokens/contracts/ERC20Token/IERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/src/interfaces/IEtherToken.sol (renamed from contracts/tokens/contracts/EtherToken/IEtherToken.sol)2
-rw-r--r--contracts/erc20/contracts/test/DummyERC20Token.sol (renamed from contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol)2
-rw-r--r--contracts/erc20/contracts/test/DummyMultipleReturnERC20Token.sol (renamed from contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/test/DummyNoReturnERC20Token.sol (renamed from contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/test/ReentrantERC20Token.sol (renamed from contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol)2
-rw-r--r--contracts/erc20/package.json (renamed from contracts/tokens/package.json)4
-rw-r--r--contracts/erc20/src/artifacts/index.ts (renamed from contracts/tokens/src/artifacts/index.ts)20
-rw-r--r--contracts/erc20/src/index.ts (renamed from contracts/tokens/src/index.ts)0
-rw-r--r--contracts/erc20/src/wrappers/index.ts (renamed from contracts/tokens/src/wrappers/index.ts)10
-rw-r--r--contracts/erc20/test/global_hooks.ts (renamed from contracts/tokens/test/global_hooks.ts)0
-rw-r--r--contracts/erc20/test/unlimited_allowance_token.ts (renamed from contracts/tokens/test/unlimited_allowance_token.ts)0
-rw-r--r--contracts/erc20/test/weth9.ts (renamed from contracts/tokens/test/weth9.ts)0
-rw-r--r--contracts/erc20/test/zrx_token.ts (renamed from contracts/tokens/test/zrx_token.ts)0
-rw-r--r--contracts/erc20/tsconfig.json (renamed from contracts/tokens/tsconfig.json)10
-rw-r--r--contracts/erc20/tslint.json (renamed from contracts/tokens/tslint.json)0
-rw-r--r--contracts/erc721/.solhintignore (renamed from contracts/tokens/.solhintignore)0
-rw-r--r--contracts/erc721/CHANGELOG.json56
-rw-r--r--contracts/erc721/CHANGELOG.md26
-rw-r--r--contracts/erc721/DEPLOYS.json16
-rw-r--r--contracts/erc721/README.md74
-rw-r--r--contracts/erc721/compiler.json30
-rw-r--r--contracts/erc721/contracts/src/ERC721Token.sol (renamed from contracts/tokens/contracts/ERC721Token/ERC721Token.sol)4
-rw-r--r--contracts/erc721/contracts/src/MintableERC721Token.sol (renamed from contracts/tokens/contracts/ERC721Token/MintableERC721Token.sol)0
-rw-r--r--contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol (renamed from contracts/tokens/contracts/ERC721Token/IERC721Receiver.sol)0
-rw-r--r--contracts/erc721/contracts/src/interfaces/IERC721Token.sol (renamed from contracts/tokens/contracts/ERC721Token/IERC721Token.sol)0
-rw-r--r--contracts/erc721/contracts/test/DummyERC721Receiver.sol (renamed from contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol)2
-rw-r--r--contracts/erc721/contracts/test/DummyERC721Token.sol (renamed from contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol)2
-rw-r--r--contracts/erc721/contracts/test/InvalidERC721Receiver.sol (renamed from contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol)2
-rw-r--r--contracts/erc721/package.json89
-rw-r--r--contracts/erc721/src/artifacts/index.ts20
-rw-r--r--contracts/erc721/src/index.ts2
-rw-r--r--contracts/erc721/src/wrappers/index.ts7
-rw-r--r--contracts/erc721/test/erc721_token.ts (renamed from contracts/tokens/test/erc721_token.ts)0
-rw-r--r--contracts/erc721/test/global_hooks.ts17
-rw-r--r--contracts/erc721/tsconfig.json19
-rw-r--r--contracts/erc721/tslint.json6
-rw-r--r--contracts/exchange/contracts/test/TestStaticCallReceiver.sol2
-rw-r--r--contracts/exchange/package.json3
-rw-r--r--contracts/exchange/test/core.ts36
-rw-r--r--contracts/exchange/test/dispatcher.ts17
-rw-r--r--contracts/exchange/test/fill_order.ts5
-rw-r--r--contracts/exchange/test/internal.ts3
-rw-r--r--contracts/exchange/test/match_orders.ts21
-rw-r--r--contracts/exchange/test/signature_validator.ts4
-rw-r--r--contracts/exchange/test/transactions.ts10
-rw-r--r--contracts/exchange/test/utils/asset_wrapper.ts11
-rw-r--r--contracts/exchange/test/utils/erc20_wrapper.ts177
-rw-r--r--contracts/exchange/test/utils/erc721_wrapper.ts234
-rw-r--r--contracts/exchange/test/utils/exchange_wrapper.ts8
-rw-r--r--contracts/exchange/test/utils/fill_order_combinatorial_utils.ts8
-rw-r--r--contracts/exchange/test/utils/index.ts4
-rw-r--r--contracts/exchange/test/utils/match_order_tester.ts3
-rw-r--r--contracts/exchange/test/utils/order_factory_from_scenario.ts2
-rw-r--r--contracts/exchange/test/wrapper.ts19
-rw-r--r--contracts/extensions/contracts/DutchAuction/DutchAuction.sol2
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinAssets.sol4
-rw-r--r--contracts/extensions/contracts/Forwarder/libs/LibConstants.sol4
-rw-r--r--contracts/extensions/contracts/OrderMatcher/MixinAssets.sol4
-rw-r--r--contracts/extensions/contracts/OrderValidator/OrderValidator.sol4
-rw-r--r--contracts/extensions/package.json3
-rw-r--r--contracts/extensions/src/index.ts1
-rw-r--r--contracts/extensions/test/balance_threshold_filter.ts (renamed from contracts/extensions/test/extensions/balance_threshold_filter.ts)15
-rw-r--r--contracts/extensions/test/dutch_auction.ts (renamed from contracts/extensions/test/extensions/dutch_auction.ts)23
-rw-r--r--contracts/extensions/test/forwarder.ts (renamed from contracts/extensions/test/extensions/forwarder.ts)24
-rw-r--r--contracts/extensions/test/order_matcher.ts (renamed from contracts/extensions/test/extensions/order_matcher.ts)24
-rw-r--r--contracts/extensions/test/order_validator.ts (renamed from contracts/extensions/test/extensions/order_validator.ts)16
-rw-r--r--contracts/extensions/test/utils/balance_threshold_wrapper.ts6
-rw-r--r--contracts/extensions/test/utils/dutch_auction_test_wrapper.ts6
-rw-r--r--contracts/extensions/test/utils/forwarder_wrapper.ts6
-rw-r--r--contracts/extensions/test/utils/index.ts3
-rw-r--r--contracts/multisig/package.json2
-rw-r--r--contracts/multisig/src/index.ts1
-rw-r--r--contracts/multisig/src/wrappers/index.ts3
-rw-r--r--contracts/multisig/test/asset_proxy_owner.ts9
-rw-r--r--contracts/multisig/test/multi_sig_with_time_lock.ts9
-rw-r--r--contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts4
-rw-r--r--contracts/multisig/test/utils/index.ts2
-rw-r--r--contracts/tokens/contracts/ZRXToken/ERC20Token_v1.sol44
-rw-r--r--contracts/tokens/contracts/ZRXToken/Token_v1.sol39
-rw-r--r--contracts/tokens/contracts/ZRXToken/UnlimitedAllowanceToken_v1.sol52
-rw-r--r--contracts/tokens/contracts/ZRXToken/ZRXToken.sol41
-rw-r--r--contracts/utils/test/lib_bytes.ts3
-rw-r--r--contracts/utils/test/libs.ts3
-rw-r--r--package.json2
104 files changed, 729 insertions, 878 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0ccb8a200..cd6065fb9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -43,10 +43,12 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-multisig
- run: yarn wsrun test:circleci @0x/contracts-utils
- - run: yarn wsrun test:circleci @0x/contracts-libs
- - run: yarn wsrun test:circleci @0x/contracts-tokens
+ - run: yarn wsrun test:circleci @0x/contracts-exchange-libs
+ - run: yarn wsrun test:circleci @0x/contracts-erc20
+ - run: yarn wsrun test:circleci @0x/contracts-erc721
- run: yarn wsrun test:circleci @0x/contracts-extensions
- - run: yarn wsrun test:circleci @0x/contracts-protocol
+ - run: yarn wsrun test:circleci @0x/contracts-asset-proxy
+ - run: yarn wsrun test:circleci @0x/contracts-exchange
test-contracts-geth:
docker:
- image: circleci/node:9-browsers
@@ -59,11 +61,13 @@ jobs:
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
# initialized
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-exchange-libs
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions
- - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol
+ - run: yarn wsrun test:circleci @0x/contracts-utils
+ - run: yarn wsrun test:circleci @0x/contracts-exchange-libs
+ - run: yarn wsrun test:circleci @0x/contracts-erc20
+ - run: yarn wsrun test:circleci @0x/contracts-erc721
+ - run: yarn wsrun test:circleci @0x/contracts-extensions
+ - run: yarn wsrun test:circleci @0x/contracts-asset-proxy
+ - run: yarn wsrun test:circleci @0x/contracts-exchange
test-publish:
resource_class: medium+
docker:
diff --git a/.gitignore b/.gitignore
index 5a7d703cc..997f8b2b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,7 +88,8 @@ contracts/asset-proxy/generated-artifacts/
contracts/multisig/generated-artifacts/
contracts/utils/generated-artifacts/
contracts/exchange-libs/generated-artifacts/
-contracts/tokens/generated-artifacts/
+contracts/erc20/generated-artifacts/
+contracts/erc721/generated-artifacts/
contracts/extensions/generated-artifacts/
packages/sol-tracing-utils/test/fixtures/artifacts/
packages/metacoin/artifacts/
@@ -100,7 +101,8 @@ contracts/asset-proxy/generated-wrappers/
contracts/multisig/generated-wrappers/
contracts/utils/generated-wrappers/
contracts/exchange-libs/generated-wrappers/
-contracts/tokens/generated-wrappers/
+contracts/erc20/generated-wrappers/
+contracts/erc721/generated-wrappers/
contracts/extensions/generated-wrappers/
packages/metacoin/src/contract_wrappers
diff --git a/.prettierignore b/.prettierignore
index 38206b5cd..00d36575c 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -10,8 +10,10 @@ lib
/contracts/utils/generated-artifacts
/contracts/exchange-libs/generated-wrappers
/contracts/exchange-libs/generated-artifacts
-/contracts/tokens/generated-wrappers
-/contracts/tokens/generated-artifacts
+/contracts/erc20/generated-wrappers
+/contracts/erc20/generated-artifacts
+/contracts/erc721/generated-wrappers
+/contracts/erc721/generated-artifacts
/contracts/extensions/generated-wrappers
/contracts/extensions/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json
index 44fdce395..258cf4629 100644
--- a/contracts/asset-proxy/package.json
+++ b/contracts/asset-proxy/package.json
@@ -69,9 +69,9 @@
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-interfaces": "^1.0.6",
"@0x/contracts-test-utils": "^2.0.1",
- "@0x/contracts-tokens": "^1.0.6",
+ "@0x/contracts-erc20": "^1.0.6",
+ "@0x/contracts-erc721": "^1.0.6",
"@0x/contracts-utils": "^1.0.6",
"@0x/order-utils": "^3.1.2",
"@0x/types": "^1.5.2",
diff --git a/contracts/asset-proxy/test/authorizable.ts b/contracts/asset-proxy/test/authorizable.ts
index 23fcf0931..087121235 100644
--- a/contracts/asset-proxy/test/authorizable.ts
+++ b/contracts/asset-proxy/test/authorizable.ts
@@ -12,8 +12,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { MixinAuthorizableContract } from '../generated-wrappers/mixin_authorizable';
-import { artifacts } from '../src/artifacts';
+import { artifacts, MixinAuthorizableContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts
index 44ab77087..797787135 100644
--- a/contracts/asset-proxy/test/proxies.ts
+++ b/contracts/asset-proxy/test/proxies.ts
@@ -1,4 +1,15 @@
-import { artifacts as interfacesArtifacts, IAssetDataContract, IAssetProxyContract } from '@0x/contracts-interfaces';
+import {
+ artifacts as erc20Artifacts,
+ DummyERC20TokenContract,
+ DummyERC20TokenTransferEventArgs,
+ DummyMultipleReturnERC20TokenContract,
+ DummyNoReturnERC20TokenContract,
+} from '@0x/contracts-erc20';
+import {
+ artifacts as erc721Artifacts,
+ DummyERC721ReceiverContract,
+ DummyERC721TokenContract,
+} from '@0x/contracts-erc721';
import {
chaiSetup,
constants,
@@ -9,15 +20,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokensArtifacts,
- DummyERC20TokenContract,
- DummyERC20TokenTransferEventArgs,
- DummyERC721ReceiverContract,
- DummyERC721TokenContract,
- DummyMultipleReturnERC20TokenContract,
- DummyNoReturnERC20TokenContract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -26,24 +28,27 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { ERC20ProxyContract } from '../generated-wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../generated-wrappers/erc721_proxy';
-import { MultiAssetProxyContract } from '../generated-wrappers/multi_asset_proxy';
-import { artifacts } from '../src/artifacts';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ERC721Wrapper } from './utils/erc721_wrapper';
+import {
+ artifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ERC721Wrapper,
+ IAssetDataContract,
+ IAssetProxyContract,
+ MultiAssetProxyContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetProxyInterface = new IAssetProxyContract(
- interfacesArtifacts.IAssetProxy.compilerOutput.abi,
+ artifacts.IAssetProxy.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
const assetDataInterface = new IAssetDataContract(
- interfacesArtifacts.IAssetData.compilerOutput.abi,
+ artifacts.IAssetData.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
@@ -149,7 +154,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_DECIMALS,
);
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyNoReturnERC20Token,
+ erc20Artifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -158,7 +163,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
);
multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyMultipleReturnERC20Token,
+ erc20Artifacts.DummyMultipleReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -199,7 +204,7 @@ describe('Asset Transfer Proxies', () => {
// Deploy and configure ERC721 tokens and receiver
[erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyERC721Receiver,
+ erc721Artifacts.DummyERC721Receiver,
provider,
txDefaults,
);
@@ -563,7 +568,7 @@ describe('Asset Transfer Proxies', () => {
erc721Receiver.address,
amount,
);
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc721Artifacts });
const tx = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
to: erc721Proxy.address,
@@ -755,7 +760,7 @@ describe('Asset Transfer Proxies', () => {
inputAmount,
);
const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts });
const tx = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
to: multiAssetProxy.address,
diff --git a/contracts/asset-proxy/test/utils/erc20_wrapper.ts b/contracts/asset-proxy/test/utils/erc20_wrapper.ts
index e5ab0e36c..12cd06ece 100644
--- a/contracts/asset-proxy/test/utils/erc20_wrapper.ts
+++ b/contracts/asset-proxy/test/utils/erc20_wrapper.ts
@@ -1,5 +1,5 @@
+import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-tokens';
import { assetDataUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
diff --git a/contracts/asset-proxy/test/utils/erc721_wrapper.ts b/contracts/asset-proxy/test/utils/erc721_wrapper.ts
index 1f658ce86..fc43d8c52 100644
--- a/contracts/asset-proxy/test/utils/erc721_wrapper.ts
+++ b/contracts/asset-proxy/test/utils/erc721_wrapper.ts
@@ -1,5 +1,5 @@
+import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-tokens';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
diff --git a/contracts/erc20/.solhintignore b/contracts/erc20/.solhintignore
new file mode 100644
index 000000000..ededa90be
--- /dev/null
+++ b/contracts/erc20/.solhintignore
@@ -0,0 +1 @@
+contracts/src/ZRXToken.sol
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/erc20/CHANGELOG.json
index 724ab1e4a..724ab1e4a 100644
--- a/contracts/tokens/CHANGELOG.json
+++ b/contracts/erc20/CHANGELOG.json
diff --git a/contracts/tokens/CHANGELOG.md b/contracts/erc20/CHANGELOG.md
index 59d0804da..59d0804da 100644
--- a/contracts/tokens/CHANGELOG.md
+++ b/contracts/erc20/CHANGELOG.md
diff --git a/contracts/tokens/DEPLOYS.json b/contracts/erc20/DEPLOYS.json
index 5ff58c035..5ff58c035 100644
--- a/contracts/tokens/DEPLOYS.json
+++ b/contracts/erc20/DEPLOYS.json
diff --git a/contracts/tokens/README.md b/contracts/erc20/README.md
index 2d1db92f0..2d1db92f0 100644
--- a/contracts/tokens/README.md
+++ b/contracts/erc20/README.md
diff --git a/contracts/tokens/compiler.json b/contracts/erc20/compiler.json
index 498c5d826..58fc8ea9b 100644
--- a/contracts/tokens/compiler.json
+++ b/contracts/erc20/compiler.json
@@ -22,23 +22,13 @@
"DummyERC20Token",
"DummyMultipleReturnERC20Token",
"DummyNoReturnERC20Token",
- "DummyERC721Receiver",
- "InvalidERC721Receiver",
- "DummyERC721Token",
"ReentrantERC20Token",
"ERC20Token",
"IERC20Token",
"MintableERC20Token",
"UnlimitedAllowanceERC20Token",
- "ERC721Token",
- "IERC721Receiver",
- "IERC721Token",
- "MintableERC721Token",
"IEtherToken",
"WETH9",
- "ERC20Token_v1",
- "Token_v1",
- "UnlimitedAllowanceToken_v1",
"ZRXToken"
]
}
diff --git a/contracts/tokens/contracts/ERC20Token/ERC20Token.sol b/contracts/erc20/contracts/src/ERC20Token.sol
index 190eead76..b6e9d0f9f 100644
--- a/contracts/tokens/contracts/ERC20Token/ERC20Token.sol
+++ b/contracts/erc20/contracts/src/ERC20Token.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "./IERC20Token.sol";
+import "./interfaces/IERC20Token.sol";
contract ERC20Token is
diff --git a/contracts/tokens/contracts/ERC20Token/MintableERC20Token.sol b/contracts/erc20/contracts/src/MintableERC20Token.sol
index 1108db53d..1108db53d 100644
--- a/contracts/tokens/contracts/ERC20Token/MintableERC20Token.sol
+++ b/contracts/erc20/contracts/src/MintableERC20Token.sol
diff --git a/contracts/tokens/contracts/ERC20Token/UnlimitedAllowanceERC20Token.sol b/contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol
index 3a43c250d..3a43c250d 100644
--- a/contracts/tokens/contracts/ERC20Token/UnlimitedAllowanceERC20Token.sol
+++ b/contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol
diff --git a/contracts/tokens/contracts/EtherToken/WETH9.sol b/contracts/erc20/contracts/src/WETH9.sol
index 17876b86d..17876b86d 100644
--- a/contracts/tokens/contracts/EtherToken/WETH9.sol
+++ b/contracts/erc20/contracts/src/WETH9.sol
diff --git a/contracts/erc20/contracts/src/ZRXToken.sol b/contracts/erc20/contracts/src/ZRXToken.sol
new file mode 100644
index 000000000..75e4dc0a9
--- /dev/null
+++ b/contracts/erc20/contracts/src/ZRXToken.sol
@@ -0,0 +1,150 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.11;
+
+
+contract Token {
+
+ /// @return total amount of tokens
+ function totalSupply() constant returns (uint supply) {}
+
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return The balance
+ function balanceOf(address _owner) constant returns (uint balance) {}
+
+ /// @notice send `_value` token to `_to` from `msg.sender`
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return Whether the transfer was successful or not
+ function transfer(address _to, uint _value) returns (bool success) {}
+
+ /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
+ /// @param _from The address of the sender
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return Whether the transfer was successful or not
+ function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
+
+ /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @param _value The amount of wei to be approved for transfer
+ /// @return Whether the approval was successful or not
+ function approve(address _spender, uint _value) returns (bool success) {}
+
+ /// @param _owner The address of the account owning tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @return Amount of remaining tokens allowed to spent
+ function allowance(address _owner, address _spender) constant returns (uint remaining) {}
+
+ event Transfer(address indexed _from, address indexed _to, uint _value);
+ event Approval(address indexed _owner, address indexed _spender, uint _value);
+}
+
+
+contract ERC20Token is Token {
+
+ function transfer(address _to, uint _value) returns (bool) {
+ //Default assumes totalSupply can't be over max (2^256 - 1).
+ if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
+ balances[msg.sender] -= _value;
+ balances[_to] += _value;
+ Transfer(msg.sender, _to, _value);
+ return true;
+ } else { return false; }
+ }
+
+ function transferFrom(address _from, address _to, uint _value) returns (bool) {
+ if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
+ balances[_to] += _value;
+ balances[_from] -= _value;
+ allowed[_from][msg.sender] -= _value;
+ Transfer(_from, _to, _value);
+ return true;
+ } else { return false; }
+ }
+
+ function balanceOf(address _owner) constant returns (uint) {
+ return balances[_owner];
+ }
+
+ function approve(address _spender, uint _value) returns (bool) {
+ allowed[msg.sender][_spender] = _value;
+ Approval(msg.sender, _spender, _value);
+ return true;
+ }
+
+ function allowance(address _owner, address _spender) constant returns (uint) {
+ return allowed[_owner][_spender];
+ }
+
+ mapping (address => uint) balances;
+ mapping (address => mapping (address => uint)) allowed;
+ uint public totalSupply;
+}
+
+
+contract UnlimitedAllowanceToken is ERC20Token {
+
+ uint constant MAX_UINT = 2**256 - 1;
+
+ /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.
+ /// @param _from Address to transfer from.
+ /// @param _to Address to transfer to.
+ /// @param _value Amount to transfer.
+ /// @return Success of transfer.
+ function transferFrom(address _from, address _to, uint _value)
+ public
+ returns (bool)
+ {
+ uint allowance = allowed[_from][msg.sender];
+ if (balances[_from] >= _value
+ && allowance >= _value
+ && balances[_to] + _value >= balances[_to]
+ ) {
+ balances[_to] += _value;
+ balances[_from] -= _value;
+ if (allowance < MAX_UINT) {
+ allowed[_from][msg.sender] -= _value;
+ }
+ Transfer(_from, _to, _value);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
+
+
+contract ZRXToken is
+ UnlimitedAllowanceToken
+{
+
+ // solhint-disable const-name-snakecase
+ uint8 constant public decimals = 18;
+ uint256 public totalSupply = 10**27; // 1 billion tokens, 18 decimal places
+ string constant public name = "0x Protocol Token";
+ string constant public symbol = "ZRX";
+ // solhint-enableconst-name-snakecase
+
+ function ZRXToken()
+ public
+ {
+ balances[msg.sender] = totalSupply;
+ }
+}
diff --git a/contracts/tokens/contracts/ERC20Token/IERC20Token.sol b/contracts/erc20/contracts/src/interfaces/IERC20Token.sol
index 9f9b89585..9f9b89585 100644
--- a/contracts/tokens/contracts/ERC20Token/IERC20Token.sol
+++ b/contracts/erc20/contracts/src/interfaces/IERC20Token.sol
diff --git a/contracts/tokens/contracts/EtherToken/IEtherToken.sol b/contracts/erc20/contracts/src/interfaces/IEtherToken.sol
index 32baa3eb0..cb07cae6f 100644
--- a/contracts/tokens/contracts/EtherToken/IEtherToken.sol
+++ b/contracts/erc20/contracts/src/interfaces/IEtherToken.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "../ERC20Token/IERC20Token.sol";
+import "./IERC20Token.sol";
contract IEtherToken is
diff --git a/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol b/contracts/erc20/contracts/test/DummyERC20Token.sol
index 93f0dd9c7..39e739a91 100644
--- a/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
+++ b/contracts/erc20/contracts/test/DummyERC20Token.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/src/Ownable.sol";
-import "../../ERC20Token/MintableERC20Token.sol";
+import "../src/MintableERC20Token.sol";
contract DummyERC20Token is
diff --git a/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/contracts/erc20/contracts/test/DummyMultipleReturnERC20Token.sol
index 733d4437e..733d4437e 100644
--- a/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
+++ b/contracts/erc20/contracts/test/DummyMultipleReturnERC20Token.sol
diff --git a/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/contracts/erc20/contracts/test/DummyNoReturnERC20Token.sol
index e16825a16..e16825a16 100644
--- a/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
+++ b/contracts/erc20/contracts/test/DummyNoReturnERC20Token.sol
diff --git a/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/contracts/erc20/contracts/test/ReentrantERC20Token.sol
index 2fc48fdca..0629754c0 100644
--- a/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ b/contracts/erc20/contracts/test/ReentrantERC20Token.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
-import "../../ERC20Token/ERC20Token.sol";
+import "../src/ERC20Token.sol";
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
diff --git a/contracts/tokens/package.json b/contracts/erc20/package.json
index 001b99f16..e0ac11164 100644
--- a/contracts/tokens/package.json
+++ b/contracts/erc20/package.json
@@ -1,5 +1,5 @@
{
- "name": "@0x/contracts-tokens",
+ "name": "@0x/contracts-erc20",
"version": "1.0.6",
"engines": {
"node": ">=6.12"
@@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token|IEtherToken|WETH9|ERC20Token_v1|Token_v1|UnlimitedAllowanceToken_v1|ZRXToken).json"
+ "abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|IEtherToken|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
diff --git a/contracts/tokens/src/artifacts/index.ts b/contracts/erc20/src/artifacts/index.ts
index 977d01c3e..ce1ae06ac 100644
--- a/contracts/tokens/src/artifacts/index.ts
+++ b/contracts/erc20/src/artifacts/index.ts
@@ -1,24 +1,14 @@
import { ContractArtifact } from 'ethereum-types';
import * as DummyERC20Token from '../../generated-artifacts/DummyERC20Token.json';
-import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
-import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
import * as DummyMultipleReturnERC20Token from '../../generated-artifacts/DummyMultipleReturnERC20Token.json';
import * as DummyNoReturnERC20Token from '../../generated-artifacts/DummyNoReturnERC20Token.json';
import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
-import * as ERC20Token_v1 from '../../generated-artifacts/ERC20Token_v1.json';
-import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
import * as IERC20Token from '../../generated-artifacts/IERC20Token.json';
-import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
-import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
import * as IEtherToken from '../../generated-artifacts/IEtherToken.json';
-import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
import * as MintableERC20Token from '../../generated-artifacts/MintableERC20Token.json';
-import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
-import * as Token_v1 from '../../generated-artifacts/Token_v1.json';
import * as UnlimitedAllowanceERC20Token from '../../generated-artifacts/UnlimitedAllowanceERC20Token.json';
-import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/UnlimitedAllowanceToken_v1.json';
import * as WETH9 from '../../generated-artifacts/WETH9.json';
import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
@@ -27,23 +17,13 @@ export const artifacts = {
DummyERC20Token: DummyERC20Token as ContractArtifact,
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
- DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
- InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
- DummyERC721Token: DummyERC721Token as ContractArtifact,
ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
ERC20Token: ERC20Token as ContractArtifact,
IERC20Token: IERC20Token as ContractArtifact,
MintableERC20Token: MintableERC20Token as ContractArtifact,
UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
- ERC721Token: ERC721Token as ContractArtifact,
- IERC721Receiver: IERC721Receiver as ContractArtifact,
- IERC721Token: IERC721Token as ContractArtifact,
- MintableERC721Token: MintableERC721Token as ContractArtifact,
IEtherToken: IEtherToken as ContractArtifact,
WETH9: WETH9 as ContractArtifact,
- ERC20Token_v1: ERC20Token_v1 as ContractArtifact,
- Token_v1: Token_v1 as ContractArtifact,
- UnlimitedAllowanceToken_v1: UnlimitedAllowanceToken_v1 as ContractArtifact,
// Note(albrow): "as any" hack still required here because ZRXToken does not
// conform to the v2 artifact type.
ZRXToken: (ZRXToken as any) as ContractArtifact,
diff --git a/contracts/tokens/src/index.ts b/contracts/erc20/src/index.ts
index 91dd7e0e3..91dd7e0e3 100644
--- a/contracts/tokens/src/index.ts
+++ b/contracts/erc20/src/index.ts
diff --git a/contracts/tokens/src/wrappers/index.ts b/contracts/erc20/src/wrappers/index.ts
index 98bf26657..b4e4ef969 100644
--- a/contracts/tokens/src/wrappers/index.ts
+++ b/contracts/erc20/src/wrappers/index.ts
@@ -1,21 +1,11 @@
export * from '../../generated-wrappers/zrx_token';
export * from '../../generated-wrappers/weth9';
-export * from '../../generated-wrappers/unlimitedallowancetoken_v1';
export * from '../../generated-wrappers/unlimited_allowance_erc20_token';
-export * from '../../generated-wrappers/token_v1';
export * from '../../generated-wrappers/reentrant_erc20_token';
-export * from '../../generated-wrappers/mintable_erc721_token';
export * from '../../generated-wrappers/mintable_erc20_token';
-export * from '../../generated-wrappers/invalid_erc721_receiver';
export * from '../../generated-wrappers/i_ether_token';
-export * from '../../generated-wrappers/i_erc721_token';
-export * from '../../generated-wrappers/i_erc721_receiver';
export * from '../../generated-wrappers/i_erc20_token';
-export * from '../../generated-wrappers/erc721_token';
-export * from '../../generated-wrappers/erc20token_v1';
export * from '../../generated-wrappers/erc20_token';
export * from '../../generated-wrappers/dummy_no_return_erc20_token';
export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
-export * from '../../generated-wrappers/dummy_erc721_token';
-export * from '../../generated-wrappers/dummy_erc721_receiver';
export * from '../../generated-wrappers/dummy_erc20_token';
diff --git a/contracts/tokens/test/global_hooks.ts b/contracts/erc20/test/global_hooks.ts
index f8ace376a..f8ace376a 100644
--- a/contracts/tokens/test/global_hooks.ts
+++ b/contracts/erc20/test/global_hooks.ts
diff --git a/contracts/tokens/test/unlimited_allowance_token.ts b/contracts/erc20/test/unlimited_allowance_token.ts
index f0b8e53a4..f0b8e53a4 100644
--- a/contracts/tokens/test/unlimited_allowance_token.ts
+++ b/contracts/erc20/test/unlimited_allowance_token.ts
diff --git a/contracts/tokens/test/weth9.ts b/contracts/erc20/test/weth9.ts
index 6a3948e2c..6a3948e2c 100644
--- a/contracts/tokens/test/weth9.ts
+++ b/contracts/erc20/test/weth9.ts
diff --git a/contracts/tokens/test/zrx_token.ts b/contracts/erc20/test/zrx_token.ts
index 820b054e6..820b054e6 100644
--- a/contracts/tokens/test/zrx_token.ts
+++ b/contracts/erc20/test/zrx_token.ts
diff --git a/contracts/tokens/tsconfig.json b/contracts/erc20/tsconfig.json
index 0d5f98cb8..4df7424be 100644
--- a/contracts/tokens/tsconfig.json
+++ b/contracts/erc20/tsconfig.json
@@ -10,23 +10,13 @@
"./generated-artifacts/DummyERC20Token.json",
"./generated-artifacts/DummyMultipleReturnERC20Token.json",
"./generated-artifacts/DummyNoReturnERC20Token.json",
- "./generated-artifacts/DummyERC721Receiver.json",
- "./generated-artifacts/InvalidERC721Receiver.json",
- "./generated-artifacts/DummyERC721Token.json",
"./generated-artifacts/ReentrantERC20Token.json",
"./generated-artifacts/ERC20Token.json",
"./generated-artifacts/IERC20Token.json",
"./generated-artifacts/MintableERC20Token.json",
"./generated-artifacts/UnlimitedAllowanceERC20Token.json",
- "./generated-artifacts/ERC721Token.json",
- "./generated-artifacts/IERC721Receiver.json",
- "./generated-artifacts/IERC721Token.json",
- "./generated-artifacts/MintableERC721Token.json",
"./generated-artifacts/IEtherToken.json",
"./generated-artifacts/WETH9.json",
- "./generated-artifacts/ERC20Token_v1.json",
- "./generated-artifacts/Token_v1.json",
- "./generated-artifacts/UnlimitedAllowanceToken_v1.json",
"./generated-artifacts/ZRXToken.json"
],
"exclude": ["./deploy/solc/solc_bin"]
diff --git a/contracts/tokens/tslint.json b/contracts/erc20/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/tokens/tslint.json
+++ b/contracts/erc20/tslint.json
diff --git a/contracts/tokens/.solhintignore b/contracts/erc721/.solhintignore
index 1e33ec53b..1e33ec53b 100644
--- a/contracts/tokens/.solhintignore
+++ b/contracts/erc721/.solhintignore
diff --git a/contracts/erc721/CHANGELOG.json b/contracts/erc721/CHANGELOG.json
new file mode 100644
index 000000000..724ab1e4a
--- /dev/null
+++ b/contracts/erc721/CHANGELOG.json
@@ -0,0 +1,56 @@
+[
+ {
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Upgrade the bignumber.js to v8.0.2",
+ "pr": 1517
+ }
+ ]
+ },
+ {
+ "timestamp": 1547747677,
+ "version": "1.0.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1547561734,
+ "version": "1.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1547225310,
+ "version": "1.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1547040760,
+ "version": "1.0.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/erc721/CHANGELOG.md b/contracts/erc721/CHANGELOG.md
new file mode 100644
index 000000000..59d0804da
--- /dev/null
+++ b/contracts/erc721/CHANGELOG.md
@@ -0,0 +1,26 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.6 - _January 17, 2019_
+
+ * Dependencies updated
+
+## v1.0.5 - _January 15, 2019_
+
+ * Dependencies updated
+
+## v1.0.4 - _January 11, 2019_
+
+ * Dependencies updated
+
+## v1.0.3 - _January 9, 2019_
+
+ * Dependencies updated
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/erc721/DEPLOYS.json b/contracts/erc721/DEPLOYS.json
new file mode 100644
index 000000000..5ff58c035
--- /dev/null
+++ b/contracts/erc721/DEPLOYS.json
@@ -0,0 +1,16 @@
+[
+ {
+ "name": "ZRXToken",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v1 deploy",
+ "networks": {
+ "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
+ "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
+ "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/erc721/README.md b/contracts/erc721/README.md
new file mode 100644
index 000000000..2d1db92f0
--- /dev/null
+++ b/contracts/erc721/README.md
@@ -0,0 +1,74 @@
+## Token contracts
+
+Token smart contracts that are used in the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
+
+## Usage
+
+Token contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+- [tokens](./contracts/tokens)
+ - This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
+- [test](./contracts/test)
+ - This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-tokens yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-tokens yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/erc721/compiler.json b/contracts/erc721/compiler.json
new file mode 100644
index 000000000..c5f07ddb8
--- /dev/null
+++ b/contracts/erc721/compiler.json
@@ -0,0 +1,30 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "DummyERC721Receiver",
+ "InvalidERC721Receiver",
+ "DummyERC721Token",
+ "ERC721Token",
+ "IERC721Receiver",
+ "IERC721Token",
+ "MintableERC721Token"
+ ]
+}
diff --git a/contracts/tokens/contracts/ERC721Token/ERC721Token.sol b/contracts/erc721/contracts/src/ERC721Token.sol
index 3cd7e13a1..32f70ccf8 100644
--- a/contracts/tokens/contracts/ERC721Token/ERC721Token.sol
+++ b/contracts/erc721/contracts/src/ERC721Token.sol
@@ -18,8 +18,8 @@
pragma solidity ^0.4.24;
-import "./IERC721Token.sol";
-import "./IERC721Receiver.sol";
+import "./interfaces/IERC721Token.sol";
+import "./interfaces/IERC721Receiver.sol";
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
diff --git a/contracts/tokens/contracts/ERC721Token/MintableERC721Token.sol b/contracts/erc721/contracts/src/MintableERC721Token.sol
index 27326d857..27326d857 100644
--- a/contracts/tokens/contracts/ERC721Token/MintableERC721Token.sol
+++ b/contracts/erc721/contracts/src/MintableERC721Token.sol
diff --git a/contracts/tokens/contracts/ERC721Token/IERC721Receiver.sol b/contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol
index c3ad35ede..c3ad35ede 100644
--- a/contracts/tokens/contracts/ERC721Token/IERC721Receiver.sol
+++ b/contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol
diff --git a/contracts/tokens/contracts/ERC721Token/IERC721Token.sol b/contracts/erc721/contracts/src/interfaces/IERC721Token.sol
index 56a3314df..56a3314df 100644
--- a/contracts/tokens/contracts/ERC721Token/IERC721Token.sol
+++ b/contracts/erc721/contracts/src/interfaces/IERC721Token.sol
diff --git a/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol b/contracts/erc721/contracts/test/DummyERC721Receiver.sol
index cf190b919..b5de01aa5 100644
--- a/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ b/contracts/erc721/contracts/test/DummyERC721Receiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../ERC721Token/IERC721Receiver.sol";
+import "../src/interfaces/IERC721Receiver.sol";
contract DummyERC721Receiver is
diff --git a/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol b/contracts/erc721/contracts/test/DummyERC721Token.sol
index a0c6ead89..41dc8ea18 100644
--- a/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
+++ b/contracts/erc721/contracts/test/DummyERC721Token.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../ERC721Token/MintableERC721Token.sol";
+import "../src/MintableERC721Token.sol";
import "@0x/contracts-utils/contracts/src/Ownable.sol";
diff --git a/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/contracts/erc721/contracts/test/InvalidERC721Receiver.sol
index 338e0e802..ea59dedc5 100644
--- a/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
+++ b/contracts/erc721/contracts/test/InvalidERC721Receiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../ERC721Token/IERC721Receiver.sol";
+import "../src/interfaces/IERC721Receiver.sol";
contract InvalidERC721Receiver is
diff --git a/contracts/erc721/package.json b/contracts/erc721/package.json
new file mode 100644
index 000000000..84b09a708
--- /dev/null
+++ b/contracts/erc721/package.json
@@ -0,0 +1,89 @@
+{
+ "name": "@0x/contracts-erc721",
+ "version": "1.0.6",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Token contracts used by 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.22",
+ "@0x/contracts-test-utils": "^2.0.1",
+ "@0x/dev-utils": "^1.0.24",
+ "@0x/sol-compiler": "^2.0.2",
+ "@0x/subproviders": "^2.1.11",
+ "@0x/tslint-config": "^2.0.2",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^3.0.0",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.13",
+ "@0x/contracts-exchange-libs": "^1.0.6",
+ "@0x/contracts-utils": "^1.0.6",
+ "@0x/order-utils": "^3.1.2",
+ "@0x/types": "^1.5.2",
+ "@0x/typescript-typings": "^3.0.8",
+ "@0x/utils": "^3.0.1",
+ "@0x/web3-wrapper": "^3.2.4",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.6",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/erc721/src/artifacts/index.ts b/contracts/erc721/src/artifacts/index.ts
new file mode 100644
index 000000000..8d5ec8a46
--- /dev/null
+++ b/contracts/erc721/src/artifacts/index.ts
@@ -0,0 +1,20 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as DummyERC721Receiver from '../../generated-artifacts/DummyERC721Receiver.json';
+import * as DummyERC721Token from '../../generated-artifacts/DummyERC721Token.json';
+import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
+import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
+import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
+import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
+import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
+
+// tslint:disable:no-unnecessary-type-assertion
+export const artifacts = {
+ DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
+ InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
+ DummyERC721Token: DummyERC721Token as ContractArtifact,
+ ERC721Token: ERC721Token as ContractArtifact,
+ IERC721Receiver: IERC721Receiver as ContractArtifact,
+ IERC721Token: IERC721Token as ContractArtifact,
+ MintableERC721Token: MintableERC721Token as ContractArtifact,
+};
diff --git a/contracts/erc721/src/index.ts b/contracts/erc721/src/index.ts
new file mode 100644
index 000000000..91dd7e0e3
--- /dev/null
+++ b/contracts/erc721/src/index.ts
@@ -0,0 +1,2 @@
+export * from './wrappers';
+export * from './artifacts';
diff --git a/contracts/erc721/src/wrappers/index.ts b/contracts/erc721/src/wrappers/index.ts
new file mode 100644
index 000000000..ba6c51885
--- /dev/null
+++ b/contracts/erc721/src/wrappers/index.ts
@@ -0,0 +1,7 @@
+export * from '../../generated-wrappers/mintable_erc721_token';
+export * from '../../generated-wrappers/invalid_erc721_receiver';
+export * from '../../generated-wrappers/i_erc721_token';
+export * from '../../generated-wrappers/i_erc721_receiver';
+export * from '../../generated-wrappers/erc721_token';
+export * from '../../generated-wrappers/dummy_erc721_token';
+export * from '../../generated-wrappers/dummy_erc721_receiver';
diff --git a/contracts/tokens/test/erc721_token.ts b/contracts/erc721/test/erc721_token.ts
index 13332cd35..13332cd35 100644
--- a/contracts/tokens/test/erc721_token.ts
+++ b/contracts/erc721/test/erc721_token.ts
diff --git a/contracts/erc721/test/global_hooks.ts b/contracts/erc721/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/erc721/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/erc721/tsconfig.json b/contracts/erc721/tsconfig.json
new file mode 100644
index 000000000..098c3a7f3
--- /dev/null
+++ b/contracts/erc721/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/DummyERC721Receiver.json",
+ "./generated-artifacts/InvalidERC721Receiver.json",
+ "./generated-artifacts/DummyERC721Token.json",
+ "./generated-artifacts/ERC721Token.json",
+ "./generated-artifacts/IERC721Receiver.json",
+ "./generated-artifacts/IERC721Token.json",
+ "./generated-artifacts/MintableERC721Token.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/erc721/tslint.json b/contracts/erc721/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/erc721/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/exchange/contracts/test/TestStaticCallReceiver.sol b/contracts/exchange/contracts/test/TestStaticCallReceiver.sol
index 522887fcb..23e60b387 100644
--- a/contracts/exchange/contracts/test/TestStaticCallReceiver.sol
+++ b/contracts/exchange/contracts/test/TestStaticCallReceiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/exchange/package.json b/contracts/exchange/package.json
index abe6d7210..9712b99ce 100644
--- a/contracts/exchange/package.json
+++ b/contracts/exchange/package.json
@@ -73,7 +73,8 @@
"@0x/contracts-exchange-libs": "^1.0.6",
"@0x/contracts-multisig": "^1.0.6",
"@0x/contracts-test-utils": "^2.0.1",
- "@0x/contracts-tokens": "^1.0.6",
+ "@0x/contracts-erc20": "^1.0.6",
+ "@0x/contracts-erc721": "^1.0.6",
"@0x/contracts-utils": "^1.0.6",
"@0x/order-utils": "^3.1.2",
"@0x/types": "^1.5.2",
diff --git a/contracts/exchange/test/core.ts b/contracts/exchange/test/core.ts
index 294976bf6..74161cc73 100644
--- a/contracts/exchange/test/core.ts
+++ b/contracts/exchange/test/core.ts
@@ -1,10 +1,20 @@
import {
artifacts as proxyArtifacts,
ERC20ProxyContract,
+ ERC20Wrapper,
ERC721ProxyContract,
+ ERC721Wrapper,
MultiAssetProxyContract,
} from '@0x/contracts-asset-proxy';
import {
+ artifacts as erc20Artifacts,
+ DummyERC20TokenContract,
+ DummyERC20TokenTransferEventArgs,
+ DummyNoReturnERC20TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
+import {
chaiSetup,
constants,
ERC20BalancesByOwner,
@@ -17,14 +27,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokensArtifacts,
- DummyERC20TokenContract,
- DummyERC20TokenTransferEventArgs,
- DummyERC721TokenContract,
- DummyNoReturnERC20TokenContract,
- ReentrantERC20TokenContract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
@@ -35,13 +37,13 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import { ExchangeCancelEventArgs, ExchangeContract } from '../generated-wrappers/exchange';
-import { TestStaticCallReceiverContract } from '../generated-wrappers/test_static_call_receiver';
-import { artifacts } from '../src/artifacts';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ERC721Wrapper } from './utils/erc721_wrapper';
-import { ExchangeWrapper } from './utils/exchange_wrapper';
+import {
+ artifacts,
+ ExchangeCancelEventArgs,
+ ExchangeContract,
+ ExchangeWrapper,
+ TestStaticCallReceiverContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -118,7 +120,7 @@ describe('Exchange core', () => {
txDefaults,
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.ReentrantERC20Token,
+ erc20Artifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
@@ -343,7 +345,7 @@ describe('Exchange core', () => {
describe('Testing exchange of ERC20 tokens with no return values', () => {
before(async () => {
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyNoReturnERC20Token,
+ erc20Artifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/exchange/test/dispatcher.ts b/contracts/exchange/test/dispatcher.ts
index 36d263bf4..a25755936 100644
--- a/contracts/exchange/test/dispatcher.ts
+++ b/contracts/exchange/test/dispatcher.ts
@@ -1,4 +1,11 @@
-import { artifacts as proxyArtifacts, ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
+import {
+ artifacts as proxyArtifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ERC721Wrapper,
+} from '@0x/contracts-asset-proxy';
+import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import {
chaiSetup,
constants,
@@ -8,7 +15,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { DummyERC20TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { AssetProxyId, RevertReason } from '@0x/types';
@@ -18,13 +24,10 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import {
+ artifacts,
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
TestAssetProxyDispatcherContract,
-} from '../generated-wrappers/test_asset_proxy_dispatcher';
-import { artifacts } from '../src/artifacts';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ERC721Wrapper } from './utils/erc721_wrapper';
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/exchange/test/fill_order.ts b/contracts/exchange/test/fill_order.ts
index fee39db53..3f54091d4 100644
--- a/contracts/exchange/test/fill_order.ts
+++ b/contracts/exchange/test/fill_order.ts
@@ -16,10 +16,7 @@ import {
import { BlockchainLifecycle } from '@0x/dev-utils';
import * as _ from 'lodash';
-import {
- FillOrderCombinatorialUtils,
- fillOrderCombinatorialUtilsFactoryAsync,
-} from './utils/fill_order_combinatorial_utils';
+import { FillOrderCombinatorialUtils, fillOrderCombinatorialUtilsFactoryAsync } from '../src';
chaiSetup.configure();
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
diff --git a/contracts/exchange/test/internal.ts b/contracts/exchange/test/internal.ts
index 3a7f0cff2..7a1e12a7a 100644
--- a/contracts/exchange/test/internal.ts
+++ b/contracts/exchange/test/internal.ts
@@ -16,8 +16,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { TestExchangeInternalsContract } from '../generated-wrappers/test_exchange_internals';
-import { artifacts } from '../src/artifacts';
+import { artifacts, TestExchangeInternalsContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/exchange/test/match_orders.ts b/contracts/exchange/test/match_orders.ts
index 346ee42a9..d17025ddd 100644
--- a/contracts/exchange/test/match_orders.ts
+++ b/contracts/exchange/test/match_orders.ts
@@ -1,4 +1,6 @@
-import { ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
+import { ERC20ProxyContract, ERC20Wrapper, ERC721ProxyContract, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts, DummyERC20TokenContract, ReentrantERC20TokenContract } from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import {
chaiSetup,
constants,
@@ -10,12 +12,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokensArtifacts,
- DummyERC20TokenContract,
- DummyERC721TokenContract,
- ReentrantERC20TokenContract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -24,14 +20,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { ExchangeContract } from '../generated-wrappers/exchange';
-import { TestExchangeInternalsContract } from '../generated-wrappers/test_exchange_internals';
-import { artifacts } from '../src/artifacts';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ERC721Wrapper } from './utils/erc721_wrapper';
-import { ExchangeWrapper } from './utils/exchange_wrapper';
-import { MatchOrderTester } from './utils/match_order_tester';
+import { artifacts, ExchangeContract, ExchangeWrapper, MatchOrderTester, TestExchangeInternalsContract } from '../src';
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
chaiSetup.configure();
@@ -142,7 +131,7 @@ describe('matchOrders', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.ReentrantERC20Token,
+ erc20Artifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/exchange/test/signature_validator.ts b/contracts/exchange/test/signature_validator.ts
index 33b15b394..89eac4ddb 100644
--- a/contracts/exchange/test/signature_validator.ts
+++ b/contracts/exchange/test/signature_validator.ts
@@ -1,3 +1,4 @@
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
import {
addressUtils,
chaiSetup,
@@ -9,7 +10,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
@@ -78,7 +78,7 @@ describe('MixinSignatureValidator', () => {
provider,
txDefaults,
);
- signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts });
await web3Wrapper.awaitTransactionSuccessAsync(
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
from: signerAddress,
diff --git a/contracts/exchange/test/transactions.ts b/contracts/exchange/test/transactions.ts
index a1d855631..613953493 100644
--- a/contracts/exchange/test/transactions.ts
+++ b/contracts/exchange/test/transactions.ts
@@ -1,4 +1,5 @@
-import { ERC20ProxyContract } from '@0x/contracts-asset-proxy';
+import { ERC20ProxyContract, ERC20Wrapper } from '@0x/contracts-asset-proxy';
+import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import {
chaiSetup,
constants,
@@ -12,7 +13,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { DummyERC20TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
@@ -20,11 +20,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { ExchangeContract } from '../generated-wrappers/exchange';
-import { artifacts, ExchangeWrapperContract, WhitelistContract } from '../src/';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ExchangeWrapper } from './utils/exchange_wrapper';
+import { artifacts, ExchangeContract, ExchangeWrapper, ExchangeWrapperContract, WhitelistContract } from '../src/';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/exchange/test/utils/asset_wrapper.ts b/contracts/exchange/test/utils/asset_wrapper.ts
index e4090ad74..e5a5205f5 100644
--- a/contracts/exchange/test/utils/asset_wrapper.ts
+++ b/contracts/exchange/test/utils/asset_wrapper.ts
@@ -4,8 +4,7 @@ import { AssetProxyId } from '@0x/types';
import { BigNumber, errorUtils } from '@0x/utils';
import * as _ from 'lodash';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
interface ProxyIdToAssetWrappers {
[proxyId: string]: AbstractAssetWrapper;
@@ -28,11 +27,13 @@ export class AssetWrapper {
const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
const balance = await erc20Wrapper.getBalanceAsync(userAddress, assetData);
return balance;
}
case AssetProxyId.ERC721: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const isOwner = await assetWrapper.isOwnerAsync(
@@ -51,6 +52,7 @@ export class AssetWrapper {
const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
await erc20Wrapper.setBalanceAsync(userAddress, assetData, desiredBalance);
return;
@@ -59,6 +61,7 @@ export class AssetWrapper {
if (!desiredBalance.eq(0) && !desiredBalance.eq(1)) {
throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`);
}
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const doesTokenExist = erc721Wrapper.doesTokenExistAsync(
@@ -109,11 +112,13 @@ export class AssetWrapper {
const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
const allowance = await erc20Wrapper.getProxyAllowanceAsync(userAddress, assetData);
return allowance;
}
case AssetProxyId.ERC721: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
const erc721ProxyData = assetDataUtils.decodeERC721AssetData(assetData);
const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync(
@@ -143,6 +148,7 @@ export class AssetWrapper {
const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (proxyId) {
case AssetProxyId.ERC20: {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
await erc20Wrapper.setAllowanceAsync(userAddress, assetData, desiredAllowance);
return;
@@ -157,6 +163,7 @@ export class AssetWrapper {
`Allowance for ERC721 token can only be set to 0, 1 or 2^256-1. Got: ${desiredAllowance}`,
);
}
+ // tslint:disable-next-line:no-unnecessary-type-assertion
const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
diff --git a/contracts/exchange/test/utils/erc20_wrapper.ts b/contracts/exchange/test/utils/erc20_wrapper.ts
deleted file mode 100644
index 3fe21ff96..000000000
--- a/contracts/exchange/test/utils/erc20_wrapper.ts
+++ /dev/null
@@ -1,177 +0,0 @@
-import { artifacts as proxyArtifacts, ERC20ProxyContract } from '@0x/contracts-asset-proxy';
-import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-tokens';
-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';
-
-export class ERC20Wrapper {
- private readonly _tokenOwnerAddresses: string[];
- private readonly _contractOwnerAddress: string;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _provider: Provider;
- private readonly _dummyTokenContracts: DummyERC20TokenContract[];
- private _proxyContract?: ERC20ProxyContract;
- private _proxyIdIfExists?: string;
- /**
- * Instanitates an ERC20Wrapper
- * @param provider Web3 provider to use for all JSON RPC requests
- * @param tokenOwnerAddresses Addresses that we want to endow as owners for dummy ERC20 tokens
- * @param contractOwnerAddress Desired owner of the contract
- * Instance of ERC20Wrapper
- */
- constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
- this._dummyTokenContracts = [];
- this._web3Wrapper = new Web3Wrapper(provider);
- this._provider = provider;
- this._tokenOwnerAddresses = tokenOwnerAddresses;
- this._contractOwnerAddress = contractOwnerAddress;
- }
- public async deployDummyTokensAsync(
- numberToDeploy: number,
- decimals: BigNumber,
- ): Promise<DummyERC20TokenContract[]> {
- for (let i = 0; i < numberToDeploy; i++) {
- this._dummyTokenContracts.push(
- await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyERC20Token,
- this._provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- decimals,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- ),
- );
- }
- return this._dummyTokenContracts;
- }
- public async deployProxyAsync(): Promise<ERC20ProxyContract> {
- this._proxyContract = await ERC20ProxyContract.deployFrom0xArtifactAsync(
- proxyArtifacts.ERC20Proxy,
- this._provider,
- txDefaults,
- );
- this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
- return this._proxyContract;
- }
- public getProxyId(): string {
- this._validateProxyContractExistsOrThrow();
- return this._proxyIdIfExists as string;
- }
- public async setBalancesAndAllowancesAsync(): Promise<void> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateProxyContractExistsOrThrow();
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await dummyTokenContract.setBalance.sendTransactionAsync(
- tokenOwnerAddress,
- constants.INITIAL_ERC20_BALANCE,
- { from: this._contractOwnerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await dummyTokenContract.approve.sendTransactionAsync(
- (this._proxyContract as ERC20ProxyContract).address,
- constants.INITIAL_ERC20_ALLOWANCE,
- { from: tokenOwnerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- }
- }
- public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const balance = new BigNumber(await tokenContract.balanceOf.callAsync(userAddress));
- return balance;
- }
- public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.setBalance.sendTransactionAsync(userAddress, amount, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
- const allowance = new BigNumber(await tokenContract.allowance.callAsync(userAddress, proxyAddress));
- return allowance;
- }
- public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.approve.sendTransactionAsync(proxyAddress, amount, {
- from: userAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async getBalancesAsync(): Promise<ERC20BalancesByOwner> {
- this._validateDummyTokenContractsExistOrThrow();
- const balancesByOwner: ERC20BalancesByOwner = {};
- const balances: BigNumber[] = [];
- const balanceInfo: Array<{ tokenOwnerAddress: string; tokenAddress: string }> = [];
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- balances.push(await dummyTokenContract.balanceOf.callAsync(tokenOwnerAddress));
- balanceInfo.push({
- tokenOwnerAddress,
- tokenAddress: dummyTokenContract.address,
- });
- }
- }
- _.forEach(balances, (balance, balanceIndex) => {
- const tokenAddress = balanceInfo[balanceIndex].tokenAddress;
- const tokenOwnerAddress = balanceInfo[balanceIndex].tokenOwnerAddress;
- if (_.isUndefined(balancesByOwner[tokenOwnerAddress])) {
- balancesByOwner[tokenOwnerAddress] = {};
- }
- const wrappedBalance = new BigNumber(balance);
- balancesByOwner[tokenOwnerAddress][tokenAddress] = wrappedBalance;
- });
- return balancesByOwner;
- }
- public addDummyTokenContract(dummy: DummyERC20TokenContract): void {
- if (!_.isUndefined(this._dummyTokenContracts)) {
- this._dummyTokenContracts.push(dummy);
- }
- }
- public addTokenOwnerAddress(address: string): void {
- this._tokenOwnerAddresses.push(address);
- }
- public getTokenOwnerAddresses(): string[] {
- return this._tokenOwnerAddresses;
- }
- public getTokenAddresses(): string[] {
- const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
- return tokenAddresses;
- }
- private _getTokenContractFromAssetData(assetData: string): DummyERC20TokenContract {
- const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
- const tokenAddress = erc20ProxyData.tokenAddress;
- const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
- if (_.isUndefined(tokenContractIfExists)) {
- throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
- }
- return tokenContractIfExists;
- }
- private _validateDummyTokenContractsExistOrThrow(): void {
- if (_.isUndefined(this._dummyTokenContracts)) {
- throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"');
- }
- }
- private _validateProxyContractExistsOrThrow(): void {
- if (_.isUndefined(this._proxyContract)) {
- throw new Error('ERC20 proxy contract not yet deployed, please call "deployProxyAsync"');
- }
- }
-}
diff --git a/contracts/exchange/test/utils/erc721_wrapper.ts b/contracts/exchange/test/utils/erc721_wrapper.ts
deleted file mode 100644
index 021c75ef2..000000000
--- a/contracts/exchange/test/utils/erc721_wrapper.ts
+++ /dev/null
@@ -1,234 +0,0 @@
-import { artifacts as proxyArtifacts, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
-import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-tokens';
-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';
-
-export class ERC721Wrapper {
- private readonly _tokenOwnerAddresses: string[];
- private readonly _contractOwnerAddress: string;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _provider: Provider;
- private readonly _dummyTokenContracts: DummyERC721TokenContract[];
- private _proxyContract?: ERC721ProxyContract;
- private _proxyIdIfExists?: string;
- private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
- constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
- this._web3Wrapper = new Web3Wrapper(provider);
- this._provider = provider;
- this._dummyTokenContracts = [];
- this._tokenOwnerAddresses = tokenOwnerAddresses;
- this._contractOwnerAddress = contractOwnerAddress;
- }
- public async deployDummyTokensAsync(): Promise<DummyERC721TokenContract[]> {
- // tslint:disable-next-line:no-unused-variable
- for (const i of _.times(constants.NUM_DUMMY_ERC721_TO_DEPLOY)) {
- this._dummyTokenContracts.push(
- await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.DummyERC721Token,
- this._provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- ),
- );
- }
- return this._dummyTokenContracts;
- }
- public async deployProxyAsync(): Promise<ERC721ProxyContract> {
- this._proxyContract = await ERC721ProxyContract.deployFrom0xArtifactAsync(
- proxyArtifacts.ERC721Proxy,
- this._provider,
- txDefaults,
- );
- this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
- return this._proxyContract;
- }
- public getProxyId(): string {
- this._validateProxyContractExistsOrThrow();
- return this._proxyIdIfExists as string;
- }
- public async setBalancesAndAllowancesAsync(): Promise<void> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateProxyContractExistsOrThrow();
- this._initialTokenIdsByOwner = {};
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- // tslint:disable-next-line:no-unused-variable
- for (const i of _.times(constants.NUM_ERC721_TOKENS_TO_MINT)) {
- const tokenId = generatePseudoRandomSalt();
- await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress);
- if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) {
- this._initialTokenIdsByOwner[tokenOwnerAddress] = {
- [dummyTokenContract.address]: [],
- };
- }
- if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address])) {
- this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = [];
- }
- this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId);
-
- await this.approveProxyAsync(dummyTokenContract.address, tokenId);
- }
- }
- }
- }
- public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const owner = await tokenContract.ownerOf.callAsync(tokenId);
- const doesExist = owner !== constants.NULL_ADDRESS;
- return doesExist;
- }
- public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise<void> {
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- await this.approveAsync(proxyAddress, tokenAddress, tokenId);
- }
- public async approveProxyForAllAsync(tokenAddress: string, tokenId: BigNumber, isApproved: boolean): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.setApprovalForAll.sendTransactionAsync(proxyAddress, isApproved, {
- from: tokenOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.approve.sendTransactionAsync(to, tokenId, {
- from: tokenOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async transferFromAsync(
- tokenAddress: string,
- tokenId: BigNumber,
- currentOwner: string,
- userAddress: string,
- ): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.transferFrom.sendTransactionAsync(currentOwner, userAddress, tokenId, {
- from: currentOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.mint.sendTransactionAsync(userAddress, tokenId, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.burn.sendTransactionAsync(owner, tokenId, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async ownerOfAsync(tokenAddress: string, tokenId: BigNumber): Promise<string> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const owner = await tokenContract.ownerOf.callAsync(tokenId);
- return owner;
- }
- public async isOwnerAsync(userAddress: string, tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await tokenContract.ownerOf.callAsync(tokenId);
- const isOwner = tokenOwner === userAddress;
- return isOwner;
- }
- public async isProxyApprovedForAllAsync(userAddress: string, tokenAddress: string): Promise<boolean> {
- this._validateProxyContractExistsOrThrow();
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const operator = (this._proxyContract as ERC721ProxyContract).address;
- const didApproveAll = await tokenContract.isApprovedForAll.callAsync(userAddress, operator);
- return didApproveAll;
- }
- public async isProxyApprovedAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- this._validateProxyContractExistsOrThrow();
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const approvedAddress = await tokenContract.getApproved.callAsync(tokenId);
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- const isProxyAnApprovedOperator = approvedAddress === proxyAddress;
- return isProxyAnApprovedOperator;
- }
- public async getBalancesAsync(): Promise<ERC721TokenIdsByOwner> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateBalancesAndAllowancesSetOrThrow();
- const tokenIdsByOwner: ERC721TokenIdsByOwner = {};
- const tokenOwnerAddresses: string[] = [];
- const tokenInfo: Array<{ tokenId: BigNumber; tokenAddress: string }> = [];
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- const initialTokenOwnerIds = this._initialTokenIdsByOwner[tokenOwnerAddress][
- dummyTokenContract.address
- ];
- for (const tokenId of initialTokenOwnerIds) {
- tokenOwnerAddresses.push(await dummyTokenContract.ownerOf.callAsync(tokenId));
- tokenInfo.push({
- tokenId,
- tokenAddress: dummyTokenContract.address,
- });
- }
- }
- }
- _.forEach(tokenOwnerAddresses, (tokenOwnerAddress, ownerIndex) => {
- const tokenAddress = tokenInfo[ownerIndex].tokenAddress;
- const tokenId = tokenInfo[ownerIndex].tokenId;
- if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress])) {
- tokenIdsByOwner[tokenOwnerAddress] = {
- [tokenAddress]: [],
- };
- }
- if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress][tokenAddress])) {
- tokenIdsByOwner[tokenOwnerAddress][tokenAddress] = [];
- }
- tokenIdsByOwner[tokenOwnerAddress][tokenAddress].push(tokenId);
- });
- return tokenIdsByOwner;
- }
- public getTokenOwnerAddresses(): string[] {
- return this._tokenOwnerAddresses;
- }
- public getTokenAddresses(): string[] {
- const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
- return tokenAddresses;
- }
- private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract {
- const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
- if (_.isUndefined(tokenContractIfExists)) {
- throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
- }
- return tokenContractIfExists;
- }
- private _validateDummyTokenContractsExistOrThrow(): void {
- if (_.isUndefined(this._dummyTokenContracts)) {
- throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"');
- }
- }
- private _validateProxyContractExistsOrThrow(): void {
- if (_.isUndefined(this._proxyContract)) {
- throw new Error('ERC721 proxy contract not yet deployed, please call "deployProxyAsync"');
- }
- }
- private _validateBalancesAndAllowancesSetOrThrow(): void {
- if (_.keys(this._initialTokenIdsByOwner).length === 0) {
- throw new Error(
- 'Dummy ERC721 balances and allowances not yet set, please call "setBalancesAndAllowancesAsync"',
- );
- }
- }
-}
diff --git a/contracts/exchange/test/utils/exchange_wrapper.ts b/contracts/exchange/test/utils/exchange_wrapper.ts
index 437882b41..eca535c65 100644
--- a/contracts/exchange/test/utils/exchange_wrapper.ts
+++ b/contracts/exchange/test/utils/exchange_wrapper.ts
@@ -1,3 +1,5 @@
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
+import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
import {
FillResults,
formatters,
@@ -6,15 +8,13 @@ import {
orderUtils,
SignedTransaction,
} from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
-import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, ExchangeContract } from '../../src';
import { AbiDecodedFillOrderData } from './types';
@@ -25,7 +25,7 @@ export class ExchangeWrapper {
constructor(exchangeContract: ExchangeContract, provider: Provider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...erc20Artifacts, ...erc721Artifacts });
}
public async fillOrderAsync(
signedOrder: SignedOrder,
diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts
index c2f530e5b..26b168909 100644
--- a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts
+++ b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts
@@ -1,4 +1,5 @@
-import { artifacts as libsArtifacts, TestLibsContract } from '@0x/contracts-libs';
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { artifacts as libsArtifacts, TestLibsContract } from '@0x/contracts-exchange-libs';
import {
AllowanceAmountScenario,
AssetDataScenario,
@@ -32,12 +33,9 @@ import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
-import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, ExchangeContract, ExchangeFillEventArgs } from '../../src';
import { AssetWrapper } from './asset_wrapper';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
import { ExchangeWrapper } from './exchange_wrapper';
import { OrderFactoryFromScenario } from './order_factory_from_scenario';
import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher';
diff --git a/contracts/exchange/test/utils/index.ts b/contracts/exchange/test/utils/index.ts
index 75cd88666..d88a38266 100644
--- a/contracts/exchange/test/utils/index.ts
+++ b/contracts/exchange/test/utils/index.ts
@@ -1,3 +1,3 @@
export * from './exchange_wrapper';
-export * from './erc20_wrapper';
-export * from './erc721_wrapper';
+export * from './fill_order_combinatorial_utils';
+export * from './match_order_tester';
diff --git a/contracts/exchange/test/utils/match_order_tester.ts b/contracts/exchange/test/utils/match_order_tester.ts
index 0ba8017c5..680ff13ac 100644
--- a/contracts/exchange/test/utils/match_order_tester.ts
+++ b/contracts/exchange/test/utils/match_order_tester.ts
@@ -1,3 +1,4 @@
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import {
chaiSetup,
ERC20BalancesByOwner,
@@ -15,8 +16,6 @@ import * as _ from 'lodash';
import { TransactionReceiptWithDecodedLogs } from '../../../../node_modules/ethereum-types';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
import { ExchangeWrapper } from './exchange_wrapper';
chaiSetup.configure();
diff --git a/contracts/exchange/test/utils/order_factory_from_scenario.ts b/contracts/exchange/test/utils/order_factory_from_scenario.ts
index ecb4b2e28..6f5645906 100644
--- a/contracts/exchange/test/utils/order_factory_from_scenario.ts
+++ b/contracts/exchange/test/utils/order_factory_from_scenario.ts
@@ -1,3 +1,4 @@
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import {
AssetDataScenario,
constants,
@@ -8,7 +9,6 @@ import {
OrderScenario,
TakerScenario,
} from '@0x/contracts-test-utils';
-import { DummyERC721TokenContract } from '@0x/contracts-tokens';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { Order } from '@0x/types';
import { BigNumber, errorUtils } from '@0x/utils';
diff --git a/contracts/exchange/test/wrapper.ts b/contracts/exchange/test/wrapper.ts
index 6211682b1..62a0d426f 100644
--- a/contracts/exchange/test/wrapper.ts
+++ b/contracts/exchange/test/wrapper.ts
@@ -1,4 +1,6 @@
-import { ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
+import { ERC20ProxyContract, ERC20Wrapper, ERC721ProxyContract, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts, DummyERC20TokenContract, ReentrantERC20TokenContract } from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
import {
chaiSetup,
constants,
@@ -12,12 +14,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokensArtifacts,
- DummyERC20TokenContract,
- DummyERC721TokenContract,
- ReentrantERC20TokenContract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -26,12 +22,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { ExchangeContract } from '../generated-wrappers/exchange';
-import { artifacts } from '../src/artifacts';
-
-import { ERC20Wrapper } from './utils/erc20_wrapper';
-import { ERC721Wrapper } from './utils/erc721_wrapper';
-import { ExchangeWrapper } from './utils/exchange_wrapper';
+import { artifacts, ExchangeContract, ExchangeWrapper } from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -116,7 +107,7 @@ describe('Exchange wrappers', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.ReentrantERC20Token,
+ erc20Artifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
index f98e553a7..7631880c0 100644
--- a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
+++ b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-utils/contracts/src/SafeMath.sol";
diff --git a/contracts/extensions/contracts/Forwarder/MixinAssets.sol b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
index c00a47088..330586ed9 100644
--- a/contracts/extensions/contracts/Forwarder/MixinAssets.sol
+++ b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
@@ -20,8 +20,8 @@ pragma solidity ^0.4.24;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-utils/contracts/src/Ownable.sol";
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
-import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
+import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
import "./libs/LibConstants.sol";
import "./mixins/MAssets.sol";
diff --git a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
index fdc63e68c..3ff2a03e5 100644
--- a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
+++ b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
@@ -20,8 +20,8 @@ pragma solidity ^0.4.24;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
-import "@0x/contracts-tokens/contracts/EtherToken/IEtherToken.sol";
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IEtherToken.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
contract LibConstants {
diff --git a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
index 9d46f5844..65b36ea65 100644
--- a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
+++ b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
@@ -20,8 +20,8 @@ pragma solidity ^0.4.24;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-utils/contracts/src/Ownable.sol";
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
-import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
+import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
import "./mixins/MAssets.sol";
import "./libs/LibConstants.sol";
diff --git a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
index 6e325665a..3297a980f 100644
--- a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
+++ b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
@@ -21,8 +21,8 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
-import "@0x/contracts-tokens/contracts/ERC20Token/IERC20Token.sol";
-import "@0x/contracts-tokens/contracts/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
+import "@0x/contracts-erc721/contracts/src/interfaces/IERC721Token.sol";
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json
index 5cea0dcea..af0c37b51 100644
--- a/contracts/extensions/package.json
+++ b/contracts/extensions/package.json
@@ -74,7 +74,8 @@
"@0x/contracts-asset-proxy": "^2.2.3",
"@0x/contracts-exchange-libs": "^1.0.6",
"@0x/contracts-exchange": "^2.2.3",
- "@0x/contracts-tokens": "^1.0.6",
+ "@0x/contracts-erc20": "^1.0.6",
+ "@0x/contracts-erc721": "^1.0.6",
"@0x/contracts-utils": "^1.0.6",
"@0x/order-utils": "^3.1.2",
"@0x/types": "^1.5.2",
diff --git a/contracts/extensions/src/index.ts b/contracts/extensions/src/index.ts
index d55f08ea2..ba813e7ca 100644
--- a/contracts/extensions/src/index.ts
+++ b/contracts/extensions/src/index.ts
@@ -1,2 +1,3 @@
export * from './artifacts';
export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/extensions/test/extensions/balance_threshold_filter.ts b/contracts/extensions/test/balance_threshold_filter.ts
index 055beb487..c79a72f5a 100644
--- a/contracts/extensions/test/extensions/balance_threshold_filter.ts
+++ b/contracts/extensions/test/balance_threshold_filter.ts
@@ -7,13 +7,9 @@ import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
-import {
- artifacts as exchangeArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-exchange';
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { DummyERC20TokenContract } from '@0x/contracts-erc20';
+import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -27,11 +23,8 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { DummyERC20TokenContract } from '@0x/contracts-tokens';
-import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter';
-import { artifacts } from '../../src/artifacts';
-import { BalanceThresholdWrapper } from '../utils/balance_threshold_wrapper';
+import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/dutch_auction.ts
index 132989efe..34ff25c3d 100644
--- a/contracts/extensions/test/extensions/dutch_auction.ts
+++ b/contracts/extensions/test/dutch_auction.ts
@@ -1,11 +1,8 @@
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
-import {
- artifacts as exchangeArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-exchange';
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
+import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -18,12 +15,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokensArtifacts,
- DummyERC20TokenContract,
- DummyERC721TokenContract,
- WETH9Contract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -32,9 +23,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
-import { artifacts } from '../../src/artifacts';
-import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper';
+import { artifacts, DutchAuctionContract, DutchAuctionTestWrapper } from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -93,7 +82,7 @@ describe(ContractName.DutchAuction, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults);
erc20Wrapper.addDummyTokenContract(wethContract as any);
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
diff --git a/contracts/extensions/test/extensions/forwarder.ts b/contracts/extensions/test/forwarder.ts
index e9bda43ae..24c219563 100644
--- a/contracts/extensions/test/extensions/forwarder.ts
+++ b/contracts/extensions/test/forwarder.ts
@@ -1,10 +1,7 @@
-import {
- artifacts as exchangeArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-exchange';
+import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
+import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -18,12 +15,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import {
- artifacts as tokenArtifacts,
- DummyERC20TokenContract,
- DummyERC721TokenContract,
- WETH9Contract,
-} from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
@@ -32,10 +23,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { ForwarderContract } from '../../generated-wrappers/forwarder';
-import { artifacts } from '../../src/artifacts';
-
-import { ForwarderWrapper } from '../utils/forwarder_wrapper';
+import { artifacts, ForwarderContract, ForwarderWrapper } from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -100,7 +88,7 @@ describe(ContractName.Forwarder, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults);
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
erc20Wrapper.addDummyTokenContract(weth);
diff --git a/contracts/extensions/test/extensions/order_matcher.ts b/contracts/extensions/test/order_matcher.ts
index 61965dab3..0b2f9ddbb 100644
--- a/contracts/extensions/test/extensions/order_matcher.ts
+++ b/contracts/extensions/test/order_matcher.ts
@@ -1,7 +1,13 @@
-import { artifacts as proxyArtifacts, ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
import {
- artifacts as exchangeArtifacts,
+ artifacts as proxyArtifacts,
+ ERC20ProxyContract,
ERC20Wrapper,
+ ERC721ProxyContract,
+} from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contracts-erc20';
+import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/contracts-erc721';
+import {
+ artifacts as exchangeArtifacts,
ExchangeContract,
ExchangeFillEventArgs,
ExchangeWrapper,
@@ -19,7 +25,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { artifacts as tokenArtifacts, DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason } from '@0x/types';
@@ -29,8 +34,7 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { OrderMatcherContract } from '../../generated-wrappers/order_matcher';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, OrderMatcherContract } from '../src';
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
chaiSetup.configure();
@@ -450,7 +454,7 @@ describe('OrderMatcher', () => {
signedOrderLeft.signature,
signedOrderRight.signature,
);
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...exchangeArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts });
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
data,
@@ -488,7 +492,7 @@ describe('OrderMatcher', () => {
signedOrderLeft.signature,
signedOrderRight.signature,
);
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...exchangeArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts });
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
data,
@@ -725,7 +729,7 @@ describe('OrderMatcher', () => {
});
it('should allow owner to withdraw ERC721 tokens', async () => {
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- tokenArtifacts.DummyERC721Token,
+ erc721Artifacts.DummyERC721Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -770,7 +774,7 @@ describe('OrderMatcher', () => {
});
it('should be able to approve an ERC721 token by passing in allowance = 1', async () => {
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- tokenArtifacts.DummyERC721Token,
+ erc721Artifacts.DummyERC721Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -787,7 +791,7 @@ describe('OrderMatcher', () => {
});
it('should be able to approve an ERC721 token by passing in allowance > 1', async () => {
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- tokenArtifacts.DummyERC721Token,
+ erc721Artifacts.DummyERC721Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/extensions/test/extensions/order_validator.ts b/contracts/extensions/test/order_validator.ts
index 7871867c7..88dae14fb 100644
--- a/contracts/extensions/test/extensions/order_validator.ts
+++ b/contracts/extensions/test/order_validator.ts
@@ -1,11 +1,7 @@
-import { ERC20ProxyContract, ERC721ProxyContract } from '@0x/contracts-asset-proxy';
-import {
- artifacts as exchangeArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-exchange';
+import { ERC20ProxyContract, ERC20Wrapper, ERC721ProxyContract, ERC721Wrapper } from '@0x/contracts-asset-proxy';
+import { DummyERC20TokenContract } from '@0x/contracts-erc20';
+import { DummyERC721TokenContract } from '@0x/contracts-erc721';
+import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -15,7 +11,6 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
-import { DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { SignedOrder } from '@0x/types';
@@ -23,8 +18,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
-import { artifacts } from '../../src/artifacts/index';
+import { artifacts, OrderValidatorContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/extensions/test/utils/balance_threshold_wrapper.ts b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
index db2b23d42..3178d992e 100644
--- a/contracts/extensions/test/utils/balance_threshold_wrapper.ts
+++ b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
@@ -1,3 +1,5 @@
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
+import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange';
import {
FillResults,
@@ -7,7 +9,6 @@ import {
orderUtils,
TransactionFactory,
} from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
@@ -35,7 +36,8 @@ export class BalanceThresholdWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
+ ...erc20Artifacts,
+ ...erc721Artifacts,
...exchangeArtifacts,
});
}
diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
index 985af336d..5899ffcac 100644
--- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
+++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
@@ -1,6 +1,7 @@
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
+import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange';
import { LogDecoder } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -19,7 +20,8 @@ export class DutchAuctionTestWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
+ ...erc20Artifacts,
+ ...erc721Artifacts,
...exchangeArtifacts,
});
}
diff --git a/contracts/extensions/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts
index 5b89638a0..207106852 100644
--- a/contracts/extensions/test/utils/forwarder_wrapper.ts
+++ b/contracts/extensions/test/utils/forwarder_wrapper.ts
@@ -1,6 +1,7 @@
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
+import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange';
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
@@ -62,7 +63,8 @@ export class ForwarderWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
+ ...erc20Artifacts,
+ ...erc721Artifacts,
...exchangeArtifacts,
});
}
diff --git a/contracts/extensions/test/utils/index.ts b/contracts/extensions/test/utils/index.ts
new file mode 100644
index 000000000..d5d529c11
--- /dev/null
+++ b/contracts/extensions/test/utils/index.ts
@@ -0,0 +1,3 @@
+export * from './balance_threshold_wrapper';
+export * from './dutch_auction_test_wrapper';
+export * from './forwarder_wrapper';
diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json
index ec6bf5367..b56a711d2 100644
--- a/contracts/multisig/package.json
+++ b/contracts/multisig/package.json
@@ -71,7 +71,7 @@
"dependencies": {
"@0x/base-contract": "^3.0.13",
"@0x/contracts-asset-proxy": "^2.2.3",
- "@0x/contracts-tokens": "^1.0.6",
+ "@0x/contracts-erc20": "^1.0.6",
"@0x/order-utils": "^3.1.2",
"@0x/types": "^1.5.2",
"@0x/typescript-typings": "^3.0.8",
diff --git a/contracts/multisig/src/index.ts b/contracts/multisig/src/index.ts
index d55f08ea2..ba813e7ca 100644
--- a/contracts/multisig/src/index.ts
+++ b/contracts/multisig/src/index.ts
@@ -1,2 +1,3 @@
export * from './artifacts';
export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/multisig/src/wrappers/index.ts b/contracts/multisig/src/wrappers/index.ts
index 69abd62f2..43ab25704 100644
--- a/contracts/multisig/src/wrappers/index.ts
+++ b/contracts/multisig/src/wrappers/index.ts
@@ -1,2 +1,5 @@
+export * from '../../generated-wrappers/asset_proxy_owner';
export * from '../../generated-wrappers/multi_sig_wallet';
export * from '../../generated-wrappers/multi_sig_wallet_with_time_lock';
+export * from '../../generated-wrappers/test_asset_proxy_owner';
+export * from '../../generated-wrappers/test_reject_ether';
diff --git a/contracts/multisig/test/asset_proxy_owner.ts b/contracts/multisig/test/asset_proxy_owner.ts
index c7b7d997b..62081554b 100644
--- a/contracts/multisig/test/asset_proxy_owner.ts
+++ b/contracts/multisig/test/asset_proxy_owner.ts
@@ -19,16 +19,15 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import {
+ artifacts,
AssetProxyOwnerAssetProxyRegistrationEventArgs,
AssetProxyOwnerContract,
AssetProxyOwnerExecutionEventArgs,
AssetProxyOwnerExecutionFailureEventArgs,
AssetProxyOwnerSubmissionEventArgs,
-} from '../generated-wrappers/asset_proxy_owner';
-import { TestAssetProxyOwnerContract } from '../generated-wrappers/test_asset_proxy_owner';
-import { artifacts } from '../src/artifacts';
-
-import { AssetProxyOwnerWrapper } from './utils/asset_proxy_owner_wrapper';
+ AssetProxyOwnerWrapper,
+ TestAssetProxyOwnerContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/multisig/test/multi_sig_with_time_lock.ts b/contracts/multisig/test/multi_sig_with_time_lock.ts
index 31c215505..b9b3732a7 100644
--- a/contracts/multisig/test/multi_sig_with_time_lock.ts
+++ b/contracts/multisig/test/multi_sig_with_time_lock.ts
@@ -16,17 +16,16 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import {
+ artifacts,
MultiSigWalletWithTimeLockConfirmationEventArgs,
MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs,
MultiSigWalletWithTimeLockContract,
MultiSigWalletWithTimeLockExecutionEventArgs,
MultiSigWalletWithTimeLockExecutionFailureEventArgs,
MultiSigWalletWithTimeLockSubmissionEventArgs,
-} from '../generated-wrappers/multi_sig_wallet_with_time_lock';
-import { TestRejectEtherContract } from '../generated-wrappers/test_reject_ether';
-import { artifacts } from '../src/artifacts';
-
-import { MultiSigWrapper } from './utils/multi_sig_wrapper';
+ MultiSigWrapper,
+ TestRejectEtherContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts b/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts
index 924a215db..b6040d8e3 100644
--- a/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts
+++ b/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts
@@ -1,6 +1,6 @@
import { artifacts as proxyArtifacts } from '@0x/contracts-asset-proxy';
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
import { LogDecoder } from '@0x/contracts-test-utils';
-import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
@@ -16,7 +16,7 @@ export class AssetProxyOwnerWrapper {
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
this._assetProxyOwner = assetproxyOwnerContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts, ...proxyArtifacts });
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...erc20Artifacts, ...proxyArtifacts });
}
public async submitTransactionAsync(
destination: string,
diff --git a/contracts/multisig/test/utils/index.ts b/contracts/multisig/test/utils/index.ts
new file mode 100644
index 000000000..382fd92e5
--- /dev/null
+++ b/contracts/multisig/test/utils/index.ts
@@ -0,0 +1,2 @@
+export * from './asset_proxy_owner_wrapper';
+export * from './multi_sig_wrapper';
diff --git a/contracts/tokens/contracts/ZRXToken/ERC20Token_v1.sol b/contracts/tokens/contracts/ZRXToken/ERC20Token_v1.sol
deleted file mode 100644
index 4920c4aac..000000000
--- a/contracts/tokens/contracts/ZRXToken/ERC20Token_v1.sol
+++ /dev/null
@@ -1,44 +0,0 @@
-pragma solidity ^0.4.11;
-
-import { Token_v1 as Token } from "./Token_v1.sol";
-
-contract ERC20Token_v1 is Token {
-
- function transfer(address _to, uint _value) returns (bool) {
- //Default assumes totalSupply can't be over max (2^256 - 1).
- if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
- balances[msg.sender] -= _value;
- balances[_to] += _value;
- Transfer(msg.sender, _to, _value);
- return true;
- } else { return false; }
- }
-
- function transferFrom(address _from, address _to, uint _value) returns (bool) {
- if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
- balances[_to] += _value;
- balances[_from] -= _value;
- allowed[_from][msg.sender] -= _value;
- Transfer(_from, _to, _value);
- return true;
- } else { return false; }
- }
-
- function balanceOf(address _owner) constant returns (uint) {
- return balances[_owner];
- }
-
- function approve(address _spender, uint _value) returns (bool) {
- allowed[msg.sender][_spender] = _value;
- Approval(msg.sender, _spender, _value);
- return true;
- }
-
- function allowance(address _owner, address _spender) constant returns (uint) {
- return allowed[_owner][_spender];
- }
-
- mapping (address => uint) balances;
- mapping (address => mapping (address => uint)) allowed;
- uint public totalSupply;
-}
diff --git a/contracts/tokens/contracts/ZRXToken/Token_v1.sol b/contracts/tokens/contracts/ZRXToken/Token_v1.sol
deleted file mode 100644
index de619fb7e..000000000
--- a/contracts/tokens/contracts/ZRXToken/Token_v1.sol
+++ /dev/null
@@ -1,39 +0,0 @@
-pragma solidity ^0.4.11;
-
-contract Token_v1 {
-
- /// @return total amount of tokens
- function totalSupply() constant returns (uint supply) {}
-
- /// @param _owner The address from which the balance will be retrieved
- /// @return The balance
- function balanceOf(address _owner) constant returns (uint balance) {}
-
- /// @notice send `_value` token to `_to` from `msg.sender`
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transfer(address _to, uint _value) returns (bool success) {}
-
- /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return Whether the transfer was successful or not
- function transferFrom(address _from, address _to, uint _value) returns (bool success) {}
-
- /// @notice `msg.sender` approves `_addr` to spend `_value` tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @param _value The amount of wei to be approved for transfer
- /// @return Whether the approval was successful or not
- function approve(address _spender, uint _value) returns (bool success) {}
-
- /// @param _owner The address of the account owning tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender) constant returns (uint remaining) {}
-
- event Transfer(address indexed _from, address indexed _to, uint _value);
- event Approval(address indexed _owner, address indexed _spender, uint _value);
-}
-
diff --git a/contracts/tokens/contracts/ZRXToken/UnlimitedAllowanceToken_v1.sol b/contracts/tokens/contracts/ZRXToken/UnlimitedAllowanceToken_v1.sol
deleted file mode 100644
index bf1b0335a..000000000
--- a/contracts/tokens/contracts/ZRXToken/UnlimitedAllowanceToken_v1.sol
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity ^0.4.11;
-
-import { ERC20Token_v1 as ERC20Token } from "./ERC20Token_v1.sol";
-
-contract UnlimitedAllowanceToken_v1 is ERC20Token {
-
- uint constant MAX_UINT = 2**256 - 1;
-
- /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.
- /// @param _from Address to transfer from.
- /// @param _to Address to transfer to.
- /// @param _value Amount to transfer.
- /// @return Success of transfer.
- function transferFrom(address _from, address _to, uint _value)
- public
- returns (bool)
- {
- uint allowance = allowed[_from][msg.sender];
- if (balances[_from] >= _value
- && allowance >= _value
- && balances[_to] + _value >= balances[_to]
- ) {
- balances[_to] += _value;
- balances[_from] -= _value;
- if (allowance < MAX_UINT) {
- allowed[_from][msg.sender] -= _value;
- }
- Transfer(_from, _to, _value);
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/contracts/tokens/contracts/ZRXToken/ZRXToken.sol b/contracts/tokens/contracts/ZRXToken/ZRXToken.sol
deleted file mode 100644
index 831e1822c..000000000
--- a/contracts/tokens/contracts/ZRXToken/ZRXToken.sol
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-
- Copyright 2018 ZeroEx Intl.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-*/
-
-pragma solidity 0.4.11;
-
-// solhint-disable-next-line max-line-length
-import { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from "./UnlimitedAllowanceToken_v1.sol";
-
-
-contract ZRXToken is
- UnlimitedAllowanceToken
-{
-
- // solhint-disable const-name-snakecase
- uint8 constant public decimals = 18;
- uint256 public totalSupply = 10**27; // 1 billion tokens, 18 decimal places
- string constant public name = "0x Protocol Token";
- string constant public symbol = "ZRX";
- // solhint-enableconst-name-snakecase
-
- function ZRXToken()
- public
- {
- balances[msg.sender] = totalSupply;
- }
-}
diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts
index 6fb859c67..daad28729 100644
--- a/contracts/utils/test/lib_bytes.ts
+++ b/contracts/utils/test/lib_bytes.ts
@@ -16,8 +16,7 @@ import * as chai from 'chai';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import { TestLibBytesContract } from '../generated-wrappers/test_lib_bytes';
-import { artifacts } from '../src';
+import { artifacts, TestLibBytesContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/utils/test/libs.ts b/contracts/utils/test/libs.ts
index 81596b2e4..77dc6e2ba 100644
--- a/contracts/utils/test/libs.ts
+++ b/contracts/utils/test/libs.ts
@@ -2,8 +2,7 @@ import { chaiSetup, provider, txDefaults, web3Wrapper } from '@0x/contracts-test
import { BlockchainLifecycle } from '@0x/dev-utils';
import * as chai from 'chai';
-import { TestConstantsContract } from '../generated-wrappers/test_constants';
-import { artifacts } from '../src';
+import { artifacts, TestConstantsContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/package.json b/package.json
index b5b5bed97..2e201f467 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,7 @@
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing"
},
"config": {
- "contractsPackages": "@0x/contracts-asset-proxy @0x/contracts-exchange @0x/contracts-exchange-libs @0x/contracts-extensions @0x/contracts-multisig @0x/contracts-test-utils @0x/contracts-tokens @0x/contracts-utils",
+ "contractsPackages": "@0x/contracts-asset-proxy @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-exchange @0x/contracts-exchange-libs @0x/contracts-extensions @0x/contracts-multisig @0x/contracts-test-utils @0x/contracts-utils",
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
"packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-coverage sol-profiler sol-trace ethereum-types asset-buyer migrations"
},