aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-12-11 01:09:59 +0800
committerGitHub <noreply@github.com>2018-12-11 01:09:59 +0800
commita39e0f13be4d47ee79dd971d49835f6929fa71e7 (patch)
tree9bc2a11f27514c8ca46e24ac268899e95ebf6b49
parent190d9244cc5544662effae508f94025a6f5de286 (diff)
parenta365ab11d24ff8365b7d69a948b1b5211b772f5e (diff)
downloaddexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar.gz
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar.bz2
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar.lz
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar.xz
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.tar.zst
dexon-sol-tools-a39e0f13be4d47ee79dd971d49835f6929fa71e7.zip
Merge pull request #1388 from 0xProject/feature/contracts-monorepo-6
Contracts monorepo 6
-rw-r--r--.circleci/config.yml2
-rw-r--r--.gitignore2
-rw-r--r--.prettierignore2
-rw-r--r--contracts/core/CHANGELOG.json14
-rw-r--r--contracts/core/README.md4
-rw-r--r--contracts/core/compiler.json13
-rw-r--r--contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol2
-rw-r--r--contracts/core/contracts/extensions/Forwarder/MixinAssets.sol4
-rw-r--r--contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol4
-rw-r--r--contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol4
-rw-r--r--contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol2
-rw-r--r--contracts/core/package.json3
-rw-r--r--contracts/core/src/artifacts/index.ts24
-rw-r--r--contracts/core/src/index.ts2
-rw-r--r--contracts/core/src/wrappers/index.ts11
-rw-r--r--contracts/core/test/asset_proxy/proxies.ts21
-rw-r--r--contracts/core/test/exchange/core.ts16
-rw-r--r--contracts/core/test/exchange/dispatcher.ts2
-rw-r--r--contracts/core/test/exchange/match_orders.ts11
-rw-r--r--contracts/core/test/exchange/signature_validator.ts13
-rw-r--r--contracts/core/test/exchange/transactions.ts2
-rw-r--r--contracts/core/test/exchange/wrapper.ts11
-rw-r--r--contracts/core/test/extensions/dutch_auction.ts11
-rw-r--r--contracts/core/test/extensions/forwarder.ts11
-rw-r--r--contracts/core/test/extensions/order_validator.ts3
-rw-r--r--contracts/core/test/utils/asset_proxy_owner_wrapper.ts3
-rw-r--r--contracts/core/test/utils/erc20_wrapper.ts4
-rw-r--r--contracts/core/test/utils/erc721_wrapper.ts4
-rw-r--r--contracts/core/test/utils/exchange_wrapper.ts3
-rw-r--r--contracts/core/test/utils/forwarder_wrapper.ts3
-rw-r--r--contracts/core/test/utils/order_factory_from_scenario.ts3
-rw-r--r--contracts/core/tsconfig.json13
-rw-r--r--contracts/tokens/.solhint.json20
-rw-r--r--contracts/tokens/.solhintignore (renamed from contracts/core/.solhintignore)0
-rw-r--r--contracts/tokens/CHANGELOG.json16
-rw-r--r--contracts/tokens/README.md74
-rw-r--r--contracts/tokens/compiler.json44
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol (renamed from contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol (renamed from contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol (renamed from contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol (renamed from contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol (renamed from contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol (renamed from contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol (renamed from contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol (renamed from contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol (renamed from contracts/core/contracts/tokens/EtherToken/IEtherToken.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/WETH9.sol (renamed from contracts/core/contracts/tokens/EtherToken/WETH9.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol (renamed from contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol (renamed from contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol)0
-rw-r--r--contracts/tokens/package.json94
-rw-r--r--contracts/tokens/src/artifacts/index.ts49
-rw-r--r--contracts/tokens/src/index.ts2
-rw-r--r--contracts/tokens/src/wrappers/index.ts21
-rw-r--r--contracts/tokens/test/erc721_token.ts (renamed from contracts/core/test/tokens/erc721_token.ts)8
-rw-r--r--contracts/tokens/test/global_hooks.ts17
-rw-r--r--contracts/tokens/test/unlimited_allowance_token.ts (renamed from contracts/core/test/tokens/unlimited_allowance_token.ts)3
-rw-r--r--contracts/tokens/test/weth9.ts (renamed from contracts/core/test/tokens/weth9.ts)3
-rw-r--r--contracts/tokens/test/zrx_token.ts (renamed from contracts/core/test/tokens/zrx_token.ts)3
-rw-r--r--contracts/tokens/tsconfig.json33
-rw-r--r--contracts/tokens/tslint.json6
69 files changed, 473 insertions, 147 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d11c7fcae..6bb8d903d 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -43,6 +43,7 @@ jobs:
- 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-core
test-contracts-geth:
docker:
@@ -58,6 +59,7 @@ jobs:
- 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-libs
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-core
test-publish:
resource_class: medium+
diff --git a/.gitignore b/.gitignore
index 355259b3b..207739cda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,6 +88,7 @@ contracts/multisig/generated-artifacts/
contracts/utils/generated-artifacts/
contracts/libs/generated-artifacts/
contracts/interfaces/generated-artifacts/
+contracts/tokens/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
@@ -98,6 +99,7 @@ contracts/multisig/generated-wrappers/
contracts/utils/generated-wrappers/
contracts/libs/generated-wrappers/
contracts/interfaces/generated-wrappers/
+contracts/tokens/generated-wrappers/
packages/metacoin/src/contract_wrappers
# solc-bin in sol-compiler
diff --git a/.prettierignore b/.prettierignore
index 0be17624b..4da37ae6e 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -10,6 +10,8 @@ lib
/contracts/libs/generated-artifacts
/contracts/interfaces/generated-wrappers
/contracts/interfaces/generated-artifacts
+/contracts/tokens/generated-wrappers
+/contracts/tokens/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
diff --git a/contracts/core/CHANGELOG.json b/contracts/core/CHANGELOG.json
index 7dfa06990..371f18cd4 100644
--- a/contracts/core/CHANGELOG.json
+++ b/contracts/core/CHANGELOG.json
@@ -117,19 +117,5 @@
}
}
]
- },
- {
- "name": "ZRXToken",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v1 deploy",
- "networks": {
- "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
- "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
- "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
- }
- }
- ]
}
]
diff --git a/contracts/core/README.md b/contracts/core/README.md
index 0004925c1..8371d8041 100644
--- a/contracts/core/README.md
+++ b/contracts/core/README.md
@@ -12,10 +12,6 @@ Contracts that make up and interact with version 2.0.0 of the protocol can be fo
* This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
* [examples](./contracts/examples)
* This directory contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
-* [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).
-* [utils](./contracts/utils)
- * This directory contains libraries and utils that are shared across all of the other directories.
* [test](./contracts/test)
* This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
diff --git a/contracts/core/compiler.json b/contracts/core/compiler.json
index 239c25919..606208e49 100644
--- a/contracts/core/compiler.json
+++ b/contracts/core/compiler.json
@@ -20,24 +20,15 @@
},
"contracts": [
"AssetProxyOwner",
- "DummyERC20Token",
- "DummyERC721Receiver",
- "DummyERC721Token",
- "DummyMultipleReturnERC20Token",
- "DummyNoReturnERC20Token",
"DutchAuction",
"ERC20Proxy",
- "ERC20Token",
- "ERC721Token",
"ERC721Proxy",
"Exchange",
"ExchangeWrapper",
"Forwarder",
- "InvalidERC721Receiver",
"MixinAuthorizable",
"MultiAssetProxy",
"OrderValidator",
- "ReentrantERC20Token",
"TestAssetProxyOwner",
"TestAssetProxyDispatcher",
"TestExchangeInternals",
@@ -45,8 +36,6 @@
"TestStaticCallReceiver",
"Validator",
"Wallet",
- "WETH9",
- "Whitelist",
- "ZRXToken"
+ "Whitelist"
]
}
diff --git a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol b/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
index 90b6f4648..9c9f3990a 100644
--- a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
+++ b/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol b/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol
index 5f5f3456d..3ebf75161 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol
+++ b/contracts/core/contracts/extensions/Forwarder/MixinAssets.sol
@@ -20,8 +20,8 @@ pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
import "./libs/LibConstants.sol";
import "./mixins/MAssets.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol b/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol
index 00be0f1bd..4a81abf76 100644
--- a/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol
+++ b/contracts/core/contracts/extensions/Forwarder/libs/LibConstants.sol
@@ -20,8 +20,8 @@ pragma solidity 0.4.24;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "../../../tokens/EtherToken/IEtherToken.sol";
-import "../../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
contract LibConstants {
diff --git a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol b/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
index 78c31c8fc..33dd1326c 100644
--- a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
+++ b/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
@@ -21,8 +21,8 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
diff --git a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
index 41aab01c8..d08da7303 100644
--- a/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
+++ b/contracts/core/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/core/package.json b/contracts/core/package.json
index be2214177..fd844ae16 100644
--- a/contracts/core/package.json
+++ b/contracts/core/package.json
@@ -33,7 +33,7 @@
"lint-contracts": "solhint contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DutchAuction|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|InvalidERC721Receiver|MixinAuthorizable|MultiAssetProxy|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json"
+ "abis": "generated-artifacts/@(AssetProxyOwner|DutchAuction|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|MixinAuthorizable|MultiAssetProxy|OrderValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist).json"
},
"repository": {
"type": "git",
@@ -76,6 +76,7 @@
"@0x/order-utils": "^3.0.4",
"@0x/contracts-multisig": "^1.0.0",
"@0x/contracts-utils": "^1.0.0",
+ "@0x/contracts-tokens": "^1.0.0",
"@0x/contracts-libs": "^1.0.0",
"@0x/contracts-interfaces": "^1.0.0",
"@0x/types": "^1.3.0",
diff --git a/contracts/core/src/artifacts/index.ts b/contracts/core/src/artifacts/index.ts
index 1d868bae2..ac334c173 100644
--- a/contracts/core/src/artifacts/index.ts
+++ b/contracts/core/src/artifacts/index.ts
@@ -1,24 +1,15 @@
import { ContractArtifact } from 'ethereum-types';
import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
-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 DutchAuction from '../../generated-artifacts/DutchAuction.json';
import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
-import * as ERC20Token from '../../generated-artifacts/ERC20Token.json';
import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
-import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
import * as Exchange from '../../generated-artifacts/Exchange.json';
import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
import * as Forwarder from '../../generated-artifacts/Forwarder.json';
-import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
-import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
@@ -26,40 +17,25 @@ import * as TestSignatureValidator from '../../generated-artifacts/TestSignature
import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
import * as Validator from '../../generated-artifacts/Validator.json';
import * as Wallet from '../../generated-artifacts/Wallet.json';
-import * as WETH9 from '../../generated-artifacts/WETH9.json';
import * as Whitelist from '../../generated-artifacts/Whitelist.json';
-import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
export const artifacts = {
AssetProxyOwner: AssetProxyOwner as ContractArtifact,
- DummyERC20Token: DummyERC20Token as ContractArtifact,
- DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
- DummyERC721Token: DummyERC721Token as ContractArtifact,
- DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
- DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
DutchAuction: DutchAuction as ContractArtifact,
ERC20Proxy: ERC20Proxy as ContractArtifact,
- ERC20Token: ERC20Token as ContractArtifact,
ERC721Proxy: ERC721Proxy as ContractArtifact,
- ERC721Token: ERC721Token as ContractArtifact,
Exchange: Exchange as ContractArtifact,
ExchangeWrapper: ExchangeWrapper as ContractArtifact,
Forwarder: Forwarder as ContractArtifact,
- InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
MixinAuthorizable: MixinAuthorizable as ContractArtifact,
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
OrderValidator: OrderValidator as ContractArtifact,
- ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
Validator: Validator as ContractArtifact,
- WETH9: WETH9 as ContractArtifact,
Wallet: Wallet as ContractArtifact,
Whitelist: Whitelist 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/core/src/index.ts b/contracts/core/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/core/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/core/src/wrappers/index.ts b/contracts/core/src/wrappers/index.ts
index 92e2f6b9f..ff26a171e 100644
--- a/contracts/core/src/wrappers/index.ts
+++ b/contracts/core/src/wrappers/index.ts
@@ -1,21 +1,12 @@
export * from '../../generated-wrappers/asset_proxy_owner';
-export * from '../../generated-wrappers/dummy_erc20_token';
-export * from '../../generated-wrappers/dummy_erc721_receiver';
-export * from '../../generated-wrappers/dummy_erc721_token';
-export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
-export * from '../../generated-wrappers/dummy_no_return_erc20_token';
export * from '../../generated-wrappers/dutch_auction';
export * from '../../generated-wrappers/erc20_proxy';
export * from '../../generated-wrappers/erc721_proxy';
-export * from '../../generated-wrappers/erc20_token';
-export * from '../../generated-wrappers/erc721_token';
export * from '../../generated-wrappers/exchange';
export * from '../../generated-wrappers/exchange_wrapper';
export * from '../../generated-wrappers/forwarder';
-export * from '../../generated-wrappers/invalid_erc721_receiver';
export * from '../../generated-wrappers/mixin_authorizable';
export * from '../../generated-wrappers/order_validator';
-export * from '../../generated-wrappers/reentrant_erc20_token';
export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
export * from '../../generated-wrappers/test_asset_proxy_owner';
export * from '../../generated-wrappers/test_exchange_internals';
@@ -23,6 +14,4 @@ export * from '../../generated-wrappers/test_signature_validator';
export * from '../../generated-wrappers/test_static_call_receiver';
export * from '../../generated-wrappers/validator';
export * from '../../generated-wrappers/wallet';
-export * from '../../generated-wrappers/weth9';
export * from '../../generated-wrappers/whitelist';
-export * from '../../generated-wrappers/zrx_token';
diff --git a/contracts/core/test/asset_proxy/proxies.ts b/contracts/core/test/asset_proxy/proxies.ts
index faa643924..c4bd95905 100644
--- a/contracts/core/test/asset_proxy/proxies.ts
+++ b/contracts/core/test/asset_proxy/proxies.ts
@@ -9,6 +9,14 @@ import {
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ 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';
@@ -16,11 +24,6 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721ReceiverContract } from '../../generated-wrappers/dummy_erc721_receiver';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { DummyMultipleReturnERC20TokenContract } from '../../generated-wrappers/dummy_multiple_return_erc20_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
@@ -143,7 +146,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_DECIMALS,
);
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
+ tokensArtifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -152,7 +155,7 @@ describe('Asset Transfer Proxies', () => {
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
);
multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyMultipleReturnERC20Token,
+ tokensArtifacts.DummyMultipleReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
@@ -193,7 +196,7 @@ describe('Asset Transfer Proxies', () => {
// Deploy and configure ERC721 tokens and receiver
[erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Receiver,
+ tokensArtifacts.DummyERC721Receiver,
provider,
txDefaults,
);
@@ -557,7 +560,7 @@ describe('Asset Transfer Proxies', () => {
erc721Receiver.address,
amount,
);
- const logDecoder = new LogDecoder(web3Wrapper, artifacts);
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
const tx = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
to: erc721Proxy.address,
diff --git a/contracts/core/test/exchange/core.ts b/contracts/core/test/exchange/core.ts
index 45eae0f22..9b948f991 100644
--- a/contracts/core/test/exchange/core.ts
+++ b/contracts/core/test/exchange/core.ts
@@ -12,6 +12,14 @@ 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';
@@ -22,14 +30,10 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-import { DummyERC20TokenContract, DummyERC20TokenTransferEventArgs } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { DummyNoReturnERC20TokenContract } from '../../generated-wrappers/dummy_no_return_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated-wrappers/exchange';
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
@@ -116,7 +120,7 @@ describe('Exchange core', () => {
txDefaults,
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
@@ -341,7 +345,7 @@ describe('Exchange core', () => {
describe('Testing exchange of ERC20 tokens with no return values', () => {
before(async () => {
noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
+ tokensArtifacts.DummyNoReturnERC20Token,
provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/exchange/dispatcher.ts b/contracts/core/test/exchange/dispatcher.ts
index 9bc5cbcce..5b1ac1e20 100644
--- a/contracts/core/test/exchange/dispatcher.ts
+++ b/contracts/core/test/exchange/dispatcher.ts
@@ -7,6 +7,7 @@ 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';
@@ -15,7 +16,6 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import {
diff --git a/contracts/core/test/exchange/match_orders.ts b/contracts/core/test/exchange/match_orders.ts
index 0e841b359..8e943c237 100644
--- a/contracts/core/test/exchange/match_orders.ts
+++ b/contracts/core/test/exchange/match_orders.ts
@@ -9,6 +9,12 @@ 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';
@@ -17,12 +23,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
@@ -139,7 +142,7 @@ describe('matchOrders', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/core/test/exchange/signature_validator.ts b/contracts/core/test/exchange/signature_validator.ts
index b84a488a1..ae372d677 100644
--- a/contracts/core/test/exchange/signature_validator.ts
+++ b/contracts/core/test/exchange/signature_validator.ts
@@ -9,6 +9,7 @@ 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';
@@ -17,13 +18,13 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import {
+ artifacts,
TestSignatureValidatorContract,
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
-} from '../../generated-wrappers/test_signature_validator';
-import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
-import { ValidatorContract } from '../../generated-wrappers/validator';
-import { WalletContract } from '../../generated-wrappers/wallet';
-import { artifacts } from '../../src/artifacts';
+ TestStaticCallReceiverContract,
+ ValidatorContract,
+ WalletContract,
+} from '../../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -77,7 +78,7 @@ describe('MixinSignatureValidator', () => {
provider,
txDefaults,
);
- signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, artifacts);
+ signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
await web3Wrapper.awaitTransactionSuccessAsync(
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
from: signerAddress,
diff --git a/contracts/core/test/exchange/transactions.ts b/contracts/core/test/exchange/transactions.ts
index c4086d9be..ad0ca41c2 100644
--- a/contracts/core/test/exchange/transactions.ts
+++ b/contracts/core/test/exchange/transactions.ts
@@ -11,6 +11,7 @@ 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';
@@ -18,7 +19,6 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper';
diff --git a/contracts/core/test/exchange/wrapper.ts b/contracts/core/test/exchange/wrapper.ts
index 17cb7a3bb..c9efb0c9d 100644
--- a/contracts/core/test/exchange/wrapper.ts
+++ b/contracts/core/test/exchange/wrapper.ts
@@ -11,6 +11,12 @@ 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';
@@ -19,12 +25,9 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
import { ERC721Wrapper } from '../utils/erc721_wrapper';
@@ -113,7 +116,7 @@ describe('Exchange wrappers', () => {
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
+ tokensArtifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/core/test/extensions/dutch_auction.ts b/contracts/core/test/extensions/dutch_auction.ts
index 54e6092d7..b396d4206 100644
--- a/contracts/core/test/extensions/dutch_auction.ts
+++ b/contracts/core/test/extensions/dutch_auction.ts
@@ -10,6 +10,12 @@ 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';
@@ -20,11 +26,8 @@ import ethAbi = require('ethereumjs-abi');
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
import { ERC721Wrapper } from '../utils/erc721_wrapper';
@@ -98,7 +101,7 @@ describe(ContractName.DutchAuction, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults);
erc20Wrapper.addDummyTokenContract(wethContract as any);
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
diff --git a/contracts/core/test/extensions/forwarder.ts b/contracts/core/test/extensions/forwarder.ts
index 44ad4d6ff..ffa015dd2 100644
--- a/contracts/core/test/extensions/forwarder.ts
+++ b/contracts/core/test/extensions/forwarder.ts
@@ -11,6 +11,12 @@ 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';
@@ -19,11 +25,8 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ExchangeContract } from '../../generated-wrappers/exchange';
import { ForwarderContract } from '../../generated-wrappers/forwarder';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
import { artifacts } from '../../src/artifacts';
import { ERC20Wrapper } from '../utils/erc20_wrapper';
import { ERC721Wrapper } from '../utils/erc721_wrapper';
@@ -94,7 +97,7 @@ describe(ContractName.Forwarder, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults);
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
erc20Wrapper.addDummyTokenContract(weth);
diff --git a/contracts/core/test/extensions/order_validator.ts b/contracts/core/test/extensions/order_validator.ts
index 3dbe76f6e..622710c98 100644
--- a/contracts/core/test/extensions/order_validator.ts
+++ b/contracts/core/test/extensions/order_validator.ts
@@ -7,6 +7,7 @@ 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';
@@ -14,8 +15,6 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { ExchangeContract } from '../../generated-wrappers/exchange';
diff --git a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts b/contracts/core/test/utils/asset_proxy_owner_wrapper.ts
index d5aaaf519..df23658d8 100644
--- a/contracts/core/test/utils/asset_proxy_owner_wrapper.ts
+++ b/contracts/core/test/utils/asset_proxy_owner_wrapper.ts
@@ -1,4 +1,5 @@
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';
@@ -14,7 +15,7 @@ export class AssetProxyOwnerWrapper {
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
this._assetProxyOwner = assetproxyOwnerContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
}
public async submitTransactionAsync(
destination: string,
diff --git a/contracts/core/test/utils/erc20_wrapper.ts b/contracts/core/test/utils/erc20_wrapper.ts
index d6210646c..e5ab0e36c 100644
--- a/contracts/core/test/utils/erc20_wrapper.ts
+++ b/contracts/core/test/utils/erc20_wrapper.ts
@@ -1,11 +1,11 @@
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';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
import { artifacts } from '../../src/artifacts';
@@ -38,7 +38,7 @@ export class ERC20Wrapper {
for (let i = 0; i < numberToDeploy; i++) {
this._dummyTokenContracts.push(
await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
+ tokensArtifacts.DummyERC20Token,
this._provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/utils/erc721_wrapper.ts b/contracts/core/test/utils/erc721_wrapper.ts
index b5ae34e60..1f658ce86 100644
--- a/contracts/core/test/utils/erc721_wrapper.ts
+++ b/contracts/core/test/utils/erc721_wrapper.ts
@@ -1,11 +1,11 @@
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';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
import { artifacts } from '../../src/artifacts';
@@ -30,7 +30,7 @@ export class ERC721Wrapper {
for (const i of _.times(constants.NUM_DUMMY_ERC721_TO_DEPLOY)) {
this._dummyTokenContracts.push(
await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
+ tokensArtifacts.DummyERC721Token,
this._provider,
txDefaults,
constants.DUMMY_TOKEN_NAME,
diff --git a/contracts/core/test/utils/exchange_wrapper.ts b/contracts/core/test/utils/exchange_wrapper.ts
index 2a24b880f..075d2cb96 100644
--- a/contracts/core/test/utils/exchange_wrapper.ts
+++ b/contracts/core/test/utils/exchange_wrapper.ts
@@ -6,6 +6,7 @@ import {
orderUtils,
SignedTransaction,
} 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';
@@ -21,7 +22,7 @@ export class ExchangeWrapper {
constructor(exchangeContract: ExchangeContract, provider: Provider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
}
public async fillOrderAsync(
signedOrder: SignedOrder,
diff --git a/contracts/core/test/utils/forwarder_wrapper.ts b/contracts/core/test/utils/forwarder_wrapper.ts
index 9c5560381..4c78ecd79 100644
--- a/contracts/core/test/utils/forwarder_wrapper.ts
+++ b/contracts/core/test/utils/forwarder_wrapper.ts
@@ -1,4 +1,5 @@
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';
@@ -58,7 +59,7 @@ export class ForwarderWrapper {
constructor(contractInstance: ForwarderContract, provider: Provider) {
this._forwarderContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
}
public async marketSellOrdersWithEthAsync(
orders: SignedOrder[],
diff --git a/contracts/core/test/utils/order_factory_from_scenario.ts b/contracts/core/test/utils/order_factory_from_scenario.ts
index 1cc962020..ecb4b2e28 100644
--- a/contracts/core/test/utils/order_factory_from_scenario.ts
+++ b/contracts/core/test/utils/order_factory_from_scenario.ts
@@ -8,12 +8,11 @@ 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';
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-
const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
const POINT_ONE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(100_000_000_000_000_000);
diff --git a/contracts/core/tsconfig.json b/contracts/core/tsconfig.json
index ca3e6c15f..ea493cbb8 100644
--- a/contracts/core/tsconfig.json
+++ b/contracts/core/tsconfig.json
@@ -8,34 +8,23 @@
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"./generated-artifacts/AssetProxyOwner.json",
- "./generated-artifacts/DummyERC20Token.json",
- "./generated-artifacts/DummyERC721Receiver.json",
- "./generated-artifacts/DummyERC721Token.json",
- "./generated-artifacts/DummyMultipleReturnERC20Token.json",
- "./generated-artifacts/DummyNoReturnERC20Token.json",
"./generated-artifacts/DutchAuction.json",
"./generated-artifacts/ERC20Proxy.json",
- "./generated-artifacts/ERC20Token.json",
"./generated-artifacts/ERC721Proxy.json",
- "./generated-artifacts/ERC721Token.json",
"./generated-artifacts/Exchange.json",
"./generated-artifacts/ExchangeWrapper.json",
"./generated-artifacts/Forwarder.json",
"./generated-artifacts/MixinAuthorizable.json",
"./generated-artifacts/MultiAssetProxy.json",
"./generated-artifacts/OrderValidator.json",
- "./generated-artifacts/ReentrantERC20Token.json",
"./generated-artifacts/TestAssetProxyDispatcher.json",
"./generated-artifacts/TestAssetProxyOwner.json",
"./generated-artifacts/TestExchangeInternals.json",
"./generated-artifacts/TestSignatureValidator.json",
"./generated-artifacts/TestStaticCallReceiver.json",
"./generated-artifacts/Validator.json",
- "./generated-artifacts/WETH9.json",
"./generated-artifacts/Wallet.json",
- "./generated-artifacts/Whitelist.json",
- "./generated-artifacts/InvalidERC721Receiver.json",
- "./generated-artifacts/ZRXToken.json"
+ "./generated-artifacts/Whitelist.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}
diff --git a/contracts/tokens/.solhint.json b/contracts/tokens/.solhint.json
new file mode 100644
index 000000000..076afe9f3
--- /dev/null
+++ b/contracts/tokens/.solhint.json
@@ -0,0 +1,20 @@
+{
+ "extends": "default",
+ "rules": {
+ "avoid-low-level-calls": false,
+ "avoid-tx-origin": "warn",
+ "bracket-align": false,
+ "code-complexity": false,
+ "const-name-snakecase": "error",
+ "expression-indent": "error",
+ "function-max-lines": false,
+ "func-order": "error",
+ "indent": ["error", 4],
+ "max-line-length": ["warn", 160],
+ "no-inline-assembly": false,
+ "quotes": ["error", "double"],
+ "separate-by-one-line-in-contract": "error",
+ "space-after-comma": "error",
+ "statement-indent": "error"
+ }
+}
diff --git a/contracts/core/.solhintignore b/contracts/tokens/.solhintignore
index 1e33ec53b..1e33ec53b 100644
--- a/contracts/core/.solhintignore
+++ b/contracts/tokens/.solhintignore
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json
new file mode 100644
index 000000000..5ff58c035
--- /dev/null
+++ b/contracts/tokens/CHANGELOG.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/tokens/README.md b/contracts/tokens/README.md
new file mode 100644
index 000000000..9c4106d41
--- /dev/null
+++ b/contracts/tokens/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/tokens/compiler.json b/contracts/tokens/compiler.json
new file mode 100644
index 000000000..498c5d826
--- /dev/null
+++ b/contracts/tokens/compiler.json
@@ -0,0 +1,44 @@
+{
+ "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": [
+ "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/core/contracts/test/DummyERC20Token/DummyERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
index 33028db0c..33028db0c 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
index 733d4437e..733d4437e 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
index e16825a16..e16825a16 100644
--- a/contracts/core/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
diff --git a/contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
index 6c8371559..6c8371559 100644
--- a/contracts/core/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
diff --git a/contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
index 309633bf5..309633bf5 100644
--- a/contracts/core/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
diff --git a/contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
index 4c978b2df..4c978b2df 100644
--- a/contracts/core/contracts/test/DummyERC721Token/DummyERC721Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
diff --git a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
index d8c65929d..d8c65929d 100644
--- a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
index 725d304df..725d304df 100644
--- a/contracts/core/contracts/tokens/ERC20Token/ERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
index 258d47393..258d47393 100644
--- a/contracts/core/contracts/tokens/ERC20Token/IERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
index 58bccb5a1..58bccb5a1 100644
--- a/contracts/core/contracts/tokens/ERC20Token/MintableERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
index 2e5bd4348..2e5bd4348 100644
--- a/contracts/core/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
index 600cee1ab..600cee1ab 100644
--- a/contracts/core/contracts/tokens/ERC721Token/ERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
index 8e0e32ab2..8e0e32ab2 100644
--- a/contracts/core/contracts/tokens/ERC721Token/IERC721Receiver.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
index ac992c80d..ac992c80d 100644
--- a/contracts/core/contracts/tokens/ERC721Token/IERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
diff --git a/contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
index bc5cd2cc2..bc5cd2cc2 100644
--- a/contracts/core/contracts/tokens/ERC721Token/MintableERC721Token.sol
+++ b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
diff --git a/contracts/core/contracts/tokens/EtherToken/IEtherToken.sol b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
index 9e2e68766..9e2e68766 100644
--- a/contracts/core/contracts/tokens/EtherToken/IEtherToken.sol
+++ b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
diff --git a/contracts/core/contracts/tokens/EtherToken/WETH9.sol b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
index 17876b86d..17876b86d 100644
--- a/contracts/core/contracts/tokens/EtherToken/WETH9.sol
+++ b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
index 4920c4aac..4920c4aac 100644
--- a/contracts/core/contracts/tokens/ZRXToken/ERC20Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
index de619fb7e..de619fb7e 100644
--- a/contracts/core/contracts/tokens/ZRXToken/Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
index bf1b0335a..bf1b0335a 100644
--- a/contracts/core/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
diff --git a/contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
index 831e1822c..831e1822c 100644
--- a/contracts/core/contracts/tokens/ZRXToken/ZRXToken.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
diff --git a/contracts/tokens/package.json b/contracts/tokens/package.json
new file mode 100644
index 000000000..0666ea89a
--- /dev/null
+++ b/contracts/tokens/package.json
@@ -0,0 +1,94 @@
+{
+ "private": true,
+ "name": "@0x/contracts-tokens",
+ "version": "1.0.0",
+ "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 --contracts-dir contracts",
+ "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 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"
+ },
+ "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/contracts-test-utils": "^1.0.0",
+ "@0x/abi-gen": "^1.0.17",
+ "@0x/dev-utils": "^1.0.19",
+ "@0x/sol-compiler": "^1.1.14",
+ "@0x/sol-cov": "^2.1.14",
+ "@0x/subproviders": "^2.1.6",
+ "@0x/tslint-config": "^1.0.10",
+ "@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": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "make-promises-safe": "^1.1.0",
+ "ethereumjs-abi": "0.6.5",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.2.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.8",
+ "@0x/order-utils": "^3.0.4",
+ "@0x/contracts-multisig": "^1.0.0",
+ "@0x/contracts-utils": "^1.0.0",
+ "@0x/contracts-libs": "^1.0.0",
+ "@0x/contracts-interfaces": "^1.0.0",
+ "@0x/types": "^1.3.0",
+ "@0x/typescript-typings": "^3.0.4",
+ "@0x/utils": "^2.0.6",
+ "@0x/web3-wrapper": "^3.1.6",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.2",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/tokens/src/artifacts/index.ts b/contracts/tokens/src/artifacts/index.ts
new file mode 100644
index 000000000..63b808748
--- /dev/null
+++ b/contracts/tokens/src/artifacts/index.ts
@@ -0,0 +1,49 @@
+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';
+
+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/tokens/src/index.ts
new file mode 100644
index 000000000..91dd7e0e3
--- /dev/null
+++ b/contracts/tokens/src/index.ts
@@ -0,0 +1,2 @@
+export * from './wrappers';
+export * from './artifacts';
diff --git a/contracts/tokens/src/wrappers/index.ts b/contracts/tokens/src/wrappers/index.ts
new file mode 100644
index 000000000..98bf26657
--- /dev/null
+++ b/contracts/tokens/src/wrappers/index.ts
@@ -0,0 +1,21 @@
+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/core/test/tokens/erc721_token.ts b/contracts/tokens/test/erc721_token.ts
index 3b0a5f001..13332cd35 100644
--- a/contracts/core/test/tokens/erc721_token.ts
+++ b/contracts/tokens/test/erc721_token.ts
@@ -15,15 +15,13 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import {
+ artifacts,
DummyERC721ReceiverContract,
DummyERC721ReceiverTokenReceivedEventArgs,
-} from '../../generated-wrappers/dummy_erc721_receiver';
-import {
DummyERC721TokenContract,
DummyERC721TokenTransferEventArgs,
-} from '../../generated-wrappers/dummy_erc721_token';
-import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
-import { artifacts } from '../../src/artifacts';
+ InvalidERC721ReceiverContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/tokens/test/global_hooks.ts b/contracts/tokens/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/tokens/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/core/test/tokens/unlimited_allowance_token.ts b/contracts/tokens/test/unlimited_allowance_token.ts
index c3e4072c5..6d5a29b23 100644
--- a/contracts/core/test/tokens/unlimited_allowance_token.ts
+++ b/contracts/tokens/test/unlimited_allowance_token.ts
@@ -11,8 +11,7 @@ import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, DummyERC20TokenContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/core/test/tokens/weth9.ts b/contracts/tokens/test/weth9.ts
index 225481904..6a3948e2c 100644
--- a/contracts/core/test/tokens/weth9.ts
+++ b/contracts/tokens/test/weth9.ts
@@ -12,8 +12,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { WETH9Contract } from '../../generated-wrappers/weth9';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, WETH9Contract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/core/test/tokens/zrx_token.ts b/contracts/tokens/test/zrx_token.ts
index 6bc5e164c..5dc8447f6 100644
--- a/contracts/core/test/tokens/zrx_token.ts
+++ b/contracts/tokens/test/zrx_token.ts
@@ -4,8 +4,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
-import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
-import { artifacts } from '../../src/artifacts';
+import { artifacts, ZRXTokenContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/tokens/tsconfig.json b/contracts/tokens/tsconfig.json
new file mode 100644
index 000000000..0d5f98cb8
--- /dev/null
+++ b/contracts/tokens/tsconfig.json
@@ -0,0 +1,33 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./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/tokens/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/tokens/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}