diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bada24405..2d2c50d69b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,25 +1,25 @@ -version: 2 +version: 2.1 jobs: build: - resource_class: medium+ + resource_class: large docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 environment: - CONTRACTS_COMMIT_HASH: '9ed05f5' + NODE_OPTIONS: '--max-old-space-size=6442' working_directory: ~/repo steps: - checkout - run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV - run: name: install-yarn - command: npm install --force --global yarn@1.17.0 + command: npm install --force --global yarn@1.22.0 - run: name: yarn command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install - setup_remote_docker - - run: yarn build:ci - - run: yarn build:ts + - run: yarn build:ci || yarn build:ci || yarn build:ci + - run: yarn build:ts || yarn build:ts || yarn build:ts - save_cache: key: repo-{{ .Environment.CIRCLE_SHA1 }} paths: @@ -31,57 +31,57 @@ jobs: test-exchange-ganache: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-exchange + - run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci test-integrations-ganache: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-integrations + - run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci test-contracts-staking-ganache: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-staking + - run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci test-contracts-extra-ganache: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder @0x/contracts-coordinator + - run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci test-contracts-rest-ganache: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-multisig @0x/contracts-utils @0x/contracts-exchange-libs @0x/contracts-erc20 @0x/contracts-erc721 @0x/contracts-erc1155 @0x/contracts-asset-proxy @0x/contracts-broker @0x/contracts-zero-ex + - run: yarn wsrun -p @0x/contracts-multisig -p @0x/contracts-utils -p @0x/contracts-exchange-libs -p @0x/contracts-erc20 -p @0x/contracts-erc721 -p @0x/contracts-erc1155 -p @0x/contracts-asset-proxy -p @0x/contracts-broker -p @0x/contracts-zero-ex -m --serial -c test:circleci test-publish: resource_class: medium+ docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 - image: 0xorg/verdaccio working_directory: ~/repo steps: @@ -95,7 +95,7 @@ jobs: path: ~/.npm/_logs test-doc-generation: docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: @@ -106,18 +106,18 @@ jobs: no_output_timeout: 1200 test-rest: docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: keys: - repo-{{ .Environment.CIRCLE_SHA1 }} - - run: yarn wsrun test:circleci @0x/contracts-test-utils - - run: yarn wsrun test:circleci @0x/contract-artifacts - - run: yarn wsrun test:circleci @0x/contract-wrappers-test - - run: yarn wsrun test:circleci @0x/migrations - - run: yarn wsrun test:circleci @0x/order-utils - - run: yarn wsrun test:circleci @0x/asset-swapper + - run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci + - run: yarn wsrun -p @0x/contract-artifacts -m --serial -c test:circleci + - run: yarn wsrun -p @0x/contract-wrappers-test -m --serial -c test:circleci + - run: yarn wsrun -p @0x/migrations -m --serial -c test:circleci + - run: yarn wsrun -p @0x/order-utils -m --serial -c test:circleci + - run: yarn wsrun -p @0x/asset-swapper -m --serial -c test:circleci - save_cache: key: coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }} paths: @@ -134,7 +134,7 @@ jobs: resource_class: large working_directory: ~/repo docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 steps: - restore_cache: keys: @@ -145,7 +145,7 @@ jobs: - run: yarn diff_md_docs:ci submit-coverage: docker: - - image: nikolaik/python-nodejs:python3.7-nodejs10 + - image: node:12 working_directory: ~/repo steps: - restore_cache: diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json index ab43dc50ea..a6c6a736c3 100644 --- a/contracts/asset-proxy/package.json +++ b/contracts/asset-proxy/package.json @@ -51,13 +51,13 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contract-wrappers": "^13.16.0", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@types/lodash": "4.14.104", @@ -79,7 +79,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-erc1155": "^2.1.28", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-erc721": "^3.1.28", @@ -87,8 +87,8 @@ "@0x/order-utils": "^10.4.20", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "ethereum-types": "^3.5.0", "lodash": "^4.17.11" }, diff --git a/contracts/broker/package.json b/contracts/broker/package.json index 3705ba9549..a4ca218360 100644 --- a/contracts/broker/package.json +++ b/contracts/broker/package.json @@ -51,20 +51,20 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-erc721": "^3.1.28", "@0x/contracts-exchange": "^3.2.29", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -84,10 +84,10 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/order-utils": "^10.4.20", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0" }, "publishConfig": { diff --git a/contracts/coordinator/package.json b/contracts/coordinator/package.json index 63e70f88a3..4ad9896987 100644 --- a/contracts/coordinator/package.json +++ b/contracts/coordinator/package.json @@ -52,17 +52,17 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-dev-utils": "^1.3.27", "@0x/contracts-erc20": "^3.3.7", - "@0x/contracts-gen": "^2.0.37", - "@0x/dev-utils": "^4.2.6", + "@0x/contracts-gen": "^2.0.38", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -82,16 +82,16 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/assert": "^3.0.26", - "@0x/base-contract": "^6.3.2", + "@0x/assert": "^3.0.27", + "@0x/base-contract": "^6.4.0", "@0x/contract-addresses": "^6.0.0", "@0x/contracts-exchange": "^3.2.29", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/json-schemas": "^6.1.2", + "@0x/json-schemas": "^6.1.3", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0", "http-status-codes": "^1.3.2" }, diff --git a/contracts/dev-utils/package.json b/contracts/dev-utils/package.json index 7105658e6b..f67b5ff910 100644 --- a/contracts/dev-utils/package.json +++ b/contracts/dev-utils/package.json @@ -41,17 +41,17 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/dev-utils", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/assert": "^3.0.26", + "@0x/abi-gen": "^5.6.0", + "@0x/assert": "^3.0.27", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-erc20": "^3.3.7", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0", "ethers": "~4.0.4", "npm-run-all": "^4.1.2", @@ -63,7 +63,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@types/node": "12.12.54" }, "publishConfig": { diff --git a/contracts/erc1155/package.json b/contracts/erc1155/package.json index 31003f15eb..a5ca4c66b8 100644 --- a/contracts/erc1155/package.json +++ b/contracts/erc1155/package.json @@ -52,11 +52,11 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/contracts-gen": "^2.0.37", + "@0x/abi-gen": "^5.6.0", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", @@ -80,10 +80,10 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-test-utils": "^5.3.25", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "lodash": "^4.17.11" }, "publishConfig": { diff --git a/contracts/erc20/package.json b/contracts/erc20/package.json index e75c5fa299..1cc51a7463 100644 --- a/contracts/erc20/package.json +++ b/contracts/erc20/package.json @@ -51,18 +51,18 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/contracts-gen": "^2.0.37", + "@0x/abi-gen": "^5.6.0", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -82,7 +82,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2" + "@0x/base-contract": "^6.4.0" }, "publishConfig": { "access": "public" diff --git a/contracts/erc721/package.json b/contracts/erc721/package.json index d6ade51cc6..e406afb2b6 100644 --- a/contracts/erc721/package.json +++ b/contracts/erc721/package.json @@ -52,18 +52,18 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/contracts-gen": "^2.0.37", + "@0x/abi-gen": "^5.6.0", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -84,7 +84,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2" + "@0x/base-contract": "^6.4.0" }, "publishConfig": { "access": "public" diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json index 3083295132..00860cf573 100644 --- a/contracts/exchange-forwarder/package.json +++ b/contracts/exchange-forwarder/package.json @@ -52,7 +52,7 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-dev-utils": "^1.3.27", "@0x/contracts-erc1155": "^2.1.28", @@ -60,17 +60,17 @@ "@0x/contracts-erc721": "^3.1.28", "@0x/contracts-exchange": "^3.2.29", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -90,7 +90,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/typescript-typings": "^5.2.0", "ethereum-types": "^3.5.0" }, diff --git a/contracts/exchange-libs/package.json b/contracts/exchange-libs/package.json index 8125cdac1f..1b4048fe1d 100644 --- a/contracts/exchange-libs/package.json +++ b/contracts/exchange-libs/package.json @@ -52,14 +52,14 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/libs", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/contracts-gen": "^2.0.37", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", - "@0x/subproviders": "^6.5.2", + "@0x/abi-gen": "^5.6.0", + "@0x/contracts-gen": "^2.0.38", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", + "@0x/subproviders": "^6.5.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -80,13 +80,13 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", "@0x/order-utils": "^10.4.20", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0" }, "publishConfig": { diff --git a/contracts/exchange/package.json b/contracts/exchange/package.json index a11704180c..980a1bcb7f 100644 --- a/contracts/exchange/package.json +++ b/contracts/exchange/package.json @@ -52,21 +52,21 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/protocol", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-multisig": "^4.1.29", "@0x/contracts-staking": "^2.0.36", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -88,13 +88,13 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-dev-utils": "^1.3.27", "@0x/contracts-erc1155": "^2.1.28", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-erc721": "^3.1.28", "@0x/order-utils": "^10.4.20", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "lodash": "^4.17.11" }, "publishConfig": { diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 24fe4f6412..9f623859b8 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -52,23 +52,23 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-dev-utils": "^1.3.27", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-erc721": "^3.1.28", "@0x/contracts-exchange": "^3.2.29", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -90,7 +90,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-test-utils": "^5.3.25", "@0x/typescript-typings": "^5.2.0", "ethereum-types": "^3.5.0" diff --git a/contracts/integrations/package.json b/contracts/integrations/package.json index c75ed8cd9d..5cd8c3abdb 100644 --- a/contracts/integrations/package.json +++ b/contracts/integrations/package.json @@ -52,7 +52,7 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/extensions", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contract-addresses": "^6.0.0", "@0x/contract-wrappers": "^13.16.0", "@0x/contracts-broker": "^1.1.28", @@ -61,16 +61,16 @@ "@0x/contracts-exchange-forwarder": "^4.2.29", "@0x/contracts-exchange-libs": "^4.3.28", "@0x/contracts-extensions": "^6.2.23", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-utils": "^4.7.7", "@0x/coordinator-server": "^1.0.5", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/migrations": "^8.0.5", "@0x/order-utils": "^10.4.20", "@0x/protocol-utils": "^1.5.1", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/tslint-config": "^4.1.4", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@azure/core-asynciterator-polyfill": "^1.0.0", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", @@ -94,7 +94,7 @@ }, "dependencies": { "@0x/asset-swapper": "^6.9.1", - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-erc1155": "^2.1.28", "@0x/contracts-erc20": "^3.3.7", @@ -104,10 +104,10 @@ "@0x/contracts-staking": "^2.0.36", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-zero-ex": "^0.22.3", - "@0x/subproviders": "^6.5.2", + "@0x/subproviders": "^6.5.3", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0", "ethereumjs-util": "^7.0.10", "lodash": "^4.17.11" diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json index 54dadb296a..063cbce4de 100644 --- a/contracts/multisig/package.json +++ b/contracts/multisig/package.json @@ -49,18 +49,18 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/multisig", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-erc20": "^3.3.7", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", - "@0x/sol-compiler": "^4.7.2", + "@0x/dev-utils": "^4.2.7", + "@0x/sol-compiler": "^4.7.3", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", "@types/node": "12.12.54", @@ -78,7 +78,7 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/typescript-typings": "^5.2.0", "ethereum-types": "^3.5.0" }, diff --git a/contracts/staking/package.json b/contracts/staking/package.json index b6e3dc0dce..e0c43ad2f4 100644 --- a/contracts/staking/package.json +++ b/contracts/staking/package.json @@ -53,20 +53,20 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-dev-utils": "^1.3.27", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-utils": "^4.7.7", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/lodash": "4.14.104", "@types/node": "12.12.54", "chai": "^4.0.1", @@ -87,10 +87,10 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contracts-test-utils": "^5.3.25", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "ethereum-types": "^3.5.0", "ethereumjs-util": "^7.0.10" }, diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json index 038c1fcec8..4abdcec9cd 100644 --- a/contracts/test-utils/CHANGELOG.json +++ b/contracts/test-utils/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "5.4.0", + "changes": [ + { + "note": "Set default ganache gas limit to 100e6", + "pr": 197 + } + ] + }, { "timestamp": 1619596077, "version": "5.3.25", diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json index 63d7a6754f..728d07c890 100644 --- a/contracts/test-utils/package.json +++ b/contracts/test-utils/package.json @@ -34,7 +34,7 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils", "devDependencies": { - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/tslint-config": "^4.1.4", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -42,20 +42,20 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/assert": "^3.0.26", - "@0x/base-contract": "^6.3.2", + "@0x/assert": "^3.0.27", + "@0x/base-contract": "^6.4.0", "@0x/contract-addresses": "^6.0.0", - "@0x/dev-utils": "^4.2.6", - "@0x/json-schemas": "^6.1.2", + "@0x/dev-utils": "^4.2.7", + "@0x/json-schemas": "^6.1.3", "@0x/order-utils": "^10.4.20", - "@0x/sol-coverage": "^4.0.36", - "@0x/sol-profiler": "^4.1.26", - "@0x/sol-trace": "^3.0.36", - "@0x/subproviders": "^6.5.2", + "@0x/sol-coverage": "^4.0.37", + "@0x/sol-profiler": "^4.1.27", + "@0x/sol-trace": "^3.0.37", + "@0x/subproviders": "^6.5.3", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/bn.js": "^4.11.0", "@types/js-combinatorics": "^0.5.29", "@types/lodash": "4.14.104", diff --git a/contracts/test-utils/src/web3_wrapper.ts b/contracts/test-utils/src/web3_wrapper.ts index a1fbbc23a6..ee8999074b 100644 --- a/contracts/test-utils/src/web3_wrapper.ts +++ b/contracts/test-utils/src/web3_wrapper.ts @@ -20,6 +20,7 @@ export let providerConfigs: Web3Config = { shouldUseInProcessGanache: true, shouldAllowUnlimitedContractSize: true, hardfork: 'istanbul', + gasLimit: 100e6, unlocked_accounts: [ '0x6cc5f688a315f3dc28a7781717a9a798a59fda7b', '0x55dc8f21d20d4c6ed3c82916a438a413ca68e335', diff --git a/contracts/treasury/package.json b/contracts/treasury/package.json index a9e7cc2ecb..6f6f95767b 100644 --- a/contracts/treasury/package.json +++ b/contracts/treasury/package.json @@ -46,14 +46,14 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contract-addresses": "^6.0.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-erc20": "^3.3.7", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-staking": "^2.0.36", "@0x/contracts-test-utils": "^5.3.25", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@types/isomorphic-fetch": "^0.0.35", @@ -72,13 +72,13 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/protocol-utils": "^1.5.1", - "@0x/subproviders": "^6.5.2", + "@0x/subproviders": "^6.5.3", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "ethereum-types": "^3.5.0", "ethereumjs-util": "^7.0.10" }, diff --git a/contracts/utils/package.json b/contracts/utils/package.json index 9ad79afe53..e1c457bc68 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -50,15 +50,15 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils", "devDependencies": { - "@0x/abi-gen": "^5.5.2", - "@0x/contracts-gen": "^2.0.37", + "@0x/abi-gen": "^5.6.0", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/web3-wrapper": "^7.5.2", + "@0x/web3-wrapper": "^7.5.3", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", "@types/mocha": "^5.2.7", @@ -79,9 +79,9 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "bn.js": "^4.11.8", "ethereum-types": "^3.5.0" }, diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeAdapter.sol b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeAdapter.sol index beaca4db70..c9d3ed0245 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeAdapter.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeAdapter.sol @@ -39,6 +39,7 @@ import "./mixins/MixinOasis.sol"; import "./mixins/MixinShell.sol"; import "./mixins/MixinUniswap.sol"; import "./mixins/MixinUniswapV2.sol"; +import "./mixins/MixinUniswapV3.sol"; import "./mixins/MixinZeroExBridge.sol"; contract BridgeAdapter is @@ -60,6 +61,7 @@ contract BridgeAdapter is MixinShell, MixinUniswap, MixinUniswapV2, + MixinUniswapV3, MixinZeroExBridge { constructor(IEtherTokenV06 weth) @@ -81,6 +83,7 @@ contract BridgeAdapter is MixinShell() MixinUniswap(weth) MixinUniswapV2() + MixinUniswapV3() MixinZeroExBridge() {} @@ -102,6 +105,12 @@ contract BridgeAdapter is sellAmount, order.bridgeData ); + } else if (protocolId == BridgeProtocols.UNISWAPV3) { + boughtAmount = _tradeUniswapV3( + sellToken, + sellAmount, + order.bridgeData + ); } else if (protocolId == BridgeProtocols.UNISWAPV2) { boughtAmount = _tradeUniswapV2( buyToken, diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol index 734d1c87de..253db4bd41 100644 --- a/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol +++ b/contracts/zero-ex/contracts/src/transformers/bridges/BridgeProtocols.sol @@ -45,4 +45,5 @@ library BridgeProtocols { uint128 internal constant NERVE = 15; uint128 internal constant MAKERPSM = 16; uint128 internal constant BALANCERV2 = 17; + uint128 internal constant UNISWAPV3 = 18; } diff --git a/contracts/zero-ex/contracts/src/transformers/bridges/mixins/MixinUniswapV3.sol b/contracts/zero-ex/contracts/src/transformers/bridges/mixins/MixinUniswapV3.sol new file mode 100644 index 0000000000..25260603a1 --- /dev/null +++ b/contracts/zero-ex/contracts/src/transformers/bridges/mixins/MixinUniswapV3.sol @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: Apache-2.0 + +/* + + Copyright 2021 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.6.5; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol"; +import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; +import "../IBridgeAdapter.sol"; + +interface IUniswapV3Router { + + struct ExactInputParams { + bytes path; + address recipient; + uint256 deadline; + uint256 amountIn; + uint256 amountOutMinimum; + } + + function exactInput(ExactInputParams memory params) + external + payable + returns (uint256 amountOut); +} + +contract MixinUniswapV3 { + + using LibERC20TokenV06 for IERC20TokenV06; + + function _tradeUniswapV3( + IERC20TokenV06 sellToken, + uint256 sellAmount, + bytes memory bridgeData + ) + internal + returns (uint256 boughtAmount) + { + (IUniswapV3Router router, bytes memory path) = + abi.decode(bridgeData, (IUniswapV3Router, bytes)); + + // Grant the Uniswap router an allowance to sell the sell token. + sellToken.approveIfBelow(address(router), sellAmount); + + boughtAmount = router.exactInput(IUniswapV3Router.ExactInputParams({ + path: path, + recipient: address(this), + deadline: block.timestamp, + amountIn: sellAmount, + amountOutMinimum: 1 + })); + } +} diff --git a/contracts/zero-ex/package.json b/contracts/zero-ex/package.json index a3f59f85e6..7e08915cea 100644 --- a/contracts/zero-ex/package.json +++ b/contracts/zero-ex/package.json @@ -43,7 +43,7 @@ "config": { "publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,BridgeAdapter,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.", - "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinDodo|MixinDodoV2|MixinKyber|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx|ZeroExOptimized).json" + "abis": "./test/generated-artifacts/@(AffiliateFeeTransformer|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeAdapter|BridgeProtocols|CurveLiquidityProvider|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC20Bridge|IERC20Transformer|IFeature|IFlashWallet|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOwnableFeature|IPancakeSwapFeature|ISimpleFunctionRegistryFeature|IStaking|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC20Transformer|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinBalancer|MixinBalancerV2|MixinBancor|MixinCoFiX|MixinCryptoCom|MixinCurve|MixinDodo|MixinDodoV2|MixinKyber|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinOasis|MixinShell|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC20Token|TestMooniswap|TestNativeOrdersFeature|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|WethTransformer|ZeroEx|ZeroExOptimized).json" }, "repository": { "type": "git", @@ -55,14 +55,14 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex", "devDependencies": { - "@0x/abi-gen": "^5.5.2", + "@0x/abi-gen": "^5.6.0", "@0x/contract-addresses": "^6.0.0", "@0x/contracts-erc20": "^3.3.7", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/order-utils": "^10.4.20", - "@0x/sol-compiler": "^4.7.2", + "@0x/sol-compiler": "^4.7.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@types/isomorphic-fetch": "^0.0.35", @@ -82,13 +82,13 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/protocol-utils": "^1.5.1", - "@0x/subproviders": "^6.5.2", + "@0x/subproviders": "^6.5.3", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "ethereum-types": "^3.5.0", "ethereumjs-util": "^7.0.10" }, diff --git a/contracts/zero-ex/test/artifacts.ts b/contracts/zero-ex/test/artifacts.ts index 46d8c24e15..5cb0702e79 100644 --- a/contracts/zero-ex/test/artifacts.ts +++ b/contracts/zero-ex/test/artifacts.ts @@ -92,6 +92,7 @@ import * as MixinOasis from '../test/generated-artifacts/MixinOasis.json'; import * as MixinShell from '../test/generated-artifacts/MixinShell.json'; import * as MixinUniswap from '../test/generated-artifacts/MixinUniswap.json'; import * as MixinUniswapV2 from '../test/generated-artifacts/MixinUniswapV2.json'; +import * as MixinUniswapV3 from '../test/generated-artifacts/MixinUniswapV3.json'; import * as MixinZeroExBridge from '../test/generated-artifacts/MixinZeroExBridge.json'; import * as MooniswapLiquidityProvider from '../test/generated-artifacts/MooniswapLiquidityProvider.json'; import * as MultiplexFeature from '../test/generated-artifacts/MultiplexFeature.json'; @@ -252,6 +253,7 @@ export const artifacts = { MixinShell: MixinShell as ContractArtifact, MixinUniswap: MixinUniswap as ContractArtifact, MixinUniswapV2: MixinUniswapV2 as ContractArtifact, + MixinUniswapV3: MixinUniswapV3 as ContractArtifact, MixinZeroExBridge: MixinZeroExBridge as ContractArtifact, ILiquidityProvider: ILiquidityProvider as ContractArtifact, IMooniswapPool: IMooniswapPool as ContractArtifact, diff --git a/contracts/zero-ex/test/wrappers.ts b/contracts/zero-ex/test/wrappers.ts index fd41960e6f..e8698ae140 100644 --- a/contracts/zero-ex/test/wrappers.ts +++ b/contracts/zero-ex/test/wrappers.ts @@ -90,6 +90,7 @@ export * from '../test/generated-wrappers/mixin_oasis'; export * from '../test/generated-wrappers/mixin_shell'; export * from '../test/generated-wrappers/mixin_uniswap'; export * from '../test/generated-wrappers/mixin_uniswap_v2'; +export * from '../test/generated-wrappers/mixin_uniswap_v3'; export * from '../test/generated-wrappers/mixin_zero_ex_bridge'; export * from '../test/generated-wrappers/mooniswap_liquidity_provider'; export * from '../test/generated-wrappers/multiplex_feature'; diff --git a/contracts/zero-ex/tsconfig.json b/contracts/zero-ex/tsconfig.json index 28cbba6dac..bce9df73e3 100644 --- a/contracts/zero-ex/tsconfig.json +++ b/contracts/zero-ex/tsconfig.json @@ -121,6 +121,7 @@ "test/generated-artifacts/MixinShell.json", "test/generated-artifacts/MixinUniswap.json", "test/generated-artifacts/MixinUniswapV2.json", + "test/generated-artifacts/MixinUniswapV3.json", "test/generated-artifacts/MixinZeroExBridge.json", "test/generated-artifacts/MooniswapLiquidityProvider.json", "test/generated-artifacts/MultiplexFeature.json", diff --git a/package.json b/package.json index 411b02c804..7173b5e111 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ ], "scripts": { "deps_versions:ci": "node ./node_modules/@0x/monorepo-scripts/lib/deps_versions.js", - "fix": "wsrun fix $PKG --fast-exit --parallel --exclude-missing", + "fix": "wsrun --fast-exit --parallel --exclude-missing -c fix $PKG", "ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"", "prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc", "prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc", @@ -27,31 +27,25 @@ "install:all": "yarn install", "wsrun": "wsrun", "lerna": "lerna", - "build": "lerna link && wsrun build $PKG -r --stages --fast-exit --exclude-missing", - "build:ci": "lerna link && wsrun build:ci $PKG --fast-exit -r --stages --exclude-missing", - "build:contracts": "lerna link && wsrun build -p ${npm_package_config_contractsPackages} -c --fast-exit -r --stages --exclude-missing", + "build": "lerna link && wsrun -r --stages --fast-exit --exclude-missing -c build $PKG", + "build:ci": "lerna link && wsrun --fast-exit -r --stages --exclude-missing -c build:ci $PKG", + "build:contracts": "lerna link && wsrun -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing -c build", "build:ts": "tsc -b", "watch:ts": "tsc -b -w", - "clean": "wsrun clean $PKG --fast-exit -r --parallel --exclude-missing", - "clean:contracts": "wsrun clean -p ${npm_package_config_contractsPackages} -c --fast-exit -r --parallel --exclude-missing", - "contracts:gen": "wsrun contracts:gen $PKG --fast-exit -r --parallel --exclude-missing", - "contracts:compile": "wsrun compile -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing", - "contracts:compile:truffle": "wsrun compile:truffle -p ${npm_package_config_contractsPackages} --fast-exit -r --stages --exclude-missing", - "contracts:watch": "wsrun watch $PKG --parallel --exclude-missing", + "clean": "wsrun --fast-exit -r --parallel --exclude-missing clean -c $PKG", + "contracts:watch": "wsrun --parallel --exclude-missing watch -c $PKG", "remove_node_modules": "lerna clean --yes; rm -rf node_modules", "rebuild": "run-s clean build", - "test": "wsrun test $(echo $(echo ${npm_package_config_contractsPackages} ${npm_package_config_nonContractPackages} | tr ' ' '\n' | sort | uniq) ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') --fast-exit --serial --exclude-missing", - "test:all": "wsrun test $PKG --fast-exit --serial --exclude-missing", - "test:contracts": "wsrun test --serial -p $(echo ${npm_package_config_contractsPackages} ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') -c --fast-exit --exclude-missing", - "test:contracts:all": "wsrun test --serial -p ${npm_package_config_contractsPackages} -c --fast-exit --exclude-missing", + "test": "wsrun --fast-exit --serial --exclude-missing -p $(echo $(echo ${npm_package_config_contractsPackages} ${npm_package_config_nonContractPackages} | tr ' ' '\n' | sort | uniq) ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') -c test", + "test:all": "wsrun --fast-exit --serial --exclude-missing -c test $PKG", + "test:contracts": "wsrun --serial -p $(echo ${npm_package_config_contractsPackages} ${npm_package_config_ignoreTestsForPackages} | tr ' ' '\n' | sort | uniq -u | tr '\n' ' ') --fast-exit --exclude-missing -c test", + "test:contracts:all": "wsrun --serial -p ${npm_package_config_contractsPackages} --fast-exit --exclude-missing -c test", "generate_doc": "node ./node_modules/@0x/monorepo-scripts/lib/doc_generate.js --config ./doc-gen-config.json", - "upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun s3:sync_md_docs --exclude-missing", - "diff_md_docs:ci": "wsrun diff_docs --exclude-missing", + "upload_md_docs": "aws s3 rm --recursive s3://docs-markdown; wsrun --exclude-missing -c s3:sync_md_docs", + "diff_md_docs:ci": "wsrun --exclude-missing -c diff_docs", "test:generate_docs:circleci": "for i in ${npm_package_config_packagesWithDocPages}; do yarn generate_doc --package $i || break -1; done;", "bundlewatch": "bundlewatch", - "lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing", - "lint:stages": "wsrun lint $PKG --fast-exit --stages --exclude-missing", - "lint:contracts": "wsrun lint -p ${npm_package_config_contractsPackages} -c --fast-exit --stages --exclude-missing", + "lint": "wsrun --fast-exit --parallel --exclude-missing -c lint $PKG", "upgrade_org_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js -p '@0x|ethereum-types'", "upgrade_deps": "node node_modules/@0x/monorepo-scripts/lib/upgrade_deps.js", "verdaccio": "docker run --rm -i -p 4873:4873 0xorg/verdaccio" @@ -66,7 +60,7 @@ "ignoreDependencyVersionsForPackage": "contract-wrappers" }, "devDependencies": { - "@0x/monorepo-scripts": "^3.1.6", + "@0x/monorepo-scripts": "^3.1.7", "@0x-lerna-fork/lerna": "3.16.10", "@0xproject/npm-cli-login": "^0.0.11", "async-child-process": "^1.1.1", @@ -78,7 +72,7 @@ "prettier": "~1.16.3", "source-map-support": "^0.5.6", "typescript": "4.2.2", - "wsrun": "^2.2.0" + "wsrun": "^5.2.4" }, "resolutions": { "merkle-patricia-tree": "^2.3.2" diff --git a/packages/asset-swapper/compiler.json b/packages/asset-swapper/compiler.json index 0f1c50dfbb..e5c1f567ae 100644 --- a/packages/asset-swapper/compiler.json +++ b/packages/asset-swapper/compiler.json @@ -6,7 +6,7 @@ "shouldSaveStandardInput": true, "compilerSettings": { "evmVersion": "istanbul", - "optimizer": { "enabled": true, "runs": 200 }, + "optimizer": { "enabled": false, "runs": 200, "details": { "yul": true } }, "outputSelection": { "*": { "*": [ diff --git a/packages/asset-swapper/contracts/src/BancorSampler.sol b/packages/asset-swapper/contracts/src/BancorSampler.sol index e69c692364..3e61c5adbf 100644 --- a/packages/asset-swapper/contracts/src/BancorSampler.sol +++ b/packages/asset-swapper/contracts/src/BancorSampler.sol @@ -22,7 +22,9 @@ pragma experimental ABIEncoderV2; import "./interfaces/IBancor.sol"; -contract BancorSampler { +contract CompilerHack {} + +contract BancorSampler is CompilerHack { /// @dev Base gas limit for Bancor calls. uint256 constant private BANCOR_CALL_GAS = 300e3; // 300k diff --git a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol b/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol index 5383f4abd5..bcd9da21c1 100644 --- a/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol +++ b/packages/asset-swapper/contracts/src/ERC20BridgeSampler.sol @@ -39,6 +39,7 @@ import "./SmoothySampler.sol"; import "./TwoHopSampler.sol"; import "./UniswapSampler.sol"; import "./UniswapV2Sampler.sol"; +import "./UniswapV3Sampler.sol"; import "./UtilitySampler.sol"; @@ -62,6 +63,7 @@ contract ERC20BridgeSampler is TwoHopSampler, UniswapSampler, UniswapV2Sampler, + UniswapV3Sampler, UtilitySampler { diff --git a/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol b/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol new file mode 100644 index 0000000000..35dca77d56 --- /dev/null +++ b/packages/asset-swapper/contracts/src/UniswapV3Sampler.sol @@ -0,0 +1,313 @@ +// SPDX-License-Identifier: Apache-2.0 +/* + + Copyright 2021 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.6; +pragma experimental ABIEncoderV2; + +import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol"; + +interface IUniswapV3Quoter { + function factory() + external + view + returns (IUniswapV3Factory factory); + function quoteExactInput(bytes memory path, uint256 amountIn) + external + returns (uint256 amountOut); + function quoteExactOutput(bytes memory path, uint256 amountOut) + external + returns (uint256 amountIn); +} + +interface IUniswapV3Factory { + function getPool(IERC20TokenV06 a, IERC20TokenV06 b, uint24 fee) + external + view + returns (IUniswapV3Pool pool); +} + +interface IUniswapV3Pool { + function token0() external view returns (IERC20TokenV06); + function token1() external view returns (IERC20TokenV06); + function fee() external view returns (uint24); +} + +contract UniswapV3Sampler +{ + /// @dev Gas limit for UniswapV3 calls. This is 100% a guess. + uint256 constant private QUOTE_GAS = 300e3; + + /// @dev Sample sell quotes from UniswapV3. + /// @param quoter UniswapV3 Quoter contract. + /// @param path Token route. Should be takerToken -> makerToken + /// @param takerTokenAmounts Taker token sell amount for each sample. + /// @return makerTokenAmounts Maker amounts bought at each taker token + /// amount. + /// @return uniswapPaths The encoded uniswap path for each sample. + function sampleSellsFromUniswapV3( + IUniswapV3Quoter quoter, + IERC20TokenV06[] memory path, + uint256[] memory takerTokenAmounts + ) + public + returns ( + uint256[] memory makerTokenAmounts, + bytes[] memory uniswapPaths + ) + { + IUniswapV3Pool[][] memory poolPaths = + _getValidPoolPaths(quoter.factory(), path, 0); + + makerTokenAmounts = new uint256[](takerTokenAmounts.length); + uniswapPaths = new bytes[](takerTokenAmounts.length); + + for (uint256 i = 0; i < takerTokenAmounts.length; ++i) { + // Pick the best result from all the paths. + bytes memory topUniswapPath; + uint256 topBuyAmount = 0; + for (uint256 j = 0; j < poolPaths.length; ++j) { + bytes memory uniswapPath = _toUniswapPath(path, poolPaths[j]); + try + quoter.quoteExactInput + { gas: QUOTE_GAS } + (uniswapPath, takerTokenAmounts[i]) + returns (uint256 buyAmount) + { + if (topBuyAmount <= buyAmount) { + topBuyAmount = buyAmount; + topUniswapPath = uniswapPath; + } + } catch { } + } + // Break early if we can't complete the buys. + if (topBuyAmount == 0) { + break; + } + makerTokenAmounts[i] = topBuyAmount; + uniswapPaths[i] = topUniswapPath; + } + } + + /// @dev Sample buy quotes from UniswapV3. + /// @param quoter UniswapV3 Quoter contract. + /// @param path Token route. Should be takerToken -> makerToken. + /// @param makerTokenAmounts Maker token buy amount for each sample. + /// @return takerTokenAmounts Taker amounts sold at each maker token + /// amount. + /// @return uniswapPaths The encoded uniswap path for each sample. + function sampleBuysFromUniswapV3( + IUniswapV3Quoter quoter, + IERC20TokenV06[] memory path, + uint256[] memory makerTokenAmounts + ) + public + returns ( + uint256[] memory takerTokenAmounts, + bytes[] memory uniswapPaths + ) + { + IUniswapV3Pool[][] memory poolPaths = + _getValidPoolPaths(quoter.factory(), path, 0); + IERC20TokenV06[] memory reversedPath = _reverseTokenPath(path); + + takerTokenAmounts = new uint256[](makerTokenAmounts.length); + uniswapPaths = new bytes[](makerTokenAmounts.length); + + for (uint256 i = 0; i < makerTokenAmounts.length; ++i) { + // Pick the best result from all the paths. + bytes memory topUniswapPath; + uint256 topSellAmount = 0; + for (uint256 j = 0; j < poolPaths.length; ++j) { + // quoter requires path to be reversed for buys. + bytes memory uniswapPath = _toUniswapPath( + reversedPath, + _reversePoolPath(poolPaths[j]) + ); + try + quoter.quoteExactOutput + { gas: QUOTE_GAS } + (uniswapPath, makerTokenAmounts[i]) + returns (uint256 sellAmount) + { + if (topSellAmount == 0 || topSellAmount >= sellAmount) { + topSellAmount = sellAmount; + // But the output path should still be encoded for sells. + topUniswapPath = _toUniswapPath(path, poolPaths[j]); + } + } catch {} + } + // Break early if we can't complete the buys. + if (topSellAmount == 0) { + break; + } + takerTokenAmounts[i] = topSellAmount; + uniswapPaths[i] = topUniswapPath; + } + } + + function _getValidPoolPaths( + IUniswapV3Factory factory, + IERC20TokenV06[] memory tokenPath, + uint256 startIndex + ) + private + view + returns (IUniswapV3Pool[][] memory poolPaths) + { + require( + tokenPath.length - startIndex >= 2, + "UniswapV3Sampler/tokenPath too short" + ); + uint24[3] memory validPoolFees = [ + // The launch pool fees. Could get hairier if they add more. + uint24(0.0005e6), + uint24(0.003e6), + uint24(0.01e6) + ]; + IUniswapV3Pool[] memory validPools = + new IUniswapV3Pool[](validPoolFees.length); + uint256 numValidPools = 0; + { + IERC20TokenV06 inputToken = tokenPath[startIndex]; + IERC20TokenV06 outputToken = tokenPath[startIndex + 1]; + for (uint256 i = 0; i < validPoolFees.length; ++i) { + IUniswapV3Pool pool = + factory.getPool(inputToken, outputToken, validPoolFees[i]); + if (_isValidPool(pool)) { + validPools[numValidPools++] = pool; + } + } + } + if (numValidPools == 0) { + // No valid pools for this hop. + return poolPaths; + } + if (startIndex + 2 == tokenPath.length) { + // End of path. + poolPaths = new IUniswapV3Pool[][](numValidPools); + for (uint256 i = 0; i < numValidPools; ++i) { + poolPaths[i] = new IUniswapV3Pool[](1); + poolPaths[i][0] = validPools[i]; + } + return poolPaths; + } + // Get paths for subsequent hops. + IUniswapV3Pool[][] memory subsequentPoolPaths = + _getValidPoolPaths(factory, tokenPath, startIndex + 1); + if (subsequentPoolPaths.length == 0) { + // Could not complete the path. + return poolPaths; + } + // Combine our pools with the next hop paths. + poolPaths = new IUniswapV3Pool[][]( + numValidPools * subsequentPoolPaths.length + ); + for (uint256 i = 0; i < numValidPools; ++i) { + for (uint256 j = 0; j < subsequentPoolPaths.length; ++j) { + uint256 o = i * subsequentPoolPaths.length + j; + // Prepend pool to the subsequent path. + poolPaths[o] = + new IUniswapV3Pool[](1 + subsequentPoolPaths[j].length); + poolPaths[o][0] = validPools[i]; + for (uint256 k = 0; k < subsequentPoolPaths[j].length; ++k) { + poolPaths[o][1 + k] = subsequentPoolPaths[j][k]; + } + } + } + return poolPaths; + } + + function _reverseTokenPath(IERC20TokenV06[] memory tokenPath) + private + returns (IERC20TokenV06[] memory reversed) + { + reversed = new IERC20TokenV06[](tokenPath.length); + for (uint256 i = 0; i < tokenPath.length; ++i) { + reversed[i] = tokenPath[tokenPath.length - i - 1]; + } + } + + function _reversePoolPath(IUniswapV3Pool[] memory poolPath) + private + returns (IUniswapV3Pool[] memory reversed) + { + reversed = new IUniswapV3Pool[](poolPath.length); + for (uint256 i = 0; i < poolPath.length; ++i) { + reversed[i] = poolPath[poolPath.length - i - 1]; + } + } + + function _isValidPool(IUniswapV3Pool pool) + private + view + returns (bool isValid) + { + // Check if it has been deployed. + { + uint256 codeSize; + assembly { + codeSize := extcodesize(pool) + } + if (codeSize == 0) { + return false; + } + } + // Must have a balance of both tokens. + if (pool.token0().balanceOf(address(pool)) == 0) { + return false; + } + if (pool.token1().balanceOf(address(pool)) == 0) { + return false; + } + return true; + } + + function _toUniswapPath( + IERC20TokenV06[] memory tokenPath, + IUniswapV3Pool[] memory poolPath + ) + private + view + returns (bytes memory uniswapPath) + { + require( + tokenPath.length >= 2 && tokenPath.length == poolPath.length + 1, + "UniswapV3Sampler/invalid path lengths" + ); + // Uniswap paths are tightly packed as: + // [token0, token0token1PairFee, token1, token1Token2PairFee, token2, ...] + uniswapPath = new bytes(tokenPath.length * 20 + poolPath.length * 3); + uint256 o; + assembly { o := add(uniswapPath, 32) } + for (uint256 i = 0; i < tokenPath.length; ++i) { + if (i > 0) { + uint24 poolFee = poolPath[i - 1].fee(); + assembly { + mstore(o, shl(232, poolFee)) + o := add(o, 3) + } + } + IERC20TokenV06 token = tokenPath[i]; + assembly { + mstore(o, shl(96, token)) + o := add(o, 20) + } + } + } +} diff --git a/packages/asset-swapper/package.json b/packages/asset-swapper/package.json index 02e6469719..fcae650cb7 100644 --- a/packages/asset-swapper/package.json +++ b/packages/asset-swapper/package.json @@ -38,7 +38,7 @@ "config": { "publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.", - "abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2Sampler|BancorSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|Eth2DaiSampler|FakeTaker|IBalancer|IBancor|ICurve|IEth2Dai|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UtilitySampler).json", + "abis": "./test/generated-artifacts/@(ApproximateBuys|BalanceChecker|BalancerSampler|BalancerV2Sampler|BancorSampler|CurveSampler|DODOSampler|DODOV2Sampler|DummyLiquidityProvider|ERC20BridgeSampler|Eth2DaiSampler|FakeTaker|IBalancer|IBancor|ICurve|IEth2Dai|IKyberNetwork|IMStable|IMooniswap|IMultiBridge|IShell|ISmoothy|IUniswapExchangeQuotes|IUniswapV2Router01|KyberSampler|LiquidityProviderSampler|MStableSampler|MakerPSMSampler|MooniswapSampler|MultiBridgeSampler|NativeOrderSampler|SamplerUtils|ShellSampler|SmoothySampler|TestERC20BridgeSampler|TestNativeOrderSampler|TwoHopSampler|UniswapSampler|UniswapV2Sampler|UniswapV3Sampler|UtilitySampler).json", "postpublish": { "assets": [] } @@ -57,20 +57,20 @@ "registry": "git@github.com:0xProject/gitpkg-registry.git" }, "dependencies": { - "@0x/assert": "^3.0.26", + "@0x/assert": "^3.0.27", "@0x/base-contract": "^6.4.0", "@0x/contract-addresses": "^6.0.0", "@0x/contract-wrappers": "^13.16.0", "@0x/contracts-erc20": "^3.3.7", "@0x/contracts-zero-ex": "^0.22.3", - "@0x/dev-utils": "^4.2.6", - "@0x/json-schemas": "^6.1.2", + "@0x/dev-utils": "^4.2.7", + "@0x/json-schemas": "^6.1.3", "@0x/protocol-utils": "^1.5.1", "@0x/quote-server": "^5.0.0", "@0x/types": "^3.3.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@balancer-labs/sor": "0.3.2", "@bancor/sdk": "0.2.9", "@ethersproject/abi": "^5.0.1", @@ -95,13 +95,13 @@ "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-exchange": "^3.2.29", "@0x/contracts-exchange-libs": "^4.3.28", - "@0x/contracts-gen": "^2.0.37", + "@0x/contracts-gen": "^2.0.38", "@0x/contracts-test-utils": "^5.3.25", "@0x/contracts-utils": "^4.7.7", "@0x/mesh-rpc-client": "^9.4.2", "@0x/migrations": "^8.0.5", - "@0x/sol-compiler": "^4.7.2", - "@0x/subproviders": "^6.5.2", + "@0x/sol-compiler": "^4.7.3", + "@0x/subproviders": "^6.5.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", diff --git a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts index ec35b628fe..5645912f52 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_proxy_swap_quote_consumer.ts @@ -13,8 +13,7 @@ import { FillQuoteTransformerSide, findTransformerNonce, } from '@0x/protocol-utils'; -import { BigNumber, providerUtils } from '@0x/utils'; -import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; +import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import { constants, POSITIVE_SLIPPAGE_FEE_TRANSFORMER_GAS } from '../constants'; @@ -77,14 +76,14 @@ const PANCAKE_SWAP_FORKS = [ ERC20BridgeSource.CheeseSwap, ERC20BridgeSource.JulSwap, ]; -const DUMMY_WETH_CONTRACT = new WETH9Contract(NULL_ADDRESS, { +const FAKE_PROVIDER: any = { sendAsync(): void { return; }, -} as any); +}; +const DUMMY_WETH_CONTRACT = new WETH9Contract(NULL_ADDRESS, FAKE_PROVIDER); export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { - public readonly provider: ZeroExProvider; public readonly chainId: ChainId; public readonly transformerNonces: { wethTransformer: number; @@ -97,19 +96,13 @@ export class ExchangeProxySwapQuoteConsumer implements SwapQuoteConsumerBase { private readonly _exchangeProxy: IZeroExContract; private readonly _multiplex: MultiplexFeatureContract; - constructor( - supportedProvider: SupportedProvider, - public readonly contractAddresses: ContractAddresses, - options: Partial = {}, - ) { + constructor(public readonly contractAddresses: ContractAddresses, options: Partial = {}) { const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options); assert.isNumber('chainId', chainId); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - this.provider = provider; this.chainId = chainId; this.contractAddresses = contractAddresses; - this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, supportedProvider); - this._multiplex = new MultiplexFeatureContract(contractAddresses.exchangeProxy, supportedProvider); + this._exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, FAKE_PROVIDER); + this._multiplex = new MultiplexFeatureContract(contractAddresses.exchangeProxy, FAKE_PROVIDER); this.transformerNonces = { wethTransformer: findTransformerNonce( contractAddresses.transformers.wethTransformer, diff --git a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts index 611853dbe2..4f91003407 100644 --- a/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/swap_quote_consumer.ts @@ -1,6 +1,4 @@ import { ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses'; -import { providerUtils } from '@0x/utils'; -import { SupportedProvider, ZeroExProvider } from '@0x/web3-wrapper'; import * as _ from 'lodash'; import { constants } from '../constants'; @@ -17,32 +15,22 @@ import { assert } from '../utils/assert'; import { ExchangeProxySwapQuoteConsumer } from './exchange_proxy_swap_quote_consumer'; export class SwapQuoteConsumer implements SwapQuoteConsumerBase { - public readonly provider: ZeroExProvider; public readonly chainId: number; private readonly _contractAddresses: ContractAddresses; private readonly _exchangeProxyConsumer: ExchangeProxySwapQuoteConsumer; - public static getSwapQuoteConsumer( - supportedProvider: SupportedProvider, - options: Partial = {}, - ): SwapQuoteConsumer { - return new SwapQuoteConsumer(supportedProvider, options); + public static getSwapQuoteConsumer(options: Partial = {}): SwapQuoteConsumer { + return new SwapQuoteConsumer(options); } - constructor(supportedProvider: SupportedProvider, options: Partial = {}) { + constructor(options: Partial = {}) { const { chainId } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options); assert.isNumber('chainId', chainId); - const provider = providerUtils.standardizeOrThrow(supportedProvider); - this.provider = provider; this.chainId = chainId; this._contractAddresses = options.contractAddresses || getContractAddressesForChainOrThrow(chainId); - this._exchangeProxyConsumer = new ExchangeProxySwapQuoteConsumer( - supportedProvider, - this._contractAddresses, - options, - ); + this._exchangeProxyConsumer = new ExchangeProxySwapQuoteConsumer(this._contractAddresses, options); } /** diff --git a/packages/asset-swapper/src/swap_quoter.ts b/packages/asset-swapper/src/swap_quoter.ts index 3b8ca427a5..58e23ba2ed 100644 --- a/packages/asset-swapper/src/swap_quoter.ts +++ b/packages/asset-swapper/src/swap_quoter.ts @@ -27,7 +27,7 @@ import { import { assert } from './utils/assert'; import { MarketOperationUtils } from './utils/market_operation_utils'; import { BancorService } from './utils/market_operation_utils/bancor_service'; -import { SOURCE_FLAGS, ZERO_AMOUNT } from './utils/market_operation_utils/constants'; +import { SAMPLER_ADDRESS, SOURCE_FLAGS, ZERO_AMOUNT } from './utils/market_operation_utils/constants'; import { DexOrderSampler } from './utils/market_operation_utils/sampler'; import { SourceFilters } from './utils/market_operation_utils/source_filters'; import { @@ -93,7 +93,7 @@ export class SwapQuoter { rfqt, tokenAdjacencyGraph, liquidityProviderRegistry, - } = _.merge({}, constants.DEFAULT_SWAP_QUOTER_OPTS, options); + } = { ...constants.DEFAULT_SWAP_QUOTER_OPTS, ...options }; const provider = providerUtils.standardizeOrThrow(supportedProvider); assert.isValidOrderbook('orderbook', orderbook); assert.isNumber('chainId', chainId); @@ -116,7 +116,7 @@ export class SwapQuoter { const samplerBytecode = _.get(artifacts.ERC20BridgeSampler, 'compilerOutput.evm.deployedBytecode.object'); const defaultCodeOverrides = samplerBytecode ? { - [this._contractAddresses.erc20BridgeSampler]: { code: samplerBytecode }, + [SAMPLER_ADDRESS]: { code: samplerBytecode }, } : {}; const samplerOverrides = _.assign( @@ -125,7 +125,7 @@ export class SwapQuoter { ); const fastAbi = new FastABI(ERC20BridgeSamplerContract.ABI() as MethodAbi[]); const samplerContract = new ERC20BridgeSamplerContract( - this._contractAddresses.erc20BridgeSampler, + SAMPLER_ADDRESS, this.provider, { gas: samplerGasLimit, diff --git a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts index 3735b6e65e..b731d16a36 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/constants.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/constants.ts @@ -24,6 +24,7 @@ import { PsmInfo, TokenAdjacencyGraph, UniswapV2FillData, + UniswapV3FillData, } from './types'; // tslint:disable: custom-no-magic-numbers no-bitwise @@ -39,6 +40,7 @@ export const ONE_HOUR_IN_SECONDS = 60 * 60; export const ONE_SECOND_MS = 1000; export const NULL_BYTES = '0x'; export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; +export const SAMPLER_ADDRESS = '0x5555555555555555555555555555555555555555'; export const COMPARISON_PRICE_DECIMALS = 10; function valueByChainId(rest: Partial<{ [key in ChainId]: T }>, defaultValue: T): { [key in ChainId]: T } { @@ -88,6 +90,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.Component, ERC20BridgeSource.Saddle, ERC20BridgeSource.XSigma, + // ERC20BridgeSource.UniswapV3, ]), [ChainId.Ropsten]: new SourceFilters([ ERC20BridgeSource.Kyber, @@ -95,6 +98,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.SushiSwap, ERC20BridgeSource.Uniswap, ERC20BridgeSource.UniswapV2, + ERC20BridgeSource.UniswapV3, ]), [ChainId.Rinkeby]: new SourceFilters([ERC20BridgeSource.Native]), [ChainId.Kovan]: new SourceFilters([ERC20BridgeSource.Native]), @@ -156,6 +160,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.Component, ERC20BridgeSource.Saddle, ERC20BridgeSource.XSigma, + // ERC20BridgeSource.UniswapV3, ]), [ChainId.Ropsten]: new SourceFilters([ ERC20BridgeSource.Kyber, @@ -163,6 +168,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId( ERC20BridgeSource.SushiSwap, ERC20BridgeSource.Uniswap, ERC20BridgeSource.UniswapV2, + ERC20BridgeSource.UniswapV3, ]), [ChainId.Rinkeby]: new SourceFilters([ERC20BridgeSource.Native]), [ChainId.Kovan]: new SourceFilters([ERC20BridgeSource.Native]), @@ -1051,6 +1057,16 @@ export const BALANCER_TOP_POOLS_FETCHED = 250; export const BALANCER_MAX_POOLS_FETCHED = 3; export const BALANCER_V2_SUBGRAPH_URL = 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-v2'; +export const UNISWAPV3_CONFIG_BY_CHAIN_ID = valueByChainId( + { + [ChainId.Ropsten]: { + quoter: '0x2F9e608FD881861B8916257B76613Cb22EE0652c', + router: '0x03782388516e94FcD4c18666303601A12Aa729Ea', + }, + }, + { quoter: NULL_ADDRESS, router: NULL_ADDRESS }, +); + // // BSC // @@ -1283,6 +1299,14 @@ export const DEFAULT_GAS_SCHEDULE: Required = { } return gas; }, + [ERC20BridgeSource.UniswapV3]: (fillData?: FillData) => { + let gas = 160e3; + const path = (fillData as UniswapV3FillData).tokenAddressPath; + if (path.length > 2) { + gas += (path.length - 2) * 117e3; // +117k for each hop. + } + return gas; + }, }; export const DEFAULT_FEE_SCHEDULE: Required = { ...DEFAULT_GAS_SCHEDULE }; diff --git a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts index 54779cc1e4..65da78bb8d 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/orders.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/orders.ts @@ -14,6 +14,7 @@ import { DexSample, DODOFillData, ERC20BridgeSource, + FillData, GenericRouterFillData, KyberFillData, LiquidityProviderFillData, @@ -29,6 +30,7 @@ import { OrderDomain, ShellFillData, UniswapV2FillData, + UniswapV3FillData, } from './types'; // tslint:disable completed-docs @@ -42,6 +44,11 @@ export interface CreateOrderFromPathOpts { bridgeSlippage: number; } +interface FinalUniswapV3FillData extends Omit { + // The uniswap-encoded path that can fll the maximum input amount. + uniswapPath: string; +} + export function createOrdersFromTwoHopSample( sample: DexSample, opts: CreateOrderFromPathOpts, @@ -149,6 +156,8 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'CheeseSwap'); case ERC20BridgeSource.JulSwap: return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'JulSwap'); + case ERC20BridgeSource.UniswapV3: + return encodeBridgeSourceId(BridgeProtocol.UniswapV3, 'UniswapV3'); default: throw new Error(AggregationError.NoBridgeForSource); } @@ -261,6 +270,10 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder const psmFillData = (order as OptimizedMarketBridgeOrder).fillData; bridgeData = encoder.encode([psmFillData.psmAddress, psmFillData.gemTokenAddress]); break; + case ERC20BridgeSource.UniswapV3: + const uniswapV3FillData = (order as OptimizedMarketBridgeOrder).fillData; + bridgeData = encoder.encode([uniswapV3FillData.router, uniswapV3FillData.uniswapPath]); + break; default: throw new Error(AggregationError.NoBridgeForSource); } @@ -279,7 +292,7 @@ export function createBridgeOrder( takerToken, makerAmount, takerAmount, - fillData: fill.fillData, + fillData: createFinalBridgeOrderFillDataFromCollapsedFill(fill), source: fill.source, sourcePathId: fill.sourcePathId, type: FillQuoteTransformerOrderType.Bridge, @@ -287,6 +300,36 @@ export function createBridgeOrder( }; } +function createFinalBridgeOrderFillDataFromCollapsedFill(fill: CollapsedFill): FillData { + switch (fill.source) { + case ERC20BridgeSource.UniswapV3: { + const fd = fill.fillData as UniswapV3FillData; + return { + router: fd.router, + tokenAddressPath: fd.tokenAddressPath, + uniswapPath: getBestUniswapV3PathForInputAmount(fd, fill.input), + }; + } + default: + break; + } + return fill.fillData; +} + +function getBestUniswapV3PathForInputAmount(fillData: UniswapV3FillData, inputAmount: BigNumber): string { + if (fillData.pathAmounts.length === 0) { + throw new Error(`No Uniswap V3 paths`); + } + // Find the best path that can satisfy `inputAmount`. + // Assumes `fillData.pathAmounts` is sorted ascending. + for (const { inputAmount: pathInputAmount, uniswapPath } of fillData.pathAmounts) { + if (pathInputAmount.gte(inputAmount)) { + return uniswapPath; + } + } + return fillData.pathAmounts[fillData.pathAmounts.length - 1].uniswapPath; +} + export function getMakerTakerTokens(opts: CreateOrderFromPathOpts): [string, string] { const makerToken = opts.side === MarketOperation.Sell ? opts.outputToken : opts.inputToken; const takerToken = opts.side === MarketOperation.Sell ? opts.inputToken : opts.outputToken; @@ -368,6 +411,10 @@ export const BRIDGE_ENCODERS: { // Custom integrations [ERC20BridgeSource.MakerPsm]: makerPsmEncoder, [ERC20BridgeSource.BalancerV2]: balancerV2Encoder, + [ERC20BridgeSource.UniswapV3]: AbiEncoder.create([ + { name: 'router', type: 'address' }, + { name: 'path', type: 'bytes' }, + ]), }; function getFillTokenAmounts(fill: CollapsedFill, side: MarketOperation): [BigNumber, BigNumber] { diff --git a/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts b/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts index fad9fca4d6..0f2832ff27 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/sampler_operations.ts @@ -36,6 +36,7 @@ import { OASIS_ROUTER_BY_CHAIN_ID, SELL_SOURCE_FILTER_BY_CHAIN_ID, UNISWAPV1_ROUTER_BY_CHAIN_ID, + UNISWAPV3_CONFIG_BY_CHAIN_ID, ZERO_AMOUNT, } from './constants'; import { getLiquidityProvidersForPair } from './liquidity_provider_utils'; @@ -69,6 +70,7 @@ import { SourcesWithPoolsCache, TokenAdjacencyGraph, UniswapV2FillData, + UniswapV3FillData, } from './types'; /** @@ -677,6 +679,62 @@ export class SamplerOperations { }); } + public getUniswapV3SellQuotes( + router: string, + quoter: string, + tokenAddressPath: string[], + takerFillAmounts: BigNumber[], + source: ERC20BridgeSource = ERC20BridgeSource.UniswapV3, + ): SourceQuoteOperation { + return new SamplerContractOperation({ + source, + contract: this._samplerContract, + function: this._samplerContract.sampleSellsFromUniswapV3, + params: [quoter, tokenAddressPath, takerFillAmounts], + callback: (callResults: string, fillData: UniswapV3FillData): BigNumber[] => { + const [samples, paths] = this._samplerContract.getABIDecodedReturnData<[BigNumber[], string[]]>( + 'sampleSellsFromUniswapV3', + callResults, + ); + fillData.router = router; + fillData.tokenAddressPath = tokenAddressPath; + fillData.pathAmounts = paths.map((uniswapPath, i) => ({ + uniswapPath, + inputAmount: takerFillAmounts[i], + })); + return samples; + }, + }); + } + + public getUniswapV3BuyQuotes( + router: string, + quoter: string, + tokenAddressPath: string[], + makerFillAmounts: BigNumber[], + source: ERC20BridgeSource = ERC20BridgeSource.UniswapV3, + ): SourceQuoteOperation { + return new SamplerContractOperation({ + source, + contract: this._samplerContract, + function: this._samplerContract.sampleBuysFromUniswapV3, + params: [quoter, tokenAddressPath, makerFillAmounts], + callback: (callResults: string, fillData: UniswapV3FillData): BigNumber[] => { + const [samples, paths] = this._samplerContract.getABIDecodedReturnData<[BigNumber[], string[]]>( + 'sampleBuysFromUniswapV3', + callResults, + ); + fillData.router = router; + fillData.tokenAddressPath = tokenAddressPath; + fillData.pathAmounts = paths.map((uniswapPath, i) => ({ + uniswapPath, + inputAmount: makerFillAmounts[i], + })); + return samples; + }, + }); + } + public getTwoHopSellQuotes( sources: ERC20BridgeSource[], makerToken: string, @@ -1266,6 +1324,16 @@ export class SamplerOperations { return []; } return this.getMakerPsmSellQuotes(psmInfo, makerToken, takerToken, takerFillAmounts); + case ERC20BridgeSource.UniswapV3: { + const { quoter, router } = UNISWAPV3_CONFIG_BY_CHAIN_ID[this.chainId]; + if (!isValidAddress(router) || !isValidAddress(quoter)) { + return []; + } + return [ + [takerToken, makerToken], + ...intermediateTokens.map(t => [takerToken, t, makerToken]), + ].map(path => this.getUniswapV3SellQuotes(router, quoter, path, takerFillAmounts)); + } default: throw new Error(`Unsupported sell sample source: ${source}`); } @@ -1502,6 +1570,16 @@ export class SamplerOperations { return []; } return this.getMakerPsmBuyQuotes(psmInfo, makerToken, takerToken, makerFillAmounts); + case ERC20BridgeSource.UniswapV3: { + const { quoter, router } = UNISWAPV3_CONFIG_BY_CHAIN_ID[this.chainId]; + if (!isValidAddress(router) || !isValidAddress(quoter)) { + return []; + } + return [ + [takerToken, makerToken], + ...intermediateTokens.map(t => [takerToken, t, makerToken]), + ].map(path => this.getUniswapV3BuyQuotes(router, quoter, path, makerFillAmounts)); + } default: throw new Error(`Unsupported buy sample source: ${source}`); } diff --git a/packages/asset-swapper/src/utils/market_operation_utils/types.ts b/packages/asset-swapper/src/utils/market_operation_utils/types.ts index d1e10dc3be..f5a1668758 100644 --- a/packages/asset-swapper/src/utils/market_operation_utils/types.ts +++ b/packages/asset-swapper/src/utils/market_operation_utils/types.ts @@ -65,6 +65,7 @@ export enum ERC20BridgeSource { Component = 'Component', Saddle = 'Saddle', XSigma = 'xSigma', + UniswapV3 = 'Uniswap_V3', // BSC only PancakeSwap = 'PancakeSwap', PancakeSwapV2 = 'PancakeSwap_V2', @@ -217,6 +218,12 @@ export interface HopInfo { returnData: string; } +export interface UniswapV3FillData extends FillData { + tokenAddressPath: string[]; + router: string; + pathAmounts: Array<{ uniswapPath: string; inputAmount: BigNumber }>; +} + /** * Represents a node on a fill path. */ diff --git a/packages/asset-swapper/test/artifacts.ts b/packages/asset-swapper/test/artifacts.ts index a07afaed70..e6af9fb93a 100644 --- a/packages/asset-swapper/test/artifacts.ts +++ b/packages/asset-swapper/test/artifacts.ts @@ -44,6 +44,7 @@ import * as TestNativeOrderSampler from '../test/generated-artifacts/TestNativeO import * as TwoHopSampler from '../test/generated-artifacts/TwoHopSampler.json'; import * as UniswapSampler from '../test/generated-artifacts/UniswapSampler.json'; import * as UniswapV2Sampler from '../test/generated-artifacts/UniswapV2Sampler.json'; +import * as UniswapV3Sampler from '../test/generated-artifacts/UniswapV3Sampler.json'; import * as UtilitySampler from '../test/generated-artifacts/UtilitySampler.json'; export const artifacts = { ApproximateBuys: ApproximateBuys as ContractArtifact, @@ -70,6 +71,7 @@ export const artifacts = { TwoHopSampler: TwoHopSampler as ContractArtifact, UniswapSampler: UniswapSampler as ContractArtifact, UniswapV2Sampler: UniswapV2Sampler as ContractArtifact, + UniswapV3Sampler: UniswapV3Sampler as ContractArtifact, UtilitySampler: UtilitySampler as ContractArtifact, IBalancer: IBalancer as ContractArtifact, IBancor: IBancor as ContractArtifact, diff --git a/packages/asset-swapper/test/contracts/erc20_bridge_sampler_test.ts b/packages/asset-swapper/test/contracts/erc20_bridge_sampler_test.ts index 3754cfe28a..5b586191f1 100644 --- a/packages/asset-swapper/test/contracts/erc20_bridge_sampler_test.ts +++ b/packages/asset-swapper/test/contracts/erc20_bridge_sampler_test.ts @@ -18,7 +18,6 @@ import { DummyLiquidityProviderContract, TestERC20BridgeSamplerContract } from ' // tslint:disable: custom-no-magic-numbers const { NULL_ADDRESS } = constants; - blockchainTests('erc20-bridge-sampler', env => { let testContract: TestERC20BridgeSamplerContract; const RATE_DENOMINATOR = constants.ONE_ETHER; @@ -45,7 +44,7 @@ blockchainTests('erc20-bridge-sampler', env => { testContract = await TestERC20BridgeSamplerContract.deployFrom0xArtifactAsync( artifacts.TestERC20BridgeSampler, env.provider, - env.txDefaults, + { ...env.txDefaults, gas: 100e6 }, {}, ); UNISWAP_V2_ROUTER = await testContract.uniswapV2Router().callAsync(); diff --git a/packages/asset-swapper/test/exchange_proxy_swap_quote_consumer_test.ts b/packages/asset-swapper/test/exchange_proxy_swap_quote_consumer_test.ts index 62a2c337ea..f1ca6d8112 100644 --- a/packages/asset-swapper/test/exchange_proxy_swap_quote_consumer_test.ts +++ b/packages/asset-swapper/test/exchange_proxy_swap_quote_consumer_test.ts @@ -60,12 +60,7 @@ describe('ExchangeProxySwapQuoteConsumer', () => { let consumer: ExchangeProxySwapQuoteConsumer; before(async () => { - const fakeProvider = { - async sendAsync(): Promise { - /* noop */ - }, - }; - consumer = new ExchangeProxySwapQuoteConsumer(fakeProvider, contractAddresses, { chainId: CHAIN_ID }); + consumer = new ExchangeProxySwapQuoteConsumer(contractAddresses, { chainId: CHAIN_ID }); }); function getRandomOrder(orderFields?: Partial): LimitOrderFields { diff --git a/packages/asset-swapper/test/wrappers.ts b/packages/asset-swapper/test/wrappers.ts index 8d3699ac75..92feca1f15 100644 --- a/packages/asset-swapper/test/wrappers.ts +++ b/packages/asset-swapper/test/wrappers.ts @@ -42,4 +42,5 @@ export * from '../test/generated-wrappers/test_native_order_sampler'; export * from '../test/generated-wrappers/two_hop_sampler'; export * from '../test/generated-wrappers/uniswap_sampler'; export * from '../test/generated-wrappers/uniswap_v2_sampler'; +export * from '../test/generated-wrappers/uniswap_v3_sampler'; export * from '../test/generated-wrappers/utility_sampler'; diff --git a/packages/asset-swapper/tsconfig.json b/packages/asset-swapper/tsconfig.json index c51b95867d..5d9a9ee254 100644 --- a/packages/asset-swapper/tsconfig.json +++ b/packages/asset-swapper/tsconfig.json @@ -45,6 +45,7 @@ "test/generated-artifacts/TwoHopSampler.json", "test/generated-artifacts/UniswapSampler.json", "test/generated-artifacts/UniswapV2Sampler.json", + "test/generated-artifacts/UniswapV3Sampler.json", "test/generated-artifacts/UtilitySampler.json" ] } diff --git a/packages/contract-artifacts/package.json b/packages/contract-artifacts/package.json index 2269742651..4b12fa4986 100644 --- a/packages/contract-artifacts/package.json +++ b/packages/contract-artifacts/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts", "devDependencies": { - "@0x/utils": "^6.4.2", + "@0x/utils": "^6.4.3", "@types/mocha": "^5.2.7", "chai": "^4.0.1", "lodash": "^4.17.11", diff --git a/packages/contract-wrappers-test/package.json b/packages/contract-wrappers-test/package.json index d6b4578aaf..4022110f41 100644 --- a/packages/contract-wrappers-test/package.json +++ b/packages/contract-wrappers-test/package.json @@ -33,15 +33,15 @@ "devDependencies": { "@0x/contract-wrappers": "^13.16.0", "@0x/contracts-test-utils": "^5.3.25", - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/migrations": "^8.0.5", "@0x/order-utils": "^10.4.20", - "@0x/subproviders": "^6.5.2", + "@0x/subproviders": "^6.5.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@types/nock": "^10.0.3", "chai": "^4.0.1", "dirty-chai": "^2.0.1", diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index c514138079..1375a20c4f 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -55,13 +55,13 @@ "typescript": "4.2.2" }, "dependencies": { - "@0x/assert": "^3.0.26", - "@0x/base-contract": "^6.3.2", + "@0x/assert": "^3.0.27", + "@0x/base-contract": "^6.4.0", "@0x/contract-addresses": "^6.0.0", - "@0x/json-schemas": "^6.1.2", + "@0x/json-schemas": "^6.1.3", "@0x/types": "^3.3.3", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "ethereum-types": "^3.5.0", "ethers": "~4.0.4" }, diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 2465fa1c3f..e6e1786b69 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -48,7 +48,7 @@ "registry": "git@github.com:0xProject/gitpkg-registry.git" }, "devDependencies": { - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", @@ -67,7 +67,7 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^6.3.2", + "@0x/base-contract": "^6.4.0", "@0x/contract-addresses": "^6.0.0", "@0x/contracts-asset-proxy": "^3.7.10", "@0x/contracts-coordinator": "^3.1.29", @@ -82,11 +82,11 @@ "@0x/contracts-staking": "^2.0.36", "@0x/contracts-utils": "^4.7.7", "@0x/contracts-zero-ex": "^0.22.3", - "@0x/sol-compiler": "^4.7.2", - "@0x/subproviders": "^6.5.2", + "@0x/sol-compiler": "^4.7.3", + "@0x/subproviders": "^6.5.3", "@0x/typescript-typings": "^5.2.0", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "@ledgerhq/hw-app-eth": "^4.3.0", "@types/web3-provider-engine": "^14.0.0", "ethereum-types": "^3.5.0", diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index e011cd928d..238ac349da 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -43,8 +43,8 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/packages/order-utils", "devDependencies": { - "@0x/dev-utils": "^4.2.6", - "@0x/subproviders": "^6.5.2", + "@0x/dev-utils": "^4.2.7", + "@0x/subproviders": "^6.5.3", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", @@ -68,12 +68,12 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0x/assert": "^3.0.26", + "@0x/assert": "^3.0.27", "@0x/contract-addresses": "^6.0.0", "@0x/contract-wrappers": "^13.16.0", - "@0x/json-schemas": "^6.1.2", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/json-schemas": "^6.1.3", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "ethereumjs-util": "^7.0.10", "ethers": "~4.0.4", "lodash": "^4.17.11" diff --git a/packages/protocol-utils/CHANGELOG.json b/packages/protocol-utils/CHANGELOG.json index a421a6afaa..81fe9b94ab 100644 --- a/packages/protocol-utils/CHANGELOG.json +++ b/packages/protocol-utils/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Add BalancerV2, remove Smoothy, Component and Saddle in BridgeProtocol enum", "pr": 206 + }, + { + "note": "Add UniswapV3 bridge protocol IDs and remove invalid ones", + "pr": 197 } ] }, diff --git a/packages/protocol-utils/package.json b/packages/protocol-utils/package.json index 9374404834..13321f642b 100644 --- a/packages/protocol-utils/package.json +++ b/packages/protocol-utils/package.json @@ -41,7 +41,7 @@ }, "homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils", "devDependencies": { - "@0x/dev-utils": "^4.2.6", + "@0x/dev-utils": "^4.2.7", "@0x/ts-doc-gen": "^0.0.28", "@0x/tslint-config": "^4.1.4", "@0x/types": "^3.3.3", @@ -62,13 +62,13 @@ "web3-provider-engine": "14.0.6" }, "dependencies": { - "@0x/assert": "^3.0.26", + "@0x/assert": "^3.0.27", "@0x/contract-addresses": "^6.0.0", "@0x/contract-wrappers": "^13.16.0", - "@0x/json-schemas": "^6.1.2", - "@0x/subproviders": "^6.5.2", - "@0x/utils": "^6.4.2", - "@0x/web3-wrapper": "^7.5.2", + "@0x/json-schemas": "^6.1.3", + "@0x/subproviders": "^6.5.3", + "@0x/utils": "^6.4.3", + "@0x/web3-wrapper": "^7.5.3", "chai": "^4.0.1", "ethereumjs-util": "^7.0.10", "ethers": "~4.0.4", diff --git a/packages/protocol-utils/src/transformer_utils.ts b/packages/protocol-utils/src/transformer_utils.ts index 9f928067f6..7927092d9d 100644 --- a/packages/protocol-utils/src/transformer_utils.ts +++ b/packages/protocol-utils/src/transformer_utils.ts @@ -127,6 +127,7 @@ export enum BridgeProtocol { Nerve, MakerPsm, BalancerV2, + UniswapV3, } // tslint:enable: enum-naming diff --git a/yarn.lock b/yarn.lock index 622498d752..477aaa7c45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -643,7 +643,7 @@ npmlog "^4.1.2" write-file-atomic "^2.3.0" -"@0x/abi-gen@^5.5.2", "@0x/abi-gen@^5.6.0": +"@0x/abi-gen@^5.6.0": version "5.6.0" resolved "https://registry.yarnpkg.com/@0x/abi-gen/-/abi-gen-5.6.0.tgz#2b022efe77a35f5589624633d880d794d0a16bde" dependencies: @@ -676,17 +676,6 @@ lodash "^4.17.11" valid-url "^1.0.9" -"@0x/assert@^3.0.26": - version "3.0.26" - resolved "https://registry.yarnpkg.com/@0x/assert/-/assert-3.0.26.tgz#c9c3209e093c5fcbb5ff8d3b8f767d35c87195fc" - dependencies: - "@0x/json-schemas" "^6.1.2" - "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@types/node" "12.12.54" - lodash "^4.17.11" - valid-url "^1.0.9" - "@0x/assert@^3.0.27": version "3.0.27" resolved "https://registry.yarnpkg.com/@0x/assert/-/assert-3.0.27.tgz#a4e54e5c1703c276689a21c935ecd24b2be292b9" @@ -709,7 +698,7 @@ lodash "^4.17.11" valid-url "^1.0.9" -"@0x/base-contract@^6.3.2", "@0x/base-contract@^6.4.0": +"@0x/base-contract@^6.4.0": version "6.4.0" resolved "https://registry.yarnpkg.com/@0x/base-contract/-/base-contract-6.4.0.tgz#7ffcb18b0b8d522545074cada1f4d62dce0a88ec" dependencies: @@ -730,15 +719,16 @@ version "4.12.0" resolved "https://registry.yarnpkg.com/@0x/contract-addresses/-/contract-addresses-4.12.0.tgz#2adb0bcde763ad13437f782adf25c403107ff428" -"@0x/contracts-gen@^2.0.37": - version "2.0.37" - resolved "https://registry.yarnpkg.com/@0x/contracts-gen/-/contracts-gen-2.0.37.tgz#5b15a8921355c4a2fc74609661246e1d707283d0" +"@0x/contracts-gen@^2.0.38": + version "2.0.38" + resolved "https://registry.yarnpkg.com/@0x/contracts-gen/-/contracts-gen-2.0.38.tgz#6f2977e2bcb299b5e8a32f45d7eca73d19e34c50" + integrity sha512-SIvfwGIjlZgL979q8iohBVVFH09kJdNCn8ozFEKxMs67GCBEWQFWOAcvyadKGPgyvMkPSOh10WBUHO9wRf18wg== dependencies: - "@0x/sol-compiler" "^4.7.2" + "@0x/sol-compiler" "^4.7.3" "@0x/sol-resolver" "^3.1.8" "@0x/types" "^3.3.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" + "@0x/utils" "^6.4.3" "@types/node" "12.12.54" ethereum-types "^3.5.0" lodash "^4.17.11" @@ -773,15 +763,16 @@ typeorm "0.2.7" websocket "^1.0.25" -"@0x/dev-utils@^4.2.6": - version "4.2.6" - resolved "https://registry.yarnpkg.com/@0x/dev-utils/-/dev-utils-4.2.6.tgz#7e918d045c4aeb10aa9ce922c8315a1953b40888" +"@0x/dev-utils@^4.2.7": + version "4.2.7" + resolved "https://registry.yarnpkg.com/@0x/dev-utils/-/dev-utils-4.2.7.tgz#9c85a134cace5a423a75221241fd687df81f3bbc" + integrity sha512-jblw/3Hpfw5E2cHTyJxbRcHsCYSCLsTOMvitbo+f/SX61HOvjXGO+T0sxy7l2d3HPu8lXaDywoZTt56ooF5EiQ== dependencies: - "@0x/subproviders" "^6.5.2" + "@0x/subproviders" "^6.5.3" "@0x/types" "^3.3.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@0x/web3-wrapper" "^7.5.2" + "@0x/utils" "^6.4.3" + "@0x/web3-wrapper" "^7.5.3" "@types/node" "12.12.54" "@types/web3-provider-engine" "^14.0.0" chai "^4.0.1" @@ -810,7 +801,7 @@ jsonschema "^1.2.0" lodash.values "^4.3.0" -"@0x/json-schemas@^6.1.2", "@0x/json-schemas@^6.1.3": +"@0x/json-schemas@^6.1.3": version "6.1.3" resolved "https://registry.yarnpkg.com/@0x/json-schemas/-/json-schemas-6.1.3.tgz#da71ed2e50ae6813a6d4d0fe5f8ad69b8e6a7435" dependencies: @@ -831,12 +822,13 @@ web3-providers "^2.0.0-alpha.1" websocket "^1.0.29" -"@0x/monorepo-scripts@^3.1.6": - version "3.1.6" - resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.1.6.tgz#a33a8e1706f5d6ce7277a15b48ade48b3ec2cf9a" +"@0x/monorepo-scripts@^3.1.7": + version "3.1.7" + resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-3.1.7.tgz#17e719b9e26875958562532ed705cd770d107a43" + integrity sha512-Us3Rn77cIFWXTkenJFoMA71TXW0WaHIcypwGZ5KaGAtItAm9sEy/DUwYTCc0Wyb1C+5QdOTwL5Cmif0N3C2f9w== dependencies: "@0x/types" "^3.3.3" - "@0x/utils" "^6.4.2" + "@0x/utils" "^6.4.3" "@lerna/batch-packages" "^3.0.0-beta.18" "@types/depcheck" "^0.6.0" "@types/node" "12.12.54" @@ -871,17 +863,18 @@ express-async-handler "^1.1.4" http-status-codes "^1.4.0" -"@0x/sol-compiler@^4.7.2": - version "4.7.2" - resolved "https://registry.yarnpkg.com/@0x/sol-compiler/-/sol-compiler-4.7.2.tgz#322e3061382f3c333a0f96999abd488c02800b87" +"@0x/sol-compiler@^4.7.3": + version "4.7.3" + resolved "https://registry.yarnpkg.com/@0x/sol-compiler/-/sol-compiler-4.7.3.tgz#d994661bc9c06a0a63b0e2f77ee6511d3cef488e" + integrity sha512-JNbdD9BgVDMFUvLX4Lb8JLLukF5svLoqk0WNaNz3LmOiZv7yPHOkI1XugR8XmG6Mr/YUEfCGk6u/VQF+1rCo5w== dependencies: - "@0x/assert" "^3.0.26" - "@0x/json-schemas" "^6.1.2" + "@0x/assert" "^3.0.27" + "@0x/json-schemas" "^6.1.3" "@0x/sol-resolver" "^3.1.8" "@0x/types" "^3.3.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@0x/web3-wrapper" "^7.5.2" + "@0x/utils" "^6.4.3" + "@0x/web3-wrapper" "^7.5.3" "@types/node" "12.12.54" "@types/yargs" "^11.0.0" chalk "^2.3.0" @@ -899,12 +892,13 @@ web3-eth-abi "^1.0.0-beta.24" yargs "^10.0.3" -"@0x/sol-coverage@^4.0.36": - version "4.0.36" - resolved "https://registry.yarnpkg.com/@0x/sol-coverage/-/sol-coverage-4.0.36.tgz#11214f73d1f58b71df10501fce5dbe8f22f1861a" +"@0x/sol-coverage@^4.0.37": + version "4.0.37" + resolved "https://registry.yarnpkg.com/@0x/sol-coverage/-/sol-coverage-4.0.37.tgz#951363f1497cc65edf9bc76f37ac7824667e2c2b" + integrity sha512-TgluveJKVXbi+V5ib+0VX0n5tJN6V9g3V8GriwXwVK4HqCFBvAWqXs8CpFcmQr7OQxXy7T2EKfD4tvNdlloqJA== dependencies: - "@0x/sol-tracing-utils" "^7.2.2" - "@0x/subproviders" "^6.5.2" + "@0x/sol-tracing-utils" "^7.2.3" + "@0x/subproviders" "^6.5.3" "@0x/typescript-typings" "^5.2.0" "@types/minimatch" "^3.0.3" "@types/node" "12.12.54" @@ -913,14 +907,15 @@ minimatch "^3.0.4" web3-provider-engine "14.0.6" -"@0x/sol-profiler@^4.1.26": - version "4.1.26" - resolved "https://registry.yarnpkg.com/@0x/sol-profiler/-/sol-profiler-4.1.26.tgz#dc5a590f902ae5652295ef06895ad21743295144" +"@0x/sol-profiler@^4.1.27": + version "4.1.27" + resolved "https://registry.yarnpkg.com/@0x/sol-profiler/-/sol-profiler-4.1.27.tgz#2bd14882dd204a7465b494149877daa16d86208d" + integrity sha512-5pDdQC1WMnpaObfuWo8kQuQ0UTb6VhlD1nuflHarI7F/AsH6M4DRGrrcRw904q1ZOpyODrGuvgpY8qxXqcQRRQ== dependencies: - "@0x/sol-tracing-utils" "^7.2.2" - "@0x/subproviders" "^6.5.2" + "@0x/sol-tracing-utils" "^7.2.3" + "@0x/subproviders" "^6.5.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" + "@0x/utils" "^6.4.3" "@types/node" "12.12.54" ethereum-types "^3.5.0" ethereumjs-util "^7.0.10" @@ -936,12 +931,13 @@ "@types/node" "12.12.54" lodash "^4.17.11" -"@0x/sol-trace@^3.0.36": - version "3.0.36" - resolved "https://registry.yarnpkg.com/@0x/sol-trace/-/sol-trace-3.0.36.tgz#f1bd31b4c13b17abfec8e674896c64b8cdb67cfd" +"@0x/sol-trace@^3.0.37": + version "3.0.37" + resolved "https://registry.yarnpkg.com/@0x/sol-trace/-/sol-trace-3.0.37.tgz#915a1c7c4869f9a95994fdb24878997d5bc39450" + integrity sha512-o7tkp3uoEWM9cT4PLiQKysmT285TEpMKLCup1uIjGutUNtWOTeLel8Lr5Z5KweuHqIolwLVpHyCwV2MbWp0DFg== dependencies: - "@0x/sol-tracing-utils" "^7.2.2" - "@0x/subproviders" "^6.5.2" + "@0x/sol-tracing-utils" "^7.2.3" + "@0x/subproviders" "^6.5.3" "@0x/typescript-typings" "^5.2.0" "@types/node" "12.12.54" chalk "^2.3.0" @@ -951,17 +947,18 @@ loglevel "^1.6.1" web3-provider-engine "14.0.6" -"@0x/sol-tracing-utils@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@0x/sol-tracing-utils/-/sol-tracing-utils-7.2.2.tgz#330246387c8d6ad78828752d2a23e9680d8fe7b6" +"@0x/sol-tracing-utils@^7.2.3": + version "7.2.3" + resolved "https://registry.yarnpkg.com/@0x/sol-tracing-utils/-/sol-tracing-utils-7.2.3.tgz#2a24969943315af4f86ceab12ad8bc34433069e5" + integrity sha512-htXf69MXo6gZ5+LK/2VkoitJyZ88e+zkR3OH+DkoIiPCOhAh+72m9Vw7Ozkb8pqXuxENllBHB/s1ZmNsXJimNg== dependencies: - "@0x/dev-utils" "^4.2.6" - "@0x/sol-compiler" "^4.7.2" + "@0x/dev-utils" "^4.2.7" + "@0x/sol-compiler" "^4.7.3" "@0x/sol-resolver" "^3.1.8" - "@0x/subproviders" "^6.5.2" + "@0x/subproviders" "^6.5.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@0x/web3-wrapper" "^7.5.2" + "@0x/utils" "^6.4.3" + "@0x/web3-wrapper" "^7.5.3" "@types/node" "12.12.54" "@types/solidity-parser-antlr" "^0.2.3" chalk "^2.3.0" @@ -1006,15 +1003,16 @@ optionalDependencies: "@ledgerhq/hw-transport-node-hid" "^4.3.0" -"@0x/subproviders@^6.5.2": - version "6.5.2" - resolved "https://registry.yarnpkg.com/@0x/subproviders/-/subproviders-6.5.2.tgz#4734759b042808cba09fa6591ab645ec67262a7a" +"@0x/subproviders@^6.5.3": + version "6.5.3" + resolved "https://registry.yarnpkg.com/@0x/subproviders/-/subproviders-6.5.3.tgz#aec86903527c8f972beec1bc2fbda5fdba361235" + integrity sha512-Qg1T7NaiMiEU+mIOojcSCRM2aQKrVB4pc6ghfoBtIkLE1Bv9Tnnxu7EQmvLPoa43rZsZ98j9q1AGEt2kOlaD4w== dependencies: - "@0x/assert" "^3.0.26" + "@0x/assert" "^3.0.27" "@0x/types" "^3.3.3" "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@0x/web3-wrapper" "^7.5.2" + "@0x/utils" "^6.4.3" + "@0x/web3-wrapper" "^7.5.3" "@ethereumjs/common" "^2.2.0" "@ethereumjs/tx" "^3.1.3" "@ledgerhq/hw-app-eth" "^4.3.0" @@ -1170,7 +1168,7 @@ js-sha3 "^0.7.0" lodash "^4.17.11" -"@0x/utils@^6.4.2", "@0x/utils@^6.4.3": +"@0x/utils@^6.4.3": version "6.4.3" resolved "https://registry.yarnpkg.com/@0x/utils/-/utils-6.4.3.tgz#d7c710a8d8b8f2ee3a4e324dc71423078d93ff37" dependencies: @@ -1203,20 +1201,6 @@ ethers "~4.0.4" lodash "^4.17.11" -"@0x/web3-wrapper@^7.5.2": - version "7.5.2" - resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.5.2.tgz#135a1bc6a5cc4e3841bb11d8e82c3ee9db82dd10" - dependencies: - "@0x/assert" "^3.0.26" - "@0x/json-schemas" "^6.1.2" - "@0x/typescript-typings" "^5.2.0" - "@0x/utils" "^6.4.2" - "@types/node" "12.12.54" - ethereum-types "^3.5.0" - ethereumjs-util "^7.0.10" - ethers "~4.0.4" - lodash "^4.17.11" - "@0x/web3-wrapper@^7.5.3": version "7.5.3" resolved "https://registry.yarnpkg.com/@0x/web3-wrapper/-/web3-wrapper-7.5.3.tgz#f36c3a2e5ffcbca2b3deef1a15e7485eb91dba7e" @@ -1651,6 +1635,15 @@ unique-filename "^1.1.1" which "^1.3.1" +"@jest/types@^24.9.0": + version "24.9.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" + integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.0" + "@types/istanbul-reports" "^1.1.1" + "@types/yargs" "^13.0.0" + "@ledgerhq/devices@^4.78.0": version "4.78.0" resolved "https://registry.yarnpkg.com/@ledgerhq/devices/-/devices-4.78.0.tgz#149b572f0616096e2bd5eb14ce14d0061c432be6" @@ -2595,6 +2588,26 @@ version "0.0.35" resolved "https://registry.yarnpkg.com/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.35.tgz#c1c0d402daac324582b6186b91f8905340ea3361" +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" + integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== + +"@types/istanbul-lib-report@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" + integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== + dependencies: + "@types/istanbul-lib-coverage" "*" + +"@types/istanbul-reports@^1.1.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-1.1.2.tgz#e875cc689e47bce549ec81f3df5e6f6f11cfaeb2" + integrity sha512-P/W9yOX/3oPZSpaYOCQzGqgCQRXn0FFO/V8bWrCQs+wLmvVVxk6CRBXALEvNs9OHIatlnlFokfhuDo2ug01ciw== + dependencies: + "@types/istanbul-lib-coverage" "*" + "@types/istanbul-lib-report" "*" + "@types/js-combinatorics@^0.5.29": version "0.5.32" resolved "https://registry.yarnpkg.com/@types/js-combinatorics/-/js-combinatorics-0.5.32.tgz#befa3c2b6ea10c45fd8d672f7aa477a79a2601ed" @@ -2719,10 +2732,22 @@ dependencies: "@types/ethereum-protocol" "*" +"@types/yargs-parser@*": + version "20.2.0" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.0.tgz#dd3e6699ba3237f0348cd085e4698780204842f9" + integrity sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA== + "@types/yargs@^11.0.0": version "11.1.7" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-11.1.7.tgz#a5be4a5f0f4b77b8accdd476004ce911f4241e8f" +"@types/yargs@^13.0.0": + version "13.0.11" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.11.tgz#def2f0c93e4bdf2c61d7e34899b17e34be28d3b1" + integrity sha512-NRqD6T4gktUrDi1o1wLH3EKC1o2caCr7/wR87ODcbVITQF106OM3sFN92ysZ++wqelOd1CTzatnOBRDYYG6wGQ== + dependencies: + "@types/yargs-parser" "*" + "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -8214,6 +8239,15 @@ iterate-value@^1.0.0: es-get-iterator "^1.0.2" iterate-iterator "^1.0.1" +jest-changed-files@^24.9.0: + version "24.9.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" + integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== + dependencies: + "@jest/types" "^24.9.0" + execa "^1.0.0" + throat "^4.0.0" + jquery@^3.4.1: version "3.5.1" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.5.1.tgz#d7b4d08e1bfdb86ad2f1a3d039ea17304717abb5" @@ -10723,9 +10757,9 @@ public-encrypt@^4.0.0: randombytes "^2.0.1" safe-buffer "^5.1.2" -"publish-release@https://github.com/0xProject/publish-release.git#3f8be1105a356527f4b362ff456d94bf9a82f2ed": +"publish-release@git+https://github.com/0xProject/publish-release.git#3f8be1105a356527f4b362ff456d94bf9a82f2ed": version "1.3.3" - resolved "https://github.com/0xProject/publish-release.git#3f8be1105a356527f4b362ff456d94bf9a82f2ed" + resolved "git+https://github.com/0xProject/publish-release.git#3f8be1105a356527f4b362ff456d94bf9a82f2ed" dependencies: async "^0.9.0" ghauth "^2.0.0" @@ -12429,7 +12463,7 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" -throat@^4.1.0: +throat@^4.0.0, throat@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" @@ -14024,17 +14058,20 @@ ws@^5.1.1: dependencies: async-limiter "~1.0.0" -wsrun@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/wsrun/-/wsrun-2.2.1.tgz#ab93cde5e59d4e8ffd140c06be66e2697c791346" +wsrun@^5.2.4: + version "5.2.4" + resolved "https://registry.yarnpkg.com/wsrun/-/wsrun-5.2.4.tgz#6eb6c3ccd3327721a8df073a5e3578fb0dea494e" + integrity sha512-akv3WtKBohdHsD/5uqhYRHw6GXeCXe87FsSg28Szq+2cpoqRW2SY4yPfm1D0za1cS6MgNy5hPgzS5SqYJaGUxg== dependencies: bluebird "^3.5.1" chalk "^2.3.0" glob "^7.1.2" + jest-changed-files "^24.9.0" lodash "^4.17.4" + minimatch "^3.0.4" split "^1.0.1" throat "^4.1.0" - yargs "^10.0.3" + yargs "^13.0.0" xhr-request-promise@^0.1.2: version "0.1.3" @@ -14223,9 +14260,10 @@ yargs@13.2.4: y18n "^4.0.0" yargs-parser "^13.1.0" -yargs@13.3.2, yargs@^13.3.0: +yargs@13.3.2, yargs@^13.0.0, yargs@^13.3.0: version "13.3.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== dependencies: cliui "^5.0.0" find-up "^3.0.0"