diff options
author | Amir Bandeali <abandeali1@gmail.com> | 2019-01-22 13:32:59 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2019-01-22 13:41:22 +0800 |
commit | efbfd08aa0152bf82d293fab0b073e1d650c9ab1 (patch) | |
tree | b7fea548337a7e1d409ba08917582eec77678c24 | |
parent | f9c29c3e7421bc8bcb59316e366249d1b0efb407 (diff) | |
download | dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar.gz dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar.bz2 dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar.lz dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar.xz dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.tar.zst dexon-0x-contracts-efbfd08aa0152bf82d293fab0b073e1d650c9ab1.zip |
Separate forwarder into own package
-rw-r--r-- | .circleci/config.yml | 2 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .prettierignore | 2 | ||||
-rw-r--r-- | contracts/exchange-forwarder/CHANGELOG.json | 74 | ||||
-rw-r--r-- | contracts/exchange-forwarder/CHANGELOG.md | 32 | ||||
-rw-r--r-- | contracts/exchange-forwarder/DEPLOYS.json | 31 | ||||
-rw-r--r-- | contracts/exchange-forwarder/README.md | 69 | ||||
-rw-r--r-- | contracts/exchange-forwarder/compiler.json | 22 | ||||
-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) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol (renamed from contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol (renamed from contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/contracts/src/MixinWeth.sol (renamed from contracts/extensions/contracts/Forwarder/MixinWeth.sol) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol (renamed from contracts/extensions/contracts/Forwarder/libs/LibConstants.sol) | 0 | ||||
-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) | 0 | ||||
-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.json | 86 | ||||
-rw-r--r-- | contracts/exchange-forwarder/src/artifacts/index.ts | 7 | ||||
-rw-r--r-- | contracts/exchange-forwarder/src/index.ts | 3 | ||||
-rw-r--r-- | contracts/exchange-forwarder/src/wrappers/index.ts | 1 | ||||
-rw-r--r-- | contracts/exchange-forwarder/test/forwarder.ts (renamed from contracts/extensions/test/forwarder.ts) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/test/global_hooks.ts | 17 | ||||
-rw-r--r-- | contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts (renamed from contracts/extensions/test/utils/forwarder_wrapper.ts) | 0 | ||||
-rw-r--r-- | contracts/exchange-forwarder/test/utils/index.ts | 1 | ||||
-rw-r--r-- | contracts/exchange-forwarder/tsconfig.json | 11 | ||||
-rw-r--r-- | contracts/exchange-forwarder/tslint.json | 6 | ||||
-rw-r--r-- | contracts/extensions/compiler.json | 2 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/BalanceThresholdFilter/BalanceThresholdFilter.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol (renamed from contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol) | 0 | ||||
-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) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol (renamed from contracts/extensions/contracts/OrderMatcher/MixinAssets.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol (renamed from contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.sol (renamed from contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol (renamed from contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol) | 0 | ||||
-rw-r--r-- | contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol (renamed from contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol) | 0 | ||||
-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) | 0 | ||||
-rw-r--r-- | contracts/extensions/package.json | 2 | ||||
-rw-r--r-- | contracts/extensions/src/artifacts/index.ts | 2 | ||||
-rw-r--r-- | contracts/extensions/src/wrappers/index.ts | 1 | ||||
-rw-r--r-- | contracts/extensions/test/utils/index.ts | 1 | ||||
-rw-r--r-- | contracts/extensions/tsconfig.json | 1 | ||||
-rw-r--r-- | contracts/utils/package.json | 2 | ||||
-rw-r--r-- | package.json | 2 |
56 files changed, 371 insertions, 8 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index cd6065fb9..248a308dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,7 @@ jobs: - run: yarn wsrun test:circleci @0x/contracts-extensions - run: yarn wsrun test:circleci @0x/contracts-asset-proxy - run: yarn wsrun test:circleci @0x/contracts-exchange + - run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder test-contracts-geth: docker: - image: circleci/node:9-browsers @@ -68,6 +69,7 @@ jobs: - run: yarn wsrun test:circleci @0x/contracts-extensions - run: yarn wsrun test:circleci @0x/contracts-asset-proxy - run: yarn wsrun test:circleci @0x/contracts-exchange + - run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder test-publish: resource_class: medium+ docker: diff --git a/.gitignore b/.gitignore index 997f8b2b2..f055a9398 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,7 @@ contracts/exchange-libs/generated-artifacts/ contracts/erc20/generated-artifacts/ contracts/erc721/generated-artifacts/ contracts/extensions/generated-artifacts/ +contracts/exchange-forwarder/generated-artifacts/ packages/sol-tracing-utils/test/fixtures/artifacts/ packages/metacoin/artifacts/ @@ -104,6 +105,7 @@ contracts/exchange-libs/generated-wrappers/ contracts/erc20/generated-wrappers/ contracts/erc721/generated-wrappers/ contracts/extensions/generated-wrappers/ +contracts/exchange-forwarder/generated-wrappers/ packages/metacoin/src/contract_wrappers # solc-bin in sol-compiler diff --git a/.prettierignore b/.prettierignore index 00d36575c..a72b5ed2a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -16,6 +16,8 @@ lib /contracts/erc721/generated-artifacts /contracts/extensions/generated-wrappers /contracts/extensions/generated-artifacts +/contracts/exchange-forwarder/generated-wrappers +/contracts/exchange-forwarder/generated-artifacts /packages/abi-gen-wrappers/src/generated-wrappers /packages/contract-artifacts/artifacts /python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts diff --git a/contracts/exchange-forwarder/CHANGELOG.json b/contracts/exchange-forwarder/CHANGELOG.json new file mode 100644 index 000000000..920fef05a --- /dev/null +++ b/contracts/exchange-forwarder/CHANGELOG.json @@ -0,0 +1,74 @@ +[ + { + "version": "2.0.0", + "changes": [ + { + "note": "Upgrade the bignumber.js to v8.0.2", + "pr": 1517 + } + ] + }, + { + "timestamp": 1547747677, + "version": "1.2.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "timestamp": 1547561734, + "version": "1.2.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "timestamp": 1547225310, + "version": "1.2.1", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { + "version": "1.2.0", + "changes": [ + { + "note": "Added Dutch Auction Wrapper", + "pr": 1465 + } + ], + "timestamp": 1547040760 + }, + { + "version": "1.1.0", + "changes": [ + { + "note": "Added Balance Threshold Filter", + "pr": 1383 + }, + { + "note": "Add OrderMatcher", + "pr": 1117 + }, + { + "note": "Add OrderValidator", + "pr": 1464 + } + ] + }, + { + "timestamp": 1544741676, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + } +] diff --git a/contracts/exchange-forwarder/CHANGELOG.md b/contracts/exchange-forwarder/CHANGELOG.md new file mode 100644 index 000000000..94ffdfb67 --- /dev/null +++ b/contracts/exchange-forwarder/CHANGELOG.md @@ -0,0 +1,32 @@ +<!-- +changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly. +Edit the package's CHANGELOG.json file only. +--> + +CHANGELOG + +## v1.2.3 - _January 17, 2019_ + + * Dependencies updated + +## v1.2.2 - _January 15, 2019_ + + * Dependencies updated + +## v1.2.1 - _January 11, 2019_ + + * Dependencies updated + +## v1.2.0 - _January 9, 2019_ + + * 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_ + + * Dependencies updated diff --git a/contracts/exchange-forwarder/DEPLOYS.json b/contracts/exchange-forwarder/DEPLOYS.json new file mode 100644 index 000000000..1a093bf77 --- /dev/null +++ b/contracts/exchange-forwarder/DEPLOYS.json @@ -0,0 +1,31 @@ +[ + { + "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/exchange-forwarder/README.md b/contracts/exchange-forwarder/README.md new file mode 100644 index 000000000..820f6e78a --- /dev/null +++ b/contracts/exchange-forwarder/README.md @@ -0,0 +1,69 @@ +## Contract extensions + +Smart contracts that implement extensions for the 0x protocol. + +## Usage + +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. + +## 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-extensions yarn build +``` + +Or continuously rebuild on change: + +```bash +PKG=@0x/contracts-extensions 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/exchange-forwarder/compiler.json b/contracts/exchange-forwarder/compiler.json new file mode 100644 index 000000000..b0237a519 --- /dev/null +++ b/contracts/exchange-forwarder/compiler.json @@ -0,0 +1,22 @@ +{ + "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": ["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 330586ed9..330586ed9 100644 --- a/contracts/extensions/contracts/Forwarder/MixinAssets.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinAssets.sol diff --git a/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol index c970c40cf..c970c40cf 100644 --- a/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinExchangeWrapper.sol diff --git a/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol index b65e1f7ce..b65e1f7ce 100644 --- a/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinForwarderCore.sol diff --git a/contracts/extensions/contracts/Forwarder/MixinWeth.sol b/contracts/exchange-forwarder/contracts/src/MixinWeth.sol index 029924019..029924019 100644 --- a/contracts/extensions/contracts/Forwarder/MixinWeth.sol +++ b/contracts/exchange-forwarder/contracts/src/MixinWeth.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 00009d3d5..00009d3d5 100644 --- a/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol +++ b/contracts/exchange-forwarder/contracts/src/interfaces/IForwarderCore.sol diff --git a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol b/contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol index 3ff2a03e5..3ff2a03e5 100644 --- a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol +++ b/contracts/exchange-forwarder/contracts/src/libs/LibConstants.sol 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 7439e8259..7439e8259 100644 --- a/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol +++ b/contracts/exchange-forwarder/contracts/src/mixins/MExchangeWrapper.sol 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..3383df990 --- /dev/null +++ b/contracts/exchange-forwarder/package.json @@ -0,0 +1,86 @@ +{ + "name": "@0x/contracts-exchange-forwarder", + "version": "1.2.3", + "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": "^2.2.3", + "@0x/contracts-exchange-libs": "^1.0.6", + "@0x/contracts-exchange": "^2.2.3", + "@0x/contracts-erc20": "^1.0.6", + "@0x/contracts-erc721": "^1.0.6", + "@0x/contracts-utils": "^1.0.6", + "@0x/order-utils": "^3.1.2", + "@0x/types": "^1.5.2", + "@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/exchange-forwarder/src/index.ts b/contracts/exchange-forwarder/src/index.ts new file mode 100644 index 000000000..ba813e7ca --- /dev/null +++ b/contracts/exchange-forwarder/src/index.ts @@ -0,0 +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/forwarder.ts b/contracts/exchange-forwarder/test/forwarder.ts index 24c219563..24c219563 100644 --- a/contracts/extensions/test/forwarder.ts +++ b/contracts/exchange-forwarder/test/forwarder.ts 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 207106852..207106852 100644 --- a/contracts/extensions/test/utils/forwarder_wrapper.ts +++ b/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts 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/exchange-forwarder/tsconfig.json b/contracts/exchange-forwarder/tsconfig.json new file mode 100644 index 000000000..cd80b5a5f --- /dev/null +++ b/contracts/exchange-forwarder/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig", + "compilerOptions": { + "outDir": "lib", + "rootDir": ".", + "resolveJsonModule": true + }, + "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], + "files": ["./generated-artifacts/Forwarder.json"], + "exclude": ["./deploy/solc/solc_bin"] +} diff --git a/contracts/exchange-forwarder/tslint.json b/contracts/exchange-forwarder/tslint.json new file mode 100644 index 000000000..1bb3ac2a2 --- /dev/null +++ b/contracts/exchange-forwarder/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": ["@0x/tslint-config"], + "rules": { + "custom-no-magic-numbers": false + } +} diff --git a/contracts/extensions/compiler.json b/contracts/extensions/compiler.json index 2bb468724..1dfaf7a05 100644 --- a/contracts/extensions/compiler.json +++ b/contracts/extensions/compiler.json @@ -18,5 +18,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 b6e14525d..b6e14525d 100644 --- a/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol +++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/BalanceThresholdFilter.sol diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol index 68dabafeb..68dabafeb 100644 --- a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol +++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol index f2c0caa57..f2c0caa57 100644 --- a/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol +++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/MixinExchangeCalldata.sol 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 1c840136b..1c840136b 100644 --- a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol +++ b/contracts/extensions/contracts/src/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.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 7631880c0..7631880c0 100644 --- a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol +++ b/contracts/extensions/contracts/src/DutchAuction/DutchAuction.sol diff --git a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol b/contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol index 65b36ea65..65b36ea65 100644 --- a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/MixinAssets.sol diff --git a/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol b/contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol index baf41f650..baf41f650 100644 --- a/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/MixinMatchOrders.sol diff --git a/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol b/contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.sol index 89a7f3c55..89a7f3c55 100644 --- a/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/OrderMatcher.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 7e4a88df8..7e4a88df8 100644 --- a/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IMatchOrders.sol diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol index 5e5125dea..5e5125dea 100644 --- a/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/interfaces/IOrderMatcher.sol diff --git a/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol b/contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol index 77b72398f..77b72398f 100644 --- a/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol +++ b/contracts/extensions/contracts/src/OrderMatcher/libs/LibConstants.sol 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 3297a980f..3297a980f 100644 --- a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol +++ b/contracts/extensions/contracts/src/OrderValidator/OrderValidator.sol diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 4395d1fac..e4adf6350 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", 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/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/utils/index.ts b/contracts/extensions/test/utils/index.ts index d5d529c11..6ba9a2300 100644 --- a/contracts/extensions/test/utils/index.ts +++ b/contracts/extensions/test/utils/index.ts @@ -1,3 +1,2 @@ export * from './balance_threshold_wrapper'; export * from './dutch_auction_test_wrapper'; -export * from './forwarder_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/utils/package.json b/contracts/utils/package.json index a4800fec9..0b14ec7cf 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -51,6 +51,7 @@ "@0x/tslint-config": "^2.0.2", "@types/lodash": "4.14.104", "@types/node": "*", + "@types/bn.js": "^4.11.0", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", "chai-bignumber": "^3.0.0", @@ -70,6 +71,7 @@ "@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/package.json b/package.json index 2e201f467..62b4c1c36 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing" }, "config": { - "contractsPackages": "@0x/contracts-asset-proxy @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-exchange @0x/contracts-exchange-libs @0x/contracts-extensions @0x/contracts-multisig @0x/contracts-test-utils @0x/contracts-utils", + "contractsPackages": "@0x/contracts-asset-proxy @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-exchange @0x/contracts-exchange-forwarder @0x/contracts-exchange-libs @0x/contracts-extensions @0x/contracts-multisig @0x/contracts-test-utils @0x/contracts-utils", "mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic", "packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-coverage sol-profiler sol-trace ethereum-types asset-buyer migrations" }, |