aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-29 00:26:13 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2019-01-29 00:26:13 +0800
commit141ac0ca0be15602a1bcf466e873134e084f30c1 (patch)
treef0e08db40c46e8c671a99231b645365747a8073f /contracts
parent0c12128f64f7d9a8de6088e98c2e638533d6f5bf (diff)
parent25e42c0ad47e9ec06e474cd12a488ae837660302 (diff)
downloaddexon-0x-contracts-141ac0ca0be15602a1bcf466e873134e084f30c1.tar.gz
dexon-0x-contracts-141ac0ca0be15602a1bcf466e873134e084f30c1.tar.zst
dexon-0x-contracts-141ac0ca0be15602a1bcf466e873134e084f30c1.zip
Merge development
Diffstat (limited to 'contracts')
-rw-r--r--contracts/asset-proxy/CHANGELOG.json11
-rw-r--r--contracts/asset-proxy/CHANGELOG.md (renamed from contracts/protocol/CHANGELOG.md)0
-rw-r--r--contracts/asset-proxy/DEPLOYS.json47
-rw-r--r--contracts/asset-proxy/README.md (renamed from contracts/protocol/README.md)19
-rw-r--r--contracts/asset-proxy/compiler.json (renamed from contracts/protocol/compiler.json)12
-rw-r--r--contracts/asset-proxy/contracts/src/ERC20Proxy.sol (renamed from contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol)0
-rw-r--r--contracts/asset-proxy/contracts/src/ERC721Proxy.sol (renamed from contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol)0
-rw-r--r--contracts/asset-proxy/contracts/src/MixinAssetProxyDispatcher.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol)4
-rw-r--r--contracts/asset-proxy/contracts/src/MixinAuthorizable.sol (renamed from contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol)2
-rw-r--r--contracts/asset-proxy/contracts/src/MultiAssetProxy.sol (renamed from contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol)2
-rw-r--r--contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol (renamed from contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol)0
-rw-r--r--contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol (renamed from contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol)0
-rw-r--r--contracts/asset-proxy/contracts/src/interfaces/IAssetProxyDispatcher.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol)0
-rw-r--r--contracts/asset-proxy/contracts/src/interfaces/IAuthorizable.sol (renamed from contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol)2
-rw-r--r--contracts/asset-proxy/contracts/src/mixins/MAssetProxyDispatcher.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol)2
-rw-r--r--contracts/asset-proxy/contracts/src/mixins/MAuthorizable.sol (renamed from contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol)2
-rw-r--r--contracts/asset-proxy/package.json82
-rw-r--r--contracts/asset-proxy/src/artifacts/index.ts19
-rw-r--r--contracts/asset-proxy/src/index.ts (renamed from contracts/protocol/src/index.ts)0
-rw-r--r--contracts/asset-proxy/src/wrappers/index.ts7
-rw-r--r--contracts/asset-proxy/test/authorizable.ts (renamed from contracts/protocol/test/asset_proxy/authorizable.ts)3
-rw-r--r--contracts/asset-proxy/test/global_hooks.ts (renamed from contracts/libs/test/global_hooks.ts)0
-rw-r--r--contracts/asset-proxy/test/proxies.ts (renamed from contracts/protocol/test/asset_proxy/proxies.ts)52
-rw-r--r--contracts/asset-proxy/test/utils/erc20_wrapper.ts (renamed from contracts/protocol/test/utils/erc20_wrapper.ts)2
-rw-r--r--contracts/asset-proxy/test/utils/erc721_wrapper.ts (renamed from contracts/protocol/test/utils/erc721_wrapper.ts)2
-rw-r--r--contracts/asset-proxy/test/utils/index.ts (renamed from contracts/protocol/test/utils/index.ts)1
-rw-r--r--contracts/asset-proxy/tsconfig.json19
-rw-r--r--contracts/asset-proxy/tslint.json (renamed from contracts/examples/tslint.json)0
-rw-r--r--contracts/erc20/.solhintignore1
-rw-r--r--contracts/erc20/CHANGELOG.json11
-rw-r--r--contracts/erc20/CHANGELOG.md (renamed from contracts/examples/CHANGELOG.md)0
-rw-r--r--contracts/erc20/DEPLOYS.json (renamed from contracts/tokens/DEPLOYS.json)1
-rw-r--r--contracts/erc20/README.md (renamed from contracts/interfaces/README.md)17
-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/tokens/ERC20Token/ERC20Token.sol)2
-rw-r--r--contracts/erc20/contracts/src/MintableERC20Token.sol (renamed from contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol)2
-rw-r--r--contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol (renamed from contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol)2
-rw-r--r--contracts/erc20/contracts/src/WETH9.sol (renamed from contracts/tokens/contracts/tokens/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/tokens/ERC20Token/IERC20Token.sol)0
-rw-r--r--contracts/erc20/contracts/src/interfaces/IEtherToken.sol (renamed from contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol)2
-rw-r--r--contracts/erc20/contracts/test/DummyERC20Token.sol (renamed from contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol)4
-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)8
-rw-r--r--contracts/erc20/package.json (renamed from contracts/tokens/package.json)23
-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/protocol/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/interfaces/tslint.json)0
-rw-r--r--contracts/erc721/.solhintignore (renamed from contracts/tokens/.solhintignore)0
-rw-r--r--contracts/erc721/CHANGELOG.json11
-rw-r--r--contracts/erc721/CHANGELOG.md (renamed from contracts/interfaces/CHANGELOG.md)0
-rw-r--r--contracts/erc721/DEPLOYS.json1
-rw-r--r--contracts/erc721/README.md (renamed from contracts/libs/README.md)23
-rw-r--r--contracts/erc721/compiler.json30
-rw-r--r--contracts/erc721/contracts/src/ERC721Token.sol (renamed from contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol)6
-rw-r--r--contracts/erc721/contracts/src/MintableERC721Token.sol (renamed from contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol)0
-rw-r--r--contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol (renamed from contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol)0
-rw-r--r--contracts/erc721/contracts/src/interfaces/IERC721Token.sol (renamed from contracts/tokens/contracts/tokens/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)4
-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.json (renamed from contracts/examples/package.json)38
-rw-r--r--contracts/erc721/src/artifacts/index.ts20
-rw-r--r--contracts/erc721/src/index.ts (renamed from contracts/libs/src/index.ts)2
-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.ts (renamed from contracts/tokens/test/global_hooks.ts)0
-rw-r--r--contracts/erc721/tsconfig.json19
-rw-r--r--contracts/erc721/tslint.json (renamed from contracts/libs/tslint.json)0
-rw-r--r--contracts/examples/CHANGELOG.json56
-rw-r--r--contracts/examples/src/artifacts/index.ts13
-rw-r--r--contracts/examples/src/wrappers/index.ts4
-rw-r--r--contracts/exchange-forwarder/CHANGELOG.json11
-rw-r--r--contracts/exchange-forwarder/CHANGELOG.md (renamed from contracts/tokens/CHANGELOG.md)16
-rw-r--r--contracts/exchange-forwarder/DEPLOYS.json32
-rw-r--r--contracts/exchange-forwarder/README.md (renamed from contracts/tokens/README.md)19
-rw-r--r--contracts/exchange-forwarder/compiler.json (renamed from contracts/examples/compiler.json)2
-rw-r--r--contracts/exchange-forwarder/contracts/src/Forwarder.sol (renamed from contracts/extensions/contracts/Forwarder/Forwarder.sol)0
-rw-r--r--contracts/exchange-forwarder/contracts/src/MixinAssets.sol (renamed from contracts/extensions/contracts/Forwarder/MixinAssets.sol)8
-rw-r--r--contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol (renamed from contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol)8
-rw-r--r--contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol (renamed from contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol)8
-rw-r--r--contracts/exchange-forwarder/contracts/src/MixinWeth.sol (renamed from contracts/extensions/contracts/Forwarder/MixinWeth.sol)2
-rw-r--r--contracts/exchange-forwarder/contracts/src/interfaces/IAssets.sol (renamed from contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol)0
-rw-r--r--contracts/exchange-forwarder/contracts/src/interfaces/IForwarder.sol (renamed from contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol)0
-rw-r--r--contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol (renamed from contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol)4
-rw-r--r--contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol (renamed from contracts/extensions/contracts/Forwarder/libs/LibConstants.sol)8
-rw-r--r--contracts/exchange-forwarder/contracts/src/libs/LibForwarderErrors.sol (renamed from contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol)0
-rw-r--r--contracts/exchange-forwarder/contracts/src/mixins/MAssets.sol (renamed from contracts/extensions/contracts/Forwarder/mixins/MAssets.sol)0
-rw-r--r--contracts/exchange-forwarder/contracts/src/mixins/MExchangeWrapper.sol (renamed from contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol)4
-rw-r--r--contracts/exchange-forwarder/contracts/src/mixins/MWeth.sol (renamed from contracts/extensions/contracts/Forwarder/mixins/MWeth.sol)0
-rw-r--r--contracts/exchange-forwarder/package.json86
-rw-r--r--contracts/exchange-forwarder/src/artifacts/index.ts7
-rw-r--r--contracts/exchange-forwarder/src/index.ts (renamed from contracts/interfaces/src/index.ts)1
-rw-r--r--contracts/exchange-forwarder/src/wrappers/index.ts1
-rw-r--r--contracts/exchange-forwarder/test/forwarder.ts (renamed from contracts/extensions/test/extensions/forwarder.ts)28
-rw-r--r--contracts/exchange-forwarder/test/global_hooks.ts17
-rw-r--r--contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts (renamed from contracts/extensions/test/utils/forwarder_wrapper.ts)10
-rw-r--r--contracts/exchange-forwarder/test/utils/index.ts1
-rw-r--r--contracts/exchange-forwarder/tsconfig.json (renamed from contracts/examples/tsconfig.json)7
-rw-r--r--contracts/exchange-forwarder/tslint.json (renamed from contracts/protocol/tslint.json)0
-rw-r--r--contracts/exchange-libs/CHANGELOG.json15
-rw-r--r--contracts/exchange-libs/CHANGELOG.md (renamed from contracts/libs/CHANGELOG.md)0
-rw-r--r--contracts/exchange-libs/README.md (renamed from contracts/examples/README.md)27
-rw-r--r--contracts/exchange-libs/compiler.json (renamed from contracts/libs/compiler.json)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibAbiEncoder.sol (renamed from contracts/libs/contracts/libs/LibAbiEncoder.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibAssetProxyErrors.sol (renamed from contracts/libs/contracts/libs/LibAssetProxyErrors.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibConstants.sol (renamed from contracts/libs/contracts/libs/LibConstants.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibEIP712.sol (renamed from contracts/libs/contracts/libs/LibEIP712.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibExchangeErrors.sol (renamed from contracts/libs/contracts/libs/LibExchangeErrors.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibExchangeSelectors.sol (renamed from contracts/libs/contracts/libs/LibExchangeSelectors.sol)0
-rw-r--r--contracts/exchange-libs/contracts/src/LibFillResults.sol (renamed from contracts/libs/contracts/libs/LibFillResults.sol)2
-rw-r--r--contracts/exchange-libs/contracts/src/LibMath.sol (renamed from contracts/libs/contracts/libs/LibMath.sol)2
-rw-r--r--contracts/exchange-libs/contracts/src/LibOrder.sol (renamed from contracts/libs/contracts/libs/LibOrder.sol)0
-rw-r--r--contracts/exchange-libs/contracts/test/TestLibs.sol (renamed from contracts/libs/contracts/test/TestLibs/TestLibs.sol)8
-rw-r--r--contracts/exchange-libs/package.json (renamed from contracts/libs/package.json)17
-rw-r--r--contracts/exchange-libs/src/artifacts/index.ts (renamed from contracts/libs/src/artifacts/index.ts)0
-rw-r--r--contracts/exchange-libs/src/index.ts (renamed from contracts/examples/src/index.ts)0
-rw-r--r--contracts/exchange-libs/src/wrappers/index.ts (renamed from contracts/libs/src/wrappers/index.ts)0
-rw-r--r--contracts/exchange-libs/test/exchange_libs.ts (renamed from contracts/libs/test/exchange/libs.ts)4
-rw-r--r--contracts/exchange-libs/test/global_hooks.ts17
-rw-r--r--contracts/exchange-libs/tsconfig.json (renamed from contracts/libs/tsconfig.json)0
-rw-r--r--contracts/exchange-libs/tslint.json (renamed from contracts/tokens/tslint.json)0
-rw-r--r--contracts/exchange/CHANGELOG.json15
-rw-r--r--contracts/exchange/CHANGELOG.md28
-rw-r--r--contracts/exchange/DEPLOYS.json17
-rw-r--r--contracts/exchange/README.md73
-rw-r--r--contracts/exchange/compiler.json (renamed from contracts/interfaces/compiler.json)14
-rw-r--r--contracts/exchange/contracts/examples/ExchangeWrapper.sol (renamed from contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol)4
-rw-r--r--contracts/exchange/contracts/examples/Validator.sol (renamed from contracts/examples/contracts/Validator/Validator.sol)2
-rw-r--r--contracts/exchange/contracts/examples/Wallet.sol (renamed from contracts/examples/contracts/Wallet/Wallet.sol)4
-rw-r--r--contracts/exchange/contracts/examples/Whitelist.sol (renamed from contracts/examples/contracts/Whitelist/Whitelist.sol)6
-rw-r--r--contracts/exchange/contracts/src/Exchange.sol (renamed from contracts/protocol/contracts/protocol/Exchange/Exchange.sol)2
-rw-r--r--contracts/exchange/contracts/src/MixinAssetProxyDispatcher.sol174
-rw-r--r--contracts/exchange/contracts/src/MixinExchangeCore.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol)10
-rw-r--r--contracts/exchange/contracts/src/MixinMatchOrders.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol)10
-rw-r--r--contracts/exchange/contracts/src/MixinSignatureValidator.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol)8
-rw-r--r--contracts/exchange/contracts/src/MixinTransactions.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol)4
-rw-r--r--contracts/exchange/contracts/src/MixinWrapperFunctions.sol (renamed from contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol)10
-rw-r--r--contracts/exchange/contracts/src/interfaces/IAssetProxyDispatcher.sol37
-rw-r--r--contracts/exchange/contracts/src/interfaces/IExchange.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IExchange.sol)0
-rw-r--r--contracts/exchange/contracts/src/interfaces/IExchangeCore.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol)4
-rw-r--r--contracts/exchange/contracts/src/interfaces/IMatchOrders.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol)4
-rw-r--r--contracts/exchange/contracts/src/interfaces/ISignatureValidator.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol)0
-rw-r--r--contracts/exchange/contracts/src/interfaces/ITransactions.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol)0
-rw-r--r--contracts/exchange/contracts/src/interfaces/IValidator.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IValidator.sol)0
-rw-r--r--contracts/exchange/contracts/src/interfaces/IWallet.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IWallet.sol)0
-rw-r--r--contracts/exchange/contracts/src/interfaces/IWrapperFunctions.sol (renamed from contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol)4
-rw-r--r--contracts/exchange/contracts/src/mixins/MAssetProxyDispatcher.sol45
-rw-r--r--contracts/exchange/contracts/src/mixins/MExchangeCore.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol)6
-rw-r--r--contracts/exchange/contracts/src/mixins/MMatchOrders.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol)6
-rw-r--r--contracts/exchange/contracts/src/mixins/MSignatureValidator.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol)2
-rw-r--r--contracts/exchange/contracts/src/mixins/MTransactions.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol)2
-rw-r--r--contracts/exchange/contracts/src/mixins/MWrapperFunctions.sol (renamed from contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol)6
-rw-r--r--contracts/exchange/contracts/test/TestAssetProxyDispatcher.sol (renamed from contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol)2
-rw-r--r--contracts/exchange/contracts/test/TestExchangeInternals.sol (renamed from contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol)2
-rw-r--r--contracts/exchange/contracts/test/TestSignatureValidator.sol (renamed from contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol)4
-rw-r--r--contracts/exchange/contracts/test/TestStaticCallReceiver.sol (renamed from contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol)2
-rw-r--r--contracts/exchange/package.json (renamed from contracts/protocol/package.json)26
-rw-r--r--contracts/exchange/src/artifacts/index.ts (renamed from contracts/interfaces/src/artifacts/index.ts)26
-rw-r--r--contracts/exchange/src/index.ts3
-rw-r--r--contracts/exchange/src/wrappers/index.ts18
-rw-r--r--contracts/exchange/test/core.ts (renamed from contracts/protocol/test/exchange/core.ts)46
-rw-r--r--contracts/exchange/test/dispatcher.ts (renamed from contracts/protocol/test/exchange/dispatcher.ts)19
-rw-r--r--contracts/exchange/test/fill_order.ts (renamed from contracts/protocol/test/exchange/fill_order.ts)5
-rw-r--r--contracts/exchange/test/global_hooks.ts17
-rw-r--r--contracts/exchange/test/internal.ts (renamed from contracts/protocol/test/exchange/internal.ts)3
-rw-r--r--contracts/exchange/test/match_orders.ts (renamed from contracts/protocol/test/exchange/match_orders.ts)21
-rw-r--r--contracts/exchange/test/signature_validator.ts (renamed from contracts/protocol/test/exchange/signature_validator.ts)13
-rw-r--r--contracts/exchange/test/transactions.ts (renamed from contracts/protocol/test/exchange/transactions.ts)14
-rw-r--r--contracts/exchange/test/utils/asset_wrapper.ts (renamed from contracts/protocol/test/utils/asset_wrapper.ts)11
-rw-r--r--contracts/exchange/test/utils/exchange_wrapper.ts (renamed from contracts/protocol/test/utils/exchange_wrapper.ts)8
-rw-r--r--contracts/exchange/test/utils/fill_order_combinatorial_utils.ts (renamed from contracts/protocol/test/utils/fill_order_combinatorial_utils.ts)8
-rw-r--r--contracts/exchange/test/utils/index.ts3
-rw-r--r--contracts/exchange/test/utils/match_order_tester.ts (renamed from contracts/protocol/test/utils/match_order_tester.ts)3
-rw-r--r--contracts/exchange/test/utils/order_factory_from_scenario.ts (renamed from contracts/protocol/test/utils/order_factory_from_scenario.ts)2
-rw-r--r--contracts/exchange/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts (renamed from contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts)0
-rw-r--r--contracts/exchange/test/utils/simple_order_filled_cancelled_fetcher.ts (renamed from contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts)0
-rw-r--r--contracts/exchange/test/utils/types.ts (renamed from contracts/protocol/test/utils/types.ts)0
-rw-r--r--contracts/exchange/test/wrapper.ts (renamed from contracts/protocol/test/exchange/wrapper.ts)19
-rw-r--r--contracts/exchange/tsconfig.json (renamed from contracts/interfaces/tsconfig.json)16
-rw-r--r--contracts/exchange/tslint.json6
-rw-r--r--contracts/extensions/CHANGELOG.json13
-rw-r--r--contracts/extensions/DEPLOYS.json32
-rw-r--r--contracts/extensions/README.md12
-rw-r--r--contracts/extensions/compiler.json2
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/BalanceThresholdFilter.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol)2
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol)4
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol)2
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol)0
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IThresholdAsset.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol)0
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol)2
-rw-r--r--contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MExchangeCalldata.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol)0
-rw-r--r--contracts/extensions/contracts/src/DutchAuction/DutchAuction.sol (renamed from contracts/extensions/contracts/DutchAuction/DutchAuction.sol)10
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol (renamed from contracts/extensions/contracts/OrderMatcher/MixinAssets.sol)8
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol (renamed from contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol)6
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.sol (renamed from contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol)2
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/interfaces/IAssets.sol (renamed from contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol)0
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/interfaces/IMatchOrders.sol (renamed from contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol)2
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol (renamed from contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol)2
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol (renamed from contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol)2
-rw-r--r--contracts/extensions/contracts/src/OrderMatcher/mixins/MAssets.sol (renamed from contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol)0
-rw-r--r--contracts/extensions/contracts/src/OrderValidator/OrderValidator.sol (renamed from contracts/extensions/contracts/OrderValidator/OrderValidator.sol)10
-rw-r--r--contracts/extensions/package.json23
-rw-r--r--contracts/extensions/src/artifacts/index.ts2
-rw-r--r--contracts/extensions/src/index.ts1
-rw-r--r--contracts/extensions/src/wrappers/index.ts1
-rw-r--r--contracts/extensions/test/balance_threshold_filter.ts (renamed from contracts/extensions/test/extensions/balance_threshold_filter.ts)17
-rw-r--r--contracts/extensions/test/dutch_auction.ts (renamed from contracts/extensions/test/extensions/dutch_auction.ts)25
-rw-r--r--contracts/extensions/test/order_matcher.ts (renamed from contracts/extensions/test/extensions/order_matcher.ts)29
-rw-r--r--contracts/extensions/test/order_validator.ts (renamed from contracts/extensions/test/extensions/order_validator.ts)19
-rw-r--r--contracts/extensions/test/utils/balance_threshold_wrapper.ts10
-rw-r--r--contracts/extensions/test/utils/dutch_auction_test_wrapper.ts10
-rw-r--r--contracts/extensions/test/utils/index.ts2
-rw-r--r--contracts/extensions/tsconfig.json1
-rw-r--r--contracts/interfaces/CHANGELOG.json56
-rw-r--r--contracts/interfaces/package.json57
-rw-r--r--contracts/interfaces/src/wrappers/index.ts12
-rw-r--r--contracts/libs/CHANGELOG.json56
-rw-r--r--contracts/multisig/CHANGELOG.json13
-rw-r--r--contracts/multisig/DEPLOYS.json17
-rw-r--r--contracts/multisig/README.md15
-rw-r--r--contracts/multisig/compiler.json8
-rw-r--r--contracts/multisig/contracts/src/AssetProxyOwner.sol (renamed from contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol)4
-rw-r--r--contracts/multisig/contracts/src/MultiSigWallet.sol (renamed from contracts/multisig/contracts/multisig/MultiSigWallet.sol)0
-rw-r--r--contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol (renamed from contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol)0
-rw-r--r--contracts/multisig/contracts/test/TestAssetProxyOwner.sol (renamed from contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol)2
-rw-r--r--contracts/multisig/contracts/test/TestRejectEther.sol (renamed from contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol)0
-rw-r--r--contracts/multisig/package.json12
-rw-r--r--contracts/multisig/src/artifacts/index.ts6
-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.ts (renamed from contracts/protocol/test/multisig/asset_proxy_owner.ts)14
-rw-r--r--contracts/multisig/test/multi_sig_with_time_lock.ts9
-rw-r--r--contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts (renamed from contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts)5
-rw-r--r--contracts/multisig/test/utils/index.ts2
-rw-r--r--contracts/multisig/tsconfig.json2
-rw-r--r--contracts/protocol/CHANGELOG.json65
-rw-r--r--contracts/protocol/DEPLOYS.json92
-rw-r--r--contracts/protocol/src/artifacts/index.ts27
-rw-r--r--contracts/protocol/src/wrappers/index.ts10
-rw-r--r--contracts/protocol/tsconfig.json23
-rw-r--r--contracts/test-utils/package.json2
-rw-r--r--contracts/tokens/CHANGELOG.json56
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol44
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol39
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol52
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol41
-rw-r--r--contracts/utils/CHANGELOG.json17
-rw-r--r--contracts/utils/README.md13
-rw-r--r--contracts/utils/contracts/src/LibAddressArray.sol (renamed from contracts/libs/contracts/libs/LibAddressArray.sol)2
-rw-r--r--contracts/utils/contracts/src/LibBytes.sol (renamed from contracts/utils/contracts/utils/LibBytes/LibBytes.sol)0
-rw-r--r--contracts/utils/contracts/src/Ownable.sol (renamed from contracts/utils/contracts/utils/Ownable/Ownable.sol)2
-rw-r--r--contracts/utils/contracts/src/ReentrancyGuard.sol (renamed from contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol)0
-rw-r--r--contracts/utils/contracts/src/SafeMath.sol (renamed from contracts/utils/contracts/utils/SafeMath/SafeMath.sol)0
-rw-r--r--contracts/utils/contracts/src/interfaces/IOwnable.sol (renamed from contracts/utils/contracts/utils/Ownable/IOwnable.sol)0
-rw-r--r--contracts/utils/contracts/test/TestConstants.sol (renamed from contracts/utils/contracts/test/TestConstants/TestConstants.sol)4
-rw-r--r--contracts/utils/contracts/test/TestLibBytes.sol (renamed from contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol)4
-rw-r--r--contracts/utils/package.json13
-rw-r--r--contracts/utils/test/lib_bytes.ts3
-rw-r--r--contracts/utils/test/libs.ts3
267 files changed, 1664 insertions, 1360 deletions
diff --git a/contracts/asset-proxy/CHANGELOG.json b/contracts/asset-proxy/CHANGELOG.json
new file mode 100644
index 000000000..9307f7da4
--- /dev/null
+++ b/contracts/asset-proxy/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Move all AssetProxy contracts out of contracts-protocol to new package",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/protocol/CHANGELOG.md b/contracts/asset-proxy/CHANGELOG.md
index 779eb68a7..779eb68a7 100644
--- a/contracts/protocol/CHANGELOG.md
+++ b/contracts/asset-proxy/CHANGELOG.md
diff --git a/contracts/asset-proxy/DEPLOYS.json b/contracts/asset-proxy/DEPLOYS.json
new file mode 100644
index 000000000..0f25da1c3
--- /dev/null
+++ b/contracts/asset-proxy/DEPLOYS.json
@@ -0,0 +1,47 @@
+[
+ {
+ "name": "MultiAssetProxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Add MultiAssetProxy implementation",
+ "pr": 1224,
+ "networks": {
+ "3": "0xab8fbd189c569ccdee3a4d929bb7f557be4028f6",
+ "4": "0xb34cde0ad3a83d04abebc0b66e75196f22216621",
+ "42": "0xf6313a772c222f51c28f2304c0703b8cf5428fd8"
+ }
+ }
+ ]
+ },
+ {
+ "name": "ERC20Proxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
+ "3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
+ "4": "0x3e809c563c15a295e832e37053798ddc8d6c8dab",
+ "42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"
+ }
+ }
+ ]
+ },
+ {
+ "name": "ERC721Proxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
+ "3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
+ "4": "0x8e1ff02637cb5e39f2fa36c14706aa348b065b09",
+ "42": "0x2a9127c745688a165106c11cd4d647d2220af821"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/protocol/README.md b/contracts/asset-proxy/README.md
index dc1f32c98..48a5b20a5 100644
--- a/contracts/protocol/README.md
+++ b/contracts/asset-proxy/README.md
@@ -1,15 +1,14 @@
-## Contracts
+## AssetProxy
-Smart contracts that implement 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.
+This package contains the implementations of all of the [`AssetProxy`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy) contracts available within the 0x protocol. These contracts are responsible for decoding the `assetData` sent to them and performing the actual transfer of assets. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-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:
+**Install**
-- [protocol](./contracts/protocol)
- - This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
-- [test](./contracts/test)
- - This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+```bash
+npm install @0x/contracts-asset-proxy --save
+```
## Bug bounty
@@ -42,13 +41,13 @@ yarn install
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-protocol yarn build
+PKG=@0x/contracts-asset-proxy yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-protocol yarn watch
+PKG=@0x/contracts-asset-proxy yarn watch
```
### Clean
diff --git a/contracts/protocol/compiler.json b/contracts/asset-proxy/compiler.json
index f4d2a5f45..70d4c6b20 100644
--- a/contracts/protocol/compiler.json
+++ b/contracts/asset-proxy/compiler.json
@@ -20,16 +20,12 @@
}
},
"contracts": [
- "AssetProxyOwner",
+ "IAssetData",
+ "IAssetProxy",
+ "IAuthorizable",
"ERC20Proxy",
"ERC721Proxy",
- "Exchange",
"MixinAuthorizable",
- "MultiAssetProxy",
- "TestAssetProxyOwner",
- "TestAssetProxyDispatcher",
- "TestExchangeInternals",
- "TestSignatureValidator",
- "TestStaticCallReceiver"
+ "MultiAssetProxy"
]
}
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol b/contracts/asset-proxy/contracts/src/ERC20Proxy.sol
index 258443bca..258443bca 100644
--- a/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol
+++ b/contracts/asset-proxy/contracts/src/ERC20Proxy.sol
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol b/contracts/asset-proxy/contracts/src/ERC721Proxy.sol
index 65b664b8b..65b664b8b 100644
--- a/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol
+++ b/contracts/asset-proxy/contracts/src/ERC721Proxy.sol
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol b/contracts/asset-proxy/contracts/src/MixinAssetProxyDispatcher.sol
index 2922a8c1a..36c287ea3 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ b/contracts/asset-proxy/contracts/src/MixinAssetProxyDispatcher.sol
@@ -18,9 +18,9 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
import "./mixins/MAssetProxyDispatcher.sol";
-import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol";
+import "./interfaces/IAssetProxy.sol";
contract MixinAssetProxyDispatcher is
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol b/contracts/asset-proxy/contracts/src/MixinAuthorizable.sol
index b610ef709..ace820625 100644
--- a/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol
+++ b/contracts/asset-proxy/contracts/src/MixinAuthorizable.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
import "./mixins/MAuthorizable.sol";
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol
index 5f559163c..0b2cb4134 100644
--- a/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol
+++ b/contracts/asset-proxy/contracts/src/MultiAssetProxy.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../Exchange/MixinAssetProxyDispatcher.sol";
+import "./MixinAssetProxyDispatcher.sol";
import "./MixinAuthorizable.sol";
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol b/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol
index a130e615f..a130e615f 100644
--- a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol
+++ b/contracts/asset-proxy/contracts/src/interfaces/IAssetData.sol
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol
index 706412dd0..706412dd0 100644
--- a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol
+++ b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxy.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxyDispatcher.sol
index b73881c07..b73881c07 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol
+++ b/contracts/asset-proxy/contracts/src/interfaces/IAssetProxyDispatcher.sol
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol b/contracts/asset-proxy/contracts/src/interfaces/IAuthorizable.sol
index 202173998..0df654711 100644
--- a/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol
+++ b/contracts/asset-proxy/contracts/src/interfaces/IAuthorizable.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
+import "@0x/contracts-utils/contracts/src/interfaces/IOwnable.sol";
contract IAuthorizable is
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/contracts/asset-proxy/contracts/src/mixins/MAssetProxyDispatcher.sol
index 05c2c4c0b..0ae555dda 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
+++ b/contracts/asset-proxy/contracts/src/mixins/MAssetProxyDispatcher.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol";
+import "../interfaces/IAssetProxyDispatcher.sol";
contract MAssetProxyDispatcher is
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol b/contracts/asset-proxy/contracts/src/mixins/MAuthorizable.sol
index 6c3f70500..c9c07e788 100644
--- a/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
+++ b/contracts/asset-proxy/contracts/src/mixins/MAuthorizable.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol";
+import "../interfaces/IAuthorizable.sol";
contract MAuthorizable is
diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json
new file mode 100644
index 000000000..360fdab75
--- /dev/null
+++ b/contracts/asset-proxy/package.json
@@ -0,0 +1,82 @@
+{
+ "name": "@0x/contracts-asset-proxy",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract components of 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/@(ERC20Proxy|ERC721Proxy|IAssetData|IAssetProxy|IAuthorizable|MixinAuthorizable|MultiAssetProxy).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/protocol/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.22",
+ "@0x/dev-utils": "^1.0.24",
+ "@0x/sol-compiler": "^2.0.2",
+ "@0x/tslint-config": "^2.0.2",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^3.0.0",
+ "dirty-chai": "^2.0.1",
+ "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"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.13",
+ "@0x/contracts-test-utils": "^2.0.1",
+ "@0x/contracts-erc20": "1.0.0",
+ "@0x/contracts-erc721": "1.0.0",
+ "@0x/contracts-utils": "3.0.0",
+ "@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",
+ "ethereum-types": "^1.1.6",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/asset-proxy/src/artifacts/index.ts b/contracts/asset-proxy/src/artifacts/index.ts
new file mode 100644
index 000000000..7f3060815
--- /dev/null
+++ b/contracts/asset-proxy/src/artifacts/index.ts
@@ -0,0 +1,19 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
+import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
+import * as IAssetData from '../../generated-artifacts/IAssetData.json';
+import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
+import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
+import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
+import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
+
+export const artifacts = {
+ IAuthorizable: IAuthorizable as ContractArtifact,
+ IAssetData: IAssetData as ContractArtifact,
+ IAssetProxy: IAssetProxy as ContractArtifact,
+ ERC20Proxy: ERC20Proxy as ContractArtifact,
+ ERC721Proxy: ERC721Proxy as ContractArtifact,
+ MixinAuthorizable: MixinAuthorizable as ContractArtifact,
+ MultiAssetProxy: MultiAssetProxy as ContractArtifact,
+};
diff --git a/contracts/protocol/src/index.ts b/contracts/asset-proxy/src/index.ts
index ba813e7ca..ba813e7ca 100644
--- a/contracts/protocol/src/index.ts
+++ b/contracts/asset-proxy/src/index.ts
diff --git a/contracts/asset-proxy/src/wrappers/index.ts b/contracts/asset-proxy/src/wrappers/index.ts
new file mode 100644
index 000000000..6aecbc086
--- /dev/null
+++ b/contracts/asset-proxy/src/wrappers/index.ts
@@ -0,0 +1,7 @@
+export * from '../../generated-wrappers/i_asset_data';
+export * from '../../generated-wrappers/i_asset_proxy';
+export * from '../../generated-wrappers/erc20_proxy';
+export * from '../../generated-wrappers/erc721_proxy';
+export * from '../../generated-wrappers/mixin_authorizable';
+export * from '../../generated-wrappers/multi_asset_proxy';
+export * from '../../generated-wrappers/i_authorizable';
diff --git a/contracts/protocol/test/asset_proxy/authorizable.ts b/contracts/asset-proxy/test/authorizable.ts
index 853d18be0..087121235 100644
--- a/contracts/protocol/test/asset_proxy/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/libs/test/global_hooks.ts b/contracts/asset-proxy/test/global_hooks.ts
index f8ace376a..f8ace376a 100644
--- a/contracts/libs/test/global_hooks.ts
+++ b/contracts/asset-proxy/test/global_hooks.ts
diff --git a/contracts/protocol/test/asset_proxy/proxies.ts b/contracts/asset-proxy/test/proxies.ts
index c34be9c6a..797787135 100644
--- a/contracts/protocol/test/asset_proxy/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,23 +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,
);
@@ -148,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,
@@ -157,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,
@@ -198,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,
);
@@ -562,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,
@@ -754,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/protocol/test/utils/erc20_wrapper.ts b/contracts/asset-proxy/test/utils/erc20_wrapper.ts
index e5ab0e36c..12cd06ece 100644
--- a/contracts/protocol/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/protocol/test/utils/erc721_wrapper.ts b/contracts/asset-proxy/test/utils/erc721_wrapper.ts
index 1f658ce86..fc43d8c52 100644
--- a/contracts/protocol/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/protocol/test/utils/index.ts b/contracts/asset-proxy/test/utils/index.ts
index 75cd88666..b11f6a45d 100644
--- a/contracts/protocol/test/utils/index.ts
+++ b/contracts/asset-proxy/test/utils/index.ts
@@ -1,3 +1,2 @@
-export * from './exchange_wrapper';
export * from './erc20_wrapper';
export * from './erc721_wrapper';
diff --git a/contracts/asset-proxy/tsconfig.json b/contracts/asset-proxy/tsconfig.json
new file mode 100644
index 000000000..7baa48cbe
--- /dev/null
+++ b/contracts/asset-proxy/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/IAssetData.json",
+ "./generated-artifacts/IAssetProxy.json",
+ "./generated-artifacts/IAuthorizable.json",
+ "./generated-artifacts/ERC20Proxy.json",
+ "./generated-artifacts/ERC721Proxy.json",
+ "./generated-artifacts/MixinAuthorizable.json",
+ "./generated-artifacts/MultiAssetProxy.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/examples/tslint.json b/contracts/asset-proxy/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/examples/tslint.json
+++ b/contracts/asset-proxy/tslint.json
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/erc20/CHANGELOG.json b/contracts/erc20/CHANGELOG.json
new file mode 100644
index 000000000..93f284234
--- /dev/null
+++ b/contracts/erc20/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Move all ERC20 contracts out of contracts-tokens to new package",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/examples/CHANGELOG.md b/contracts/erc20/CHANGELOG.md
index 59d0804da..59d0804da 100644
--- a/contracts/examples/CHANGELOG.md
+++ b/contracts/erc20/CHANGELOG.md
diff --git a/contracts/tokens/DEPLOYS.json b/contracts/erc20/DEPLOYS.json
index 5ff58c035..e165b37b3 100644
--- a/contracts/tokens/DEPLOYS.json
+++ b/contracts/erc20/DEPLOYS.json
@@ -8,6 +8,7 @@
"networks": {
"1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
"3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
+ "4": "0x2727e688b8fd40b198cd5fe6e408e00494a06f07",
"42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
}
}
diff --git a/contracts/interfaces/README.md b/contracts/erc20/README.md
index 81dd4c3ac..e1214c00c 100644
--- a/contracts/interfaces/README.md
+++ b/contracts/erc20/README.md
@@ -1,13 +1,14 @@
-## Contract interfaces
+## ERC20 Tokens
-Smart contract interfaces of the 0x protocol.
+This package contains implementations of various [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md) tokens, including WETH (Wrapped Ether) and ZRX. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-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:
+**Install**
-- [protocol](./contracts/protocol)
- - This directory contains the contract interfaces that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+```bash
+npm install @0x/contracts-erc20 --save
+```
## Bug bounty
@@ -40,13 +41,13 @@ yarn install
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-interfaces yarn build
+PKG=@0x/contracts-erc20 yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-interfaces yarn watch
+PKG=@0x/contracts-erc20 yarn watch
```
### Clean
diff --git a/contracts/tokens/compiler.json b/contracts/erc20/compiler.json
index eec24a769..264f6231a 100644
--- a/contracts/tokens/compiler.json
+++ b/contracts/erc20/compiler.json
@@ -23,23 +23,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/tokens/ERC20Token/ERC20Token.sol b/contracts/erc20/contracts/src/ERC20Token.sol
index 190eead76..b6e9d0f9f 100644
--- a/contracts/tokens/contracts/tokens/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/tokens/ERC20Token/MintableERC20Token.sol b/contracts/erc20/contracts/src/MintableERC20Token.sol
index a66031f03..1108db53d 100644
--- a/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
+++ b/contracts/erc20/contracts/src/MintableERC20Token.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+import "@0x/contracts-utils/contracts/src/SafeMath.sol";
import "./UnlimitedAllowanceERC20Token.sol";
diff --git a/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol
index 869d16147..3a43c250d 100644
--- a/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
+++ b/contracts/erc20/contracts/src/UnlimitedAllowanceERC20Token.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "../ERC20Token/ERC20Token.sol";
+import "./ERC20Token.sol";
contract UnlimitedAllowanceERC20Token is
diff --git a/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol b/contracts/erc20/contracts/src/WETH9.sol
index 17876b86d..17876b86d 100644
--- a/contracts/tokens/contracts/tokens/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/tokens/ERC20Token/IERC20Token.sol b/contracts/erc20/contracts/src/interfaces/IERC20Token.sol
index 9f9b89585..9f9b89585 100644
--- a/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
+++ b/contracts/erc20/contracts/src/interfaces/IERC20Token.sol
diff --git a/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol b/contracts/erc20/contracts/src/interfaces/IEtherToken.sol
index 32baa3eb0..cb07cae6f 100644
--- a/contracts/tokens/contracts/tokens/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 33028db0c..39e739a91 100644
--- a/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
+++ b/contracts/erc20/contracts/test/DummyERC20Token.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/MintableERC20Token.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.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 d8c65929d..0629754c0 100644
--- a/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ b/contracts/erc20/contracts/test/ReentrantERC20Token.sol
@@ -19,10 +19,10 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "../../tokens/ERC20Token/ERC20Token.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "../src/ERC20Token.sol";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/tokens/package.json b/contracts/erc20/package.json
index bd0316919..778b9257d 100644
--- a/contracts/tokens/package.json
+++ b/contracts/erc20/package.json
@@ -1,6 +1,6 @@
{
- "name": "@0x/contracts-tokens",
- "version": "1.0.6",
+ "name": "@0x/contracts-erc20",
+ "version": "1.0.0",
"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",
@@ -48,41 +48,30 @@
"@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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-interfaces": "^1.0.6",
- "@0x/contracts-libs": "^1.0.6",
- "@0x/contracts-multisig": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
- "@0x/order-utils": "^3.1.2",
+ "@0x/contracts-exchange-libs": "1.0.0",
+ "@0x/contracts-utils": "3.0.0",
"@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": {
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/protocol/test/global_hooks.ts b/contracts/erc20/test/global_hooks.ts
index f8ace376a..f8ace376a 100644
--- a/contracts/protocol/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/interfaces/tslint.json b/contracts/erc20/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/interfaces/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..caf1e6701
--- /dev/null
+++ b/contracts/erc721/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Move all ERC721 contracts out of contracts-tokens to new package",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/interfaces/CHANGELOG.md b/contracts/erc721/CHANGELOG.md
index 59d0804da..59d0804da 100644
--- a/contracts/interfaces/CHANGELOG.md
+++ b/contracts/erc721/CHANGELOG.md
diff --git a/contracts/erc721/DEPLOYS.json b/contracts/erc721/DEPLOYS.json
new file mode 100644
index 000000000..fe51488c7
--- /dev/null
+++ b/contracts/erc721/DEPLOYS.json
@@ -0,0 +1 @@
+[]
diff --git a/contracts/libs/README.md b/contracts/erc721/README.md
index cfa631679..c14035b9e 100644
--- a/contracts/libs/README.md
+++ b/contracts/erc721/README.md
@@ -1,15 +1,18 @@
-## Contracts libs
+## ERC721 Tokens
-Smart contracts libs used in the 0x protocol.
+This package contains implementations of various [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) tokens. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+**Install**
-- [libs](./contracts/protocol)
- - This directory contains the libs.
-- [test](./contracts/test)
- - This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+```bash
+npm install @0x/contracts-erc721 --save
+```
+
+## 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
@@ -38,13 +41,13 @@ yarn install
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-libs yarn build
+PKG=@0x/contracts-erc721 yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-libs yarn watch
+PKG=@0x/contracts-erc721 yarn watch
```
### Clean
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/tokens/ERC721Token/ERC721Token.sol b/contracts/erc721/contracts/src/ERC721Token.sol
index c46bd0af4..32f70ccf8 100644
--- a/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
+++ b/contracts/erc721/contracts/src/ERC721Token.sol
@@ -18,9 +18,9 @@
pragma solidity ^0.4.24;
-import "./IERC721Token.sol";
-import "./IERC721Receiver.sol";
-import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+import "./interfaces/IERC721Token.sol";
+import "./interfaces/IERC721Receiver.sol";
+import "@0x/contracts-utils/contracts/src/SafeMath.sol";
contract ERC721Token is
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol b/contracts/erc721/contracts/src/MintableERC721Token.sol
index 27326d857..27326d857 100644
--- a/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
+++ b/contracts/erc721/contracts/src/MintableERC721Token.sol
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol b/contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol
index c3ad35ede..c3ad35ede 100644
--- a/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
+++ b/contracts/erc721/contracts/src/interfaces/IERC721Receiver.sol
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol b/contracts/erc721/contracts/src/interfaces/IERC721Token.sol
index 56a3314df..56a3314df 100644
--- a/contracts/tokens/contracts/tokens/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 6c8371559..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 "../../tokens/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 4c978b2df..41dc8ea18 100644
--- a/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
+++ b/contracts/erc721/contracts/test/DummyERC721Token.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
-import "../../tokens/ERC721Token/MintableERC721Token.sol";
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "../src/MintableERC721Token.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
// solhint-disable no-empty-blocks
diff --git a/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/contracts/erc721/contracts/test/InvalidERC721Receiver.sol
index 309633bf5..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 "../../tokens/ERC721Token/IERC721Receiver.sol";
+import "../src/interfaces/IERC721Receiver.sol";
contract InvalidERC721Receiver is
diff --git a/contracts/examples/package.json b/contracts/erc721/package.json
index 845ea0636..096e1025e 100644
--- a/contracts/examples/package.json
+++ b/contracts/erc721/package.json
@@ -1,10 +1,10 @@
{
- "name": "@0x/contracts-examples",
- "version": "1.0.6",
+ "name": "@0x/contracts-erc721",
+ "version": "1.0.0",
"engines": {
"node": ">=6.12"
},
- "description": "Smart contract examples of 0x protocol",
+ "description": "Token contracts used by 0x protocol",
"main": "lib/src/index.js",
"directories": {
"test": "test"
@@ -13,15 +13,26 @@
"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/@(ExchangeWrapper|Validator|Wallet|Whitelist).json"
+ "abis": "generated-artifacts/@(DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token).json"
},
"repository": {
"type": "git",
@@ -31,48 +42,35 @@
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
- "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
+ "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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-interfaces": "^1.0.6",
- "@0x/contracts-libs": "^1.0.6",
- "@0x/contracts-multisig": "^1.0.6",
- "@0x/contracts-tokens": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
- "@0x/order-utils": "^3.1.2",
+ "@0x/contracts-utils": "3.0.0",
"@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": {
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/libs/src/index.ts b/contracts/erc721/src/index.ts
index d55f08ea2..91dd7e0e3 100644
--- a/contracts/libs/src/index.ts
+++ b/contracts/erc721/src/index.ts
@@ -1,2 +1,2 @@
-export * from './artifacts';
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/tokens/test/global_hooks.ts b/contracts/erc721/test/global_hooks.ts
index f8ace376a..f8ace376a 100644
--- a/contracts/tokens/test/global_hooks.ts
+++ b/contracts/erc721/test/global_hooks.ts
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/libs/tslint.json b/contracts/erc721/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/libs/tslint.json
+++ b/contracts/erc721/tslint.json
diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json
deleted file mode 100644
index 724ab1e4a..000000000
--- a/contracts/examples/CHANGELOG.json
+++ /dev/null
@@ -1,56 +0,0 @@
-[
- {
- "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/examples/src/artifacts/index.ts b/contracts/examples/src/artifacts/index.ts
deleted file mode 100644
index c921fbf89..000000000
--- a/contracts/examples/src/artifacts/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
-import * as Validator from '../../generated-artifacts/Validator.json';
-import * as Wallet from '../../generated-artifacts/Wallet.json';
-import * as Whitelist from '../../generated-artifacts/Whitelist.json';
-
-export const artifacts = {
- ExchangeWrapper: ExchangeWrapper as ContractArtifact,
- Validator: Validator as ContractArtifact,
- Wallet: Wallet as ContractArtifact,
- Whitelist: Whitelist as ContractArtifact,
-};
diff --git a/contracts/examples/src/wrappers/index.ts b/contracts/examples/src/wrappers/index.ts
deleted file mode 100644
index dc67277d7..000000000
--- a/contracts/examples/src/wrappers/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from '../../generated-wrappers/exchange_wrapper';
-export * from '../../generated-wrappers/validator';
-export * from '../../generated-wrappers/wallet';
-export * from '../../generated-wrappers/whitelist';
diff --git a/contracts/exchange-forwarder/CHANGELOG.json b/contracts/exchange-forwarder/CHANGELOG.json
new file mode 100644
index 000000000..a9e5fa8da
--- /dev/null
+++ b/contracts/exchange-forwarder/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Move Forwarder contract out of contracts-extensions into new package",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/CHANGELOG.md b/contracts/exchange-forwarder/CHANGELOG.md
index 59d0804da..94ffdfb67 100644
--- a/contracts/tokens/CHANGELOG.md
+++ b/contracts/exchange-forwarder/CHANGELOG.md
@@ -5,21 +5,27 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
-## v1.0.6 - _January 17, 2019_
+## v1.2.3 - _January 17, 2019_
* Dependencies updated
-## v1.0.5 - _January 15, 2019_
+## v1.2.2 - _January 15, 2019_
* Dependencies updated
-## v1.0.4 - _January 11, 2019_
+## v1.2.1 - _January 11, 2019_
* Dependencies updated
-## v1.0.3 - _January 9, 2019_
+## v1.2.0 - _January 9, 2019_
- * Dependencies updated
+ * Added Dutch Auction Wrapper (#1465)
+
+## v1.1.0 - _Invalid date_
+
+ * Added Balance Threshold Filter (#1383)
+ * Add OrderMatcher (#1117)
+ * Add OrderValidator (#1464)
## v1.0.2 - _December 13, 2018_
diff --git a/contracts/exchange-forwarder/DEPLOYS.json b/contracts/exchange-forwarder/DEPLOYS.json
new file mode 100644
index 000000000..86bd264c4
--- /dev/null
+++ b/contracts/exchange-forwarder/DEPLOYS.json
@@ -0,0 +1,32 @@
+[
+ {
+ "name": "Forwarder",
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "Round up when calculating remaining amounts in marketBuy functions",
+ "pr": 1162,
+ "networks": {
+ "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
+ "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
+ "4": "0xd2dbf3250a764eaaa94fa0c84ed87c0edc8ed04e",
+ "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Forwarder",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
+ "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
+ "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/README.md b/contracts/exchange-forwarder/README.md
index 2d1db92f0..3fc8c006b 100644
--- a/contracts/tokens/README.md
+++ b/contracts/exchange-forwarder/README.md
@@ -1,15 +1,14 @@
-## Token contracts
+## Exchange Forwarder
-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.
+This package contains the implementation of the [`Forwarder`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract. This contract is intended to improve the UX of interacting with the 0x [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract by abstracting user approvals, converting ETH to WETH, and paying fees. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-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:
+**Install**
-- [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.
+```bash
+npm install @0x/contracts-exchange-forwarder --save
+```
## Bug bounty
@@ -42,13 +41,13 @@ yarn install
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
+PKG=@0x/contracts-exchange-forwarder yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-tokens yarn watch
+PKG=@0x/contracts-exchange-forwarder yarn watch
```
### Clean
diff --git a/contracts/examples/compiler.json b/contracts/exchange-forwarder/compiler.json
index 7c78fba3b..e93eb4bdd 100644
--- a/contracts/examples/compiler.json
+++ b/contracts/exchange-forwarder/compiler.json
@@ -19,5 +19,5 @@
}
}
},
- "contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"]
+ "contracts": ["Forwarder"]
}
diff --git a/contracts/extensions/contracts/Forwarder/Forwarder.sol b/contracts/exchange-forwarder/contracts/src/Forwarder.sol
index 94dec40ed..94dec40ed 100644
--- a/contracts/extensions/contracts/Forwarder/Forwarder.sol
+++ b/contracts/exchange-forwarder/contracts/src/Forwarder.sol
diff --git a/contracts/extensions/contracts/Forwarder/MixinAssets.sol b/contracts/exchange-forwarder/contracts/src/MixinAssets.sol
index 116cdf267..330586ed9 100644
--- a/contracts/extensions/contracts/Forwarder/MixinAssets.sol
+++ b/contracts/exchange-forwarder/contracts/src/MixinAssets.sol
@@ -18,10 +18,10 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
-import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
-import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.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/MixinExchangeWrapper.sol b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol
index cab26741d..c970c40cf 100644
--- a/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol
+++ b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol
@@ -21,10 +21,10 @@ pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";
import "./mixins/MExchangeWrapper.sol";
-import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibAbiEncoder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
contract MixinExchangeWrapper is
diff --git a/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol
index 11c0147a5..b65e1f7ce 100644
--- a/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol
+++ b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol
@@ -24,10 +24,10 @@ import "./mixins/MWeth.sol";
import "./mixins/MAssets.sol";
import "./mixins/MExchangeWrapper.sol";
import "./interfaces/IForwarderCore.sol";
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
contract MixinForwarderCore is
diff --git a/contracts/extensions/contracts/Forwarder/MixinWeth.sol b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol
index 25a35f47b..029924019 100644
--- a/contracts/extensions/contracts/Forwarder/MixinWeth.sol
+++ b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
import "./libs/LibConstants.sol";
import "./mixins/MWeth.sol";
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol b/contracts/exchange-forwarder/contracts/src/interfaces/IAssets.sol
index cebfd3706..cebfd3706 100644
--- a/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol
+++ b/contracts/exchange-forwarder/contracts/src/interfaces/IAssets.sol
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarder.sol
index 6ce8a1d31..6ce8a1d31 100644
--- a/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol
+++ b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarder.sol
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol
index 7f62722e7..00009d3d5 100644
--- a/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol
+++ b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol
@@ -19,8 +19,8 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
contract IForwarderCore {
diff --git a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol b/contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol
index 0d2f6e36d..3ff2a03e5 100644
--- a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
+++ b/contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol
@@ -18,10 +18,10 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
-import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.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/Forwarder/libs/LibForwarderErrors.sol b/contracts/exchange-forwarder/contracts/src/libs/LibForwarderErrors.sol
index 7a95b78a0..7a95b78a0 100644
--- a/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol
+++ b/contracts/exchange-forwarder/contracts/src/libs/LibForwarderErrors.sol
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol b/contracts/exchange-forwarder/contracts/src/mixins/MAssets.sol
index 1757b37fb..1757b37fb 100644
--- a/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol
+++ b/contracts/exchange-forwarder/contracts/src/mixins/MAssets.sol
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol b/contracts/exchange-forwarder/contracts/src/mixins/MExchangeWrapper.sol
index 143f888b1..7439e8259 100644
--- a/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol
+++ b/contracts/exchange-forwarder/contracts/src/mixins/MExchangeWrapper.sol
@@ -19,8 +19,8 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
contract MExchangeWrapper {
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol b/contracts/exchange-forwarder/contracts/src/mixins/MWeth.sol
index 15d66942f..15d66942f 100644
--- a/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol
+++ b/contracts/exchange-forwarder/contracts/src/mixins/MWeth.sol
diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json
new file mode 100644
index 000000000..73a30e851
--- /dev/null
+++ b/contracts/exchange-forwarder/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "@0x/contracts-exchange-forwarder",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract extensions of 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/@(Forwarder).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/extensions/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.22",
+ "@0x/contract-wrappers": "^5.0.1",
+ "@0x/contracts-test-utils": "^2.0.1",
+ "@0x/dev-utils": "^1.0.24",
+ "@0x/sol-compiler": "^2.0.2",
+ "@0x/tslint-config": "^2.0.2",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^3.0.0",
+ "dirty-chai": "^2.0.1",
+ "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"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.13",
+ "@0x/contracts-asset-proxy": "1.0.0",
+ "@0x/contracts-exchange-libs": "1.0.0",
+ "@0x/contracts-exchange": "1.0.0",
+ "@0x/contracts-erc20": "1.0.0",
+ "@0x/contracts-erc721": "1.0.0",
+ "@0x/contracts-utils": "3.0.0",
+ "@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",
+ "ethereum-types": "^1.1.6",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/exchange-forwarder/src/artifacts/index.ts b/contracts/exchange-forwarder/src/artifacts/index.ts
new file mode 100644
index 000000000..f15dac49a
--- /dev/null
+++ b/contracts/exchange-forwarder/src/artifacts/index.ts
@@ -0,0 +1,7 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as Forwarder from '../../generated-artifacts/Forwarder.json';
+
+export const artifacts = {
+ Forwarder: Forwarder as ContractArtifact,
+};
diff --git a/contracts/interfaces/src/index.ts b/contracts/exchange-forwarder/src/index.ts
index d55f08ea2..ba813e7ca 100644
--- a/contracts/interfaces/src/index.ts
+++ b/contracts/exchange-forwarder/src/index.ts
@@ -1,2 +1,3 @@
export * from './artifacts';
export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/exchange-forwarder/src/wrappers/index.ts b/contracts/exchange-forwarder/src/wrappers/index.ts
new file mode 100644
index 000000000..89dff9e74
--- /dev/null
+++ b/contracts/exchange-forwarder/src/wrappers/index.ts
@@ -0,0 +1 @@
+export * from '../../generated-wrappers/forwarder';
diff --git a/contracts/extensions/test/extensions/forwarder.ts b/contracts/exchange-forwarder/test/forwarder.ts
index 69939ed04..24c219563 100644
--- a/contracts/extensions/test/extensions/forwarder.ts
+++ b/contracts/exchange-forwarder/test/forwarder.ts
@@ -1,10 +1,7 @@
-import {
- artifacts as protocolArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-protocol';
+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,14 +88,14 @@ 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);
wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
@@ -178,7 +166,7 @@ describe(ContractName.Forwarder, () => {
describe('constructor', () => {
it('should revert if assetProxy is unregistered', async () => {
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/exchange-forwarder/test/global_hooks.ts b/contracts/exchange-forwarder/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/exchange-forwarder/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/extensions/test/utils/forwarder_wrapper.ts b/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts
index 4a43be04a..207106852 100644
--- a/contracts/extensions/test/utils/forwarder_wrapper.ts
+++ b/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts
@@ -1,6 +1,7 @@
-import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
+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,8 +63,9 @@ export class ForwarderWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
- ...protocolArtifacts,
+ ...erc20Artifacts,
+ ...erc721Artifacts,
+ ...exchangeArtifacts,
});
}
public async marketSellOrdersWithEthAsync(
diff --git a/contracts/exchange-forwarder/test/utils/index.ts b/contracts/exchange-forwarder/test/utils/index.ts
new file mode 100644
index 000000000..d290ec75d
--- /dev/null
+++ b/contracts/exchange-forwarder/test/utils/index.ts
@@ -0,0 +1 @@
+export * from './forwarder_wrapper';
diff --git a/contracts/examples/tsconfig.json b/contracts/exchange-forwarder/tsconfig.json
index 63245da1e..cd80b5a5f 100644
--- a/contracts/examples/tsconfig.json
+++ b/contracts/exchange-forwarder/tsconfig.json
@@ -6,11 +6,6 @@
"resolveJsonModule": true
},
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
- "files": [
- "./generated-artifacts/ExchangeWrapper.json",
- "./generated-artifacts/Validator.json",
- "./generated-artifacts/Wallet.json",
- "./generated-artifacts/Whitelist.json"
- ],
+ "files": ["./generated-artifacts/Forwarder.json"],
"exclude": ["./deploy/solc/solc_bin"]
}
diff --git a/contracts/protocol/tslint.json b/contracts/exchange-forwarder/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/protocol/tslint.json
+++ b/contracts/exchange-forwarder/tslint.json
diff --git a/contracts/exchange-libs/CHANGELOG.json b/contracts/exchange-libs/CHANGELOG.json
new file mode 100644
index 000000000..cdaac93ea
--- /dev/null
+++ b/contracts/exchange-libs/CHANGELOG.json
@@ -0,0 +1,15 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Rename contracts-libs to contracts-exchange-libs",
+ "pr": 1539
+ },
+ {
+ "note": "Move LibAddressArray contract to contracts-utils",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/libs/CHANGELOG.md b/contracts/exchange-libs/CHANGELOG.md
index 59d0804da..59d0804da 100644
--- a/contracts/libs/CHANGELOG.md
+++ b/contracts/exchange-libs/CHANGELOG.md
diff --git a/contracts/examples/README.md b/contracts/exchange-libs/README.md
index ca23d0974..696fb7f11 100644
--- a/contracts/examples/README.md
+++ b/contracts/exchange-libs/README.md
@@ -1,11 +1,14 @@
-## Contract examples
+## Exchange Libraries
-Example smart contracts that interact with 0x protocol.
+This package contains the implementations of various libraries and utilities used within the [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract. These libraries may be useful when creating external contracts that interact with the `Exchange` contract. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-Contracts can be found in the [contracts](./contracts) directory.
-This package 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.
+**Install**
+
+```bash
+npm install @0x/contracts-exchange-libs --save
+```
## Contributing
@@ -34,13 +37,13 @@ yarn install
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-examples yarn build
+PKG=@0x/contracts-exchange-libs yarn build
```
Or continuously rebuild on change:
```bash
-PKG=@0x/contracts-examples yarn watch
+PKG=@0x/contracts-exchange-libs yarn watch
```
### Clean
@@ -54,3 +57,13 @@ yarn clean
```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/libs/compiler.json b/contracts/exchange-libs/compiler.json
index c4f0c6bd9..c4f0c6bd9 100644
--- a/contracts/libs/compiler.json
+++ b/contracts/exchange-libs/compiler.json
diff --git a/contracts/libs/contracts/libs/LibAbiEncoder.sol b/contracts/exchange-libs/contracts/src/LibAbiEncoder.sol
index 5422bfeec..5422bfeec 100644
--- a/contracts/libs/contracts/libs/LibAbiEncoder.sol
+++ b/contracts/exchange-libs/contracts/src/LibAbiEncoder.sol
diff --git a/contracts/libs/contracts/libs/LibAssetProxyErrors.sol b/contracts/exchange-libs/contracts/src/LibAssetProxyErrors.sol
index 96c48b5e3..96c48b5e3 100644
--- a/contracts/libs/contracts/libs/LibAssetProxyErrors.sol
+++ b/contracts/exchange-libs/contracts/src/LibAssetProxyErrors.sol
diff --git a/contracts/libs/contracts/libs/LibConstants.sol b/contracts/exchange-libs/contracts/src/LibConstants.sol
index 3efa3e1b3..3efa3e1b3 100644
--- a/contracts/libs/contracts/libs/LibConstants.sol
+++ b/contracts/exchange-libs/contracts/src/LibConstants.sol
diff --git a/contracts/libs/contracts/libs/LibEIP712.sol b/contracts/exchange-libs/contracts/src/LibEIP712.sol
index 3a85ab3c0..3a85ab3c0 100644
--- a/contracts/libs/contracts/libs/LibEIP712.sol
+++ b/contracts/exchange-libs/contracts/src/LibEIP712.sol
diff --git a/contracts/libs/contracts/libs/LibExchangeErrors.sol b/contracts/exchange-libs/contracts/src/LibExchangeErrors.sol
index a160242c9..a160242c9 100644
--- a/contracts/libs/contracts/libs/LibExchangeErrors.sol
+++ b/contracts/exchange-libs/contracts/src/LibExchangeErrors.sol
diff --git a/contracts/libs/contracts/libs/LibExchangeSelectors.sol b/contracts/exchange-libs/contracts/src/LibExchangeSelectors.sol
index 71640c609..71640c609 100644
--- a/contracts/libs/contracts/libs/LibExchangeSelectors.sol
+++ b/contracts/exchange-libs/contracts/src/LibExchangeSelectors.sol
diff --git a/contracts/libs/contracts/libs/LibFillResults.sol b/contracts/exchange-libs/contracts/src/LibFillResults.sol
index 74b7f7984..08a1649b8 100644
--- a/contracts/libs/contracts/libs/LibFillResults.sol
+++ b/contracts/exchange-libs/contracts/src/LibFillResults.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+import "@0x/contracts-utils/contracts/src/SafeMath.sol";
contract LibFillResults is
diff --git a/contracts/libs/contracts/libs/LibMath.sol b/contracts/exchange-libs/contracts/src/LibMath.sol
index f14b1b34d..24ea90c6b 100644
--- a/contracts/libs/contracts/libs/LibMath.sol
+++ b/contracts/exchange-libs/contracts/src/LibMath.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+import "@0x/contracts-utils/contracts/src/SafeMath.sol";
contract LibMath is
diff --git a/contracts/libs/contracts/libs/LibOrder.sol b/contracts/exchange-libs/contracts/src/LibOrder.sol
index fcf5da5fb..fcf5da5fb 100644
--- a/contracts/libs/contracts/libs/LibOrder.sol
+++ b/contracts/exchange-libs/contracts/src/LibOrder.sol
diff --git a/contracts/libs/contracts/test/TestLibs/TestLibs.sol b/contracts/exchange-libs/contracts/test/TestLibs.sol
index bd5f9f9da..751a3773e 100644
--- a/contracts/libs/contracts/test/TestLibs/TestLibs.sol
+++ b/contracts/exchange-libs/contracts/test/TestLibs.sol
@@ -19,10 +19,10 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../libs/LibMath.sol";
-import "../../libs/LibOrder.sol";
-import "../../libs/LibFillResults.sol";
-import "../../libs/LibAbiEncoder.sol";
+import "../src/LibMath.sol";
+import "../src/LibOrder.sol";
+import "../src/LibFillResults.sol";
+import "../src/LibAbiEncoder.sol";
contract TestLibs is
diff --git a/contracts/libs/package.json b/contracts/exchange-libs/package.json
index b28ec3774..f3efdd00e 100644
--- a/contracts/libs/package.json
+++ b/contracts/exchange-libs/package.json
@@ -1,6 +1,6 @@
{
- "name": "@0x/contracts-libs",
- "version": "1.0.6",
+ "name": "@0x/contracts-exchange-libs",
+ "version": "1.0.0",
"engines": {
"node": ">=6.12"
},
@@ -48,39 +48,30 @@
"@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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-multisig": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
+ "@0x/contracts-utils": "3.0.0",
"@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": {
diff --git a/contracts/libs/src/artifacts/index.ts b/contracts/exchange-libs/src/artifacts/index.ts
index 3955bbe2b..3955bbe2b 100644
--- a/contracts/libs/src/artifacts/index.ts
+++ b/contracts/exchange-libs/src/artifacts/index.ts
diff --git a/contracts/examples/src/index.ts b/contracts/exchange-libs/src/index.ts
index d55f08ea2..d55f08ea2 100644
--- a/contracts/examples/src/index.ts
+++ b/contracts/exchange-libs/src/index.ts
diff --git a/contracts/libs/src/wrappers/index.ts b/contracts/exchange-libs/src/wrappers/index.ts
index baaae6e34..baaae6e34 100644
--- a/contracts/libs/src/wrappers/index.ts
+++ b/contracts/exchange-libs/src/wrappers/index.ts
diff --git a/contracts/libs/test/exchange/libs.ts b/contracts/exchange-libs/test/exchange_libs.ts
index 44ff6a844..b61323189 100644
--- a/contracts/libs/test/exchange/libs.ts
+++ b/contracts/exchange-libs/test/exchange_libs.ts
@@ -13,8 +13,8 @@ import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
-import { TestLibsContract } from '../../generated-wrappers/test_libs';
-import { artifacts } from '../../src/artifacts';
+import { TestLibsContract } from '../generated-wrappers/test_libs';
+import { artifacts } from '../src/artifacts';
chaiSetup.configure();
const expect = chai.expect;
diff --git a/contracts/exchange-libs/test/global_hooks.ts b/contracts/exchange-libs/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/exchange-libs/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/libs/tsconfig.json b/contracts/exchange-libs/tsconfig.json
index 27ca35085..27ca35085 100644
--- a/contracts/libs/tsconfig.json
+++ b/contracts/exchange-libs/tsconfig.json
diff --git a/contracts/tokens/tslint.json b/contracts/exchange-libs/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/contracts/tokens/tslint.json
+++ b/contracts/exchange-libs/tslint.json
diff --git a/contracts/exchange/CHANGELOG.json b/contracts/exchange/CHANGELOG.json
new file mode 100644
index 000000000..e4c7aa986
--- /dev/null
+++ b/contracts/exchange/CHANGELOG.json
@@ -0,0 +1,15 @@
+[
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Move Exchange contract out of contracts-protocol to new package",
+ "pr": 1539
+ },
+ {
+ "note": "Move example contracts out of contracts-examples to new package",
+ "pr": 1539
+ }
+ ]
+ }
+]
diff --git a/contracts/exchange/CHANGELOG.md b/contracts/exchange/CHANGELOG.md
new file mode 100644
index 000000000..779eb68a7
--- /dev/null
+++ b/contracts/exchange/CHANGELOG.md
@@ -0,0 +1,28 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v2.2.3 - _January 17, 2019_
+
+ * Dependencies updated
+
+## v2.2.2 - _January 15, 2019_
+
+ * Dependencies updated
+
+## v2.2.1 - _January 11, 2019_
+
+ * Dependencies updated
+
+## v2.2.0 - _January 9, 2019_
+
+ * Added LibAddressArray (#1383)
+ * Add validation and comments to MultiAssetProxy (#1455)
+ * Move OrderValidator to extensions (#1464)
+
+## v2.1.59 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/exchange/DEPLOYS.json b/contracts/exchange/DEPLOYS.json
new file mode 100644
index 000000000..1e110d4f7
--- /dev/null
+++ b/contracts/exchange/DEPLOYS.json
@@ -0,0 +1,17 @@
+[
+ {
+ "name": "Exchange",
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
+ "3": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf",
+ "4": "0x22ebc052f43a88efa06379426120718170f2204e",
+ "42": "0x35dd2932454449b14cee11a94d3674a936d5d7b2"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/exchange/README.md b/contracts/exchange/README.md
new file mode 100644
index 000000000..41997f84d
--- /dev/null
+++ b/contracts/exchange/README.md
@@ -0,0 +1,73 @@
+## Exchange
+
+This package contains the implementation of the [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange). This contract is responsible for settling trades and is typically the entry point for all transactions that interact with the 0x protocol. Lightweight examples of how external contracts can interct with the `Exchange` contract can be found in the [examples](./contracts/examples) directory. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
+
+## Installation
+
+**Install**
+
+```bash
+npm install @0x/contracts-exchange --save
+```
+
+## 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-exchange yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-exchange 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/interfaces/compiler.json b/contracts/exchange/compiler.json
index ab3bc1078..6a5f666d1 100644
--- a/contracts/interfaces/compiler.json
+++ b/contracts/exchange/compiler.json
@@ -20,9 +20,7 @@
}
},
"contracts": [
- "IAssetData",
- "IAssetProxy",
- "IAuthorizable",
+ "Exchange",
"IAssetProxyDispatcher",
"IExchange",
"IExchangeCore",
@@ -31,6 +29,14 @@
"ITransactions",
"IValidator",
"IWallet",
- "IWrapperFunctions"
+ "IWrapperFunctions",
+ "TestAssetProxyDispatcher",
+ "TestExchangeInternals",
+ "TestSignatureValidator",
+ "TestStaticCallReceiver",
+ "ExchangeWrapper",
+ "Validator",
+ "Wallet",
+ "Whitelist"
]
}
diff --git a/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol b/contracts/exchange/contracts/examples/ExchangeWrapper.sol
index d98136922..604f614b5 100644
--- a/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol
+++ b/contracts/exchange/contracts/examples/ExchangeWrapper.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "../src/interfaces/IExchange.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
contract ExchangeWrapper {
diff --git a/contracts/examples/contracts/Validator/Validator.sol b/contracts/exchange/contracts/examples/Validator.sol
index e488a9ca7..98a10d37f 100644
--- a/contracts/examples/contracts/Validator/Validator.sol
+++ b/contracts/exchange/contracts/examples/Validator.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
+import "../src/interfaces/IValidator.sol";
contract Validator is
diff --git a/contracts/examples/contracts/Wallet/Wallet.sol b/contracts/exchange/contracts/examples/Wallet.sol
index 8edc74eb3..17e3dd5cc 100644
--- a/contracts/examples/contracts/Wallet/Wallet.sol
+++ b/contracts/exchange/contracts/examples/Wallet.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "../src/interfaces/IWallet.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
contract Wallet is
diff --git a/contracts/examples/contracts/Whitelist/Whitelist.sol b/contracts/exchange/contracts/examples/Whitelist.sol
index 2a3d33738..a9db1bb82 100644
--- a/contracts/examples/contracts/Whitelist/Whitelist.sol
+++ b/contracts/exchange/contracts/examples/Whitelist.sol
@@ -19,9 +19,9 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "../src/interfaces/IExchange.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
contract Whitelist is
diff --git a/contracts/protocol/contracts/protocol/Exchange/Exchange.sol b/contracts/exchange/contracts/src/Exchange.sol
index 65ca742ea..541750518 100644
--- a/contracts/protocol/contracts/protocol/Exchange/Exchange.sol
+++ b/contracts/exchange/contracts/src/Exchange.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibConstants.sol";
import "./MixinExchangeCore.sol";
import "./MixinSignatureValidator.sol";
import "./MixinWrapperFunctions.sol";
diff --git a/contracts/exchange/contracts/src/MixinAssetProxyDispatcher.sol b/contracts/exchange/contracts/src/MixinAssetProxyDispatcher.sol
new file mode 100644
index 000000000..c55d6aaec
--- /dev/null
+++ b/contracts/exchange/contracts/src/MixinAssetProxyDispatcher.sol
@@ -0,0 +1,174 @@
+/*
+
+ 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.24;
+
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
+import "./mixins/MAssetProxyDispatcher.sol";
+import "@0x/contracts-asset-proxy/contracts/src/interfaces/IAssetProxy.sol";
+
+
+contract MixinAssetProxyDispatcher is
+ Ownable,
+ MAssetProxyDispatcher
+{
+ // Mapping from Asset Proxy Id's to their respective Asset Proxy
+ mapping (bytes4 => IAssetProxy) public assetProxies;
+
+ /// @dev Registers an asset proxy to its asset proxy id.
+ /// Once an asset proxy is registered, it cannot be unregistered.
+ /// @param assetProxy Address of new asset proxy to register.
+ function registerAssetProxy(address assetProxy)
+ external
+ onlyOwner
+ {
+ IAssetProxy assetProxyContract = IAssetProxy(assetProxy);
+
+ // Ensure that no asset proxy exists with current id.
+ bytes4 assetProxyId = assetProxyContract.getProxyId();
+ address currentAssetProxy = assetProxies[assetProxyId];
+ require(
+ currentAssetProxy == address(0),
+ "ASSET_PROXY_ALREADY_EXISTS"
+ );
+
+ // Add asset proxy and log registration.
+ assetProxies[assetProxyId] = assetProxyContract;
+ emit AssetProxyRegistered(
+ assetProxyId,
+ assetProxy
+ );
+ }
+
+ /// @dev Gets an asset proxy.
+ /// @param assetProxyId Id of the asset proxy.
+ /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
+ function getAssetProxy(bytes4 assetProxyId)
+ external
+ view
+ returns (address)
+ {
+ return assetProxies[assetProxyId];
+ }
+
+ /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
+ /// @param assetData Byte array encoded for the asset.
+ /// @param from Address to transfer token from.
+ /// @param to Address to transfer token to.
+ /// @param amount Amount of token to transfer.
+ function dispatchTransferFrom(
+ bytes memory assetData,
+ address from,
+ address to,
+ uint256 amount
+ )
+ internal
+ {
+ // Do nothing if no amount should be transferred.
+ if (amount > 0 && from != to) {
+ // Ensure assetData length is valid
+ require(
+ assetData.length > 3,
+ "LENGTH_GREATER_THAN_3_REQUIRED"
+ );
+
+ // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.
+ bytes4 assetProxyId;
+ assembly {
+ assetProxyId := and(mload(
+ add(assetData, 32)),
+ 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000
+ )
+ }
+ address assetProxy = assetProxies[assetProxyId];
+
+ // Ensure that assetProxy exists
+ require(
+ assetProxy != address(0),
+ "ASSET_PROXY_DOES_NOT_EXIST"
+ );
+
+ // We construct calldata for the `assetProxy.transferFrom` ABI.
+ // The layout of this calldata is in the table below.
+ //
+ // | Area | Offset | Length | Contents |
+ // | -------- |--------|---------|-------------------------------------------- |
+ // | Header | 0 | 4 | function selector |
+ // | Params | | 4 * 32 | function parameters: |
+ // | | 4 | | 1. offset to assetData (*) |
+ // | | 36 | | 2. from |
+ // | | 68 | | 3. to |
+ // | | 100 | | 4. amount |
+ // | Data | | | assetData: |
+ // | | 132 | 32 | assetData Length |
+ // | | 164 | ** | assetData Contents |
+
+ assembly {
+ /////// Setup State ///////
+ // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).
+ let cdStart := mload(64)
+ // `dataAreaLength` is the total number of words needed to store `assetData`
+ // As-per the ABI spec, this value is padded up to the nearest multiple of 32,
+ // and includes 32-bytes for length.
+ let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)
+ // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.
+ let cdEnd := add(cdStart, add(132, dataAreaLength))
+
+
+ /////// Setup Header Area ///////
+ // This area holds the 4-byte `transferFromSelector`.
+ // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4
+ mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)
+
+ /////// Setup Params Area ///////
+ // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.
+ // Notes:
+ // 1. The offset to `assetData` is the length of the Params Area (128 bytes).
+ // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.
+ mstore(add(cdStart, 4), 128)
+ mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))
+ mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))
+ mstore(add(cdStart, 100), amount)
+
+ /////// Setup Data Area ///////
+ // This area holds `assetData`.
+ let dataArea := add(cdStart, 132)
+ // solhint-disable-next-line no-empty-blocks
+ for {} lt(dataArea, cdEnd) {} {
+ mstore(dataArea, mload(assetData))
+ dataArea := add(dataArea, 32)
+ assetData := add(assetData, 32)
+ }
+
+ /////// Call `assetProxy.transferFrom` using the constructed calldata ///////
+ let success := call(
+ gas, // forward all gas
+ assetProxy, // call address of asset proxy
+ 0, // don't send any ETH
+ cdStart, // pointer to start of input
+ sub(cdEnd, cdStart), // length of input
+ cdStart, // write output over input
+ 512 // reserve 512 bytes for output
+ )
+ if iszero(success) {
+ revert(cdStart, returndatasize())
+ }
+ }
+ }
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol b/contracts/exchange/contracts/src/MixinExchangeCore.sol
index 72bcebc62..2e4f717c9 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol
+++ b/contracts/exchange/contracts/src/MixinExchangeCore.sol
@@ -19,11 +19,11 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-utils/contracts/src/ReentrancyGuard.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibConstants.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol b/contracts/exchange/contracts/src/MixinMatchOrders.sol
index 2627b82fd..e84842793 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol
+++ b/contracts/exchange/contracts/src/MixinMatchOrders.sol
@@ -14,11 +14,11 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-utils/contracts/src/ReentrancyGuard.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibConstants.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MMatchOrders.sol";
import "./mixins/MTransactions.sol";
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol b/contracts/exchange/contracts/src/MixinSignatureValidator.sol
index b40aa1412..421ec666a 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol
+++ b/contracts/exchange/contracts/src/MixinSignatureValidator.sol
@@ -18,12 +18,12 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "@0x/contracts-utils/contracts/src/ReentrancyGuard.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
+import "./interfaces/IWallet.sol";
+import "./interfaces/IValidator.sol";
contract MixinSignatureValidator is
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol b/contracts/exchange/contracts/src/MixinTransactions.sol
index 1ac5b1a5e..6b9b06b0d 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol
+++ b/contracts/exchange/contracts/src/MixinTransactions.sol
@@ -17,10 +17,10 @@
*/
pragma solidity ^0.4.24;
-import "@0x/contracts-libs/contracts/libs/LibExchangeErrors.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibExchangeErrors.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
-import "@0x/contracts-libs/contracts/libs/LibEIP712.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibEIP712.sol";
contract MixinTransactions is
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/contracts/exchange/contracts/src/MixinWrapperFunctions.sol
index 6fc6ee999..911107422 100644
--- a/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/contracts/exchange/contracts/src/MixinWrapperFunctions.sol
@@ -19,11 +19,11 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "@0x/contracts-libs/contracts/libs/LibMath.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
+import "@0x/contracts-utils/contracts/src/ReentrancyGuard.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibMath.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibAbiEncoder.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MWrapperFunctions.sol";
diff --git a/contracts/exchange/contracts/src/interfaces/IAssetProxyDispatcher.sol b/contracts/exchange/contracts/src/interfaces/IAssetProxyDispatcher.sol
new file mode 100644
index 000000000..b73881c07
--- /dev/null
+++ b/contracts/exchange/contracts/src/interfaces/IAssetProxyDispatcher.sol
@@ -0,0 +1,37 @@
+/*
+
+ 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.24;
+
+
+contract IAssetProxyDispatcher {
+
+ /// @dev Registers an asset proxy to its asset proxy id.
+ /// Once an asset proxy is registered, it cannot be unregistered.
+ /// @param assetProxy Address of new asset proxy to register.
+ function registerAssetProxy(address assetProxy)
+ external;
+
+ /// @dev Gets an asset proxy.
+ /// @param assetProxyId Id of the asset proxy.
+ /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
+ function getAssetProxy(bytes4 assetProxyId)
+ external
+ view
+ returns (address);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol b/contracts/exchange/contracts/src/interfaces/IExchange.sol
index 866e4c194..866e4c194 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol
+++ b/contracts/exchange/contracts/src/interfaces/IExchange.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol b/contracts/exchange/contracts/src/interfaces/IExchangeCore.sol
index ab4a62408..f87abb2ad 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol
+++ b/contracts/exchange/contracts/src/interfaces/IExchangeCore.sol
@@ -19,8 +19,8 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
contract IExchangeCore {
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol b/contracts/exchange/contracts/src/interfaces/IMatchOrders.sol
index 5df46ea80..fba1da6d9 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol
+++ b/contracts/exchange/contracts/src/interfaces/IMatchOrders.sol
@@ -18,8 +18,8 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
contract IMatchOrders {
diff --git a/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol b/contracts/exchange/contracts/src/interfaces/ISignatureValidator.sol
index c5a4a57e1..c5a4a57e1 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol
+++ b/contracts/exchange/contracts/src/interfaces/ISignatureValidator.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol b/contracts/exchange/contracts/src/interfaces/ITransactions.sol
index aaaee389f..aaaee389f 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol
+++ b/contracts/exchange/contracts/src/interfaces/ITransactions.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol b/contracts/exchange/contracts/src/interfaces/IValidator.sol
index d214e54dd..d214e54dd 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol
+++ b/contracts/exchange/contracts/src/interfaces/IValidator.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol b/contracts/exchange/contracts/src/interfaces/IWallet.sol
index c2db4a5b1..c2db4a5b1 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol
+++ b/contracts/exchange/contracts/src/interfaces/IWallet.sol
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol b/contracts/exchange/contracts/src/interfaces/IWrapperFunctions.sol
index 0eeaa874b..b1afc8895 100644
--- a/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol
+++ b/contracts/exchange/contracts/src/interfaces/IWrapperFunctions.sol
@@ -19,8 +19,8 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
contract IWrapperFunctions {
diff --git a/contracts/exchange/contracts/src/mixins/MAssetProxyDispatcher.sol b/contracts/exchange/contracts/src/mixins/MAssetProxyDispatcher.sol
new file mode 100644
index 000000000..0ae555dda
--- /dev/null
+++ b/contracts/exchange/contracts/src/mixins/MAssetProxyDispatcher.sol
@@ -0,0 +1,45 @@
+/*
+
+ 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.24;
+
+import "../interfaces/IAssetProxyDispatcher.sol";
+
+
+contract MAssetProxyDispatcher is
+ IAssetProxyDispatcher
+{
+ // Logs registration of new asset proxy
+ event AssetProxyRegistered(
+ bytes4 id, // Id of new registered AssetProxy.
+ address assetProxy // Address of new registered AssetProxy.
+ );
+
+ /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
+ /// @param assetData Byte array encoded for the asset.
+ /// @param from Address to transfer token from.
+ /// @param to Address to transfer token to.
+ /// @param amount Amount of token to transfer.
+ function dispatchTransferFrom(
+ bytes memory assetData,
+ address from,
+ address to,
+ uint256 amount
+ )
+ internal;
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/contracts/exchange/contracts/src/mixins/MExchangeCore.sol
index 09dc491cd..b5a9c660b 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/contracts/exchange/contracts/src/mixins/MExchangeCore.sol
@@ -19,9 +19,9 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchangeCore.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "../interfaces/IExchangeCore.sol";
contract MExchangeCore is
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/contracts/exchange/contracts/src/mixins/MMatchOrders.sol
index 56ee895c4..3dcc9f31b 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol
+++ b/contracts/exchange/contracts/src/mixins/MMatchOrders.sol
@@ -18,9 +18,9 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IMatchOrders.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "../interfaces/IMatchOrders.sol";
contract MMatchOrders is
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol b/contracts/exchange/contracts/src/mixins/MSignatureValidator.sol
index 6407760d4..c39e84e08 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
+++ b/contracts/exchange/contracts/src/mixins/MSignatureValidator.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/ISignatureValidator.sol";
+import "../interfaces/ISignatureValidator.sol";
contract MSignatureValidator is
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol b/contracts/exchange/contracts/src/mixins/MTransactions.sol
index 04dd716d7..04a25ccf3 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol
+++ b/contracts/exchange/contracts/src/mixins/MTransactions.sol
@@ -17,7 +17,7 @@
*/
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/ITransactions.sol";
+import "../interfaces/ITransactions.sol";
contract MTransactions is
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/contracts/exchange/contracts/src/mixins/MWrapperFunctions.sol
index 2ff3b8790..df50c6a8e 100644
--- a/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
+++ b/contracts/exchange/contracts/src/mixins/MWrapperFunctions.sol
@@ -19,9 +19,9 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "../interfaces/IWrapperFunctions.sol";
contract MWrapperFunctions is
diff --git a/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/contracts/exchange/contracts/test/TestAssetProxyDispatcher.sol
index ad71fc9a1..88155c6ee 100644
--- a/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ b/contracts/exchange/contracts/test/TestAssetProxyDispatcher.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../protocol/Exchange/MixinAssetProxyDispatcher.sol";
+import "../src/MixinAssetProxyDispatcher.sol";
contract TestAssetProxyDispatcher is
diff --git a/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol b/contracts/exchange/contracts/test/TestExchangeInternals.sol
index 27187f8f8..dce8e03c0 100644
--- a/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
+++ b/contracts/exchange/contracts/test/TestExchangeInternals.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/Exchange.sol";
+import "../src/Exchange.sol";
// solhint-disable no-empty-blocks
diff --git a/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol b/contracts/exchange/contracts/test/TestSignatureValidator.sol
index ea3e2de59..2f9523666 100644
--- a/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
+++ b/contracts/exchange/contracts/test/TestSignatureValidator.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
-import "../../protocol/Exchange/MixinSignatureValidator.sol";
-import "../../protocol/Exchange/MixinTransactions.sol";
+import "../src/MixinSignatureValidator.sol";
+import "../src/MixinTransactions.sol";
contract TestSignatureValidator is
diff --git a/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/contracts/exchange/contracts/test/TestStaticCallReceiver.sol
index d08da7303..23e60b387 100644
--- a/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
+++ b/contracts/exchange/contracts/test/TestStaticCallReceiver.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-erc20/contracts/src/interfaces/IERC20Token.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/protocol/package.json b/contracts/exchange/package.json
index d1ef70a70..a11767626 100644
--- a/contracts/protocol/package.json
+++ b/contracts/exchange/package.json
@@ -1,6 +1,6 @@
{
- "name": "@0x/contracts-protocol",
- "version": "2.2.3",
+ "name": "@0x/contracts-exchange",
+ "version": "1.0.0",
"engines": {
"node": ">=6.12"
},
@@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json"
+ "abis": "generated-artifacts/@(ERC20Proxy|ERC721Proxy|Exchange|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IWrapperFunctions|IValidator|IWallet|MixinAuthorizable|MultiAssetProxy|TestSignatureValidator|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver|ExchangeWrapper|Validator|Wallet|Whitelist).json"
},
"repository": {
"type": "git",
@@ -47,42 +47,34 @@
"@0x/abi-gen": "^1.0.22",
"@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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-examples": "^1.0.6",
- "@0x/contracts-interfaces": "^1.0.6",
- "@0x/contracts-libs": "^1.0.6",
- "@0x/contracts-multisig": "^1.0.6",
+ "@0x/contracts-asset-proxy": "1.0.0",
+ "@0x/contracts-exchange-libs": "1.0.0",
"@0x/contracts-test-utils": "^2.0.1",
- "@0x/contracts-tokens": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
+ "@0x/contracts-erc20": "1.0.0",
+ "@0x/contracts-erc721": "1.0.0",
+ "@0x/contracts-utils": "3.0.0",
"@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"
diff --git a/contracts/interfaces/src/artifacts/index.ts b/contracts/exchange/src/artifacts/index.ts
index 5a2a37d8a..798ff17ab 100644
--- a/contracts/interfaces/src/artifacts/index.ts
+++ b/contracts/exchange/src/artifacts/index.ts
@@ -1,9 +1,8 @@
import { ContractArtifact } from 'ethereum-types';
-import * as IAssetData from '../../generated-artifacts/IAssetData.json';
-import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
+import * as Exchange from '../../generated-artifacts/Exchange.json';
+import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
import * as IAssetProxyDispatcher from '../../generated-artifacts/IAssetProxyDispatcher.json';
-import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
import * as IExchange from '../../generated-artifacts/IExchange.json';
import * as IExchangeCore from '../../generated-artifacts/IExchangeCore.json';
import * as IMatchOrders from '../../generated-artifacts/IMatchOrders.json';
@@ -12,18 +11,31 @@ import * as ITransactions from '../../generated-artifacts/ITransactions.json';
import * as IValidator from '../../generated-artifacts/IValidator.json';
import * as IWallet from '../../generated-artifacts/IWallet.json';
import * as IWrapperFunctions from '../../generated-artifacts/IWrapperFunctions.json';
+import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
+import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
+import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
+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 Whitelist from '../../generated-artifacts/Whitelist.json';
export const artifacts = {
- IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
- IAuthorizable: IAuthorizable as ContractArtifact,
+ Exchange: Exchange as ContractArtifact,
+ TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
+ TestExchangeInternals: TestExchangeInternals as ContractArtifact,
+ TestSignatureValidator: TestSignatureValidator as ContractArtifact,
+ TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
IExchange: IExchange as ContractArtifact,
IExchangeCore: IExchangeCore as ContractArtifact,
IMatchOrders: IMatchOrders as ContractArtifact,
ISignatureValidator: ISignatureValidator as ContractArtifact,
ITransactions: ITransactions as ContractArtifact,
IWrapperFunctions: IWrapperFunctions as ContractArtifact,
- IAssetData: IAssetData as ContractArtifact,
- IAssetProxy: IAssetProxy as ContractArtifact,
+ IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
IValidator: IValidator as ContractArtifact,
IWallet: IWallet as ContractArtifact,
+ ExchangeWrapper: ExchangeWrapper as ContractArtifact,
+ Validator: Validator as ContractArtifact,
+ Wallet: Wallet as ContractArtifact,
+ Whitelist: Whitelist as ContractArtifact,
};
diff --git a/contracts/exchange/src/index.ts b/contracts/exchange/src/index.ts
new file mode 100644
index 000000000..ba813e7ca
--- /dev/null
+++ b/contracts/exchange/src/index.ts
@@ -0,0 +1,3 @@
+export * from './artifacts';
+export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/exchange/src/wrappers/index.ts b/contracts/exchange/src/wrappers/index.ts
new file mode 100644
index 000000000..86e939b56
--- /dev/null
+++ b/contracts/exchange/src/wrappers/index.ts
@@ -0,0 +1,18 @@
+export * from '../../generated-wrappers/exchange';
+export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/test_exchange_internals';
+export * from '../../generated-wrappers/test_signature_validator';
+export * from '../../generated-wrappers/test_static_call_receiver';
+export * from '../../generated-wrappers/i_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/i_exchange';
+export * from '../../generated-wrappers/i_exchange_core';
+export * from '../../generated-wrappers/i_match_orders';
+export * from '../../generated-wrappers/i_signature_validator';
+export * from '../../generated-wrappers/i_transactions';
+export * from '../../generated-wrappers/i_wrapper_functions';
+export * from '../../generated-wrappers/i_validator';
+export * from '../../generated-wrappers/i_wallet';
+export * from '../../generated-wrappers/exchange_wrapper';
+export * from '../../generated-wrappers/validator';
+export * from '../../generated-wrappers/wallet';
+export * from '../../generated-wrappers/whitelist';
diff --git a/contracts/protocol/test/exchange/core.ts b/contracts/exchange/test/core.ts
index f88be1c94..74161cc73 100644
--- a/contracts/protocol/test/exchange/core.ts
+++ b/contracts/exchange/test/core.ts
@@ -1,4 +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,
@@ -11,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';
@@ -29,15 +37,13 @@ import { LogWithDecodedArgs } from 'ethereum-types';
import ethUtil = require('ethereumjs-util');
import * as _ from 'lodash';
-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 { 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;
@@ -92,7 +98,7 @@ describe('Exchange core', () => {
erc20Proxy = await erc20Wrapper.deployProxyAsync();
erc721Proxy = await erc721Wrapper.deployProxyAsync();
multiAssetProxy = await MultiAssetProxyContract.deployFrom0xArtifactAsync(
- artifacts.MultiAssetProxy,
+ proxyArtifacts.MultiAssetProxy,
provider,
txDefaults,
);
@@ -114,7 +120,7 @@ describe('Exchange core', () => {
txDefaults,
);
reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- tokensArtifacts.ReentrantERC20Token,
+ erc20Artifacts.ReentrantERC20Token,
provider,
txDefaults,
exchange.address,
@@ -339,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/protocol/test/exchange/dispatcher.ts b/contracts/exchange/test/dispatcher.ts
index eca1b38f1..a25755936 100644
--- a/contracts/protocol/test/exchange/dispatcher.ts
+++ b/contracts/exchange/test/dispatcher.ts
@@ -1,4 +1,12 @@
import {
+ artifacts as proxyArtifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ERC721Wrapper,
+} from '@0x/contracts-asset-proxy';
+import { DummyERC20TokenContract } from '@0x/contracts-erc20';
+import {
chaiSetup,
constants,
expectTransactionFailedAsync,
@@ -7,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';
@@ -16,15 +23,11 @@ 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 {
+ 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;
@@ -128,7 +131,7 @@ describe('AssetProxyDispatcher', () => {
expect(proxyAddress).to.be.equal(erc20Proxy.address);
// Deploy a new version of the ERC20 Transfer Proxy contract
const newErc20TransferProxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC20Proxy,
+ proxyArtifacts.ERC20Proxy,
provider,
txDefaults,
);
diff --git a/contracts/protocol/test/exchange/fill_order.ts b/contracts/exchange/test/fill_order.ts
index 2bdbe4855..3f54091d4 100644
--- a/contracts/protocol/test/exchange/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/global_hooks.ts b/contracts/exchange/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/exchange/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/protocol/test/exchange/internal.ts b/contracts/exchange/test/internal.ts
index 6ff1fdc2f..7a1e12a7a 100644
--- a/contracts/protocol/test/exchange/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/protocol/test/exchange/match_orders.ts b/contracts/exchange/test/match_orders.ts
index 8e943c237..d17025ddd 100644
--- a/contracts/protocol/test/exchange/match_orders.ts
+++ b/contracts/exchange/test/match_orders.ts
@@ -1,3 +1,6 @@
+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,
@@ -9,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';
@@ -23,15 +20,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
-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/protocol/test/exchange/signature_validator.ts b/contracts/exchange/test/signature_validator.ts
index 3f1786b5b..89eac4ddb 100644
--- a/contracts/protocol/test/exchange/signature_validator.ts
+++ b/contracts/exchange/test/signature_validator.ts
@@ -1,4 +1,4 @@
-import { artifacts as examplesArtifacts, ValidatorContract, WalletContract } from '@0x/contracts-examples';
+import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
import {
addressUtils,
chaiSetup,
@@ -10,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';
@@ -23,7 +22,9 @@ import {
TestSignatureValidatorContract,
TestSignatureValidatorSignatureValidatorApprovalEventArgs,
TestStaticCallReceiverContract,
-} from '../../src';
+ ValidatorContract,
+ WalletContract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -61,13 +62,13 @@ describe('MixinSignatureValidator', () => {
txDefaults,
);
testWallet = await WalletContract.deployFrom0xArtifactAsync(
- examplesArtifacts.Wallet,
+ artifacts.Wallet,
provider,
txDefaults,
signerAddress,
);
testValidator = await ValidatorContract.deployFrom0xArtifactAsync(
- examplesArtifacts.Validator,
+ artifacts.Validator,
provider,
txDefaults,
signerAddress,
@@ -77,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/protocol/test/exchange/transactions.ts b/contracts/exchange/test/transactions.ts
index e8c775f3e..613953493 100644
--- a/contracts/protocol/test/exchange/transactions.ts
+++ b/contracts/exchange/test/transactions.ts
@@ -1,4 +1,5 @@
-import { artifacts as examplesArtifacts, ExchangeWrapperContract, WhitelistContract } from '@0x/contracts-examples';
+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 { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
-import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { artifacts } from '../../src/artifacts';
-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;
@@ -221,7 +217,7 @@ describe('Exchange transactions', () => {
before(async () => {
exchangeWrapperContract = await ExchangeWrapperContract.deployFrom0xArtifactAsync(
- examplesArtifacts.ExchangeWrapper,
+ artifacts.ExchangeWrapper,
provider,
txDefaults,
exchange.address,
@@ -335,7 +331,7 @@ describe('Exchange transactions', () => {
before(async () => {
whitelist = await WhitelistContract.deployFrom0xArtifactAsync(
- examplesArtifacts.Whitelist,
+ artifacts.Whitelist,
provider,
txDefaults,
exchange.address,
diff --git a/contracts/protocol/test/utils/asset_wrapper.ts b/contracts/exchange/test/utils/asset_wrapper.ts
index e4090ad74..e5a5205f5 100644
--- a/contracts/protocol/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/protocol/test/utils/exchange_wrapper.ts b/contracts/exchange/test/utils/exchange_wrapper.ts
index 437882b41..eca535c65 100644
--- a/contracts/protocol/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/protocol/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts
index c2f530e5b..26b168909 100644
--- a/contracts/protocol/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
new file mode 100644
index 000000000..d88a38266
--- /dev/null
+++ b/contracts/exchange/test/utils/index.ts
@@ -0,0 +1,3 @@
+export * from './exchange_wrapper';
+export * from './fill_order_combinatorial_utils';
+export * from './match_order_tester';
diff --git a/contracts/protocol/test/utils/match_order_tester.ts b/contracts/exchange/test/utils/match_order_tester.ts
index 0ba8017c5..680ff13ac 100644
--- a/contracts/protocol/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/protocol/test/utils/order_factory_from_scenario.ts b/contracts/exchange/test/utils/order_factory_from_scenario.ts
index ecb4b2e28..6f5645906 100644
--- a/contracts/protocol/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/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/contracts/exchange/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
index 64b7dedbe..64b7dedbe 100644
--- a/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
+++ b/contracts/exchange/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
diff --git a/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts b/contracts/exchange/test/utils/simple_order_filled_cancelled_fetcher.ts
index af959e00e..af959e00e 100644
--- a/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/contracts/exchange/test/utils/simple_order_filled_cancelled_fetcher.ts
diff --git a/contracts/protocol/test/utils/types.ts b/contracts/exchange/test/utils/types.ts
index 5f12635a7..5f12635a7 100644
--- a/contracts/protocol/test/utils/types.ts
+++ b/contracts/exchange/test/utils/types.ts
diff --git a/contracts/protocol/test/exchange/wrapper.ts b/contracts/exchange/test/wrapper.ts
index 49ba5a2e5..62a0d426f 100644
--- a/contracts/protocol/test/exchange/wrapper.ts
+++ b/contracts/exchange/test/wrapper.ts
@@ -1,3 +1,6 @@
+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,
@@ -11,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';
@@ -25,13 +22,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
-import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
-import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
-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/interfaces/tsconfig.json b/contracts/exchange/tsconfig.json
index 90b7d41bb..b0fcd1771 100644
--- a/contracts/interfaces/tsconfig.json
+++ b/contracts/exchange/tsconfig.json
@@ -5,11 +5,8 @@
"rootDir": ".",
"resolveJsonModule": true
},
- "include": ["./src/**/*", "./generated-wrappers/**/*"],
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
- "./generated-artifacts/IAssetData.json",
- "./generated-artifacts/IAssetProxy.json",
- "./generated-artifacts/IAuthorizable.json",
"./generated-artifacts/IAssetProxyDispatcher.json",
"./generated-artifacts/IExchange.json",
"./generated-artifacts/IExchangeCore.json",
@@ -18,7 +15,16 @@
"./generated-artifacts/ITransactions.json",
"./generated-artifacts/IValidator.json",
"./generated-artifacts/IWallet.json",
- "./generated-artifacts/IWrapperFunctions.json"
+ "./generated-artifacts/IWrapperFunctions.json",
+ "./generated-artifacts/Exchange.json",
+ "./generated-artifacts/TestAssetProxyDispatcher.json",
+ "./generated-artifacts/TestExchangeInternals.json",
+ "./generated-artifacts/TestSignatureValidator.json",
+ "./generated-artifacts/TestStaticCallReceiver.json",
+ "./generated-artifacts/ExchangeWrapper.json",
+ "./generated-artifacts/Validator.json",
+ "./generated-artifacts/Wallet.json",
+ "./generated-artifacts/Whitelist.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}
diff --git a/contracts/exchange/tslint.json b/contracts/exchange/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/exchange/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json
index 920fef05a..16ec073aa 100644
--- a/contracts/extensions/CHANGELOG.json
+++ b/contracts/extensions/CHANGELOG.json
@@ -1,5 +1,18 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Move Forwarder contract into new package",
+ "pr": 1539
+ },
+ {
+ "note": "Nest extensions under src directory",
+ "pr": 1539
+ }
+ ]
+ },
+ {
"version": "2.0.0",
"changes": [
{
diff --git a/contracts/extensions/DEPLOYS.json b/contracts/extensions/DEPLOYS.json
index 1a093bf77..fe51488c7 100644
--- a/contracts/extensions/DEPLOYS.json
+++ b/contracts/extensions/DEPLOYS.json
@@ -1,31 +1 @@
-[
- {
- "name": "Forwarder",
- "version": "1.1.0",
- "changes": [
- {
- "note": "Round up when calculating remaining amounts in marketBuy functions",
- "pr": 1162,
- "networks": {
- "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
- "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
- }
- }
- ]
- },
- {
- "name": "Forwarder",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
- "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
- "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
- }
- }
- ]
- }
-]
+[]
diff --git a/contracts/extensions/README.md b/contracts/extensions/README.md
index 820f6e78a..f1767869d 100644
--- a/contracts/extensions/README.md
+++ b/contracts/extensions/README.md
@@ -1,10 +1,14 @@
-## Contract extensions
+## Extensions
-Smart contracts that implement extensions for the 0x protocol.
+This package implements various extensions to the 0x protocol. Extension contracts can add various rules around how orders are settled while still getting the interoperability and security benefits of using the underlying 0x protocol contracts. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-Contract extensions of the protocol can be found in the [contracts](./contracts) directory. 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.
+**Install**
+
+```bash
+npm install @0x/contracts-extensions --save
+```
## Bug bounty
diff --git a/contracts/extensions/compiler.json b/contracts/extensions/compiler.json
index e95478e34..91e0bd429 100644
--- a/contracts/extensions/compiler.json
+++ b/contracts/extensions/compiler.json
@@ -19,5 +19,5 @@
}
}
},
- "contracts": ["BalanceThresholdFilter", "DutchAuction", "Forwarder", "OrderMatcher", "OrderValidator"]
+ "contracts": ["BalanceThresholdFilter", "DutchAuction", "OrderMatcher", "OrderValidator"]
}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/BalanceThresholdFilter.sol
index 16cacd461..b6e14525d 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/BalanceThresholdFilter.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
import "./interfaces/IThresholdAsset.sol";
import "./MixinBalanceThresholdFilterCore.sol";
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
index da050bf72..68dabafeb 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
@@ -18,8 +18,8 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-libs/contracts/libs/LibExchangeSelectors.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibExchangeSelectors.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "./mixins/MBalanceThresholdFilterCore.sol";
import "./MixinExchangeCalldata.sol";
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol
index a15e95a9d..f2c0caa57 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol
@@ -20,7 +20,7 @@
pragma solidity ^0.4.24;
import "./mixins/MExchangeCalldata.sol";
-import "@0x/contracts-libs/contracts/libs/LibAddressArray.sol";
+import "@0x/contracts-utils/contracts/src/LibAddressArray.sol";
contract MixinExchangeCalldata is
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol
index 4a1bf1fb2..4a1bf1fb2 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
index f78f9c2de..f78f9c2de 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol
index 074686e8d..1c840136b 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
import "../interfaces/IThresholdAsset.sol";
import "../interfaces/IBalanceThresholdFilterCore.sol";
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MExchangeCalldata.sol
index 40536d820..40536d820 100644
--- a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol
+++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MExchangeCalldata.sol
diff --git a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/src/DutchAuction/DutchAuction.sol
index 9c9f3990a..7631880c0 100644
--- a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
+++ b/contracts/extensions/contracts/src/DutchAuction/DutchAuction.sol
@@ -19,11 +19,11 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.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";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.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";
contract DutchAuction is
diff --git a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol b/contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol
index f0f91cfc0..65b36ea65 100644
--- a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol
@@ -18,10 +18,10 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
-import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
-import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.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/OrderMatcher/MixinMatchOrders.sol b/contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol
index 1787deb59..baf41f650 100644
--- a/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol
@@ -20,9 +20,9 @@ pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
-import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibFillResults.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
contract MixinMatchOrders is
diff --git a/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol b/contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.sol
index 4879b7bca..89a7f3c55 100644
--- a/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-utils/contracts/src/Ownable.sol";
import "./libs/LibConstants.sol";
import "./MixinMatchOrders.sol";
import "./MixinAssets.sol";
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IAssets.sol
index 9fcc0023a..9fcc0023a 100644
--- a/contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IAssets.sol
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IMatchOrders.sol
index 1443c73b9..7e4a88df8 100644
--- a/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IMatchOrders.sol
@@ -19,7 +19,7 @@
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
contract IMatchOrders {
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol
index 75f26dca6..5e5125dea 100644
--- a/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contract-utils/contracts/utils/Ownable/IOwnable.sol";
+import "@0x/contract-utils/contracts/src/interfaces/IOwnable.sol";
import "./IMatchOrders.sol";
import "./IAssets.sol";
diff --git a/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol b/contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol
index c1a86a9c7..77b72398f 100644
--- a/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
contract LibConstants {
diff --git a/contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol b/contracts/extensions/contracts/src/OrderMatcher/mixins/MAssets.sol
index 6ea7a3290..6ea7a3290 100644
--- a/contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol
+++ b/contracts/extensions/contracts/src/OrderMatcher/mixins/MAssets.sol
diff --git a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol b/contracts/extensions/contracts/src/OrderValidator/OrderValidator.sol
index 33dd1326c..3297a980f 100644
--- a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
+++ b/contracts/extensions/contracts/src/OrderValidator/OrderValidator.sol
@@ -19,11 +19,11 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
-import "@0x/contracts-libs/contracts/libs/LibOrder.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";
+import "@0x/contracts-exchange/contracts/src/interfaces/IExchange.sol";
+import "@0x/contracts-exchange-libs/contracts/src/LibOrder.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";
contract OrderValidator {
diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json
index 14492af8f..ad829033f 100644
--- a/contracts/extensions/package.json
+++ b/contracts/extensions/package.json
@@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|Forwarder|OrderMatcher|OrderValidator).json"
+ "abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|OrderMatcher|OrderValidator).json"
},
"repository": {
"type": "git",
@@ -49,42 +49,35 @@
"@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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-interfaces": "^1.0.6",
- "@0x/contracts-libs": "^1.0.6",
- "@0x/contracts-protocol": "^2.2.3",
- "@0x/contracts-tokens": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
+ "@0x/contracts-asset-proxy": "1.0.0",
+ "@0x/contracts-exchange-libs": "1.0.0",
+ "@0x/contracts-exchange": "1.0.0",
+ "@0x/contracts-erc20": "1.0.0",
+ "@0x/contracts-erc721": "1.0.0",
+ "@0x/contracts-utils": "3.0.0",
"@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": {
diff --git a/contracts/extensions/src/artifacts/index.ts b/contracts/extensions/src/artifacts/index.ts
index 329d0f3f3..f2aee4908 100644
--- a/contracts/extensions/src/artifacts/index.ts
+++ b/contracts/extensions/src/artifacts/index.ts
@@ -2,14 +2,12 @@ import { ContractArtifact } from 'ethereum-types';
import * as BalanceThresholdFilter from '../../generated-artifacts/BalanceThresholdFilter.json';
import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
-import * as Forwarder from '../../generated-artifacts/Forwarder.json';
import * as OrderMatcher from '../../generated-artifacts/OrderMatcher.json';
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
export const artifacts = {
BalanceThresholdFilter: BalanceThresholdFilter as ContractArtifact,
DutchAuction: DutchAuction as ContractArtifact,
- Forwarder: Forwarder as ContractArtifact,
OrderMatcher: OrderMatcher as ContractArtifact,
OrderValidator: OrderValidator as ContractArtifact,
};
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/src/wrappers/index.ts b/contracts/extensions/src/wrappers/index.ts
index 65aec3ccd..eed198524 100644
--- a/contracts/extensions/src/wrappers/index.ts
+++ b/contracts/extensions/src/wrappers/index.ts
@@ -1,5 +1,4 @@
export * from '../../generated-wrappers/balance_threshold_filter';
export * from '../../generated-wrappers/dutch_auction';
-export * from '../../generated-wrappers/forwarder';
export * from '../../generated-wrappers/order_matcher';
export * from '../../generated-wrappers/order_validator';
diff --git a/contracts/extensions/test/extensions/balance_threshold_filter.ts b/contracts/extensions/test/balance_threshold_filter.ts
index adeb7c422..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 protocolArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-protocol';
+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;
@@ -134,7 +127,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
await erc20Wrapper.setBalancesAndAllowancesAsync();
// Deploy Exchange contract
exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/dutch_auction.ts
index 22b3caa16..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 protocolArtifacts,
- ERC20Wrapper,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-protocol';
+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,12 +82,12 @@ 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);
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/extensions/test/extensions/order_matcher.ts b/contracts/extensions/test/order_matcher.ts
index acb46ced4..0b2f9ddbb 100644
--- a/contracts/extensions/test/extensions/order_matcher.ts
+++ b/contracts/extensions/test/order_matcher.ts
@@ -1,12 +1,17 @@
import {
- artifacts as protocolArtifacts,
+ 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,
-} from '@0x/contracts-protocol';
+} from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -20,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';
@@ -30,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();
@@ -102,13 +105,13 @@ describe('OrderMatcher', () => {
await erc20Wrapper.setBalancesAndAllowancesAsync();
// Deploy ERC721 proxy
erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
- protocolArtifacts.ERC721Proxy,
+ proxyArtifacts.ERC721Proxy,
provider,
txDefaults,
);
// Depoy exchange
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
assetDataUtils.encodeERC20AssetData(zrxToken.address),
@@ -197,7 +200,7 @@ describe('OrderMatcher', () => {
describe('constructor', () => {
it('should revert if assetProxy is unregistered', async () => {
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
constants.NULL_BYTES,
@@ -451,7 +454,7 @@ describe('OrderMatcher', () => {
signedOrderLeft.signature,
signedOrderRight.signature,
);
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts });
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
data,
@@ -489,7 +492,7 @@ describe('OrderMatcher', () => {
signedOrderLeft.signature,
signedOrderRight.signature,
);
- const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...erc20Artifacts, ...exchangeArtifacts });
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
await web3Wrapper.sendTransactionAsync({
data,
@@ -726,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,
@@ -771,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,
@@ -788,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 7d8675f36..88dae14fb 100644
--- a/contracts/extensions/test/extensions/order_validator.ts
+++ b/contracts/extensions/test/order_validator.ts
@@ -1,12 +1,7 @@
-import {
- artifacts as protocolArtifacts,
- ERC20ProxyContract,
- ERC20Wrapper,
- ERC721ProxyContract,
- ERC721Wrapper,
- ExchangeContract,
- ExchangeWrapper,
-} from '@0x/contracts-protocol';
+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,
@@ -16,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';
@@ -24,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;
@@ -81,7 +74,7 @@ describe('OrderValidator', () => {
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- protocolArtifacts.Exchange,
+ exchangeArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/extensions/test/utils/balance_threshold_wrapper.ts b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
index 28a4ef011..3178d992e 100644
--- a/contracts/extensions/test/utils/balance_threshold_wrapper.ts
+++ b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
@@ -1,4 +1,6 @@
-import { artifacts as protocolArtifacts, ExchangeContract } from '@0x/contracts-protocol';
+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,
formatters,
@@ -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,8 +36,9 @@ export class BalanceThresholdWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
- ...protocolArtifacts,
+ ...erc20Artifacts,
+ ...erc721Artifacts,
+ ...exchangeArtifacts,
});
}
public async fillOrderAsync(
diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
index c1e2f2070..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 protocolArtifacts } from '@0x/contracts-protocol';
+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,8 +20,9 @@ export class DutchAuctionTestWrapper {
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
- ...tokensArtifacts,
- ...protocolArtifacts,
+ ...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..6ba9a2300
--- /dev/null
+++ b/contracts/extensions/test/utils/index.ts
@@ -0,0 +1,2 @@
+export * from './balance_threshold_wrapper';
+export * from './dutch_auction_test_wrapper';
diff --git a/contracts/extensions/tsconfig.json b/contracts/extensions/tsconfig.json
index ed9b4fbe1..0c06c6902 100644
--- a/contracts/extensions/tsconfig.json
+++ b/contracts/extensions/tsconfig.json
@@ -9,7 +9,6 @@
"files": [
"./generated-artifacts/BalanceThresholdFilter.json",
"./generated-artifacts/DutchAuction.json",
- "./generated-artifacts/Forwarder.json",
"./generated-artifacts/OrderMatcher.json",
"./generated-artifacts/OrderValidator.json"
],
diff --git a/contracts/interfaces/CHANGELOG.json b/contracts/interfaces/CHANGELOG.json
deleted file mode 100644
index 724ab1e4a..000000000
--- a/contracts/interfaces/CHANGELOG.json
+++ /dev/null
@@ -1,56 +0,0 @@
-[
- {
- "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/interfaces/package.json b/contracts/interfaces/package.json
deleted file mode 100644
index c67c25df3..000000000
--- a/contracts/interfaces/package.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "name": "@0x/contracts-interfaces",
- "version": "1.0.6",
- "engines": {
- "node": ">=6.12"
- },
- "description": "Smart contract interfaces of 0x protocol",
- "main": "lib/src/index.js",
- "scripts": {
- "build": "yarn pre_build && tsc -b",
- "build:ci": "yarn build",
- "pre_build": "run-s compile generate_contract_wrappers",
- "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",
- "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
- },
- "config": {
- "abis": "generated-artifacts/@(IAssetData|IAssetProxy|IAuthorizable|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IValidator|IWallet|IWrapperFunctions).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/interfaces/README.md",
- "devDependencies": {
- "@0x/abi-gen": "^1.0.22",
- "@0x/sol-compiler": "^2.0.2",
- "@0x/tslint-config": "^2.0.2",
- "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-libs": "^1.0.6",
- "@0x/contracts-utils": "^1.0.6",
- "@0x/types": "^1.5.2",
- "@0x/typescript-typings": "^3.0.8",
- "@0x/utils": "^3.0.1",
- "@0x/web3-wrapper": "^3.2.4",
- "ethereum-types": "^1.1.6",
- "lodash": "^4.17.5"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/contracts/interfaces/src/wrappers/index.ts b/contracts/interfaces/src/wrappers/index.ts
deleted file mode 100644
index f7f72fada..000000000
--- a/contracts/interfaces/src/wrappers/index.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export * from '../../generated-wrappers/i_asset_data';
-export * from '../../generated-wrappers/i_asset_proxy';
-export * from '../../generated-wrappers/i_asset_proxy_dispatcher';
-export * from '../../generated-wrappers/i_exchange';
-export * from '../../generated-wrappers/i_exchange_core';
-export * from '../../generated-wrappers/i_match_orders';
-export * from '../../generated-wrappers/i_signature_validator';
-export * from '../../generated-wrappers/i_transactions';
-export * from '../../generated-wrappers/i_authorizable';
-export * from '../../generated-wrappers/i_wrapper_functions';
-export * from '../../generated-wrappers/i_validator';
-export * from '../../generated-wrappers/i_wallet';
diff --git a/contracts/libs/CHANGELOG.json b/contracts/libs/CHANGELOG.json
deleted file mode 100644
index 724ab1e4a..000000000
--- a/contracts/libs/CHANGELOG.json
+++ /dev/null
@@ -1,56 +0,0 @@
-[
- {
- "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/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json
index 724ab1e4a..0fd8833c9 100644
--- a/contracts/multisig/CHANGELOG.json
+++ b/contracts/multisig/CHANGELOG.json
@@ -1,5 +1,18 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Add AssetProxyOwner contract",
+ "pr": 1539
+ },
+ {
+ "note": "Rename multisig directory to src",
+ "pr": 1539
+ }
+ ]
+ },
+ {
"version": "2.0.0",
"changes": [
{
diff --git a/contracts/multisig/DEPLOYS.json b/contracts/multisig/DEPLOYS.json
new file mode 100644
index 000000000..ea4e7ff89
--- /dev/null
+++ b/contracts/multisig/DEPLOYS.json
@@ -0,0 +1,17 @@
+[
+ {
+ "name": "AssetProxyOwner",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6",
+ "3": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b",
+ "4": "0x1da52d1d3a3acfa0a1836b737393b4e9931268fc",
+ "42": "0x2c824d2882baa668e0d5202b1e7f2922278703f8"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/multisig/README.md b/contracts/multisig/README.md
index e29f46251..98cd8a080 100644
--- a/contracts/multisig/README.md
+++ b/contracts/multisig/README.md
@@ -1,15 +1,14 @@
-## MultisSig Contracts
+## MultiSignature Contracts
-MultiSig smart contracts
+This package contains various types of multisignature wallet contracts, including the [`AssetProxyOwner`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxyowner) contract that is responsible for upgrading the 0x protocol smart contracts. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
-## Usage
+## Installation
-Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+**Install**
-- [multisig](./contracts/multisig)
- - This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
-- [test](./contracts/test)
- - This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+```bash
+npm install @0x/contracts-multisig --save
+```
## Contributing
diff --git a/contracts/multisig/compiler.json b/contracts/multisig/compiler.json
index 5c4d262dc..ae3905238 100644
--- a/contracts/multisig/compiler.json
+++ b/contracts/multisig/compiler.json
@@ -19,5 +19,11 @@
}
}
},
- "contracts": ["MultiSigWallet", "MultiSigWalletWithTimeLock", "TestRejectEther"]
+ "contracts": [
+ "AssetProxyOwner",
+ "MultiSigWallet",
+ "MultiSigWalletWithTimeLock",
+ "TestAssetProxyOwner",
+ "TestRejectEther"
+ ]
}
diff --git a/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol b/contracts/multisig/contracts/src/AssetProxyOwner.sol
index bfc7b5a66..d115a9d82 100644
--- a/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
+++ b/contracts/multisig/contracts/src/AssetProxyOwner.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
-import "@0x/contracts-multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol";
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "./MultiSigWalletWithTimeLock.sol";
+import "@0x/contracts-utils/contracts/src/LibBytes.sol";
contract AssetProxyOwner is
diff --git a/contracts/multisig/contracts/multisig/MultiSigWallet.sol b/contracts/multisig/contracts/src/MultiSigWallet.sol
index 516e7391c..516e7391c 100644
--- a/contracts/multisig/contracts/multisig/MultiSigWallet.sol
+++ b/contracts/multisig/contracts/src/MultiSigWallet.sol
diff --git a/contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol b/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol
index 9513d3b30..9513d3b30 100644
--- a/contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol
+++ b/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol
diff --git a/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/contracts/multisig/contracts/test/TestAssetProxyOwner.sol
index 52c66cb56..09ae836c7 100644
--- a/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
+++ b/contracts/multisig/contracts/test/TestAssetProxyOwner.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol";
+import "../src/AssetProxyOwner.sol";
// solhint-disable no-empty-blocks
diff --git a/contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol b/contracts/multisig/contracts/test/TestRejectEther.sol
index e523f591d..e523f591d 100644
--- a/contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol
+++ b/contracts/multisig/contracts/test/TestRejectEther.sol
diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json
index 1c3911cbc..cbdd96fd8 100644
--- a/contracts/multisig/package.json
+++ b/contracts/multisig/package.json
@@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).json"
+ "abis": "generated-artifacts/@(AssetProxyOwner|MultiSigWallet|MultiSigWalletWithTimeLock|TestAssetProxyOwner|TestRejectEther).json"
},
"repository": {
"type": "git",
@@ -48,13 +48,9 @@
"@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/ethereumjs-abi": "^0.6.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",
@@ -65,12 +61,12 @@
"shx": "^0.2.2",
"solhint": "^1.4.1",
"tslint": "5.11.0",
- "typescript": "3.0.1",
- "yargs": "^10.0.3"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/order-utils": "^3.1.2",
+ "@0x/contracts-asset-proxy": "1.0.0",
+ "@0x/contracts-erc20": "1.0.0",
"@0x/types": "^1.5.2",
"@0x/typescript-typings": "^3.0.8",
"@0x/utils": "^3.0.1",
diff --git a/contracts/multisig/src/artifacts/index.ts b/contracts/multisig/src/artifacts/index.ts
index 7cf47be01..326d79000 100644
--- a/contracts/multisig/src/artifacts/index.ts
+++ b/contracts/multisig/src/artifacts/index.ts
@@ -1,11 +1,15 @@
import { ContractArtifact } from 'ethereum-types';
+import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
import * as MultiSigWallet from '../../generated-artifacts/MultiSigWallet.json';
import * as MultiSigWalletWithTimeLock from '../../generated-artifacts/MultiSigWalletWithTimeLock.json';
+import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
import * as TestRejectEther from '../../generated-artifacts/TestRejectEther.json';
export const artifacts = {
- TestRejectEther: TestRejectEther as ContractArtifact,
+ AssetProxyOwner: AssetProxyOwner as ContractArtifact,
MultiSigWallet: MultiSigWallet as ContractArtifact,
MultiSigWalletWithTimeLock: MultiSigWalletWithTimeLock as ContractArtifact,
+ TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
+ TestRejectEther: TestRejectEther as ContractArtifact,
};
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/protocol/test/multisig/asset_proxy_owner.ts b/contracts/multisig/test/asset_proxy_owner.ts
index daebfb7fb..62081554b 100644
--- a/contracts/protocol/test/multisig/asset_proxy_owner.ts
+++ b/contracts/multisig/test/asset_proxy_owner.ts
@@ -1,3 +1,4 @@
+import { artifacts as proxyArtifacts, MixinAuthorizableContract } from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,
@@ -18,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 { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
-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;
@@ -58,12 +58,12 @@ describe('AssetProxyOwner', () => {
notOwner = accounts[3];
const initialOwner = accounts[0];
erc20Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
- artifacts.MixinAuthorizable,
+ proxyArtifacts.MixinAuthorizable,
provider,
txDefaults,
);
erc721Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
- artifacts.MixinAuthorizable,
+ proxyArtifacts.MixinAuthorizable,
provider,
txDefaults,
);
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/protocol/test/utils/asset_proxy_owner_wrapper.ts b/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts
index df23658d8..b6040d8e3 100644
--- a/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts
+++ b/contracts/multisig/test/utils/asset_proxy_owner_wrapper.ts
@@ -1,5 +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';
@@ -15,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 });
+ 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/multisig/tsconfig.json b/contracts/multisig/tsconfig.json
index 6f381620e..ad1707e43 100644
--- a/contracts/multisig/tsconfig.json
+++ b/contracts/multisig/tsconfig.json
@@ -7,8 +7,10 @@
},
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
+ "./generated-artifacts/AssetProxyOwner.json",
"./generated-artifacts/MultiSigWallet.json",
"./generated-artifacts/MultiSigWalletWithTimeLock.json",
+ "./generated-artifacts/TestAssetProxyOwner.json",
"./generated-artifacts/TestRejectEther.json"
],
"exclude": ["./deploy/solc/solc_bin"]
diff --git a/contracts/protocol/CHANGELOG.json b/contracts/protocol/CHANGELOG.json
deleted file mode 100644
index 0d513cc17..000000000
--- a/contracts/protocol/CHANGELOG.json
+++ /dev/null
@@ -1,65 +0,0 @@
-[
- {
- "version": "3.0.0",
- "changes": [
- {
- "note": "Upgrade the bignumber.js to v8.0.2",
- "pr": 1517
- }
- ]
- },
- {
- "timestamp": 1547747677,
- "version": "2.2.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547561734,
- "version": "2.2.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547225310,
- "version": "2.2.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "2.2.0",
- "changes": [
- {
- "note": "Added LibAddressArray",
- "pr": 1383
- },
- {
- "note": "Add validation and comments to MultiAssetProxy",
- "pr": 1455
- },
- {
- "note": "Move OrderValidator to extensions",
- "pr": 1464
- }
- ],
- "timestamp": 1547040760
- },
- {
- "timestamp": 1544741676,
- "version": "2.1.59",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- }
-]
diff --git a/contracts/protocol/DEPLOYS.json b/contracts/protocol/DEPLOYS.json
deleted file mode 100644
index 5c24ae59c..000000000
--- a/contracts/protocol/DEPLOYS.json
+++ /dev/null
@@ -1,92 +0,0 @@
-[
- {
- "name": "MultiAssetProxy",
- "version": "1.0.0",
- "changes": [
- {
- "note": "Add MultiAssetProxy implementation",
- "pr": 1224
- }
- ]
- },
- {
- "name": "OrderValidator",
- "version": "1.0.0",
- "changes": [
- {
- "note": "remove `getApproved` check from ERC721 approval query",
- "pr": 1149
- }
- ]
- },
- {
- "name": "OrderValidator",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x9463e518dea6810309563c81d5266c1b1d149138",
- "3": "0x90431a90516ab49af23a0530e04e8c7836e7122f",
- "42": "0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d"
- }
- }
- ]
- },
- {
- "name": "Exchange",
- "version": "2.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
- "3": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf",
- "42": "0x35dd2932454449b14cee11a94d3674a936d5d7b2"
- }
- }
- ]
- },
- {
- "name": "ERC20Proxy",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
- "42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"
- }
- }
- ]
- },
- {
- "name": "ERC721Proxy",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
- "3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
- "42": "0x2a9127c745688a165106c11cd4d647d2220af821"
- }
- }
- ]
- },
- {
- "name": "AssetProxyOwner",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6",
- "3": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b",
- "42": "0x2c824d2882baa668e0d5202b1e7f2922278703f8"
- }
- }
- ]
- }
-]
diff --git a/contracts/protocol/src/artifacts/index.ts b/contracts/protocol/src/artifacts/index.ts
deleted file mode 100644
index c5d12f10b..000000000
--- a/contracts/protocol/src/artifacts/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
-import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
-import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
-import * as Exchange from '../../generated-artifacts/Exchange.json';
-import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
-import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.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';
-import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
-import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
-
-export const artifacts = {
- AssetProxyOwner: AssetProxyOwner as ContractArtifact,
- ERC20Proxy: ERC20Proxy as ContractArtifact,
- ERC721Proxy: ERC721Proxy as ContractArtifact,
- Exchange: Exchange as ContractArtifact,
- MixinAuthorizable: MixinAuthorizable as ContractArtifact,
- MultiAssetProxy: MultiAssetProxy as ContractArtifact,
- TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
- TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
- TestExchangeInternals: TestExchangeInternals as ContractArtifact,
- TestSignatureValidator: TestSignatureValidator as ContractArtifact,
- TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
-};
diff --git a/contracts/protocol/src/wrappers/index.ts b/contracts/protocol/src/wrappers/index.ts
deleted file mode 100644
index 01b121054..000000000
--- a/contracts/protocol/src/wrappers/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-export * from '../../generated-wrappers/asset_proxy_owner';
-export * from '../../generated-wrappers/erc20_proxy';
-export * from '../../generated-wrappers/erc721_proxy';
-export * from '../../generated-wrappers/exchange';
-export * from '../../generated-wrappers/mixin_authorizable';
-export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
-export * from '../../generated-wrappers/test_asset_proxy_owner';
-export * from '../../generated-wrappers/test_exchange_internals';
-export * from '../../generated-wrappers/test_signature_validator';
-export * from '../../generated-wrappers/test_static_call_receiver';
diff --git a/contracts/protocol/tsconfig.json b/contracts/protocol/tsconfig.json
deleted file mode 100644
index db872fc32..000000000
--- a/contracts/protocol/tsconfig.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": ".",
- "resolveJsonModule": true
- },
- "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
- "files": [
- "./generated-artifacts/AssetProxyOwner.json",
- "./generated-artifacts/ERC20Proxy.json",
- "./generated-artifacts/ERC721Proxy.json",
- "./generated-artifacts/Exchange.json",
- "./generated-artifacts/MixinAuthorizable.json",
- "./generated-artifacts/MultiAssetProxy.json",
- "./generated-artifacts/TestAssetProxyDispatcher.json",
- "./generated-artifacts/TestAssetProxyOwner.json",
- "./generated-artifacts/TestExchangeInternals.json",
- "./generated-artifacts/TestSignatureValidator.json",
- "./generated-artifacts/TestStaticCallReceiver.json"
- ],
- "exclude": ["./deploy/solc/solc_bin"]
-}
diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json
index b0f4713af..262b8c7cd 100644
--- a/contracts/test-utils/package.json
+++ b/contracts/test-utils/package.json
@@ -54,7 +54,6 @@
"@0x/utils": "^3.0.1",
"@0x/web3-wrapper": "^3.2.4",
"@types/bn.js": "^4.11.0",
- "@types/ethereumjs-abi": "^0.6.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -64,7 +63,6 @@
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^1.1.6",
- "ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"js-combinatorics": "^0.5.3",
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json
deleted file mode 100644
index 724ab1e4a..000000000
--- a/contracts/tokens/CHANGELOG.json
+++ /dev/null
@@ -1,56 +0,0 @@
-[
- {
- "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/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
deleted file mode 100644
index 4920c4aac..000000000
--- a/contracts/tokens/contracts/tokens/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/tokens/ZRXToken/Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
deleted file mode 100644
index de619fb7e..000000000
--- a/contracts/tokens/contracts/tokens/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/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
deleted file mode 100644
index bf1b0335a..000000000
--- a/contracts/tokens/contracts/tokens/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/tokens/ZRXToken/ZRXToken.sol b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
deleted file mode 100644
index 831e1822c..000000000
--- a/contracts/tokens/contracts/tokens/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/CHANGELOG.json b/contracts/utils/CHANGELOG.json
index d44a81fef..94434b803 100644
--- a/contracts/utils/CHANGELOG.json
+++ b/contracts/utils/CHANGELOG.json
@@ -1,5 +1,22 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note": "Add LibAddressArray contract",
+ "pr": 1539
+ },
+ {
+ "note": "Do not nest contracts in redundant directories",
+ "pr": 1539
+ },
+ {
+ "note": "Rename utils directory to src",
+ "pr": 1539
+ }
+ ]
+ },
+ {
"version": "2.0.1",
"changes": [
{
diff --git a/contracts/utils/README.md b/contracts/utils/README.md
index 2f872ddb5..5c69971b6 100644
--- a/contracts/utils/README.md
+++ b/contracts/utils/README.md
@@ -1,15 +1,14 @@
## Contracts utils
-Smart contracts utils used in the 0x protocol.
+This package contains smart contract utilities and libraries that are used throughout the entire codebase of smart contracts. These contracts are all generic and may helpful to use outside of the context of 0x protocol.
-## Usage
+## Installation
-Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+**Install**
-- [utils](./contracts/utils)
- - This directory contains libraries and utils.
-- [test](./contracts/test)
- - This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+```bash
+npm install @0x/contracts-utils --save
+```
## Contributing
diff --git a/contracts/libs/contracts/libs/LibAddressArray.sol b/contracts/utils/contracts/src/LibAddressArray.sol
index 997ce85fa..892c486f1 100644
--- a/contracts/libs/contracts/libs/LibAddressArray.sol
+++ b/contracts/utils/contracts/src/LibAddressArray.sol
@@ -18,7 +18,7 @@
pragma solidity ^0.4.24;
-import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "./LibBytes.sol";
library LibAddressArray {
diff --git a/contracts/utils/contracts/utils/LibBytes/LibBytes.sol b/contracts/utils/contracts/src/LibBytes.sol
index 4ee6228d5..4ee6228d5 100644
--- a/contracts/utils/contracts/utils/LibBytes/LibBytes.sol
+++ b/contracts/utils/contracts/src/LibBytes.sol
diff --git a/contracts/utils/contracts/utils/Ownable/Ownable.sol b/contracts/utils/contracts/src/Ownable.sol
index aa74a72d2..f67f241a4 100644
--- a/contracts/utils/contracts/utils/Ownable/Ownable.sol
+++ b/contracts/utils/contracts/src/Ownable.sol
@@ -1,6 +1,6 @@
pragma solidity ^0.4.24;
-import "./IOwnable.sol";
+import "./interfaces/IOwnable.sol";
contract Ownable is
diff --git a/contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol b/contracts/utils/contracts/src/ReentrancyGuard.sol
index 1a02c88a4..1a02c88a4 100644
--- a/contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol
+++ b/contracts/utils/contracts/src/ReentrancyGuard.sol
diff --git a/contracts/utils/contracts/utils/SafeMath/SafeMath.sol b/contracts/utils/contracts/src/SafeMath.sol
index d7a4a603e..d7a4a603e 100644
--- a/contracts/utils/contracts/utils/SafeMath/SafeMath.sol
+++ b/contracts/utils/contracts/src/SafeMath.sol
diff --git a/contracts/utils/contracts/utils/Ownable/IOwnable.sol b/contracts/utils/contracts/src/interfaces/IOwnable.sol
index c0cbfddfd..c0cbfddfd 100644
--- a/contracts/utils/contracts/utils/Ownable/IOwnable.sol
+++ b/contracts/utils/contracts/src/interfaces/IOwnable.sol
diff --git a/contracts/utils/contracts/test/TestConstants/TestConstants.sol b/contracts/utils/contracts/test/TestConstants.sol
index 1275d007b..bf98bafef 100644
--- a/contracts/utils/contracts/test/TestConstants/TestConstants.sol
+++ b/contracts/utils/contracts/test/TestConstants.sol
@@ -16,9 +16,9 @@
*/
-pragma solidity 0.4.24;
+pragma solidity ^0.4.24;
-import "../../utils/LibBytes/LibBytes.sol";
+import "../src/LibBytes.sol";
// solhint-disable max-line-length
diff --git a/contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol b/contracts/utils/contracts/test/TestLibBytes.sol
index 00d861e61..cd6b1456d 100644
--- a/contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol
+++ b/contracts/utils/contracts/test/TestLibBytes.sol
@@ -16,9 +16,9 @@
*/
-pragma solidity 0.4.24;
+pragma solidity ^0.4.24;
-import "../../utils/LibBytes/LibBytes.sol";
+import "../src/LibBytes.sol";
contract TestLibBytes {
diff --git a/contracts/utils/package.json b/contracts/utils/package.json
index 4e45169fd..33d94cc33 100644
--- a/contracts/utils/package.json
+++ b/contracts/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
- "version": "1.0.6",
+ "version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -48,35 +48,30 @@
"@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",
- "bn.js": "^4.11.8",
+ "@types/bn.js": "^4.11.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"
+ "typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^3.0.13",
- "@0x/contracts-multisig": "^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",
+ "bn.js": "^4.11.8",
"ethereum-types": "^1.1.6",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"
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;