Compare commits

...

68 Commits

Author SHA1 Message Date
Github Actions
d06f6c8b4d Publish
- @0x/contracts-erc20@3.3.45
 - @0x/contracts-test-utils@5.4.36
 - @0x/contracts-treasury@1.4.28
 - @0x/contracts-utils@4.8.26
 - @0x/contracts-zero-ex@0.37.5
 - @0x/asset-swapper@16.66.12
 - @0x/contract-addresses@6.24.0
 - @0x/contract-wrappers@13.22.5
 - @0x/protocol-utils@11.16.12
2022-10-05 23:42:44 +00:00
Github Actions
a689e98b0f Updated CHANGELOGS & MD docs 2022-10-05 23:42:41 +00:00
Noah Khamliche
6f72a8e8e3 fix: add balancerV2/batch to optimismBridgeAdapter (#578)
* add balancerV2/batch to optimismBridgeAdapter

* changelog

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
Co-authored-by: Savarn Dontamsetti <sav.dontamsetti@gmail.com>
2022-09-29 12:16:34 -04:00
eobbad
422f83fc99 Chore: Remove Solhint + TSlint clean-up [TKR-585] (#593)
* contracts/ERC20

* remove tslint.json from erc20

* remove tslint.json from test-utils

* remove solhint from treasury

* remove tslint.json from treasury

* remove solhint from utils

* remove tslint.json from utils

* remove solhint from zero-ex

* remove lint-contracts
2022-09-27 14:51:47 -04:00
eobbad
b6597df84f ignore generated wrappers and asset-swapper (#591) 2022-09-26 16:05:55 -04:00
eobbad
c9b1aac8a5 remove scripts from asset swapper (#590) 2022-09-26 12:41:38 -04:00
Ido Kleinman
87f4189e93 chore: Replace TSLint with ESLint in contracts/utils,treasury,test-utils,erc20 (#589)
* replace TSLint with ESLint in contracts-utils

* also contracts/treasury

* also do test-utils

* yarn fix

* fix stuff yarn fix could not fix

* eslint erc20 contracts folder too

* changelogs

* actually zeroex was a different pr

* PR #589 in changelogs

* whitespace

* prettier
2022-09-23 12:39:27 -07:00
Ido Kleinman
390e1b8510 chore: Replace TSLint with ESLint in contracts/zeroex (#587)
* replace tslint with eslint

* config file

* fix linting errors

* changelog

* prettier
2022-09-23 12:39:17 -07:00
Ido Kleinman
5645e87aca chore: add ESLint to package contract wrappers (#584)
* replace tslint with eslint + add eslintrc config

* few more missing packages for eslint

* exclude. now eslint is running (but there are errors)

* correct excludes fixes all the linter issues

* no need for max warnings
2022-09-21 17:20:09 -07:00
eobbad
0daa988996 purge tslint comments (#585) 2022-09-21 19:53:47 -04:00
eobbad
b4d6f74d7b [protocol-utils] tslint->eslint (#582)
* initialize eslint and remove tslint

* change some packages + eslintrc

* run eslint fix

* run prettier

* changelog

* update package.json

* changelog update+prettier
2022-09-21 19:37:25 -04:00
Kyu
2163cb221b Add missing Arbitrum ZeroExGovernor address (#583) 2022-09-21 16:16:28 -07:00
Github Actions
4575300016 Publish
- @0x/contracts-erc20@3.3.44
 - @0x/contracts-test-utils@5.4.35
 - @0x/contracts-treasury@1.4.27
 - @0x/contracts-utils@4.8.25
 - @0x/contracts-zero-ex@0.37.4
 - @0x/asset-swapper@16.66.11
 - @0x/contract-addresses@6.23.4
 - @0x/contract-wrappers@13.22.4
 - @0x/protocol-utils@11.16.11
2022-09-21 19:02:46 +00:00
Github Actions
82341c3b9d Updated CHANGELOGS & MD docs 2022-09-21 19:02:43 +00:00
Noah Khamliche
f89c2d2fed feat: add new fqt address containing nerve mixin (#581)
* add new fqt address containing nerve

* changelog

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-09-21 14:44:55 -04:00
Savarn Dontamsetti (Sav)
09419a7909 Adding Nerve Mixin to Arbitrum Bridge Adapter [TKR-554] (#579)
* adding Nerve Mixin to Arbitrum Bridge Adapter

* refactor bridgeAdapter to include currently deployed changes

* remove duplicate DODOV2

* removing DODO V1 from Arbitrum Bridge Adapter

* updating imports

* fixing CI: ganache tests

* Invalid caching configuration

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
Co-authored-by: Marcin Wolny <marcin@0xproject.com>
2022-09-20 10:54:50 -04:00
Github Actions
1fa093be64 Publish
- @0x/contracts-erc20@3.3.43
 - @0x/contracts-test-utils@5.4.34
 - @0x/contracts-treasury@1.4.26
 - @0x/contracts-utils@4.8.24
 - @0x/contracts-zero-ex@0.37.3
 - @0x/asset-swapper@16.66.10
 - @0x/contract-addresses@6.23.3
 - @0x/contract-wrappers@13.22.3
 - @0x/protocol-utils@11.16.10
2022-09-12 15:56:30 +00:00
Github Actions
8e9f358a02 Updated CHANGELOGS & MD docs 2022-09-12 15:56:27 +00:00
Noah Khamliche
0a2e8fc224 feat: add new fqt for optimism with balancerv2 (#577)
* add new fqt for optimism with balancerv2

* changelog

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-09-09 15:50:23 -04:00
Github Actions
5653ee8f86 Publish
- @0x/contracts-erc20@3.3.42
 - @0x/contracts-test-utils@5.4.33
 - @0x/contracts-treasury@1.4.25
 - @0x/contracts-utils@4.8.23
 - @0x/contracts-zero-ex@0.37.2
 - @0x/asset-swapper@16.66.9
 - @0x/contract-addresses@6.23.2
 - @0x/contract-wrappers@13.22.2
 - @0x/protocol-utils@11.16.9
2022-09-07 14:10:14 +00:00
Github Actions
d180d5325d Updated CHANGELOGS & MD docs 2022-09-07 14:10:11 +00:00
Noah Khamliche
d249042b47 nwe fqt address and changelog (#574)
* nwe fqt address and changelog

* add pr

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-09-07 09:52:42 -04:00
Github Actions
d3a6f79015 Publish
- @0x/contracts-erc20@3.3.41
 - @0x/contracts-test-utils@5.4.32
 - @0x/contracts-treasury@1.4.24
 - @0x/contracts-utils@4.8.22
 - @0x/contracts-zero-ex@0.37.1
 - @0x/asset-swapper@16.66.8
 - @0x/contract-addresses@6.23.1
 - @0x/contract-wrappers@13.22.1
 - @0x/protocol-utils@11.16.8
2022-09-02 19:31:26 +00:00
Github Actions
8c9dc96e5d Updated CHANGELOGS & MD docs 2022-09-02 19:31:23 +00:00
Noah Khamliche
fc0edba46b Fix/new arbitrum bridge adapter (#572)
* added new fqt with new bridge adapter for Arbitrum

* changelog

* changelog add pr

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-09-02 15:16:00 -04:00
Github Actions
37dc99181e Publish
- @0x/contracts-erc20@3.3.40
 - @0x/contracts-test-utils@5.4.31
 - @0x/contracts-treasury@1.4.23
 - @0x/contracts-utils@4.8.21
 - @0x/contracts-zero-ex@0.37.0
 - @0x/asset-swapper@16.66.7
 - @0x/contract-addresses@6.23.0
 - @0x/contract-wrappers@13.22.0
 - @0x/protocol-utils@11.16.7
2022-09-01 15:27:33 +00:00
Github Actions
6efb9f532b Updated CHANGELOGS & MD docs 2022-09-01 15:27:30 +00:00
Noah Khamliche
9b7d88e136 change weth from OPWeth to ARBWeth (#571)
* change weth from OPWeth to ARBWeth

* udpate changelog

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-09-01 11:12:46 -04:00
Noah Khamliche
e51e1f1674 added otc order array to createTranformData (#569)
* added otc order array to createTranformData

* changelog

* fix linting

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-08-31 11:37:50 -04:00
Noah Khamliche
036a263267 prereq code for otc orders in asset-swapper (#565)
* prereq code for otc orders in asset-swapper

* update changelog

* add pr to changelog

Co-authored-by: Noah Khamliche <0xnoah@Noahs-MacBook-Pro-2.local>
2022-08-31 11:08:28 -04:00
Marcin Wolny
1fb44a55b4 Invalid working_directory (#568)
* Invalid working_directory

Invalid working_directory leads to a bug where some of commands are
executed incorrect code version.

* Fix prettier
2022-08-31 16:37:39 +02:00
Kyu
d738eede0e chore: Cleanup contract addresses [TKR-530] (#564)
* Delete unused addresses in addresses.json

* Update contract wrappers

* Update CHANGELOG.json
2022-08-29 20:10:53 +09:00
Github Actions
a99c916100 Publish
- @0x/contracts-erc20@3.3.39
 - @0x/contracts-test-utils@5.4.30
 - @0x/contracts-treasury@1.4.22
 - @0x/contracts-utils@4.8.20
 - @0x/contracts-zero-ex@0.36.6
 - @0x/asset-swapper@16.66.6
 - @0x/contract-addresses@6.22.0
 - @0x/contract-wrappers@13.21.3
 - @0x/protocol-utils@11.16.6
2022-08-25 21:18:21 +00:00
Github Actions
2abb00b5e2 Updated CHANGELOGS & MD docs 2022-08-25 21:18:18 +00:00
eobbad
ef723e6f36 Empty commit 2022-08-25 17:02:48 -04:00
Ido Kleinman
1fc139886e Arbitrum-rinkeby support in AS + contracts-addresses (#552)
* Arbitrum-rinkeby support in AS + contracts-addresses

* fix UniV3 router+quoter addresses to standard ones

* changelog update
2022-08-25 13:51:37 -07:00
Github Actions
2be10bc72f Publish
- @0x/contracts-erc20@3.3.38
 - @0x/contracts-test-utils@5.4.29
 - @0x/contracts-treasury@1.4.21
 - @0x/contracts-utils@4.8.19
 - @0x/contracts-zero-ex@0.36.5
 - @0x/asset-swapper@16.66.5
 - @0x/contract-addresses@6.21.0
 - @0x/contract-wrappers@13.21.2
 - @0x/protocol-utils@11.16.5
2022-08-25 20:34:36 +00:00
Github Actions
abdc02f066 Updated CHANGELOGS & MD docs 2022-08-25 20:34:30 +00:00
eobbad
b7ef5473cd update FQT address on Arbitrum 2022-08-25 15:49:17 -04:00
eobbad
e43cdda22f Arbitrum support (#560)
* Arbitrum support

* fix typo in bridge adapter

* changelog

* remove timestamp from changelog

* fix typo in brige adapter

* add new addresses

* Fix build error

* adjust DodoV2 arguments
2022-08-25 10:37:26 -04:00
Marcin Wolny
416f2ec24c CircleCI candies 🍬 (#550)
* Re-usable cache

By use of branch as a cache key, we invalidate the cache very often.
This leads to incresed builds time. By use of cache based on checksum of
yarn.lock, we may drop the build time.

It will increase the time every time checksum has changed. In our case,
it happens multiple times per month.

* Skip job run if no changes applied

* Skip tests if no changes applied

* Skip tests if no changes applied
2022-08-25 10:08:28 +02:00
Kyu
4f7fe66d74 Fix asset-swapper deprecation notice (#561) 2022-08-24 09:49:46 +09:00
Kyu
eb394383d8 chore: Deprecate asset-swapper [TKR-484] (#559)
* Add asset-swapper deprecation notice in README.md

* Remove asset-swapper references from the top-level README

* Remove asset-swapper from circleci config

* Set asset-swapper private to prevent it from being published

* Remove asset-swapper from `nonContractPackages`

* Disable asset-swapper build and test scripts
2022-08-24 09:30:52 +09:00
Github Actions
92e681f21b Publish
- @0x/contracts-erc20@3.3.37
 - @0x/contracts-test-utils@5.4.28
 - @0x/contracts-treasury@1.4.20
 - @0x/contracts-utils@4.8.18
 - @0x/contracts-zero-ex@0.36.4
 - @0x/asset-swapper@16.66.4
 - @0x/contract-addresses@6.20.1
 - @0x/contract-artifacts@3.18.1
 - @0x/contract-wrappers@13.21.1
 - @0x/protocol-utils@11.16.4
2022-08-22 05:20:31 +00:00
Github Actions
3f65dd6049 Updated CHANGELOGS & MD docs 2022-08-22 05:20:26 +00:00
Jacob Evans
4425c316a3 chore: update packages (#553)
* Update package.jsons to latest tools packages

* Skip tests relying on gasPrice > 0

* Yarn.lock

* Fix linter

* Update Balance checker, new ganache gets more ETH

* Fix new Ganache insufficient assertion string

* Temporarily set QuoteRequestor to skip

* Fix headers Axios now requests with
2022-08-22 14:55:42 +10:00
eobbad
9058839645 WooFi Gas Estimates (#551)
* change gas estimates

* changelog

* remove comments

* fix lerna run lint error
2022-08-16 14:10:53 -04:00
Ido Kleinman
46a7a2e620 Revert "chore: Remove unused addresses in addresses.json [TKR-519] (#548)"
This reverts commit 8aa313a437.
2022-08-11 13:31:47 -07:00
eobbad
b35dccd43d Offboard Cream (#546)
* offboard cream

* changelog

* remove BalancerFillData (unused)
2022-08-10 08:42:43 -04:00
Kyu
08e0c2ebb9 chore: Add checks for addresses.json [TKR-519] (#549) 2022-08-10 17:35:38 +09:00
Kyu
8aa313a437 chore: Remove unused addresses in addresses.json [TKR-519] (#548)
* Delete unused addresses in addresses.json and update index.ts

* Update contract wrappers

* Remove outdated references to `exchange` contract in `asset-swapper`

* Update CHANGELOG.json
2022-08-10 16:59:21 +09:00
Github Actions
8e9699c340 Publish
- @0x/contracts-erc20@3.3.36
 - @0x/contracts-test-utils@5.4.27
 - @0x/contracts-treasury@1.4.19
 - @0x/contracts-utils@4.8.17
 - @0x/contracts-zero-ex@0.36.3
 - @0x/asset-swapper@16.66.3
 - @0x/contract-addresses@6.19.2
 - @0x/contract-wrappers@13.20.8
 - @0x/protocol-utils@11.16.3
2022-08-10 01:12:34 +00:00
Github Actions
939b708e63 Updated CHANGELOGS & MD docs 2022-08-10 01:12:31 +00:00
Kyu
1617e3fc44 Fix Polygon and Ganache FillQuoteTransformer addresses (#547)
* Revert Ganache (1337) FQT address as it was mistakenly updated.
* Update Polygon (137) FQT address with the new one.
2022-08-10 09:43:42 +09:00
Github Actions
e0d705703d Publish
- @0x/contracts-erc20@3.3.35
 - @0x/contracts-test-utils@5.4.26
 - @0x/contracts-treasury@1.4.18
 - @0x/contracts-utils@4.8.16
 - @0x/contracts-zero-ex@0.36.2
 - @0x/asset-swapper@16.66.2
 - @0x/contract-addresses@6.19.1
 - @0x/contract-wrappers@13.20.7
 - @0x/protocol-utils@11.16.2
2022-08-09 19:27:28 +00:00
Github Actions
01a6d933ca Updated CHANGELOGS & MD docs 2022-08-09 19:27:24 +00:00
Kyu
9b9f0b91d7 Move woofi tokens to constant.ts and run prettier (#544) 2022-08-09 13:31:37 +09:00
Ido Kleinman
0d0fef841d PR # 2022-08-08 19:04:04 -05:00
Ido Kleinman
17adfbea32 changelogs 2022-08-08 19:04:04 -05:00
Noah Khamliche
80594622b2 empty commit to run workflow 2022-08-08 18:55:39 -05:00
Ido Kleinman
0dba5a5a3a lowercase addresses (#542) 2022-08-08 16:40:31 -07:00
phil-ociraptor
4dae8de1b6 feat: add Foundry support to contracts/zero-ex (#534)
Co-authored-by: Michael Zhu <mchl.zhu.96@gmail.com>
2022-08-08 11:46:50 -05:00
eobbad
0046bb26d8 Update WooFi sampler logicand addresses.json w/ new FQT's 2022-08-08 12:27:45 -04:00
Kyu
fe935f787c Use @0x/fast-abi instead of deprecated fast-abi (#540) 2022-08-08 14:34:48 +09:00
Kyu
1b527ffcd8 Clean up Mirror and UST related stuff (#539) 2022-08-08 12:29:33 +09:00
Github Actions
9f5324d9c3 Publish
- @0x/asset-swapper@16.66.1
2022-08-08 02:47:26 +00:00
Github Actions
3647392a04 Updated CHANGELOGS & MD docs 2022-08-08 02:47:21 +00:00
Kyu
1d49662c58 Upgrade fast-abi (#538) 2022-08-08 11:27:44 +09:00
102 changed files with 9124 additions and 2864 deletions

View File

@@ -1,16 +1,27 @@
version: 2.1
parameters:
cache_version:
type: string
default: v5
jobs:
build:
resource_class: xlarge
docker:
- image: node:16
environment:
NODE_OPTIONS: '--max-old-space-size=16384'
working_directory: ~/repo
NODE_OPTIONS: "--max-old-space-size=16384"
steps:
- checkout
- run: git submodule update --init --recursive
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-feat/NerveMixinArbitrum
- restore_cache:
keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- run:
name: install-yarn
command: npm install --force --global yarn@1.22.0
@@ -18,77 +29,176 @@ jobs:
name: yarn
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
- setup_remote_docker
- run: yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci || yarn build:ci
- run: yarn build:ci
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
key: cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
paths:
- ~/repo
- ~/project/node_modules
- ~/.cache/yarn
- save_cache:
key: lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
paths:
- ~/project/contracts/erc20/generated-artifacts/
- ~/project/contracts/erc20/generated-wrappers/
- ~/project/contracts/erc20/lib/
- ~/project/contracts/erc20/node_modules
- ~/project/contracts/erc20/test/generated-artifacts/
- ~/project/contracts/erc20/test/generated-wrappers/
- ~/project/contracts/test-utils/lib/
- ~/project/contracts/test-utils/node_modules
- ~/project/contracts/treasury/generated-artifacts/
- ~/project/contracts/treasury/generated-wrappers/
- ~/project/contracts/treasury/lib/
- ~/project/contracts/treasury/node_modules
- ~/project/contracts/treasury/test/generated-artifacts/
- ~/project/contracts/treasury/test/generated-wrappers/
- ~/project/contracts/utils/generated-artifacts/
- ~/project/contracts/utils/generated-wrappers/
- ~/project/contracts/utils/lib/
- ~/project/contracts/utils/node_modules
- ~/project/contracts/utils/test/generated-artifacts/
- ~/project/contracts/utils/test/generated-wrappers/
- ~/project/contracts/zero-ex/generated-artifacts/
- ~/project/contracts/zero-ex/generated-wrappers/
- ~/project/contracts/zero-ex/lib/
- ~/project/contracts/zero-ex/node_modules
- ~/project/contracts/zero-ex/test/generated-artifacts/
- ~/project/contracts/zero-ex/test/generated-wrappers/
- ~/project/packages/asset-swapper/node_modules
- ~/project/packages/contract-addresses/lib/
- ~/project/packages/contract-addresses/node_modules
- ~/project/packages/contract-artifacts/lib/
- ~/project/packages/contract-artifacts/node_modules
- ~/project/packages/contract-wrappers/lib/
- ~/project/packages/contract-wrappers/node_modules
- ~/project/packages/protocol-utils/lib/
- ~/project/packages/protocol-utils/node_modules
- store_artifacts:
path: ~/repo/packages/abi-gen/test-cli/output
- store_artifacts:
path: ~/repo/packages/contract-wrappers/generated_docs
test-exchange-ganache:
resource_class: medium+
resource_class: xlarge
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange -m --serial -c test:circleci
test-integrations-ganache:
resource_class: medium+
resource_class: xlarge
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-integrations -m --serial -c test:circleci
test-contracts-staking-ganache:
resource_class: medium+
resource_class: xlarge
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-staking -m --serial -c test:circleci
test-contracts-extra-ganache:
resource_class: medium+
resource_class: xlarge
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-exchange-forwarder -p @0x/contracts-coordinator -m --serial -c test:circleci
test-contracts-rest-ganache:
resource_class: medium+
resource_class: xlarge
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- run: |
git diff --name-only development >> changed.txt
if ! grep -q \.sol changed.txt; then
circleci-agent step halt
fi
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- 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
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- 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-foundry:
resource_class: xlarge
docker:
- image: ghcr.io/foundry-rs/foundry:latest
steps:
- checkout
- run: |
git diff --name-only development >> changed.txt
cat changed.txt
if ! grep -q \.sol changed.txt; then
circleci-agent step halt
fi
- restore_cache:
keys:
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: git submodule update --init --recursive
- run:
command: forge test
working_directory: ~/project/contracts/zero-ex
test-publish:
resource_class: large
environment:
NODE_OPTIONS: '--max-old-space-size=6442'
NODE_OPTIONS: "--max-old-space-size=6442"
docker:
- image: node:16
- image: 0xorg/verdaccio
working_directory: ~/repo
steps:
- checkout
- run: |
git diff --name-only development >> changed.txt
cat changed.txt
if ! grep -q packages/ changed.txt; then
circleci-agent step halt
fi
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn test:publish:circleci
no_output_timeout: 1800
@@ -97,71 +207,87 @@ jobs:
test-doc-generation:
docker:
- image: node:16
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn test:generate_docs:circleci
no_output_timeout: 1200
test-rest:
docker:
- image: node:16
working_directory: ~/repo
environment:
RUST_ROUTER: 'true'
RUST_ROUTER: "true"
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run: yarn wsrun -p @0x/contracts-test-utils -m --serial -c test:circleci
- run: yarn wsrun -p @0x/contract-addresses -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/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 }}
key: coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
paths:
- ~/repo/packages/contract-wrappers-test/coverage/lcov.info
- save_cache:
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
key: coverage-order-utils-{{ checksum "yarn.lock" }}
paths:
- ~/repo/packages/order-utils/coverage/lcov.info
- save_cache:
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
key: coverage-web3-wrapper-{{ checksum "yarn.lock" }}
paths:
- ~/repo/packages/web3-wrapper/coverage/lcov.info
static-tests:
resource_class: large
working_directory: ~/repo
docker:
- image: node:16
steps:
- checkout
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn lerna run lint
- run: yarn prettier:ci
- run: yarn deps_versions:ci
- run: yarn diff_md_docs:ci
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- run:
command: yarn lerna run lint
- run:
command: yarn prettier:ci
- run:
command: yarn deps_versions:ci
- run:
command: yarn diff_md_docs:ci
submit-coverage:
docker:
- image: node:16
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- cache-{{ checksum "yarn.lock" }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- coverage-contract-wrappers-test-{{ .Environment.CIRCLE_SHA1 }}
- lib-{{ .Environment.CIRCLE_BRANCH }}-<< pipeline.parameters.cache_version >>
- restore_cache:
keys:
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
- coverage-contract-wrappers-test-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- coverage-order-utils-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- coverage-contracts-{{ checksum "yarn.lock" }}
- run: yarn report_coverage
workflows:
version: 2
@@ -181,6 +307,9 @@ workflows:
# - test-contracts-extra-ganache:
# requires:
# - build
- test-foundry:
requires:
- build
- test-contracts-rest-ganache:
requires:
- build

9
.gitignore vendored
View File

@@ -173,6 +173,15 @@ contracts/zero-ex/test/generated-wrappers/
contracts/treasury/generated-wrappers/
contracts/treasury/test/generated-wrappers/
# foundry artifacts
contracts/zero-ex/foundry-artifacts/
# foundry cache
contracts/zero-ex/foundry-cache/
# typechain wrappers
contracts/zero-ex/typechain-wrappers/
# Doc README copy
packages/*/docs/README.md

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "contracts/zero-ex/contracts/deps/forge-std"]
path = contracts/zero-ex/contracts/deps/forge-std
url = https://github.com/foundry-rs/forge-std

View File

@@ -80,10 +80,8 @@ lib
/contracts/erc1155/build/
/contracts/extensions/build/
/contracts/exchange-forwarder/build/
/packages/asset-swapper/generated-artifacts
/packages/asset-swapper/generated-wrappers
/packages/asset-swapper/test/generated-artifacts
/packages/asset-swapper/test/generated-wrappers
/packages/asset-swapper/
/packages/contract-wrappers/src/generated-wrappers/
package.json
packages/*/docs
docs/

View File

@@ -34,7 +34,6 @@ These packages are all under development. See [/contracts/README.md](/contracts/
| Package | Version | Description |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [`@0x/asset-swapper`](/packages/asset-swapper) | [![npm](https://img.shields.io/npm/v/@0x/asset-swapper.svg)](https://www.npmjs.com/package/@0x/asset-swapper) | Package used to find and create aggregated swaps |
| [`@0x/protocol-utils`](/packages/protocol-utils) | [![npm](https://img.shields.io/npm/v/@0x/protocol-utils.svg)](https://www.npmjs.com/package/@0x/protocol-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
@@ -82,7 +81,7 @@ yarn build
To build a specific package:
```bash
PKG=@0x/asset-swapper yarn build
PKG=@0x/protocol-utils yarn build
```
To build all contracts packages:
@@ -105,7 +104,7 @@ To watch a specific package and all it's dependent packages:
PKG=[NPM_PACKAGE_NAME] yarn watch
e.g
PKG=@0x/asset-swapper yarn watch
PKG=@0x/protocol-utils yarn watch
```
### Clean
@@ -119,7 +118,7 @@ yarn clean
Clean a specific package
```bash
PKG=@0x/asset-swapper yarn clean
PKG=@0x/protocol-utils yarn clean
```
### Rebuild
@@ -133,7 +132,7 @@ yarn rebuild
To re-build (clean & build) a specific package & it's deps:
```bash
PKG=@0x/asset-swapper yarn rebuild
PKG=@0x/protocol-utils yarn rebuild
```
### Lint
@@ -147,7 +146,7 @@ yarn lint
Lint a specific package:
```bash
PKG=@0x/asset-swapper yarn lint
PKG=@0x/protocol-utils yarn lint
```
### Run Tests
@@ -161,7 +160,7 @@ yarn test
Run a specific package's test:
```bash
PKG=@0x/asset-swapper yarn test
PKG=@0x/protocol-utils yarn test
```
Run all contracts packages tests:

View File

@@ -1,22 +0,0 @@
{
"extends": "default",
"rules": {
"avoid-low-level-calls": false,
"avoid-tx-origin": "warn",
"bracket-align": false,
"code-complexity": false,
"compiler-fixed": false,
"const-name-snakecase": "error",
"expression-indent": "error",
"function-max-lines": false,
"func-order": "error",
"indent": ["error", 4],
"max-line-length": ["warn", 160],
"no-inline-assembly": false,
"quotes": ["error", "double"],
"separate-by-one-line-in-contract": "error",
"space-after-comma": "error",
"statement-indent": "error",
"no-empty-blocks": false
}
}

25
contracts/erc20/.eslintrc Normal file
View File

@@ -0,0 +1,25 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"contracts/**/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1 +0,0 @@
contracts/src/ZRXToken.sol

View File

@@ -1,4 +1,104 @@
[
{
"version": "3.3.45",
"changes": [
{
"note": "Migrate from TSLint to ESLint and fix linting errors",
"pr": 589
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "3.3.44",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "3.3.43",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "3.3.42",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "3.3.41",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662046042,
"version": "3.3.40",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661462289,
"version": "3.3.39",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "3.3.38",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "3.3.37",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "3.3.36",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "3.3.35",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "3.3.34",

View File

@@ -5,6 +5,50 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.3.45 - _October 5, 2022_
* Migrate from TSLint to ESLint and fix linting errors (#589)
## v3.3.44 - _September 21, 2022_
* Dependencies updated
## v3.3.43 - _September 12, 2022_
* Dependencies updated
## v3.3.42 - _September 7, 2022_
* Dependencies updated
## v3.3.41 - _September 2, 2022_
* Dependencies updated
## v3.3.40 - _September 1, 2022_
* Dependencies updated
## v3.3.39 - _August 25, 2022_
* Dependencies updated
## v3.3.38 - _August 25, 2022_
* Dependencies updated
## v3.3.37 - _August 22, 2022_
* Dependencies updated
## v3.3.36 - _August 10, 2022_
* Dependencies updated
## v3.3.35 - _August 9, 2022_
* Dependencies updated
## v3.3.34 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "3.3.34",
"version": "3.3.45",
"engines": {
"node": ">=6.12"
},
@@ -23,8 +23,8 @@
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"lint": "eslint src test",
"fix": "eslint --fix src test",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -32,7 +32,6 @@
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
},
@@ -51,38 +50,39 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/tokens",
"devDependencies": {
"@0x/abi-gen": "^5.8.0",
"@0x/contracts-gen": "^2.0.46",
"@0x/contracts-test-utils": "^5.4.25",
"@0x/contracts-utils": "^4.8.15",
"@0x/dev-utils": "^4.2.14",
"@0x/sol-compiler": "^4.8.1",
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.47",
"@0x/contracts-test-utils": "^5.4.36",
"@0x/contracts-utils": "^4.8.26",
"@0x/dev-utils": "^5.0.0",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.7.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"ethereum-types": "^3.7.1",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typedoc": "~0.16.11",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/base-contract": "^6.5.0",
"@0x/base-contract": "^7.0.0",
"ethers": "~4.0.4"
},
"publishConfig": {

View File

@@ -1,6 +0,0 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false
}
}

View File

@@ -0,0 +1,25 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"contracts/**/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,104 @@
[
{
"version": "5.4.36",
"changes": [
{
"note": "Migrate from TSLint to ESLint and fix linting errors",
"pr": 589
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "5.4.35",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "5.4.34",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "5.4.33",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "5.4.32",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662046042,
"version": "5.4.31",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661462289,
"version": "5.4.30",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "5.4.29",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "5.4.28",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "5.4.27",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "5.4.26",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "5.4.25",

View File

@@ -5,6 +5,50 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v5.4.36 - _October 5, 2022_
* Migrate from TSLint to ESLint and fix linting errors (#589)
## v5.4.35 - _September 21, 2022_
* Dependencies updated
## v5.4.34 - _September 12, 2022_
* Dependencies updated
## v5.4.33 - _September 7, 2022_
* Dependencies updated
## v5.4.32 - _September 2, 2022_
* Dependencies updated
## v5.4.31 - _September 1, 2022_
* Dependencies updated
## v5.4.30 - _August 25, 2022_
* Dependencies updated
## v5.4.29 - _August 25, 2022_
* Dependencies updated
## v5.4.28 - _August 22, 2022_
* Dependencies updated
## v5.4.27 - _August 10, 2022_
* Dependencies updated
## v5.4.26 - _August 9, 2022_
* Dependencies updated
## v5.4.25 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "5.4.25",
"version": "5.4.36",
"engines": {
"node": ">=6.12"
},
@@ -16,8 +16,8 @@
"test:coverage": "run-s build run_mocha coverage:report:text coverage:report:lcov",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"clean": "shx rm -rf lib",
"lint": "tslint --format stylish --project tsconfig.lint.json",
"fix": "tslint --fix --format stylish --project tsconfig.lint.json",
"lint": "eslint src test",
"fix": "eslint --fix src test",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -34,28 +34,30 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/test-utils",
"devDependencies": {
"@0x/sol-compiler": "^4.8.1",
"@0x/tslint-config": "^4.1.4",
"@0x/sol-compiler": "^4.8.2",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/assert": "^3.0.34",
"@0x/base-contract": "^6.5.0",
"@0x/contract-addresses": "^6.19.0",
"@0x/dev-utils": "^4.2.14",
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^6.24.0",
"@0x/dev-utils": "^5.0.0",
"@0x/json-schemas": "^6.4.4",
"@0x/order-utils": "^10.4.28",
"@0x/sol-coverage": "^4.0.45",
"@0x/sol-profiler": "^4.1.35",
"@0x/sol-trace": "^3.0.45",
"@0x/subproviders": "^6.6.5",
"@0x/sol-coverage": "^4.0.46",
"@0x/sol-profiler": "^4.1.36",
"@0x/sol-trace": "^3.0.46",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",
@@ -67,7 +69,7 @@
"chai-bignumber": "^3.0.0",
"decimal.js": "^10.2.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^3.7.0",
"ethereum-types": "^3.7.1",
"ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4",
"js-combinatorics": "^0.5.3",

View File

@@ -38,7 +38,7 @@ async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: stri
}
async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
return _getGanacheOrGethErrorAsync("sender doesn't have enough funds", 'insufficient funds');
return _getGanacheOrGethErrorAsync('insufficient funds for gas * price + value', 'insufficient funds');
}
async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
@@ -102,9 +102,9 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
if (nodeType === undefined) {
nodeType = await web3Wrapper.getNodeTypeAsync();
}
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
switch (nodeType) {
case NodeType.Ganache:
const rejectionMessageRegex = new RegExp(`^VM Exception while processing transaction: revert ${reason}$`);
return expect(p).to.be.rejectedWith(rejectionMessageRegex);
case NodeType.Geth:
logUtils.warn(

View File

@@ -11,9 +11,14 @@ export function shortZip<T1, T2>(a: T1[], b: T2[]): Array<[T1, T2]> {
/**
* Replaces the keys in a deeply nested object. Adapted from https://stackoverflow.com/a/39126851
*/
export function replaceKeysDeep(obj: {}, mapKeys: (key: string) => string | void): _.Dictionary<{}> {
export function replaceKeysDeep(
obj: Record<string, unknown>,
mapKeys: (key: string) => string | void,
): _.Dictionary<Record<string, unknown>> {
return _.transform(obj, (result, value, key) => {
const currentKey = mapKeys(key) || key;
result[currentKey] = _.isObject(value) ? replaceKeysDeep(value as {}, mapKeys) : (value as {});
result[currentKey] = _.isObject(value)
? replaceKeysDeep(value as Record<string, unknown>, mapKeys)
: (value as Record<string, unknown>);
});
}

View File

@@ -236,7 +236,7 @@ export const describe = _.assign(mochaDescribe, {
* Like mocha's `describe()`, but sets up a blockchain environment for you.
*/
export const blockchainTests: BlockchainContextDefinition = _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite {
function (description: string, callback: BlockchainSuiteCallback): ISuite {
return defineBlockchainSuite(StandardBlockchainTestsEnvironmentSingleton, description, callback, describe);
},
{
@@ -275,7 +275,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
);
},
fork: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
return defineBlockchainSuite(
ForkedBlockchainTestsEnvironmentSingleton,
description,
@@ -319,7 +319,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
},
),
live: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite | void {
function (description: string, callback: BlockchainSuiteCallback): ISuite | void {
return defineBlockchainSuite(
LiveBlockchainTestsEnvironmentSingleton,
description,
@@ -355,7 +355,7 @@ export const blockchainTests: BlockchainContextDefinition = _.assign(
},
),
resets: _.assign(
function(description: string, callback: BlockchainSuiteCallback): ISuite {
function (description: string, callback: BlockchainSuiteCallback): ISuite {
return defineResetsBlockchainSuite(
StandardBlockchainTestsEnvironmentSingleton,
description,
@@ -399,7 +399,7 @@ function defineBlockchainSuite<T>(
callback: BlockchainSuiteCallback,
describeCall: ContextDefinitionCallback<T>,
): T {
return describeCall(description, function(this: ISuiteCallbackContext): void {
return describeCall(description, function (this: ISuiteCallbackContext): void {
callback.call(this, envFactory.create());
});
}
@@ -410,7 +410,7 @@ function defineResetsBlockchainSuite<T>(
callback: BlockchainSuiteCallback,
describeCall: ContextDefinitionCallback<T>,
): T {
return describeCall(description, function(this: ISuiteCallbackContext): void {
return describeCall(description, function (this: ISuiteCallbackContext): void {
const env = envFactory.create();
beforeEach(async () => env.blockchainLifecycle.startAsync());
afterEach(async () => env.blockchainLifecycle.revertAsync());

View File

@@ -40,10 +40,7 @@ export function getRandomPortion(total: Numberish): BigNumber {
export function getRandomFloat(min: Numberish, max: Numberish): BigNumber {
// Generate a really high precision number between [0, 1]
const r = new BigNumber(crypto.randomBytes(32).toString('hex'), 16).dividedBy(new BigNumber(2).pow(256).minus(1));
return new BigNumber(max)
.minus(min)
.times(r)
.plus(min);
return new BigNumber(max).minus(min).times(r).plus(min);
}
export const FIXED_POINT_BASE = new BigNumber(2).pow(127);
@@ -66,7 +63,7 @@ export function fromFixed(n: Numberish): BigNumber {
* Converts two decimal numbers to integers with `precision` digits, then returns
* the absolute difference.
*/
export function getNumericalDivergence(a: Numberish, b: Numberish, precision: number = 18): number {
export function getNumericalDivergence(a: Numberish, b: Numberish, precision = 18): number {
const _a = new BigNumber(a);
const _b = new BigNumber(b);
const maxIntegerDigits = Math.max(
@@ -77,16 +74,13 @@ export function getNumericalDivergence(a: Numberish, b: Numberish, precision: nu
const base = 10 ** (precision - maxIntegerDigits);
return n.times(base).integerValue(BigNumber.ROUND_DOWN);
};
return _toInteger(_a)
.minus(_toInteger(_b))
.abs()
.toNumber();
return _toInteger(_a).minus(_toInteger(_b)).abs().toNumber();
}
/**
* Asserts that two numbers are equal up to `precision` digits.
*/
export function assertRoughlyEquals(actual: Numberish, expected: Numberish, precision: number = 18): void {
export function assertRoughlyEquals(actual: Numberish, expected: Numberish, precision = 18): void {
if (getNumericalDivergence(actual, expected, precision) <= 1) {
return;
}
@@ -96,16 +90,8 @@ export function assertRoughlyEquals(actual: Numberish, expected: Numberish, prec
/**
* Asserts that two numbers are equal with up to `maxError` difference between them.
*/
export function assertIntegerRoughlyEquals(
actual: Numberish,
expected: Numberish,
maxError: number = 1,
msg?: string,
): void {
const diff = new BigNumber(actual)
.minus(expected)
.abs()
.toNumber();
export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError = 1, msg?: string): void {
const diff = new BigNumber(actual).minus(expected).abs().toNumber();
if (diff <= maxError) {
return;
}

View File

@@ -8,10 +8,7 @@ import { BatchMatchOrder, CancelOrder, MatchOrder } from './types';
export const orderUtils = {
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
const partialAmount = numerator
.multipliedBy(target)
.div(denominator)
.integerValue(BigNumber.ROUND_FLOOR);
const partialAmount = numerator.multipliedBy(target).div(denominator).integerValue(BigNumber.ROUND_FLOOR);
return partialAmount;
},
createFill: (signedOrder: SignedOrder, takerAssetFillAmount?: BigNumber) => {

View File

@@ -15,7 +15,7 @@ export const txDefaults = {
gasPrice: constants.DEFAULT_GAS_PRICE,
};
export let providerConfigs: Web3Config = {
export const providerConfigs: Web3Config = {
total_accounts: constants.NUM_TEST_ACCOUNTS,
shouldUseInProcessGanache: true,
shouldAllowUnlimitedContractSize: true,

View File

@@ -4,6 +4,7 @@ import * as process from 'process';
import { expect } from '../src/chai_setup';
import { constants } from '../src/constants';
import { blockchainTests, describe } from '../src/mocha_blockchain';
import { append } from './subtests/mocha_blockchain_1';
blockchainTests('mocha blockchain extensions', env => {
describe('blockchainTests()', () => {
@@ -78,7 +79,7 @@ blockchainTests('mocha blockchain extensions', env => {
});
describe('subtests', () => {
require('./subtests/mocha_blockchain_1').append(env);
append(env);
});
});
@@ -96,7 +97,7 @@ blockchainTests('mocha blockchain extensions', env => {
function createHookedObject(obj: any, handler: (name: string) => void, methods: string[]): any {
const hookedMethods = _.map(methods, methodName => {
// tslint:disable: only-arrow-functions
return function(this: any, ...args: any[]): any {
return function (this: any, ...args: any[]): any {
handler(methodName);
return obj[methodName].call(this, ...args);
};

View File

@@ -55,7 +55,7 @@ describe('Order hashing', () => {
it('throws a readable error message if taker format is invalid', async () => {
const orderWithInvalidtakerFormat = {
...order,
takerAddress: (null as any) as string,
takerAddress: null as any as string,
};
const expectedErrorMessage = `Expected order to conform to schema`;
expect(() => orderHashUtils.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);

View File

@@ -1,6 +0,0 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false
}
}

View File

@@ -0,0 +1,25 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"contracts/**/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,104 @@
[
{
"version": "1.4.28",
"changes": [
{
"note": "Migrate from TSLint to ESLint and fix linting errors",
"pr": 589
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "1.4.27",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "1.4.26",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "1.4.25",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "1.4.24",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662046042,
"version": "1.4.23",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661462289,
"version": "1.4.22",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "1.4.21",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "1.4.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "1.4.19",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "1.4.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "1.4.17",

View File

@@ -5,6 +5,50 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.4.28 - _October 5, 2022_
* Migrate from TSLint to ESLint and fix linting errors (#589)
## v1.4.27 - _September 21, 2022_
* Dependencies updated
## v1.4.26 - _September 12, 2022_
* Dependencies updated
## v1.4.25 - _September 7, 2022_
* Dependencies updated
## v1.4.24 - _September 2, 2022_
* Dependencies updated
## v1.4.23 - _September 1, 2022_
* Dependencies updated
## v1.4.22 - _August 25, 2022_
* Dependencies updated
## v1.4.21 - _August 25, 2022_
* Dependencies updated
## v1.4.20 - _August 22, 2022_
* Dependencies updated
## v1.4.19 - _August 10, 2022_
* Dependencies updated
## v1.4.18 - _August 9, 2022_
* Dependencies updated
## v1.4.17 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-treasury",
"version": "1.4.17",
"version": "1.4.28",
"engines": {
"node": ">=6.12"
},
@@ -21,12 +21,11 @@
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"lint": "eslint src test",
"fix": "eslint --fix src test",
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"lint-contracts": "#solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
"publish:private": "yarn build && gitpkg publish"
@@ -46,40 +45,41 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/treasury",
"devDependencies": {
"@0x/abi-gen": "^5.8.0",
"@0x/contract-addresses": "^6.19.0",
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^6.24.0",
"@0x/contracts-asset-proxy": "^3.7.19",
"@0x/contracts-erc20": "^3.3.34",
"@0x/contracts-gen": "^2.0.46",
"@0x/contracts-erc20": "^3.3.45",
"@0x/contracts-gen": "^2.0.47",
"@0x/contracts-staking": "^2.0.45",
"@0x/contracts-test-utils": "^5.4.25",
"@0x/sol-compiler": "^4.8.1",
"@0x/contracts-test-utils": "^5.4.36",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@types/isomorphic-fetch": "^0.0.35",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/prompts": "^2.0.9",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.11",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"prompts": "^2.4.0",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typedoc": "~0.16.11",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/base-contract": "^6.5.0",
"@0x/protocol-utils": "^11.16.1",
"@0x/subproviders": "^6.6.5",
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.16.12",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"ethereum-types": "^3.7.0",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"ethereum-types": "^3.7.1",
"ethereumjs-util": "^7.0.10"
},
"publishConfig": {

View File

@@ -1,13 +0,0 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false,
"max-file-line-count": false,
"no-non-null-assertion": false,
"no-unnecessary-type-assertion": false,
"number-literal-format": false
},
"linterOptions": {
"exclude": ["src/artifacts.ts", "test/artifacts.ts"]
}
}

25
contracts/utils/.eslintrc Normal file
View File

@@ -0,0 +1,25 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"contracts/**/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,104 @@
[
{
"version": "4.8.26",
"changes": [
{
"note": "Migrate from TSLint to ESLint and fix linting errors",
"pr": 589
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "4.8.25",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "4.8.24",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "4.8.23",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "4.8.22",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662046042,
"version": "4.8.21",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661462289,
"version": "4.8.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "4.8.19",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "4.8.18",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "4.8.17",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "4.8.16",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "4.8.15",

View File

@@ -5,6 +5,50 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.8.26 - _October 5, 2022_
* Migrate from TSLint to ESLint and fix linting errors (#589)
## v4.8.25 - _September 21, 2022_
* Dependencies updated
## v4.8.24 - _September 12, 2022_
* Dependencies updated
## v4.8.23 - _September 7, 2022_
* Dependencies updated
## v4.8.22 - _September 2, 2022_
* Dependencies updated
## v4.8.21 - _September 1, 2022_
* Dependencies updated
## v4.8.20 - _August 25, 2022_
* Dependencies updated
## v4.8.19 - _August 25, 2022_
* Dependencies updated
## v4.8.18 - _August 22, 2022_
* Dependencies updated
## v4.8.17 - _August 10, 2022_
* Dependencies updated
## v4.8.16 - _August 9, 2022_
* Dependencies updated
## v4.8.15 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "4.8.15",
"version": "4.8.26",
"engines": {
"node": ">=6.12"
},
@@ -23,8 +23,8 @@
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"lint": "eslint src test",
"fix": "eslint --fix src test",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -32,7 +32,6 @@
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
"compile:truffle": "truffle compile"
},
"config": {
@@ -50,40 +49,41 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/utils",
"devDependencies": {
"@0x/abi-gen": "^5.8.0",
"@0x/contracts-gen": "^2.0.46",
"@0x/contracts-test-utils": "^5.4.25",
"@0x/dev-utils": "^4.2.14",
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.47",
"@0x/contracts-test-utils": "^5.4.36",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.1",
"@0x/tslint-config": "^4.1.4",
"@0x/sol-compiler": "^4.8.2",
"@0x/types": "^3.3.6",
"@0x/web3-wrapper": "^7.6.5",
"@0x/web3-wrapper": "^8.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"ethereumjs-util": "^7.0.10",
"lodash": "^4.17.11",
"make-promises-safe": "^1.1.0",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/base-contract": "^6.5.0",
"@0x/base-contract": "^7.0.0",
"@0x/typescript-typings": "^5.3.1",
"@0x/utils": "^6.5.3",
"@0x/utils": "^7.0.0",
"bn.js": "^4.11.8",
"ethereum-types": "^3.7.0"
"ethereum-types": "^3.7.1"
},
"publishConfig": {
"access": "public"

View File

@@ -748,15 +748,7 @@ blockchainTests('LibBytes', env => {
const result = await libBytes
.publicWriteLength(byteArrayLongerThan32Bytes, newLen, constants.NULL_BYTES)
.callAsync();
expect(result).to.eq(
byteArrayLongerThan32Bytes.slice(
0,
newLen
.multipliedBy(2)
.plus(2)
.toNumber(),
),
);
expect(result).to.eq(byteArrayLongerThan32Bytes.slice(0, newLen.multipliedBy(2).plus(2).toNumber()));
});
it("should right pad with 0's if new length is greater than original and no extra bytes are appended", async () => {
const byteLen = fromHex(byteArrayLongerThan32Bytes).length;

View File

@@ -1,6 +0,0 @@
{
"extends": ["@0x/tslint-config"],
"rules": {
"custom-no-magic-numbers": false
}
}

View File

@@ -0,0 +1,23 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,110 @@
[
{
"version": "0.37.5",
"changes": [
{
"note": "Migrate from TSLint to ESLint and fix linting errors",
"pr": 587
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "0.37.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "0.37.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "0.37.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "0.37.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.37.0",
"changes": [
{
"note": "Add support for OTC orders in the FillQuoteTransformer",
"pr": "565"
},
{
"note": "fix CI",
"pr": "569"
}
],
"timestamp": 1662046042
},
{
"timestamp": 1661462289,
"version": "0.36.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "0.36.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "0.36.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "0.36.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.36.2",
"changes": [
{
"note": "Add Foundry support",
"pr": 534
}
],
"timestamp": 1659976271
},
{
"timestamp": 1659750766,
"version": "0.36.1",

View File

@@ -5,6 +5,51 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.37.5 - _October 5, 2022_
* Migrate from TSLint to ESLint and fix linting errors (#587)
## v0.37.4 - _September 21, 2022_
* Dependencies updated
## v0.37.3 - _September 12, 2022_
* Dependencies updated
## v0.37.2 - _September 7, 2022_
* Dependencies updated
## v0.37.1 - _September 2, 2022_
* Dependencies updated
## v0.37.0 - _September 1, 2022_
* Add support for OTC orders in the FillQuoteTransformer (#565)
* fix CI (#569)
## v0.36.6 - _August 25, 2022_
* Dependencies updated
## v0.36.5 - _August 25, 2022_
* Dependencies updated
## v0.36.4 - _August 22, 2022_
* Dependencies updated
## v0.36.3 - _August 10, 2022_
* Dependencies updated
## v0.36.2 - _August 8, 2022_
* Add Foundry support (#534)
## v0.36.1 - _August 6, 2022_
* Dependencies updated

View File

@@ -2,6 +2,10 @@
This package contains contracts for the ZeroEx extensible contract architecture.
> **_NOTE:_** This repo is undergoing a tooling change. If adding a contract, you will need to
> add it to `compiler.json`. You can generate the entire list by running the following:
> `find . -type f -name "*.sol" | grep -v foundry | grep -v "contracts/dep" | grep -v "node_modules"`
## Installation
**Install**

View File

@@ -1,6 +1,212 @@
{
"artifactsDir": "./test/generated-artifacts",
"contractsDir": "./contracts",
"contracts": [
"./contracts/src/IZeroEx.sol",
"./contracts/src/ZeroEx.sol",
"./contracts/src/ZeroExOptimized.sol",
"./contracts/src/errors/LibCommonRichErrors.sol",
"./contracts/src/errors/LibLiquidityProviderRichErrors.sol",
"./contracts/src/errors/LibMetaTransactionsRichErrors.sol",
"./contracts/src/errors/LibNFTOrdersRichErrors.sol",
"./contracts/src/errors/LibNativeOrdersRichErrors.sol",
"./contracts/src/errors/LibOwnableRichErrors.sol",
"./contracts/src/errors/LibProxyRichErrors.sol",
"./contracts/src/errors/LibSignatureRichErrors.sol",
"./contracts/src/errors/LibSimpleFunctionRegistryRichErrors.sol",
"./contracts/src/errors/LibTransformERC20RichErrors.sol",
"./contracts/src/errors/LibWalletRichErrors.sol",
"./contracts/src/external/FeeCollector.sol",
"./contracts/src/external/FeeCollectorController.sol",
"./contracts/src/external/FlashWallet.sol",
"./contracts/src/external/IFlashWallet.sol",
"./contracts/src/external/ILiquidityProviderSandbox.sol",
"./contracts/src/external/LibFeeCollector.sol",
"./contracts/src/external/LiquidityProviderSandbox.sol",
"./contracts/src/external/PermissionlessTransformerDeployer.sol",
"./contracts/src/external/TransformerDeployer.sol",
"./contracts/src/features/BatchFillNativeOrdersFeature.sol",
"./contracts/src/features/BootstrapFeature.sol",
"./contracts/src/features/ERC165Feature.sol",
"./contracts/src/features/FundRecoveryFeature.sol",
"./contracts/src/features/LiquidityProviderFeature.sol",
"./contracts/src/features/MetaTransactionsFeature.sol",
"./contracts/src/features/NativeOrdersFeature.sol",
"./contracts/src/features/OtcOrdersFeature.sol",
"./contracts/src/features/OwnableFeature.sol",
"./contracts/src/features/PancakeSwapFeature.sol",
"./contracts/src/features/SimpleFunctionRegistryFeature.sol",
"./contracts/src/features/TransformERC20Feature.sol",
"./contracts/src/features/UniswapFeature.sol",
"./contracts/src/features/UniswapV3Feature.sol",
"./contracts/src/features/interfaces/IBatchFillNativeOrdersFeature.sol",
"./contracts/src/features/interfaces/IBootstrapFeature.sol",
"./contracts/src/features/interfaces/IERC1155OrdersFeature.sol",
"./contracts/src/features/interfaces/IERC165Feature.sol",
"./contracts/src/features/interfaces/IERC721OrdersFeature.sol",
"./contracts/src/features/interfaces/IFeature.sol",
"./contracts/src/features/interfaces/IFundRecoveryFeature.sol",
"./contracts/src/features/interfaces/ILiquidityProviderFeature.sol",
"./contracts/src/features/interfaces/IMetaTransactionsFeature.sol",
"./contracts/src/features/interfaces/IMultiplexFeature.sol",
"./contracts/src/features/interfaces/INativeOrdersEvents.sol",
"./contracts/src/features/interfaces/INativeOrdersFeature.sol",
"./contracts/src/features/interfaces/IOtcOrdersFeature.sol",
"./contracts/src/features/interfaces/IOwnableFeature.sol",
"./contracts/src/features/interfaces/IPancakeSwapFeature.sol",
"./contracts/src/features/interfaces/ISimpleFunctionRegistryFeature.sol",
"./contracts/src/features/interfaces/ITokenSpenderFeature.sol",
"./contracts/src/features/interfaces/ITransformERC20Feature.sol",
"./contracts/src/features/interfaces/IUniswapFeature.sol",
"./contracts/src/features/interfaces/IUniswapV3Feature.sol",
"./contracts/src/features/libs/LibNFTOrder.sol",
"./contracts/src/features/libs/LibNativeOrder.sol",
"./contracts/src/features/libs/LibSignature.sol",
"./contracts/src/features/multiplex/MultiplexFeature.sol",
"./contracts/src/features/multiplex/MultiplexLiquidityProvider.sol",
"./contracts/src/features/multiplex/MultiplexOtc.sol",
"./contracts/src/features/multiplex/MultiplexRfq.sol",
"./contracts/src/features/multiplex/MultiplexTransformERC20.sol",
"./contracts/src/features/multiplex/MultiplexUniswapV2.sol",
"./contracts/src/features/multiplex/MultiplexUniswapV3.sol",
"./contracts/src/features/native_orders/NativeOrdersCancellation.sol",
"./contracts/src/features/native_orders/NativeOrdersInfo.sol",
"./contracts/src/features/native_orders/NativeOrdersProtocolFees.sol",
"./contracts/src/features/native_orders/NativeOrdersSettlement.sol",
"./contracts/src/features/nft_orders/ERC1155OrdersFeature.sol",
"./contracts/src/features/nft_orders/ERC721OrdersFeature.sol",
"./contracts/src/features/nft_orders/NFTOrders.sol",
"./contracts/src/fixins/FixinCommon.sol",
"./contracts/src/fixins/FixinEIP712.sol",
"./contracts/src/fixins/FixinERC1155Spender.sol",
"./contracts/src/fixins/FixinERC721Spender.sol",
"./contracts/src/fixins/FixinProtocolFees.sol",
"./contracts/src/fixins/FixinReentrancyGuard.sol",
"./contracts/src/fixins/FixinTokenSpender.sol",
"./contracts/src/liquidity-providers/CurveLiquidityProvider.sol",
"./contracts/src/liquidity-providers/MooniswapLiquidityProvider.sol",
"./contracts/src/migrations/FullMigration.sol",
"./contracts/src/migrations/InitialMigration.sol",
"./contracts/src/migrations/LibBootstrap.sol",
"./contracts/src/migrations/LibMigrate.sol",
"./contracts/src/storage/LibERC1155OrdersStorage.sol",
"./contracts/src/storage/LibERC721OrdersStorage.sol",
"./contracts/src/storage/LibMetaTransactionsStorage.sol",
"./contracts/src/storage/LibNativeOrdersStorage.sol",
"./contracts/src/storage/LibOtcOrdersStorage.sol",
"./contracts/src/storage/LibOwnableStorage.sol",
"./contracts/src/storage/LibProxyStorage.sol",
"./contracts/src/storage/LibReentrancyGuardStorage.sol",
"./contracts/src/storage/LibSimpleFunctionRegistryStorage.sol",
"./contracts/src/storage/LibStorage.sol",
"./contracts/src/storage/LibTransformERC20Storage.sol",
"./contracts/src/transformers/AffiliateFeeTransformer.sol",
"./contracts/src/transformers/FillQuoteTransformer.sol",
"./contracts/src/transformers/IERC20Transformer.sol",
"./contracts/src/transformers/LibERC20Transformer.sol",
"./contracts/src/transformers/LogMetadataTransformer.sol",
"./contracts/src/transformers/PayTakerTransformer.sol",
"./contracts/src/transformers/PositiveSlippageFeeTransformer.sol",
"./contracts/src/transformers/Transformer.sol",
"./contracts/src/transformers/WethTransformer.sol",
"./contracts/src/transformers/bridges/AbstractBridgeAdapter.sol",
"./contracts/src/transformers/bridges/AvalancheBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BSCBridgeAdapter.sol",
"./contracts/src/transformers/bridges/BridgeProtocols.sol",
"./contracts/src/transformers/bridges/CeloBridgeAdapter.sol",
"./contracts/src/transformers/bridges/EthereumBridgeAdapter.sol",
"./contracts/src/transformers/bridges/FantomBridgeAdapter.sol",
"./contracts/src/transformers/bridges/IBridgeAdapter.sol",
"./contracts/src/transformers/bridges/OptimismBridgeAdapter.sol",
"./contracts/src/transformers/bridges/PolygonBridgeAdapter.sol",
"./contracts/src/transformers/bridges/mixins/MixinAaveV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinBalancer.sol",
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinBalancerV2Batch.sol",
"./contracts/src/transformers/bridges/mixins/MixinBancor.sol",
"./contracts/src/transformers/bridges/mixins/MixinBancorV3.sol",
"./contracts/src/transformers/bridges/mixins/MixinCompound.sol",
"./contracts/src/transformers/bridges/mixins/MixinCryptoCom.sol",
"./contracts/src/transformers/bridges/mixins/MixinCurve.sol",
"./contracts/src/transformers/bridges/mixins/MixinCurveV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinDodo.sol",
"./contracts/src/transformers/bridges/mixins/MixinDodoV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinGMX.sol",
"./contracts/src/transformers/bridges/mixins/MixinKyberDmm.sol",
"./contracts/src/transformers/bridges/mixins/MixinLido.sol",
"./contracts/src/transformers/bridges/mixins/MixinMStable.sol",
"./contracts/src/transformers/bridges/mixins/MixinMakerPSM.sol",
"./contracts/src/transformers/bridges/mixins/MixinMooniswap.sol",
"./contracts/src/transformers/bridges/mixins/MixinNerve.sol",
"./contracts/src/transformers/bridges/mixins/MixinPlatypus.sol",
"./contracts/src/transformers/bridges/mixins/MixinShell.sol",
"./contracts/src/transformers/bridges/mixins/MixinSynthetix.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswap.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswapV2.sol",
"./contracts/src/transformers/bridges/mixins/MixinUniswapV3.sol",
"./contracts/src/transformers/bridges/mixins/MixinVelodrome.sol",
"./contracts/src/transformers/bridges/mixins/MixinZeroExBridge.sol",
"./contracts/src/vendor/IERC1155Token.sol",
"./contracts/src/vendor/IERC721Token.sol",
"./contracts/src/vendor/IFeeRecipient.sol",
"./contracts/src/vendor/ILiquidityProvider.sol",
"./contracts/src/vendor/IMooniswapPool.sol",
"./contracts/src/vendor/IPropertyValidator.sol",
"./contracts/src/vendor/ITakerCallback.sol",
"./contracts/src/vendor/IUniswapV2Pair.sol",
"./contracts/src/vendor/IUniswapV3Pool.sol",
"./contracts/src/vendor/v3/IERC20Bridge.sol",
"./contracts/src/vendor/v3/IStaking.sol",
"./contracts/test/ITestSimpleFunctionRegistryFeature.sol",
"./contracts/test/TestBridge.sol",
"./contracts/test/TestCallTarget.sol",
"./contracts/test/TestDelegateCaller.sol",
"./contracts/test/TestFeeCollectorController.sol",
"./contracts/test/TestFeeRecipient.sol",
"./contracts/test/TestFillQuoteTransformerBridge.sol",
"./contracts/test/TestFillQuoteTransformerExchange.sol",
"./contracts/test/TestFillQuoteTransformerHost.sol",
"./contracts/test/TestFixinProtocolFees.sol",
"./contracts/test/TestFixinTokenSpender.sol",
"./contracts/test/TestFullMigration.sol",
"./contracts/test/TestInitialMigration.sol",
"./contracts/test/TestLibNativeOrder.sol",
"./contracts/test/TestLibSignature.sol",
"./contracts/test/TestMetaTransactionsNativeOrdersFeature.sol",
"./contracts/test/TestMetaTransactionsTransformERC20Feature.sol",
"./contracts/test/TestMigrator.sol",
"./contracts/test/TestMintTokenERC20Transformer.sol",
"./contracts/test/TestNFTOrderPresigner.sol",
"./contracts/test/TestNativeOrdersFeature.sol",
"./contracts/test/TestNoEthRecipient.sol",
"./contracts/test/TestOrderSignerRegistryWithContractWallet.sol",
"./contracts/test/TestPermissionlessTransformerDeployerSuicidal.sol",
"./contracts/test/TestPermissionlessTransformerDeployerTransformer.sol",
"./contracts/test/TestPropertyValidator.sol",
"./contracts/test/TestRfqOriginRegistration.sol",
"./contracts/test/TestSimpleFunctionRegistryFeatureImpl1.sol",
"./contracts/test/TestSimpleFunctionRegistryFeatureImpl2.sol",
"./contracts/test/TestStaking.sol",
"./contracts/test/TestTransformERC20.sol",
"./contracts/test/TestTransformerBase.sol",
"./contracts/test/TestTransformerDeployerTransformer.sol",
"./contracts/test/TestTransformerHost.sol",
"./contracts/test/TestUniswapV3Feature.sol",
"./contracts/test/TestWethTransformerHost.sol",
"./contracts/test/TestZeroExFeature.sol",
"./contracts/test/integration/TestCurve.sol",
"./contracts/test/integration/TestLiquidityProvider.sol",
"./contracts/test/integration/TestMooniswap.sol",
"./contracts/test/integration/TestUniswapV2Factory.sol",
"./contracts/test/integration/TestUniswapV2Pool.sol",
"./contracts/test/integration/TestUniswapV3Factory.sol",
"./contracts/test/integration/TestUniswapV3Pool.sol",
"./contracts/test/tokens/TestMintableERC1155Token.sol",
"./contracts/test/tokens/TestMintableERC20Token.sol",
"./contracts/test/tokens/TestMintableERC721Token.sol",
"./contracts/test/tokens/TestTokenSpenderERC20Token.sol",
"./contracts/test/tokens/TestWeth.sol"
],
"useDockerisedSolc": false,
"isOfflineMode": false,
"shouldSaveStandardInput": true,

View File

@@ -31,6 +31,7 @@ import "../features/libs/LibNativeOrder.sol";
import "./bridges/IBridgeAdapter.sol";
import "./Transformer.sol";
import "./LibERC20Transformer.sol";
import "../IZeroEx.sol";
/// @dev A transformer that fills an ERC20 market sell/buy quote.
/// This transformer shortcuts bridge orders and fills them directly
@@ -52,7 +53,8 @@ contract FillQuoteTransformer is
enum OrderType {
Bridge,
Limit,
Rfq
Rfq,
Otc
}
struct LimitOrderInfo {
@@ -69,6 +71,13 @@ contract FillQuoteTransformer is
uint256 maxTakerTokenFillAmount;
}
struct OtcOrderInfo {
LibNativeOrder.OtcOrder order;
LibSignature.Signature signature;
// Maximum taker token amount of this limit order to fill.
uint256 maxTakerTokenFillAmount;
}
/// @dev Transform data to ABI-encode and pass into `transform()`.
struct TransformData {
// Whether we are performing a market sell or buy.
@@ -84,6 +93,8 @@ contract FillQuoteTransformer is
IBridgeAdapter.BridgeOrder[] bridgeOrders;
// Native limit orders. Sorted by fill sequence.
LimitOrderInfo[] limitOrders;
// Otc orders. Sorted by fill sequence.
OtcOrderInfo[] otcOrders;
// Native RFQ orders. Sorted by fill sequence.
RfqOrderInfo[] rfqOrders;
@@ -123,7 +134,7 @@ contract FillQuoteTransformer is
uint256 soldAmount;
uint256 protocolFee;
uint256 takerTokenBalanceRemaining;
uint256[3] currentIndices;
uint256[4] currentIndices;
OrderType currentOrderType;
}
@@ -147,12 +158,12 @@ contract FillQuoteTransformer is
IBridgeAdapter public immutable bridgeAdapter;
/// @dev The exchange proxy contract.
INativeOrdersFeature public immutable zeroEx;
IZeroEx public immutable zeroEx;
/// @dev Create this contract.
/// @param bridgeAdapter_ The bridge adapter contract.
/// @param zeroEx_ The Exchange Proxy contract.
constructor(IBridgeAdapter bridgeAdapter_, INativeOrdersFeature zeroEx_)
constructor(IBridgeAdapter bridgeAdapter_, IZeroEx zeroEx_)
public
Transformer()
{
@@ -183,7 +194,8 @@ contract FillQuoteTransformer is
if (data.bridgeOrders.length
+ data.limitOrders.length
+ data.rfqOrders.length != data.fillSequence.length
+ data.rfqOrders.length
+ data.otcOrders.length != data.fillSequence.length
) {
LibTransformERC20RichErrors.InvalidTransformDataError(
LibTransformERC20RichErrors.InvalidTransformDataErrorCode.INVALID_ARRAY_LENGTH,
@@ -198,7 +210,7 @@ contract FillQuoteTransformer is
// Approve the exchange proxy to spend our sell tokens if native orders
// are present.
if (data.limitOrders.length + data.rfqOrders.length != 0) {
if (data.limitOrders.length + data.rfqOrders.length + data.otcOrders.length != 0) {
data.sellToken.approveIfBelow(address(zeroEx), data.fillAmount);
// Compute the protocol fee if a limit order is present.
if (data.limitOrders.length != 0) {
@@ -230,6 +242,8 @@ contract FillQuoteTransformer is
results = _fillLimitOrder(data.limitOrders[orderIndex], data, state);
} else if (state.currentOrderType == OrderType.Rfq) {
results = _fillRfqOrder(data.rfqOrders[orderIndex], data, state);
} else if (state.currentOrderType == OrderType.Otc) {
results = _fillOtcOrder(data.otcOrders[orderIndex], data, state);
} else {
revert("INVALID_ORDER_TYPE");
}
@@ -402,6 +416,42 @@ contract FillQuoteTransformer is
} catch {}
}
// Fill a single OTC order.
function _fillOtcOrder(
OtcOrderInfo memory orderInfo,
TransformData memory data,
FillState memory state
)
private
returns (FillOrderResults memory results)
{
uint256 takerTokenFillAmount = LibSafeMathV06.min256(
_computeTakerTokenFillAmount(
data,
state,
orderInfo.order.takerAmount,
orderInfo.order.makerAmount,
0
),
orderInfo.maxTakerTokenFillAmount
);
try
zeroEx.fillOtcOrder
(
orderInfo.order,
orderInfo.signature,
takerTokenFillAmount.safeDowncastToUint128()
)
returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount)
{
results.takerTokenSoldAmount = takerTokenFilledAmount;
results.makerTokenBoughtAmount = makerTokenFilledAmount;
} catch {
revert("FillQuoteTransformer/OTC_ORDER_FILL_FAILED");
}
}
// Compute the next taker token fill amount of a generic order.
function _computeTakerTokenFillAmount(
TransformData memory data,

View File

@@ -0,0 +1,158 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2022 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 "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinDodoV2.sol";
import "./mixins/MixinKyberDmm.sol";
import "./mixins/MixinGMX.sol";
import "./mixins/MixinNerve.sol";
import "./mixins/MixinUniswapV3.sol";
import "./mixins/MixinUniswapV2.sol";
import "./mixins/MixinZeroExBridge.sol";
contract ArbitrumBridgeAdapter is
AbstractBridgeAdapter(42161, "Arbitrum"),
MixinBalancerV2,
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinDodoV2,
MixinKyberDmm,
MixinGMX,
MixinNerve,
MixinUniswapV3,
MixinUniswapV2,
MixinZeroExBridge
{
constructor(IEtherTokenV06 weth)
public
MixinCurve(weth)
{}
function _trade(
BridgeOrder memory order,
IERC20TokenV06 sellToken,
IERC20TokenV06 buyToken,
uint256 sellAmount,
bool dryRun
)
internal
override
returns (uint256 boughtAmount, bool supportedSource)
{
uint128 protocolId = uint128(uint256(order.source) >> 128);
if (protocolId == BridgeProtocols.BALANCERV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeBalancerV2(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeBalancerV2Batch(
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.CURVE) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeCurve(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.CURVEV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeCurveV2(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.DODOV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeDodoV2(
sellToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.KYBERDMM) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeKyberDmm(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV3) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeUniswapV3(
sellToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNISWAPV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeUniswapV2(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.GMX) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeGMX(
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.NERVE) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeNerve(
sellToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.UNKNOWN) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeZeroExBridge(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
}
emit BridgeFill(
order.source,
sellToken,
buyToken,
sellAmount,
boughtAmount
);
}
}

View File

@@ -22,6 +22,8 @@ pragma experimental ABIEncoderV2;
import "./AbstractBridgeAdapter.sol";
import "./BridgeProtocols.sol";
import "./mixins/MixinBalancerV2.sol";
import "./mixins/MixinBalancerV2Batch.sol";
import "./mixins/MixinCurve.sol";
import "./mixins/MixinCurveV2.sol";
import "./mixins/MixinNerve.sol";
@@ -32,6 +34,8 @@ import "./mixins/MixinZeroExBridge.sol";
contract OptimismBridgeAdapter is
AbstractBridgeAdapter(10, "Optimism"),
MixinBalancerV2,
MixinBalancerV2Batch,
MixinCurve,
MixinCurveV2,
MixinNerve,
@@ -109,7 +113,21 @@ contract OptimismBridgeAdapter is
sellAmount,
order.bridgeData
);
}
}else if (protocolId == BridgeProtocols.BALANCERV2) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeBalancerV2(
sellToken,
buyToken,
sellAmount,
order.bridgeData
);
} else if (protocolId == BridgeProtocols.BALANCERV2BATCH) {
if (dryRun) { return (0, true); }
boughtAmount = _tradeBalancerV2Batch(
sellAmount,
order.bridgeData
);
}
emit BridgeFill(
order.source,
@@ -119,4 +137,4 @@ contract OptimismBridgeAdapter is
boughtAmount
);
}
}
}

View File

@@ -0,0 +1,30 @@
// SPDX-License-Identifier: Apache-2.0
/*
Copyright 2022 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;
import "forge-std/Test.sol";
contract ContractTest is Test {
function setUp() public {}
function testExample() public {
assertTrue(true);
}
}

View File

@@ -0,0 +1,8 @@
[default]
src = 'contracts/src'
out = 'foundry-artifacts'
test = 'contracts/test/foundry'
libs = ["contracts/deps/", "../utils/contracts/src/"]
remappings = ['@0x/contracts-utils/=../utils/', '@0x/contracts-erc20/=../erc20/', 'src/=./contracts/src']
cache_path = 'foundry-cache'
optimizer_runs = 1000000

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-zero-ex",
"version": "0.36.1",
"version": "0.37.5",
"engines": {
"node": ">=6.12"
},
@@ -24,8 +24,8 @@
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"lint": "eslint src test scripts",
"fix": "eslint --fix src scripts test",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -33,17 +33,17 @@
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"lint-contracts": "#solhint -c ../.solhint.json contracts/**/**/**/**/*.sol",
"compile:truffle": "truffle compile",
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
"publish:private": "yarn build && gitpkg publish",
"rollback": "node ./lib/scripts/rollback.js"
"rollback": "node ./lib/scripts/rollback.js",
"typechain": "typechain --target=ethers-v5 --out-dir='typechain-wrappers' './foundry-artifacts/**/*.json'"
},
"config": {
"publicInterfaceContracts": "IZeroEx,ZeroEx,FullMigration,InitialMigration,IFlashWallet,IERC20Transformer,IOwnableFeature,ISimpleFunctionRegistryFeature,ITransformERC20Feature,FillQuoteTransformer,PayTakerTransformer,PositiveSlippageFeeTransformer,WethTransformer,OwnableFeature,SimpleFunctionRegistryFeature,TransformERC20Feature,AffiliateFeeTransformer,MetaTransactionsFeature,LogMetadataTransformer,LiquidityProviderFeature,ILiquidityProviderFeature,NativeOrdersFeature,INativeOrdersFeature,FeeCollectorController,FeeCollector,CurveLiquidityProvider,BatchFillNativeOrdersFeature,IBatchFillNativeOrdersFeature,MultiplexFeature,IMultiplexFeature,OtcOrdersFeature,IOtcOrdersFeature,AvalancheBridgeAdapter,BSCBridgeAdapter,CeloBridgeAdapter,EthereumBridgeAdapter,FantomBridgeAdapter,OptimismBridgeAdapter,PolygonBridgeAdapter",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|AvalancheBridgeAdapter|BSCBridgeAdapter|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeProtocols|CeloBridgeAdapter|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|EthereumBridgeAdapter|FantomBridgeAdapter|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinVelodrome|MixinWOOFi|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OptimismBridgeAdapter|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PolygonBridgeAdapter|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
"abis": "./test/generated-artifacts/@(AbstractBridgeAdapter|AffiliateFeeTransformer|AvalancheBridgeAdapter|BSCBridgeAdapter|BatchFillNativeOrdersFeature|BootstrapFeature|BridgeProtocols|CeloBridgeAdapter|CurveLiquidityProvider|ERC1155OrdersFeature|ERC165Feature|ERC721OrdersFeature|EthereumBridgeAdapter|FantomBridgeAdapter|FeeCollector|FeeCollectorController|FillQuoteTransformer|FixinCommon|FixinEIP712|FixinERC1155Spender|FixinERC721Spender|FixinProtocolFees|FixinReentrancyGuard|FixinTokenSpender|FlashWallet|FullMigration|FundRecoveryFeature|IBatchFillNativeOrdersFeature|IBootstrapFeature|IBridgeAdapter|IERC1155OrdersFeature|IERC1155Token|IERC165Feature|IERC20Bridge|IERC20Transformer|IERC721OrdersFeature|IERC721Token|IFeature|IFeeRecipient|IFlashWallet|IFundRecoveryFeature|ILiquidityProvider|ILiquidityProviderFeature|ILiquidityProviderSandbox|IMetaTransactionsFeature|IMooniswapPool|IMultiplexFeature|INativeOrdersEvents|INativeOrdersFeature|IOtcOrdersFeature|IOwnableFeature|IPancakeSwapFeature|IPropertyValidator|ISimpleFunctionRegistryFeature|IStaking|ITakerCallback|ITestSimpleFunctionRegistryFeature|ITokenSpenderFeature|ITransformERC20Feature|IUniswapFeature|IUniswapV2Pair|IUniswapV3Feature|IUniswapV3Pool|IZeroEx|InitialMigration|LibBootstrap|LibCommonRichErrors|LibERC1155OrdersStorage|LibERC20Transformer|LibERC721OrdersStorage|LibFeeCollector|LibLiquidityProviderRichErrors|LibMetaTransactionsRichErrors|LibMetaTransactionsStorage|LibMigrate|LibNFTOrder|LibNFTOrdersRichErrors|LibNativeOrder|LibNativeOrdersRichErrors|LibNativeOrdersStorage|LibOtcOrdersStorage|LibOwnableRichErrors|LibOwnableStorage|LibProxyRichErrors|LibProxyStorage|LibReentrancyGuardStorage|LibSignature|LibSignatureRichErrors|LibSimpleFunctionRegistryRichErrors|LibSimpleFunctionRegistryStorage|LibStorage|LibTransformERC20RichErrors|LibTransformERC20Storage|LibWalletRichErrors|LiquidityProviderFeature|LiquidityProviderSandbox|LogMetadataTransformer|MetaTransactionsFeature|MixinAaveV2|MixinBalancer|MixinBalancerV2|MixinBalancerV2Batch|MixinBancor|MixinBancorV3|MixinCompound|MixinCryptoCom|MixinCurve|MixinCurveV2|MixinDodo|MixinDodoV2|MixinGMX|MixinKyberDmm|MixinLido|MixinMStable|MixinMakerPSM|MixinMooniswap|MixinNerve|MixinPlatypus|MixinShell|MixinSynthetix|MixinUniswap|MixinUniswapV2|MixinUniswapV3|MixinVelodrome|MixinZeroExBridge|MooniswapLiquidityProvider|MultiplexFeature|MultiplexLiquidityProvider|MultiplexOtc|MultiplexRfq|MultiplexTransformERC20|MultiplexUniswapV2|MultiplexUniswapV3|NFTOrders|NativeOrdersCancellation|NativeOrdersFeature|NativeOrdersInfo|NativeOrdersProtocolFees|NativeOrdersSettlement|OptimismBridgeAdapter|OtcOrdersFeature|OwnableFeature|PancakeSwapFeature|PayTakerTransformer|PermissionlessTransformerDeployer|PolygonBridgeAdapter|PositiveSlippageFeeTransformer|SimpleFunctionRegistryFeature|TestBridge|TestCallTarget|TestCurve|TestDelegateCaller|TestFeeCollectorController|TestFeeRecipient|TestFillQuoteTransformerBridge|TestFillQuoteTransformerExchange|TestFillQuoteTransformerHost|TestFixinProtocolFees|TestFixinTokenSpender|TestFullMigration|TestInitialMigration|TestLibNativeOrder|TestLibSignature|TestLiquidityProvider|TestMetaTransactionsNativeOrdersFeature|TestMetaTransactionsTransformERC20Feature|TestMigrator|TestMintTokenERC20Transformer|TestMintableERC1155Token|TestMintableERC20Token|TestMintableERC721Token|TestMooniswap|TestNFTOrderPresigner|TestNativeOrdersFeature|TestNoEthRecipient|TestOrderSignerRegistryWithContractWallet|TestPermissionlessTransformerDeployerSuicidal|TestPermissionlessTransformerDeployerTransformer|TestPropertyValidator|TestRfqOriginRegistration|TestSimpleFunctionRegistryFeatureImpl1|TestSimpleFunctionRegistryFeatureImpl2|TestStaking|TestTokenSpenderERC20Token|TestTransformERC20|TestTransformerBase|TestTransformerDeployerTransformer|TestTransformerHost|TestUniswapV2Factory|TestUniswapV2Pool|TestUniswapV3Factory|TestUniswapV3Feature|TestUniswapV3Pool|TestWeth|TestWethTransformerHost|TestZeroExFeature|TransformERC20Feature|Transformer|TransformerDeployer|UniswapFeature|UniswapV3Feature|WethTransformer|ZeroEx|ZeroExOptimized).json"
},
"repository": {
"type": "git",
@@ -55,41 +55,44 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/contracts/zero-ex",
"devDependencies": {
"@0x/abi-gen": "^5.8.0",
"@0x/contract-addresses": "^6.19.0",
"@0x/contracts-erc20": "^3.3.34",
"@0x/contracts-gen": "^2.0.46",
"@0x/contracts-test-utils": "^5.4.25",
"@0x/dev-utils": "^4.2.14",
"@0x/abi-gen": "^5.8.1",
"@0x/contract-addresses": "^6.24.0",
"@0x/contracts-erc20": "^3.3.45",
"@0x/contracts-gen": "^2.0.47",
"@0x/contracts-test-utils": "^5.4.36",
"@0x/dev-utils": "^5.0.0",
"@0x/order-utils": "^10.4.28",
"@0x/sol-compiler": "^4.8.1",
"@0x/sol-compiler": "^4.8.2",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@typechain/ethers-v5": "^10.0.0",
"@types/isomorphic-fetch": "^0.0.35",
"@types/lodash": "4.14.104",
"@types/mocha": "^5.2.7",
"@types/prompts": "^2.0.9",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"isomorphic-fetch": "^3.0.0",
"lodash": "^4.17.11",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"prompts": "^2.4.0",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"truffle": "^5.0.32",
"tslint": "5.11.0",
"typechain": "^8.0.0",
"typedoc": "~0.16.11",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/base-contract": "^6.5.0",
"@0x/protocol-utils": "^11.16.1",
"@0x/subproviders": "^6.6.5",
"@0x/base-contract": "^7.0.0",
"@0x/protocol-utils": "^11.16.12",
"@0x/subproviders": "^7.0.0",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"ethereum-types": "^3.7.0",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"ethereum-types": "^3.7.1",
"ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4"
},

View File

@@ -386,7 +386,7 @@ async function getMainnetContractAsync(): Promise<wrappers.IZeroExContract> {
const proxyFunctions = await querySubgraphAsync();
const deployments = reconstructDeployments(proxyFunctions);
while (true) {
for (;;) {
const { action } = await prompts({
type: 'select',
name: 'action',

View File

@@ -129,7 +129,6 @@ 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 MixinVelodrome from '../test/generated-artifacts/MixinVelodrome.json';
import * as MixinWOOFi from '../test/generated-artifacts/MixinWOOFi.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';
@@ -354,7 +353,6 @@ export const artifacts = {
MixinUniswapV2: MixinUniswapV2 as ContractArtifact,
MixinUniswapV3: MixinUniswapV3 as ContractArtifact,
MixinVelodrome: MixinVelodrome as ContractArtifact,
MixinWOOFi: MixinWOOFi as ContractArtifact,
MixinZeroExBridge: MixinZeroExBridge as ContractArtifact,
IERC1155Token: IERC1155Token as ContractArtifact,
IERC721Token: IERC721Token as ContractArtifact,

View File

@@ -30,7 +30,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
let maker: string;
let sender: string;
let notSigner: string;
let signers: string[];
const signers: string[] = [];
let zeroEx: IZeroExContract;
let feature: MetaTransactionsFeatureContract;
let feeToken: TestMintableERC20TokenContract;
@@ -45,7 +45,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
const REENTRANCY_FLAG_MTX = 0x1;
before(async () => {
[owner, maker, sender, notSigner, ...signers] = await env.getAccountAddressesAsync();
let possibleSigners: string[];
[owner, maker, sender, notSigner, ...possibleSigners] = await env.getAccountAddressesAsync();
transformERC20Feature = await TestMetaTransactionsTransformERC20FeatureContract.deployFrom0xArtifactAsync(
artifacts.TestMetaTransactionsTransformERC20Feature,
env.provider,
@@ -74,20 +75,26 @@ blockchainTests.resets('MetaTransactions feature', env => {
env.txDefaults,
{},
);
// Fund signers with fee tokens.
await Promise.all(
signers.map(async signer => {
await feeToken.mint(signer, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
await feeToken.approve(zeroEx.address, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync({ from: signer });
}),
);
// some accounts returned can be unfunded
for (const possibleSigner of possibleSigners) {
const balance = await env.web3Wrapper.getBalanceInWeiAsync(possibleSigner);
if (balance.isGreaterThan(0)) {
signers.push(possibleSigner);
await feeToken
.approve(zeroEx.address, MAX_FEE_AMOUNT)
.awaitTransactionSuccessAsync({ from: possibleSigner });
await feeToken.mint(possibleSigner, MAX_FEE_AMOUNT).awaitTransactionSuccessAsync();
}
}
});
function getRandomMetaTransaction(fields: Partial<MetaTransactionFields> = {}): MetaTransaction {
return new MetaTransaction({
signer: _.sampleSize(signers)[0],
sender,
minGasPrice: getRandomInteger('2', '1e9'),
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
minGasPrice: ZERO_AMOUNT,
maxGasPrice: getRandomInteger('1e9', '100e9'),
expirationTimeSeconds: new BigNumber(Math.floor(_.now() / 1000) + 360),
salt: new BigNumber(hexUtils.random()),
@@ -145,6 +152,7 @@ blockchainTests.resets('MetaTransactions feature', env => {
gasPrice: mtx.minGasPrice,
value: mtx.value,
};
const rawResult = await feature.executeMetaTransaction(mtx, signature).callAsync(callOpts);
expect(rawResult).to.eq(RAW_ORDER_SUCCESS_RESULT);
const receipt = await feature.executeMetaTransaction(mtx, signature).awaitTransactionSuccessAsync(callOpts);
@@ -434,7 +442,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
);
});
it('fails if gas price too low', async () => {
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
it.skip('fails if gas price too low', async () => {
const mtx = getRandomMetaTransaction();
const mtxHash = mtx.getHash();
const signature = await mtx.getSignatureWithProviderAsync(env.provider);
@@ -453,7 +462,8 @@ blockchainTests.resets('MetaTransactions feature', env => {
);
});
it('fails if gas price too high', async () => {
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
it.skip('fails if gas price too high', async () => {
const mtx = getRandomMetaTransaction();
const mtxHash = mtx.getHash();
const signature = await mtx.getSignatureWithProviderAsync(env.provider);

View File

@@ -294,7 +294,7 @@ blockchainTests.resets('MultiplexFeature', env => {
};
}
function getUniswapV2MultiHopSubcall(tokens: string[], isSushi: boolean = false): MultiHopSellSubcall {
function getUniswapV2MultiHopSubcall(tokens: string[], isSushi = false): MultiHopSellSubcall {
const uniswapDataEncoder = AbiEncoder.create([
{ name: 'tokens', type: 'address[]' },
{ name: 'isSushi', type: 'bool' },
@@ -307,7 +307,7 @@ blockchainTests.resets('MultiplexFeature', env => {
function getUniswapV2BatchSubcall(
tokens: string[],
sellAmount: BigNumber = getRandomInteger(1, toBaseUnitAmount(1)),
isSushi: boolean = false,
isSushi = false,
): BatchSellSubcall {
return {
...getUniswapV2MultiHopSubcall(tokens, isSushi),

View File

@@ -61,15 +61,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
before(async () => {
let owner;
[
owner,
maker,
taker,
notMaker,
notTaker,
contractWalletOwner,
contractWalletSigner,
] = await env.getAccountAddressesAsync();
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner] =
await env.getAccountAddressesAsync();
[makerToken, takerToken, wethToken] = await Promise.all(
[...new Array(3)].map(async () =>
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(
@@ -761,11 +754,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
receipt: undefined,
...opts,
};
const {
makerTokenFilledAmount,
takerTokenFilledAmount,
takerTokenFeeFilledAmount,
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const makerBalance = await takerToken.balanceOf(maker).callAsync();
const takerBalance = await makerToken.balanceOf(taker).callAsync();
const feeRecipientBalance = await takerToken.balanceOf(order.feeRecipient).callAsync();
@@ -938,7 +928,8 @@ blockchainTests.resets('NativeOrdersFeature', env => {
);
});
it('fails if no protocol fee attached', async () => {
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
it.skip('fails if no protocol fee attached', async () => {
const order = getTestLimitOrder();
await testUtils.prepareBalancesForOrdersAsync([order]);
const tx = zeroEx

View File

@@ -42,17 +42,8 @@ blockchainTests.resets('OtcOrdersFeature', env => {
// Useful for ETH balance accounting
const txDefaults = { ...env.txDefaults, gasPrice: 0 };
let owner;
[
owner,
maker,
taker,
notMaker,
notTaker,
contractWalletOwner,
contractWalletSigner,
txOrigin,
notTxOrigin,
] = await env.getAccountAddressesAsync();
[owner, maker, taker, notMaker, notTaker, contractWalletOwner, contractWalletSigner, txOrigin, notTxOrigin] =
await env.getAccountAddressesAsync();
[makerToken, takerToken] = await Promise.all(
[...new Array(2)].map(async () =>
TestMintableERC20TokenContract.deployFrom0xArtifactAsync(

View File

@@ -10,7 +10,8 @@ import {
TestWethContract,
} from './wrappers';
blockchainTests.resets('ProtocolFees', env => {
// TODO: dekz Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
blockchainTests.resets.skip('ProtocolFees', env => {
const FEE_MULTIPLIER = 70e3;
let taker: string;
let unauthorized: string;
@@ -62,7 +63,7 @@ blockchainTests.resets('ProtocolFees', env => {
it('should disallow unauthorized initialization', async () => {
const pool = hexUtils.random();
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: singleFeeAmount });
await protocolFees.collectProtocolFee(pool).awaitTransactionSuccessAsync({ value: 1e9 });
await protocolFees.transferFeesForPool(pool).awaitTransactionSuccessAsync();
const feeCollector = new FeeCollectorContract(
@@ -89,6 +90,7 @@ blockchainTests.resets('ProtocolFees', env => {
feeCollector2Address = await protocolFees.getFeeCollector(pool2).callAsync();
});
// Ganache gasPrice opcode is returning 0, cannot influence it up to test this case
it('should revert if insufficient ETH transferred', async () => {
const tooLittle = singleFeeAmount.minus(1);
const tx = protocolFees.collectProtocolFee(pool1).awaitTransactionSuccessAsync({ value: tooLittle });

View File

@@ -334,17 +334,13 @@ blockchainTests.resets('FillQuoteTransformer', env => {
async function getBalancesAsync(owner: string): Promise<Balances> {
const balances = { ...ZERO_BALANCES };
[
balances.makerTokenBalance,
balances.takerTokensBalance,
balances.takerFeeBalance,
balances.ethBalance,
] = await Promise.all([
makerToken.balanceOf(owner).callAsync(),
takerToken.balanceOf(owner).callAsync(),
takerFeeToken.balanceOf(owner).callAsync(),
env.web3Wrapper.getBalanceInWeiAsync(owner),
]);
[balances.makerTokenBalance, balances.takerTokensBalance, balances.takerFeeBalance, balances.ethBalance] =
await Promise.all([
makerToken.balanceOf(owner).callAsync(),
takerToken.balanceOf(owner).callAsync(),
takerFeeToken.balanceOf(owner).callAsync(),
env.web3Wrapper.getBalanceInWeiAsync(owner),
]);
return balances;
}
@@ -365,11 +361,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
function normalizeFillAmount(raw: BigNumber, balance: BigNumber): BigNumber {
if (raw.gte(HIGH_BIT)) {
return raw
.minus(HIGH_BIT)
.div('1e18')
.times(balance)
.integerValue(BigNumber.ROUND_DOWN);
return raw.minus(HIGH_BIT).div('1e18').times(balance).integerValue(BigNumber.ROUND_DOWN);
}
return raw;
}
@@ -393,6 +385,7 @@ blockchainTests.resets('FillQuoteTransformer', env => {
buyToken: makerToken.address,
bridgeOrders: [],
limitOrders: [],
otcOrders: [],
rfqOrders: [],
fillSequence: [],
fillAmount: MAX_UINT256,

View File

@@ -34,7 +34,7 @@ interface RfqOrderFilledAmounts {
makerTokenFilledAmount: BigNumber;
takerTokenFilledAmount: BigNumber;
}
interface OtcOrderFilledAmounts extends RfqOrderFilledAmounts {}
type OtcOrderFilledAmounts = RfqOrderFilledAmounts;
interface LimitOrderFilledAmounts {
makerTokenFilledAmount: BigNumber;
@@ -52,7 +52,7 @@ export class NativeOrdersTestEnvironment {
public static async createAsync(
env: BlockchainTestsEnvironment,
gasPrice: BigNumber = new BigNumber('123e9'),
protocolFeeMultiplier: number = 70e3,
protocolFeeMultiplier = 70e3,
): Promise<NativeOrdersTestEnvironment> {
const [owner, maker, taker] = await env.getAccountAddressesAsync();
const [makerToken, takerToken] = await Promise.all(
@@ -153,7 +153,7 @@ export class NativeOrdersTestEnvironment {
order: OtcOrder,
fillAmount: BigNumber | number = order.takerAmount,
taker: string = this.taker,
unwrapWeth: boolean = false,
unwrapWeth = false,
): Promise<TransactionReceiptWithDecodedLogs> {
await this.prepareBalancesForOrdersAsync([order], taker);
if (unwrapWeth) {
@@ -179,7 +179,7 @@ export class NativeOrdersTestEnvironment {
order: OtcOrder,
origin: string = order.txOrigin,
taker: string = order.taker,
unwrapWeth: boolean = false,
unwrapWeth = false,
): Promise<TransactionReceiptWithDecodedLogs> {
await this.prepareBalancesForOrdersAsync([order], taker);
if (unwrapWeth) {
@@ -217,11 +217,8 @@ export class NativeOrdersTestEnvironment {
takerTokenFillAmount: BigNumber = order.takerAmount,
takerTokenAlreadyFilledAmount: BigNumber = ZERO,
): IZeroExLimitOrderFilledEventArgs {
const {
makerTokenFilledAmount,
takerTokenFilledAmount,
takerTokenFeeFilledAmount,
} = computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const { makerTokenFilledAmount, takerTokenFilledAmount, takerTokenFeeFilledAmount } =
computeLimitOrderFilledAmounts(order, takerTokenFillAmount, takerTokenAlreadyFilledAmount);
const protocolFee = order.taker !== NULL_ADDRESS ? ZERO : this.protocolFee;
return {
takerTokenFilledAmount,
@@ -354,7 +351,7 @@ export function assertOrderInfoEquals(actual: OrderInfo, expected: OrderInfo): v
/**
* Creates an order expiry field.
*/
export function createExpiry(deltaSeconds: number = 60): BigNumber {
export function createExpiry(deltaSeconds = 60): BigNumber {
return new BigNumber(Math.floor(Date.now() / 1000) + deltaSeconds);
}

View File

@@ -127,7 +127,6 @@ 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_velodrome';
export * from '../test/generated-wrappers/mixin_w_o_o_fi';
export * from '../test/generated-wrappers/mixin_zero_ex_bridge';
export * from '../test/generated-wrappers/mooniswap_liquidity_provider';
export * from '../test/generated-wrappers/multiplex_feature';

View File

@@ -166,7 +166,6 @@
"test/generated-artifacts/MixinUniswapV2.json",
"test/generated-artifacts/MixinUniswapV3.json",
"test/generated-artifacts/MixinVelodrome.json",
"test/generated-artifacts/MixinWOOFi.json",
"test/generated-artifacts/MixinZeroExBridge.json",
"test/generated-artifacts/MooniswapLiquidityProvider.json",
"test/generated-artifacts/MultiplexFeature.json",

View File

@@ -52,7 +52,7 @@
},
"config": {
"contractsPackages": "@0x/contracts-erc20 @0x/contracts-test-utils @0x/contracts-utils @0x/contracts-zero-ex @0x/contracts-treasury",
"nonContractPackages": "@0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test @0x/asset-swapper",
"nonContractPackages": "@0x/contract-wrappers @0x/contract-addresses @0x/contract-artifacts @0x/contract-wrappers-test",
"ignoreTestsForPackages": "",
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
"packagesWithDocPages": "@0x/contract-wrappers",
@@ -69,13 +69,12 @@
"lcov-result-merger": "^3.0.0",
"lerna": "^3.0.0-beta.25",
"npm-run-all": "^4.1.2",
"prettier": "1.19.1",
"prettier": "2.7.1",
"source-map-support": "^0.5.6",
"typescript": "4.6.3",
"wsrun": "^5.2.4"
},
"resolutions": {
"merkle-patricia-tree": "3.0.0",
"**/bignumber.js": "^9.0.2"
}
}

View File

@@ -1,4 +1,47 @@
[
{
"version": "16.66.4",
"changes": [
{
"note": "Offboard Cream",
"pr": 546
},
{
"note": "Change WooFi gas estimates",
"pr": 551
}
],
"timestamp": 1661145612
},
{
"timestamp": 1660093941,
"version": "16.66.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "16.66.2",
"changes": [
{
"note": "Upgrade dependency",
"pr": 543
}
],
"timestamp": 1660073235
},
{
"version": "16.66.1",
"changes": [
{
"note": "Upgrade dependency",
"pr": 538
}
],
"timestamp": 1659926840
},
{
"version": "16.66.0",
"changes": [

View File

@@ -5,6 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v16.66.4 - _August 22, 2022_
* Offboard Cream (#546)
* Change WooFi gas estimates (#551)
## v16.66.3 - _August 10, 2022_
* Dependencies updated
## v16.66.2 - _August 9, 2022_
* Upgrade dependency (#543)
## v16.66.1 - _August 8, 2022_
* Upgrade dependency (#538)
## v16.66.0 - _August 6, 2022_
* Add WOOFi support (#513)

View File

@@ -1,3 +1,5 @@
> :warning: **@0x/asset-swapper has been deprecated!** The `asset-swapper` code has been moved to [0x-api](https://github.com/0xProject/0x-api). Please do not open a PR with `asset-swapper` changes.
## @0x/asset-swapper
Convenience package for swapping assets represented on the Ethereum blockchain using 0x. The package helps to perform all the off-chain computations to execute a marketBuy or marketSell function execution with 0x exchange contracts, or 0x extension contracts. Given some liquidity (0x signed orders), it helps estimate the cost of buying or selling a certain asset (giving a range) and then provide varying consumable outputs to execute the buy or sell.

View File

@@ -1,42 +1,14 @@
{
"name": "@0x/asset-swapper",
"version": "16.66.0",
"version": "16.66.12",
"private": true,
"engines": {
"node": ">=6.12"
},
"description": "Convenience package for discovering and buying assets on-chain and off-chain.",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ts": "tsc -b",
"watch": "tsc -w -p tsconfig.json",
"watch:contracts": "sol-compiler -w",
"build:ci": "yarn build",
"pre_build": "run-s compile contracts:gen generate_contract_wrappers contracts:copy",
"compile": "sol-compiler",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"lint-contracts": "#solhint -c .solhint.json contracts/**/**/**/**/*.sol",
"prettier": "prettier --write '**/*.{ts,tsx,json}' --config ../../.prettierrc --ignore-path ../../.prettierignore",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*_test.js' lib/test/global_hooks.js --timeout 30000 --bail --exit",
"clean": "shx rm -rf lib test_temp generated_docs test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
"diff_docs": "git diff --exit-code ./docs",
"s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
"docs:json": "typedoc --excludePrivate --excludeExternals --excludeProtected --ignoreCompilerErrors --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output test/generated-wrappers --backend ethers",
"contracts:gen": "contracts-gen generate",
"contracts:copy": "contracts-gen copy",
"publish:private": "yarn build && gitpkg publish",
"sampler-size": "jq .compilerOutput.evm.deployedBytecode.object -- test/generated-artifacts/ERC20BridgeSampler.json | echo $(( $(wc -c) / 2 - 1 ))",
"list:deps": "yarn lerna list -l"
},
"scripts": {},
"config": {
"publicInterfaceContracts": "ERC20BridgeSampler,BalanceChecker,FakeTaker",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
@@ -59,20 +31,21 @@
"registry": "git@github.com:0xProject/gitpkg-registry.git"
},
"dependencies": {
"@0x/assert": "^3.0.34",
"@0x/base-contract": "^6.5.0",
"@0x/contract-addresses": "^6.19.0",
"@0x/contract-wrappers": "^13.20.6",
"@0x/contracts-erc20": "^3.3.34",
"@0x/contracts-zero-ex": "^0.36.1",
"@0x/dev-utils": "^4.2.14",
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^6.24.0",
"@0x/contract-wrappers": "^13.22.5",
"@0x/contracts-erc20": "^3.3.45",
"@0x/contracts-zero-ex": "^0.37.5",
"@0x/dev-utils": "^5.0.0",
"@0x/fast-abi": "^0.0.5",
"@0x/json-schemas": "^6.4.4",
"@0x/neon-router": "^0.3.5",
"@0x/protocol-utils": "^11.16.1",
"@0x/protocol-utils": "^11.16.12",
"@0x/quote-server": "^8.0.0",
"@0x/types": "^3.3.6",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"@balancer-labs/sdk": "0.1.6",
"@bancor/sdk": "0.2.9",
"@ethersproject/abi": "^5.0.1",
@@ -83,9 +56,7 @@
"axios": "^0.21.1",
"axios-mock-adapter": "^1.19.0",
"balancer-labs-sor-v1": "npm:@balancer-labs/sor@0.3.2",
"cream-sor": "^0.3.3",
"ethereum-types": "^3.7.0",
"fast-abi": "^0.0.4",
"ethereum-types": "^3.7.1",
"graphql": "^15.4.0",
"graphql-request": "^3.4.0",
"heartbeats": "^5.0.1",
@@ -93,11 +64,11 @@
"msw": "^0.44.2"
},
"devDependencies": {
"@0x/abi-gen": "^5.8.0",
"@0x/contracts-gen": "^2.0.46",
"@0x/contracts-test-utils": "^5.4.25",
"@0x/sol-compiler": "^4.8.1",
"@0x/subproviders": "^6.6.5",
"@0x/abi-gen": "^5.8.1",
"@0x/contracts-gen": "^2.0.47",
"@0x/contracts-test-utils": "^5.4.36",
"@0x/sol-compiler": "^4.8.2",
"@0x/subproviders": "^7.0.0",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@types/lodash": "4.14.137",

View File

@@ -1,9 +1,9 @@
import { ChainId, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
import { FastABI } from '@0x/fast-abi';
import { FillQuoteTransformerOrderType, LimitOrder } from '@0x/protocol-utils';
import { BigNumber, providerUtils } from '@0x/utils';
import Axios, { AxiosInstance } from 'axios';
import { BlockParamLiteral, MethodAbi, SupportedProvider, ZeroExProvider } from 'ethereum-types';
import { FastABI } from 'fast-abi';
import { Agent as HttpAgent } from 'http';
import { Agent as HttpsAgent } from 'https';
import * as _ from 'lodash';
@@ -144,7 +144,7 @@ export class SwapQuoter {
this.chainId,
samplerContract,
samplerOverrides,
undefined, // pools caches for balancer and cream
undefined, // pools caches for balancer
tokenAdjacencyGraph,
liquidityProviderRegistry,
this.chainId === ChainId.Mainnet // Enable Bancor only on Mainnet

View File

@@ -71,6 +71,8 @@ function valueByChainId<T>(rest: Partial<{ [key in ChainId]: T }>, defaultValue:
[ChainId.Fantom]: defaultValue,
[ChainId.Celo]: defaultValue,
[ChainId.Optimism]: defaultValue,
[ChainId.ArbitrumRinkeby]: defaultValue,
[ChainId.Arbitrum]: defaultValue,
...(rest || {}),
};
}
@@ -95,7 +97,6 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.MultiHop,
ERC20BridgeSource.Dodo,
ERC20BridgeSource.DodoV2,
ERC20BridgeSource.Cream,
ERC20BridgeSource.LiquidityProvider,
ERC20BridgeSource.CryptoCom,
ERC20BridgeSource.Lido,
@@ -223,6 +224,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.Velodrome,
ERC20BridgeSource.Synthetix,
]),
[ChainId.ArbitrumRinkeby]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
},
new SourceFilters([]),
);
@@ -247,7 +249,6 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.MultiHop,
ERC20BridgeSource.Dodo,
ERC20BridgeSource.DodoV2,
ERC20BridgeSource.Cream,
ERC20BridgeSource.Lido,
ERC20BridgeSource.LiquidityProvider,
ERC20BridgeSource.CryptoCom,
@@ -375,6 +376,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.Velodrome,
ERC20BridgeSource.Synthetix,
]),
[ChainId.ArbitrumRinkeby]: new SourceFilters([ERC20BridgeSource.Native, ERC20BridgeSource.UniswapV3]),
},
new SourceFilters([]),
);
@@ -399,6 +401,7 @@ export const FEE_QUOTE_SOURCES_BY_CHAIN_ID = valueByChainId<ERC20BridgeSource[]>
[ChainId.Fantom]: [ERC20BridgeSource.SpiritSwap, ERC20BridgeSource.SpookySwap, ERC20BridgeSource.SushiSwap],
[ChainId.Celo]: [ERC20BridgeSource.UbeSwap, ERC20BridgeSource.SushiSwap],
[ChainId.Optimism]: [ERC20BridgeSource.UniswapV3],
[ChainId.ArbitrumRinkeby]: [ERC20BridgeSource.UniswapV3],
},
[],
);
@@ -415,23 +418,6 @@ export const SOURCE_FLAGS: { [key in ERC20BridgeSource]: bigint } & {
})),
);
const MIRROR_WRAPPED_TOKENS = {
mAAPL: '0xd36932143f6ebdedd872d5fb0651f4b72fd15a84',
mSLV: '0x9d1555d8cb3c846bb4f7d5b1b1080872c3166676',
mIAU: '0x1d350417d9787e000cc1b95d70e9536dcd91f373',
mAMZN: '0x0cae9e4d663793c2a2a0b211c1cf4bbca2b9caa7',
mGOOGL: '0x4b70ccd1cf9905be1faed025eadbd3ab124efe9a',
mTSLA: '0x21ca39943e91d704678f5d00b6616650f066fd63',
mQQQ: '0x13b02c8de71680e71f0820c996e4be43c2f57d15',
mTWTR: '0xedb0414627e6f1e3f082de65cd4f9c693d78cca9',
mMSFT: '0x41bbedd7286daab5910a1f15d12cbda839852bd7',
mNFLX: '0xc8d674114bac90148d11d3c1d33c61835a0f9dcd',
mBABA: '0x676ce85f66adb8d7b8323aeefe17087a3b8cb363',
mUSO: '0x31c63146a635eb7465e5853020b39713ac356991',
mVIXY: '0xf72fcd9dcf0190923fadd44811e240ef4533fc86',
mLUNA: '0xd2877702675e6ceb975b4a1dff9fb7baf4c91ea9',
};
// Mainnet tokens
// Not an exhaustive list, just enough so we don't repeat ourselves
export const MAINNET_TOKENS = {
@@ -495,10 +481,7 @@ export const MAINNET_TOKENS = {
vETH: '0x898bad2774eb97cf6b94605677f43b41871410b1',
alETH: '0x0100546f2cd4c9d97f798ffc9755e47865ff7ee6',
HT: '0x6f259637dcD74C767781E37Bc6133cd6A68aa161',
// Mirror Protocol
UST: '0xa47c8bf37f92abed4a126bda807a7b7498661acd',
MIR: '0x09a3ecafa817268f77be1283176b946c4ff2e608',
...MIRROR_WRAPPED_TOKENS,
// StableSwap "open pools" (crv.finance)
STABLEx: '0xcd91538b91b4ba7797d39a2f66e63810b50a33d0',
alUSD: '0xbc6da0fe9ad5f3b0d58160288917aa56653660e9',
@@ -735,8 +718,6 @@ export const CURVE_POOLS = {
eurt: '0xfd5db7463a3ab53fd211b4af195c5bccc1a03890',
ethcrv: '0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511',
ethcvx: '0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4',
mimust: '0x55a8a39bc9694714e2874c1ce77aa1e599461e18',
usttri_wormhole: '0xceaf7747579696a2f0bb206a14210e3c9e6fb269',
fei_tri: '0x06cb22615ba53e60d67bf6c341a0fd5e718e1655',
rai_tri: '0x618788357d0ebd8a37e763adab3bc575d54c2c7d',
DOLA_tri: '0xaa5a67c256e27a5d80712c51971408db3370927d',
@@ -887,6 +868,29 @@ export const WOOFI_POOL_BY_CHAIN_ID = valueByChainId<string>(
NULL_ADDRESS,
);
export const WOOFI_SUPPORTED_TOKENS = new Set([
BSC_TOKENS.USDT,
BSC_TOKENS.WBNB,
BSC_TOKENS.WOO,
BSC_TOKENS.WETH,
BSC_TOKENS.BTCB,
AVALANCHE_TOKENS.nUSDC,
AVALANCHE_TOKENS.WAVAX,
AVALANCHE_TOKENS.WBTC,
AVALANCHE_TOKENS.WETH,
AVALANCHE_TOKENS.WOO,
FANTOM_TOKENS.USDC,
FANTOM_TOKENS.WFTM,
FANTOM_TOKENS.WETH,
FANTOM_TOKENS.WBTC,
FANTOM_TOKENS.WOO,
POLYGON_TOKENS.USDC,
POLYGON_TOKENS.WMATIC,
POLYGON_TOKENS.WBTC,
POLYGON_TOKENS.WETH,
POLYGON_TOKENS.WOO,
]);
export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
{
[ChainId.Mainnet]: [
@@ -915,6 +919,11 @@ export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
'0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', // DAI
'0x07865c6E87B9F70255377e024ace6630C1Eaa37F', // USDC
],
[ChainId.ArbitrumRinkeby]: [
getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
'0x237b3B5238D2022aA80cAd1f67dAE53f353F74bF', // USDT
'0xF61Cffd6071a8DB7cD5E8DF1D3A5450D9903cF1c', // USDC
],
[ChainId.PolygonMumbai]: [
getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
'0xe6b8a5CF854791412c1f6EFC7CAf629f5Df1c747', // USDC
@@ -972,8 +981,6 @@ export const DEFAULT_TOKEN_ADJACENCY_GRAPH_BY_CHAIN_ID = valueByChainId<TokenAdj
{
[ChainId.Mainnet]: new TokenAdjacencyGraphBuilder(DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID[ChainId.Mainnet])
.tap(builder => {
// Mirror Protocol
builder.add(MAINNET_TOKENS.MIR, MAINNET_TOKENS.UST);
// Convex and Curve
builder.addBidirectional(MAINNET_TOKENS.cvxCRV, MAINNET_TOKENS.CRV);
// Convex and FXS
@@ -1048,6 +1055,7 @@ export const NATIVE_FEE_TOKEN_BY_CHAIN_ID = valueByChainId<string>(
[ChainId.Ropsten]: getContractAddressesForChainOrThrow(ChainId.Ropsten).etherToken,
[ChainId.Goerli]: getContractAddressesForChainOrThrow(ChainId.Goerli).etherToken,
[ChainId.PolygonMumbai]: getContractAddressesForChainOrThrow(ChainId.PolygonMumbai).etherToken,
[ChainId.ArbitrumRinkeby]: getContractAddressesForChainOrThrow(ChainId.ArbitrumRinkeby).etherToken,
[ChainId.Rinkeby]: getContractAddressesForChainOrThrow(ChainId.Rinkeby).etherToken,
[ChainId.Kovan]: getContractAddressesForChainOrThrow(ChainId.Kovan).etherToken,
[ChainId.Polygon]: getContractAddressesForChainOrThrow(ChainId.Polygon).etherToken,
@@ -1381,16 +1389,6 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
},
[CURVE_POOLS.mimust]: createCurveExchangePool({
tokens: [MAINNET_TOKENS.MIM, MAINNET_TOKENS.UST],
pool: CURVE_POOLS.mimust,
gasSchedule: 105e3,
}),
[CURVE_POOLS.usttri_wormhole]: createCurveMetaTriPool({
tokens: [MAINNET_TOKENS.UST_WORMHOLE],
pool: CURVE_POOLS.usttri_wormhole,
gasSchedule: 340e3,
}),
[CURVE_POOLS.fei_tri]: createCurveMetaTriPool({
tokens: [MAINNET_TOKENS.FEI],
pool: CURVE_POOLS.fei_tri,
@@ -2236,6 +2234,10 @@ export const UNISWAPV3_CONFIG_BY_CHAIN_ID = valueByChainId(
quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
router: '0xe592427a0aece92de3edee1f18e0157c05861564',
},
[ChainId.ArbitrumRinkeby]: {
quoter: '0x61ffe014ba17989e743c5f6cb21bf9697530b21e',
router: '0xe592427a0aece92de3edee1f18e0157c05861564',
},
},
{ quoter: NULL_ADDRESS, router: NULL_ADDRESS },
);
@@ -2531,7 +2533,6 @@ export const DEFAULT_GAS_SCHEDULE: Required<GasSchedule> = {
[ERC20BridgeSource.BalancerV2]: (fillData?: FillData) => {
return 100e3 + ((fillData as BalancerV2BatchSwapFillData).swapSteps.length - 1) * 50e3;
},
[ERC20BridgeSource.Cream]: () => 120e3,
[ERC20BridgeSource.MStable]: () => 200e3,
[ERC20BridgeSource.MakerPsm]: (fillData?: FillData) => {
const psmFillData = fillData as MakerPsmFillData;
@@ -2671,14 +2672,34 @@ export const DEFAULT_GAS_SCHEDULE: Required<GasSchedule> = {
[ERC20BridgeSource.WOOFi]: (fillData?: FillData) => {
const woofiFillData = fillData as WOOFiFillData;
const quoteTokenAddresses = [BSC_TOKENS.USDT, AVALANCHE_TOKENS.nUSDC, FANTOM_TOKENS.USDC, POLYGON_TOKENS.USDC];
if (
const hasQuoteToken =
quoteTokenAddresses.includes(woofiFillData.takerToken) ||
quoteTokenAddresses.includes(woofiFillData.makerToken)
) {
return 500e3;
quoteTokenAddresses.includes(woofiFillData.makerToken);
if (woofiFillData.chainId === ChainId.BSC) {
if (hasQuoteToken) {
return 550e3;
} else {
return 100e4;
}
} else if (woofiFillData.chainId === ChainId.Avalanche) {
if (hasQuoteToken) {
return 300e3;
} else {
return 550e3;
}
} else if (woofiFillData.chainId === ChainId.Polygon) {
if (hasQuoteToken) {
return 500e3;
} else {
return 700e3;
}
} else {
return 100e4;
// Fantom
if (hasQuoteToken) {
return 400e3;
} else {
return 600e3;
}
}
},
//

View File

@@ -8,7 +8,6 @@ import { MAX_UINT256, ZERO_AMOUNT } from './constants';
import {
AaveV2FillData,
AggregationError,
BalancerFillData,
BalancerV2BatchSwapFillData,
BalancerV2FillData,
BancorFillData,
@@ -101,8 +100,6 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
return encodeBridgeSourceId(BridgeProtocol.Bancor, 'Bancor');
case ERC20BridgeSource.Curve:
return encodeBridgeSourceId(BridgeProtocol.Curve, 'Curve');
case ERC20BridgeSource.Cream:
return encodeBridgeSourceId(BridgeProtocol.Balancer, 'Cream');
case ERC20BridgeSource.CryptoCom:
return encodeBridgeSourceId(BridgeProtocol.CryptoCom, 'CryptoCom');
case ERC20BridgeSource.Dodo:
@@ -258,10 +255,6 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
]);
break;
case ERC20BridgeSource.Balancer:
case ERC20BridgeSource.Cream:
const balancerFillData = (order as OptimizedMarketBridgeOrder<BalancerFillData>).fillData;
bridgeData = encoder.encode([balancerFillData.poolAddress]);
break;
case ERC20BridgeSource.BalancerV2:
{
const balancerV2FillData = (order as OptimizedMarketBridgeOrder<BalancerV2BatchSwapFillData>).fillData;
@@ -505,7 +498,6 @@ export const BRIDGE_ENCODERS: {
[ERC20BridgeSource.Mooniswap]: poolEncoder,
[ERC20BridgeSource.MStable]: poolEncoder,
[ERC20BridgeSource.Balancer]: poolEncoder,
[ERC20BridgeSource.Cream]: poolEncoder,
[ERC20BridgeSource.Uniswap]: poolEncoder,
// Custom integrations
[ERC20BridgeSource.MakerPsm]: makerPsmEncoder,

View File

@@ -1,36 +0,0 @@
import { ChainId } from '@0x/contract-addresses';
import { Pool } from 'balancer-labs-sor-v1/dist/types';
import { getPoolsWithTokens, parsePoolData } from 'cream-sor';
import { BALANCER_MAX_POOLS_FETCHED } from '../constants';
import { NoOpPoolsCache } from './no_op_pools_cache';
import { AbstractPoolsCache, CacheValue, PoolsCache } from './pools_cache';
export class CreamPoolsCache extends AbstractPoolsCache {
public static create(chainId: ChainId): PoolsCache {
if (chainId !== ChainId.Mainnet) {
return new NoOpPoolsCache();
}
return new CreamPoolsCache();
}
protected async _fetchPoolsForPairAsync(takerToken: string, makerToken: string): Promise<Pool[]> {
try {
const poolData = (await getPoolsWithTokens(takerToken, makerToken)).pools;
// Sort by maker token balance (descending)
const pools = parsePoolData(poolData, takerToken, makerToken).sort((a, b) =>
b.balanceOut.minus(a.balanceOut).toNumber(),
);
return pools.slice(0, this.maxPoolsFetched);
} catch (err) {
return [];
}
}
private constructor(
_cache: Map<string, CacheValue> = new Map(),
private readonly maxPoolsFetched: number = BALANCER_MAX_POOLS_FETCHED,
) {
super(_cache);
}
}

View File

@@ -1,4 +1,3 @@
export { BalancerPoolsCache } from './balancer_pools_cache';
export { BalancerV2PoolsCache } from './balancer_v2_pools_cache';
export { CreamPoolsCache } from './cream_pools_cache';
export { AbstractPoolsCache, PoolsCache } from './pools_cache';

View File

@@ -53,11 +53,12 @@ import {
UNISWAPV3_CONFIG_BY_CHAIN_ID,
VELODROME_ROUTER_BY_CHAIN_ID,
WOOFI_POOL_BY_CHAIN_ID,
WOOFI_SUPPORTED_TOKENS,
ZERO_AMOUNT,
} from './constants';
import { getGeistInfoForPair } from './geist_utils';
import { getLiquidityProvidersForPair } from './liquidity_provider_utils';
import { BalancerPoolsCache, BalancerV2PoolsCache, CreamPoolsCache, PoolsCache } from './pools_cache';
import { BalancerPoolsCache, BalancerV2PoolsCache, PoolsCache } from './pools_cache';
import { BalancerV2SwapInfoCache } from './pools_cache/balancer_v2_swap_info_cache';
import { SamplerContractOperation } from './sampler_contract_operation';
import { SamplerNoOperation } from './sampler_no_operation';
@@ -119,7 +120,6 @@ export interface PoolsCacheMap {
[ERC20BridgeSource.Balancer]: PoolsCache;
[ERC20BridgeSource.BalancerV2]: BalancerV2SwapInfoCache | undefined;
[ERC20BridgeSource.Beethovenx]: PoolsCache;
[ERC20BridgeSource.Cream]: PoolsCache;
}
// tslint:disable:no-inferred-empty-object-type no-unbound-method
@@ -159,7 +159,6 @@ export class SamplerOperations {
: {
[ERC20BridgeSource.Beethovenx]: BalancerV2PoolsCache.createBeethovenXPoolCache(chainId),
[ERC20BridgeSource.Balancer]: BalancerPoolsCache.create(chainId),
[ERC20BridgeSource.Cream]: CreamPoolsCache.create(chainId),
[ERC20BridgeSource.BalancerV2]:
BALANCER_V2_VAULT_ADDRESS_BY_CHAIN[chainId] === NULL_ADDRESS
? undefined
@@ -1372,8 +1371,9 @@ export class SamplerOperations {
makerToken: string,
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<WOOFiFillData> {
const chainId = this.chainId;
return new SamplerContractOperation({
fillData: { poolAddress, takerToken, makerToken },
fillData: { poolAddress, takerToken, makerToken, chainId },
source: ERC20BridgeSource.WOOFi,
contract: this._samplerContract,
function: this._samplerContract.sampleSellsFromWooPP,
@@ -1387,8 +1387,9 @@ export class SamplerOperations {
makerToken: string,
makerFillAmounts: BigNumber[],
): SourceQuoteOperation<WOOFiFillData> {
const chainId = this.chainId;
return new SamplerContractOperation({
fillData: { poolAddress, takerToken, makerToken },
fillData: { poolAddress, takerToken, makerToken, chainId },
source: ERC20BridgeSource.WOOFi,
contract: this._samplerContract,
function: this._samplerContract.sampleBuysFromWooPP,
@@ -1667,18 +1668,6 @@ export class SamplerOperations {
),
);
}
case ERC20BridgeSource.Cream:
return this.poolsCaches[ERC20BridgeSource.Cream]
.getPoolAddressesForPair(takerToken, makerToken)
.map(creamPool =>
this.getBalancerSellQuotes(
creamPool,
makerToken,
takerToken,
takerFillAmounts,
ERC20BridgeSource.Cream,
),
);
case ERC20BridgeSource.Dodo:
if (!isValidAddress(DODOV1_CONFIG_BY_CHAIN_ID[this.chainId].registry)) {
return [];
@@ -1832,6 +1821,9 @@ export class SamplerOperations {
);
}
case ERC20BridgeSource.WOOFi: {
if (!(WOOFI_SUPPORTED_TOKENS.has(takerToken) && WOOFI_SUPPORTED_TOKENS.has(makerToken))) {
return [];
}
return this.getWOOFiSellQuotes(
WOOFI_POOL_BY_CHAIN_ID[this.chainId],
takerToken,
@@ -2027,18 +2019,6 @@ export class SamplerOperations {
),
);
}
case ERC20BridgeSource.Cream:
return this.poolsCaches[ERC20BridgeSource.Cream]
.getPoolAddressesForPair(takerToken, makerToken)
.map(poolAddress =>
this.getBalancerBuyQuotes(
poolAddress,
makerToken,
takerToken,
makerFillAmounts,
ERC20BridgeSource.Cream,
),
);
case ERC20BridgeSource.Dodo:
if (!isValidAddress(DODOV1_CONFIG_BY_CHAIN_ID[this.chainId].registry)) {
return [];
@@ -2180,6 +2160,9 @@ export class SamplerOperations {
);
}
case ERC20BridgeSource.WOOFi: {
if (!(WOOFI_SUPPORTED_TOKENS.has(takerToken) && WOOFI_SUPPORTED_TOKENS.has(makerToken))) {
return [];
}
return this.getWOOFiBuyQuotes(
WOOFI_POOL_BY_CHAIN_ID[this.chainId],
takerToken,

View File

@@ -45,7 +45,6 @@ export enum ERC20BridgeSource {
MultiBridge = 'MultiBridge',
Balancer = 'Balancer',
BalancerV2 = 'Balancer_V2',
Cream = 'CREAM',
Bancor = 'Bancor',
MakerPsm = 'MakerPsm',
MStable = 'mStable',
@@ -378,6 +377,8 @@ export interface WOOFiFillData extends FillData {
poolAddress: string;
takerToken: string;
makerToken: string;
// Only needed for gas estimation
chainId: ChainId;
}
export interface VelodromeFillData extends FillData {

View File

@@ -43,7 +43,7 @@ blockchainTests.resets('BalanceChecker contract', env => {
const testResults = await contract.balances([owner, owner2], [makerToken.address, ETH_ADDRESS]).callAsync();
expect(testResults).to.eql([new BigNumber(100), new BigNumber(100000000000000000000)]);
expect(testResults).to.eql([new BigNumber(100), new BigNumber(1000000000000000000000)]);
});
it('it throws an error if the input arrays of different lengths', async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();

View File

@@ -107,7 +107,7 @@ class MockPoolsCache extends AbstractPoolsCache {
}
}
// Return some pool so that sampling functions are called for Balancer, BalancerV2, and Cream
// Return some pool so that sampling functions are called for Balancer and BalancerV2
// tslint:disable:custom-no-magic-numbers
const mockPoolsCache = new MockPoolsCache((_takerToken: string, _makerToken: string) => {
return [
@@ -362,7 +362,6 @@ describe('MarketOperationUtils tests', () => {
[ERC20BridgeSource.MultiHop]: {},
[ERC20BridgeSource.Shell]: { poolAddress: randomAddress() },
[ERC20BridgeSource.Component]: { poolAddress: randomAddress() },
[ERC20BridgeSource.Cream]: { poolAddress: randomAddress() },
[ERC20BridgeSource.Dodo]: {},
[ERC20BridgeSource.DodoV2]: {},
[ERC20BridgeSource.CryptoCom]: { tokenAddressPath: [] },
@@ -402,7 +401,6 @@ describe('MarketOperationUtils tests', () => {
poolsCaches: {
[ERC20BridgeSource.BalancerV2]: mockPoolsCache,
[ERC20BridgeSource.Balancer]: mockPoolsCache,
[ERC20BridgeSource.Cream]: mockPoolsCache,
},
liquidityProviderRegistry: {},
chainId: CHAIN_ID,

View File

@@ -2,12 +2,7 @@ import { ChainId } from '@0x/contract-addresses';
import * as chai from 'chai';
import 'mocha';
import {
BalancerPoolsCache,
BalancerV2PoolsCache,
CreamPoolsCache,
PoolsCache,
} from '../src/utils/market_operation_utils/pools_cache';
import { BalancerPoolsCache, BalancerV2PoolsCache, PoolsCache } from '../src/utils/market_operation_utils/pools_cache';
import { chaiSetup } from './utils/chai_setup';
@@ -17,7 +12,6 @@ const expect = chai.expect;
const usdcAddress = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
const daiAddress = '0x6b175474e89094c44da98b954eedeac495271d0f';
const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
const creamAddress = '0x2ba592f78db6436527729929aaf6c908497cb200';
const timeoutMs = 5000;
const poolKeys: string[] = ['id', 'balanceIn', 'balanceOut', 'weightIn', 'weightOut', 'swapFee'];
@@ -63,17 +57,4 @@ describe('Pools Caches for Balancer-based sampling', () => {
);
});
});
describe('CreamPoolsCache', () => {
const cache = CreamPoolsCache.create(ChainId.Mainnet);
it('fetches pools', async () => {
const pairs = [
[usdcAddress, creamAddress],
[creamAddress, wethAddress],
];
await Promise.all(
pairs.map(async ([takerToken, makerToken]) => fetchAndAssertPoolsAsync(cache, takerToken, makerToken)),
);
});
});
});

View File

@@ -68,7 +68,7 @@ export const testHelpers = {
const { endpoint, mmApiKey, requestData, responseData, responseCode } = mockedResponse;
const requestHeaders = {
Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/json;charset=utf-8',
'Content-Type': 'application/json',
Authorization: `Bearer ${mmApiKey}`,
};
mockedAxios

View File

@@ -1,4 +1,128 @@
[
{
"version": "6.24.0",
"changes": [
{
"note": "Add missing zeroExGovernor for Arbitrum",
"pr": 583
}
],
"timestamp": 1665013355
},
{
"version": "6.23.4",
"changes": [
{
"note": "New FQT for Arbitrum with Nerve",
"pr": 581
}
],
"timestamp": 1663786955
},
{
"version": "6.23.3",
"changes": [
{
"note": "New FQT for Optimism with BalV2",
"pr": 577
},
{
"note": "Add balV2/batch to opt bridge adapter code",
"pr": 578
}
],
"timestamp": 1662998180
},
{
"version": "6.23.2",
"changes": [
{
"note": "New FQT for arbitrum again",
"pr": 574
}
],
"timestamp": 1662559804
},
{
"version": "6.23.1",
"changes": [
{
"note": "New FQT for arbitrum",
"pr": 572
}
],
"timestamp": 1662147076
},
{
"version": "6.23.0",
"changes": [
{
"note": "Remove contract addresses that are no longer needed",
"pr": 564
},
{
"note": "Change WETH address in contract-addresses",
"pr": 571
}
],
"timestamp": 1662046042
},
{
"version": "6.22.0",
"changes": [
{
"note": "Arbitrum Rinkeby support",
"pr": 552
}
],
"timestamp": 1661462289
},
{
"version": "6.21.0",
"changes": [
{
"note": "Arbitrum addresses: need to be updated when deployed"
}
],
"timestamp": 1661459661
},
{
"version": "6.20.1",
"changes": [
{
"note": "Revert: Remove contract addresses that are no longer needed"
}
],
"timestamp": 1661145612
},
{
"version": "6.20.0",
"changes": [
{
"note": "Remove contract addresses that are no longer needed",
"pr": 548
}
]
},
{
"timestamp": 1660093941,
"version": "6.19.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "6.19.1",
"changes": [
{
"note": "Fix lowercase addresses",
"pr": 543
}
],
"timestamp": 1660073235
},
{
"version": "6.19.0",
"changes": [

View File

@@ -5,6 +5,56 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v6.24.0 - _October 5, 2022_
* Add missing zeroExGovernor for Arbitrum (#583)
## v6.23.4 - _September 21, 2022_
* New FQT for Arbitrum with Nerve (#581)
## v6.23.3 - _September 12, 2022_
* New FQT for Optimism with BalV2 (#577)
* Add balV2/batch to opt bridge adapter code (#578)
## v6.23.2 - _September 7, 2022_
* New FQT for arbitrum again (#574)
## v6.23.1 - _September 2, 2022_
* New FQT for arbitrum (#572)
## v6.23.0 - _September 1, 2022_
* Remove contract addresses that are no longer needed (#564)
* Change WETH address in contract-addresses (#571)
## v6.22.0 - _August 25, 2022_
* Arbitrum Rinkeby support (#552)
## v6.21.0 - _August 25, 2022_
* Arbitrum addresses: need to be updated when deployed
## v6.20.1 - _August 22, 2022_
* Revert: Remove contract addresses that are no longer needed
## v6.20.0 - _Invalid date_
* Remove contract addresses that are no longer needed (#548)
## v6.19.2 - _August 10, 2022_
* Dependencies updated
## v6.19.1 - _August 9, 2022_
* Fix lowercase addresses (#543)
## v6.19.0 - _August 6, 2022_
* Goerli and Mumbai updated verified contracts addresses (#537)

View File

@@ -1,32 +1,13 @@
{
"1": {
"exchangeV2": "0x080bf510fcbf18b91105470639e9561022937712",
"exchange": "0x61935cbdd02287b511119ddb11aeb42f1593b7ef",
"erc20Proxy": "0x95e6f48254609a6ee006f7d493c8e5fb97094cef",
"erc721Proxy": "0xefc70a1b18c432bdc64b596838b4d138f6bc6cad",
"forwarder": "0x6958f5e95332d93d21af0d7b9ca85b8212fee0a5",
"zrxToken": "0xe41d2489571d322189246dafa5ebde1f4699f498",
"etherToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetProxyOwner": "0xdffe798c7172dd6deb32baee68af322e8f495ce0",
"zeroExGovernor": "0x7d3455421bbc5ed534a83c88fd80387dc8271392",
"coordinatorRegistry": "0x45797531b873fd5e519477a070a955764c1a5b07",
"coordinator": "0x38a795580d0f687e399913a00ddef6a17612c722",
"multiAssetProxy": "0xef701d5389ae74503d633396c4d654eabedc9d78",
"staticCallProxy": "0x3517b88c19508c08650616019062b898ab65ed29",
"erc1155Proxy": "0x7eefbd48fd63d441ec7435d024ec7c5131019add",
"zrxVault": "0xba7f8b5fb1b19c1211c5d49550fcd149177a5eaf",
"staking": "0x2a17c35ff147b32f13f19f2e311446eeb02503f3",
"stakingProxy": "0xa26e80e7dea86279c6d778d702cc413e6cffa777",
"devUtils": "0x74134cf88b21383713e096a5ecf59e297dc7f547",
"erc20BridgeProxy": "0x8ed95d1746bf1e4dab58d8ed4724f1ef95b20db0",
"erc20BridgeSampler": "0xd8c38704c9937ea3312de29f824b4ad3450a5e61",
"chaiBridge": "0x77c31eba23043b9a72d13470f3a3a311344d7438",
"dydxBridge": "0x92af95e37afddac412e5688a9dcc1dd815d4ae53",
"godsUnchainedValidator": "0x09a379ef7218bcfd8913faa8b281ebc5a2e0bc04",
"broker": "0xd4690a51044db77d91d7aa8f7a3a5ad5da331af0",
"chainlinkStopLimit": "0xeb27220f95f364e1d9531992c48613f231839f53",
"maximumGasPrice": "0xe2bfd35306495d11e3c9db0d8de390cda24563cf",
"dexForwarderBridge": "0xc47b7094f378e54347e281aab170e8cca69d880a",
"exchangeProxyGovernor": "0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x39dce47a67ad34344eab877eae3ef1fa2a1d50bb",
@@ -42,33 +23,14 @@
}
},
"3": {
"erc20Proxy": "0xf1ec7d0ba42f15fb5c9e3adbe86431973e44764c",
"erc721Proxy": "0x070efeb7e5ffa3d1a59d03a219539551ae60ba43",
"zrxToken": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
"etherToken": "0xc778417e063141139fce010982780140aa0cd5ab",
"exchangeV2": "0xbff9493f92a3df4b0429b6d00743b3cfb4c85831",
"exchange": "0x5d8c9ba74607d2cbc4176882a42d4ace891c1c00",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x53993733d41a88ae86f77a18a024e5548ee26579",
"forwarder": "0xd5abddda4ba89c0120edc0ca8a95ed1ad0bf9fc3",
"coordinatorRegistry": "0xf8becacec90bfc361c0a2c720839e08405a72f6d",
"coordinator": "0xc2e2f8faf4bf649123b6f94103646cb4a0331006",
"multiAssetProxy": "0x7b70a148e20b348c320208df84fdd642aab49fd0",
"staticCallProxy": "0xaa460127562482faa5df42f2c39a025cd4a1cc0a",
"erc1155Proxy": "0x7f10d80f2659aaae790ab03da12be11c4e6008c3",
"devUtils": "0xc812af3f3fbc62f76ea4262576ec0f49db8b7f1c",
"zrxVault": "0x38bbb9fb54a6b6d0376948bf3b2a7ed1e8aea6e8",
"staking": "0x4af649ffde640ceb34b1afaba3e0bb8e9698cb01",
"stakingProxy": "0x6acab4c9c4e3a0c78435fdb5ad1719c95460a668",
"erc20BridgeProxy": "0xb344afed348de15eb4a9e180205a2b0739628339",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0xd4690a51044db77d91d7aa8f7a3a5ad5da331af0",
"broker": "0x4022e3982f326455f0905de3dbc4449999baf2dc",
"chainlinkStopLimit": "0x67a094cf028221ffdd93fc658f963151d05e2a74",
"maximumGasPrice": "0x407b4128e9ecad8769b2332312a9f655cb9f5f3a",
"dexForwarderBridge": "0x3261ea1411a1a840aed708896f779e1b837c917e",
"exchangeProxyGovernor": "0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x1c9a27658dd303a31205a3b245e8993b92d4d502",
@@ -84,33 +46,14 @@
}
},
"4": {
"exchangeV2": "0xbff9493f92a3df4b0429b6d00743b3cfb4c85831",
"exchange": "0xf8becacec90bfc361c0a2c720839e08405a72f6d",
"erc20Proxy": "0x070efeb7e5ffa3d1a59d03a219539551ae60ba43",
"erc721Proxy": "0x7f10d80f2659aaae790ab03da12be11c4e6008c3",
"zrxToken": "0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa",
"etherToken": "0xc778417e063141139fce010982780140aa0cd5ab",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x3f46b98061a3e1e1f41dff296ec19402c298f8a9",
"forwarder": "0xe30f6166fe1cd5f0048abeed3d20360feb4a1fd8",
"coordinatorRegistry": "0xc2e2f8faf4bf649123b6f94103646cb4a0331006",
"coordinator": "0xf1ec7d0ba42f15fb5c9e3adbe86431973e44764c",
"multiAssetProxy": "0xb344afed348de15eb4a9e180205a2b0739628339",
"staticCallProxy": "0x7b70a148e20b348c320208df84fdd642aab49fd0",
"erc1155Proxy": "0xaa460127562482faa5df42f2c39a025cd4a1cc0a",
"devUtils": "0x46b5bc959e8a754c0256fff73bf34a52ad5cdfa9",
"zrxVault": "0x4af649ffde640ceb34b1afaba3e0bb8e9698cb01",
"staking": "0x6acab4c9c4e3a0c78435fdb5ad1719c95460a668",
"stakingProxy": "0x781ee6683595f823208be6540a279f940e6af196",
"erc20BridgeProxy": "0xa2aa4befed748fba27a3be7dfd2c4b2c6db1f49b",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0dd2d6cabbd8ae7d2fe6840fa597a44b1a7e4747",
"chainlinkStopLimit": "0x407b4128e9ecad8769b2332312a9f655cb9f5f3a",
"maximumGasPrice": "0x47697b44bd89051e93b4d5857ba8e024800a74ac",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x1c9a27658dd303a31205a3b245e8993b92d4d502",
@@ -126,33 +69,14 @@
}
},
"5": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xf289f8a9d26f9a32ecc8602e92e634d71a91d490",
"exchangeProxy": "0xf91bb752490473b8342a3e964e855b9f9a2a668e",
"exchangeProxyTransformerDeployer": "0x7b4f0063cc0097c19c6b8cc74ecaf630621e2be6",
@@ -168,33 +92,14 @@
}
},
"42": {
"erc20Proxy": "0xaa460127562482faa5df42f2c39a025cd4a1cc0a",
"erc721Proxy": "0x7b70a148e20b348c320208df84fdd642aab49fd0",
"zrxToken": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa",
"etherToken": "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
"exchangeV2": "0x30589010550762d2f0d06f650d8e8b6ade6dbf4b",
"exchange": "0xf1ec7d0ba42f15fb5c9e3adbe86431973e44764c",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x6ff734d96104965c9c1b0108f83abc46e6e501df",
"forwarder": "0x0f64646a5154ae5e58b6dd87ede7b04f508d76f8",
"coordinatorRegistry": "0x070efeb7e5ffa3d1a59d03a219539551ae60ba43",
"coordinator": "0x7f10d80f2659aaae790ab03da12be11c4e6008c3",
"multiAssetProxy": "0x58a01e826e60731247e7de8b446ed4c8535a099c",
"staticCallProxy": "0xa2aa4befed748fba27a3be7dfd2c4b2c6db1f49b",
"erc1155Proxy": "0xb344afed348de15eb4a9e180205a2b0739628339",
"devUtils": "0xc67ae71928568a180b3aad1339dedcf3076876fe",
"zrxVault": "0x781ee6683595f823208be6540a279f940e6af196",
"staking": "0x73ea24041e03a012c51a45c307e0ba376af0238c",
"stakingProxy": "0xe94cb304b3f515be7c95fedcfa249a84995fd748",
"erc20BridgeProxy": "0x3577552c1fb7a44ad76beeb7ab53251668a21f8d",
"erc20BridgeSampler": "0x298a99d3a2b891df04019425542897ac1a867d9d",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0xc213707de0454008758071c2edc1365621b8a5c5",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0xcdeb6d90ee7c96b4c713f7bb4f8604981f7ebe9d",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x67a094cf028221ffdd93fc658f963151d05e2a74",
"dexForwarderBridge": "0x985d1a95c6a86a3bf85c4d425af984abceaf01de",
"exchangeProxyGovernor": "0x618f9c67ce7bf1a50afa1e7e0238422601b0ff6e",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x1b62de2dbb5e7aa519e9c442721ecef75702807f",
@@ -210,33 +115,14 @@
}
},
"56": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xccc9769c1a58766e79423a34b2cc5052d65c1983",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x8224aa8fe5c9f07d5a59c735386ff6cc6aaeb568",
@@ -247,38 +133,19 @@
"wethTransformer": "0xac3d95668c092e895cd83a9cbafe9c7d9906471f",
"payTakerTransformer": "0x4f5e8ca2cadecd4a467ae441e4b03de4278a4574",
"affiliateFeeTransformer": "0x1be34ab9b2acb5c4ddd89454bdce637967e65230",
"fillQuoteTransformer": "0x0b72d55485e8d877f73cc8b14ea3e010b3e804fd",
"fillQuoteTransformer": "0xbd7fd6e116fc8589bb658fba3a2cc6273050bcf2",
"positiveSlippageFeeTransformer": "0x7f5c79ad1788573b1145f4651a248523c54f5d1f"
}
},
"1337": {
"erc20Proxy": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c",
"etherToken": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"zrxVault": "0xf23276778860e420acfc18ebeebf7e829b06965c",
"staking": "0x8a063452f7df2614db1bca3a85ef35da40cf0835",
"stakingProxy": "0x59adefa01843c627ba5d6aa350292b4b7ccae67a",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x0000000000000000000000000000000000000000",
"exchangeProxy": "0x5315e44798395d4a952530d131249fe00f554565",
"exchangeProxyTransformerDeployer": "0x5409ed021d9299bf6814279a6a1411a7e866a631",
@@ -294,33 +161,14 @@
}
},
"137": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x4d3e56c56a55d23fc7aa9a9ffad61631cf7d1ae6",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0xe6d9207df11c55bce2f7a189ae95e3222d5484d3",
@@ -331,38 +179,19 @@
"wethTransformer": "0xe309d011cc6f189a3e8dcba85922715a019fed38",
"payTakerTransformer": "0x5ba7b9be86cda01cfbf56e0fb97184783be9dda1",
"affiliateFeeTransformer": "0xbed27284b42e5684e987169cf1da09c5d6c49fa8",
"fillQuoteTransformer": "0xd4a518760030dae1adbde9496f8a3b478e83932a",
"fillQuoteTransformer": "0x01c082e47c8dc6dedd01e3fcb07bfd3eb72e044d",
"positiveSlippageFeeTransformer": "0x4cd8f1c0df4d40fcc1e073845d5f6f4ed5cc8dab"
}
},
"80001": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x9c3c9283d3e44854697cd22d3faa240cfb032889",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x30186b2e187aeddabf019089f9375a8dc53138e4",
"exchangeProxy": "0xf471d32cb40837bf24529fcf17418fc1a4807626",
"exchangeProxyTransformerDeployer": "0x05481589f447a0767def2b0ed98a04ea5f5eba50",
@@ -378,33 +207,14 @@
}
},
"43114": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xca7bab1b2d1ec7d81710b7f9e2ab4e6788930588",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0xa60b57833dce6260f4f2411c811755dd980bc0a7",
@@ -415,38 +225,19 @@
"wethTransformer": "0x9b8b52391071d71cd4ad1e61d7f273268fa34c6c",
"payTakerTransformer": "0x898c6fde239d646c73f0a57e3570b6f86a3d62a3",
"affiliateFeeTransformer": "0x34617b855411e52fbc05899435f44cbd0503022c",
"fillQuoteTransformer": "0xb6c9c52ce7094fc96d8bd5d3ecd0c6feeafe3457",
"fillQuoteTransformer": "0xcee9118bc14e1fe740c54c754b901629b322ee4f",
"positiveSlippageFeeTransformer": "0x470ba89da18a6db6e8a0567b3c9214b960861857"
}
},
"250": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xf760c5b88d970d6f97e64e264dac5a3767dafd74",
"exchangeProxy": "0xdef189deaef76e379df891899eb5a00a94cbc250",
"exchangeProxyTransformerDeployer": "0x47f01db18a38261e4cb153bae6db7d3743acb33c",
@@ -457,38 +248,19 @@
"wethTransformer": "0x9b6aa8f26a92108e7d1f66373d757bb955112703",
"payTakerTransformer": "0x32df54951d33d7460e15fa59b1fcc262183ce4c2",
"affiliateFeeTransformer": "0x67efa679a4b56c38713d478e649c88247f4f8e88",
"fillQuoteTransformer": "0x641efe8a57ad39353fe22f77d211ef6b17b0590b",
"fillQuoteTransformer": "0xe40f81ef6e9c95ba04c659b8d032eab73152aafd",
"positiveSlippageFeeTransformer": "0xe87d69b285005cc82b53b844322652c49ed64600"
}
},
"42220": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x471ece3750da237f93b8e339c536989b8978a438",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x92115010fd9b170d4918b102efc86b1b7bebdc7f",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x1fe80d5ad9464dba2d60b88e449305f184823f8a",
@@ -504,33 +276,14 @@
}
},
"10": {
"erc20Proxy": "0x0000000000000000000000000000000000000000",
"erc721Proxy": "0x0000000000000000000000000000000000000000",
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x4200000000000000000000000000000000000006",
"exchangeV2": "0x0000000000000000000000000000000000000000",
"exchange": "0x0000000000000000000000000000000000000000",
"assetProxyOwner": "0x0000000000000000000000000000000000000000",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"forwarder": "0x0000000000000000000000000000000000000000",
"coordinatorRegistry": "0x0000000000000000000000000000000000000000",
"coordinator": "0x0000000000000000000000000000000000000000",
"multiAssetProxy": "0x0000000000000000000000000000000000000000",
"staticCallProxy": "0x0000000000000000000000000000000000000000",
"erc1155Proxy": "0x0000000000000000000000000000000000000000",
"devUtils": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"chaiBridge": "0x0000000000000000000000000000000000000000",
"dydxBridge": "0x0000000000000000000000000000000000000000",
"godsUnchainedValidator": "0x0000000000000000000000000000000000000000",
"broker": "0x0000000000000000000000000000000000000000",
"chainlinkStopLimit": "0x0000000000000000000000000000000000000000",
"maximumGasPrice": "0x0000000000000000000000000000000000000000",
"dexForwarderBridge": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x6d506b2847df0c6f04d2628da1adaf4d8fb2e81b",
"exchangeProxy": "0xdef1abe32c034e558cdd535791643c58a13acc10",
"exchangeProxyTransformerDeployer": "0x3a539ed6bd42de8fbaf3899fb490c792e153d647",
@@ -541,8 +294,54 @@
"wethTransformer": "0x02ce7af6520e2862f961f5d7eda746642865179c",
"payTakerTransformer": "0x085d10a34f14f6a631ea8ff7d016782ee3ffaa11",
"affiliateFeeTransformer": "0x55cf1d7535250db75bf0190493f55781ee583553",
"fillQuoteTransformer": "0x96499c097efc56ba5cf6b2a474392db17790ce96",
"fillQuoteTransformer": "0x845c75a791cceb1a451f4ca5778c011226dda95c",
"positiveSlippageFeeTransformer": "0xb11e14565dfbeb702dea9bc0cb47f1a8b32f4783"
}
},
"421611": {
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x4200000000000000000000000000000000000006",
"zeroExGovernor": "0x0000000000000000000000000000000000000000",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0xf5e66206eb523988eae22dd7d4e06e36999fef94",
"exchangeProxy": "0x2c1994270ae589deae7b4bb6c2446c57d40b99d4",
"exchangeProxyTransformerDeployer": "0x42b43abe1358a7b2c00f8eb5b2668f821ee8edbf",
"exchangeProxyFlashWallet": "0xc1831049d451b69a9dccc391f8285eb83c94c940",
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
"zrxTreasury": "0x0000000000000000000000000000000000000000",
"transformers": {
"wethTransformer": "0x7c0ef1020f9ee63bcf8248006174b9cbaa29af5a",
"payTakerTransformer": "0xb5c5ebd57ccf14480e30ce85f891f894cedbc694",
"affiliateFeeTransformer": "0xfa3d8ca1c877185af1ce2ec558e586e12cdbc50c",
"fillQuoteTransformer": "0xd6ddb08beb4c48e35352ee4df5ebc028e72f3c81",
"positiveSlippageFeeTransformer": "0x8830f7c5925b129efcc7831397f30c1c02953bac"
}
},
"42161": {
"zrxToken": "0x0000000000000000000000000000000000000000",
"etherToken": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
"zeroExGovernor": "0x1fe80d5ad9464dba2d60b88e449305f184823f8a",
"zrxVault": "0x0000000000000000000000000000000000000000",
"staking": "0x0000000000000000000000000000000000000000",
"stakingProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeProxy": "0x0000000000000000000000000000000000000000",
"erc20BridgeSampler": "0x0000000000000000000000000000000000000000",
"exchangeProxyGovernor": "0x1fe80d5ad9464dba2d60b88e449305f184823f8a",
"exchangeProxy": "0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"exchangeProxyTransformerDeployer": "0x29f80c1f685e19ae1807063eda432f431ac623d0",
"exchangeProxyFlashWallet": "0xdb6f1920a889355780af7570773609bd8cb1f498",
"exchangeProxyLiquidityProviderSandbox": "0x0000000000000000000000000000000000000000",
"zrxTreasury": "0x0000000000000000000000000000000000000000",
"transformers": {
"wethTransformer": "0x10e968968f49dd66a5efeebbb2edcb9c49c4fc49",
"payTakerTransformer": "0xae3e8cf7bf340d7084f312dfae2aa8b01c885b02",
"affiliateFeeTransformer": "0x05a24978471869327904ea13da3c4322128e2aaa",
"fillQuoteTransformer": "0x466b00a77662245c2cc7b093a7102a687afc16f3",
"positiveSlippageFeeTransformer": "0xd56b9c014b45ed95e2a048a0c28121db30265f13"
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "6.19.0",
"version": "6.24.0",
"engines": {
"node": ">=6.12"
},
@@ -12,6 +12,8 @@
"scripts": {
"build": "yarn tsc -b",
"build:ci": "yarn build",
"test": "mocha --require source-map-support/register 'lib/test/**/*_test.js' --timeout 10000 --bail --exit",
"test:circleci": "yarn test",
"clean": "shx rm -rf lib",
"publish:private": "yarn build && gitpkg publish"
},
@@ -28,7 +30,11 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-addresses",
"devDependencies": {
"@types/mocha": "^5.2.7",
"chai": "^4.0.1",
"ethereumjs-util": "^7.1.5",
"gitpkg": "https://github.com/0xProject/gitpkg.git",
"mocha": "^6.2.0",
"shx": "^0.2.2",
"typescript": "4.6.3"
},

View File

@@ -1,33 +1,14 @@
import addresses from '../addresses.json';
export interface ContractAddresses {
erc20Proxy: string;
erc721Proxy: string;
zrxToken: string;
etherToken: string;
exchangeV2: string;
exchange: string;
assetProxyOwner: string;
zeroExGovernor: string;
forwarder: string;
coordinatorRegistry: string;
coordinator: string;
multiAssetProxy: string;
staticCallProxy: string;
erc1155Proxy: string;
devUtils: string;
zrxVault: string;
staking: string;
stakingProxy: string;
erc20BridgeProxy: string;
erc20BridgeSampler: string;
chaiBridge: string;
dydxBridge: string;
godsUnchainedValidator: string;
broker: string;
chainlinkStopLimit: string;
maximumGasPrice: string;
dexForwarderBridge: string;
exchangeProxyGovernor: string;
exchangeProxy: string;
exchangeProxyTransformerDeployer: string;
@@ -56,8 +37,9 @@ export enum ChainId {
Avalanche = 43114,
Fantom = 250,
Celo = 42220,
// Arbitrum = 42161,
Optimism = 10,
Arbitrum = 42161,
ArbitrumRinkeby = 421611,
}
/**

View File

@@ -0,0 +1,70 @@
import * as chai from 'chai';
import 'mocha';
import { ChainId, getContractAddressesForChainOrThrow } from '../src';
import { bufferToHex, rlphash } from 'ethereumjs-util';
const expect = chai.expect;
function toDeployedAddress(deployerAddress: string, nonce: number): string {
return bufferToHex(rlphash([deployerAddress, nonce]).slice(12));
}
function isValidDeployedAddress(deployerAddress: string, deployedAddress: string): boolean {
for (let i = 0; i < 256; i++) {
const address = toDeployedAddress(deployerAddress, i);
if (address.toLowerCase() === deployedAddress.toLowerCase()) {
return true;
}
}
return false;
}
describe('addresses.json sanity test', () => {
const allChainIds = Object.values(ChainId).filter(chainId => !isNaN(Number(chainId))) as ChainId[];
allChainIds.forEach(chainId => {
describe(`addresses of chain id ${chainId}`, () => {
const contractAddresses = getContractAddressesForChainOrThrow(chainId);
it('all addresses are lowercased', async () => {
const addresses = [
contractAddresses.zrxToken,
contractAddresses.etherToken,
contractAddresses.zeroExGovernor,
contractAddresses.zrxVault,
contractAddresses.staking,
contractAddresses.erc20BridgeProxy,
contractAddresses.erc20BridgeSampler,
contractAddresses.exchangeProxyGovernor,
contractAddresses.exchangeProxy,
contractAddresses.exchangeProxyTransformerDeployer,
contractAddresses.exchangeProxyFlashWallet,
contractAddresses.exchangeProxyLiquidityProviderSandbox,
contractAddresses.zrxTreasury,
contractAddresses.transformers.wethTransformer,
contractAddresses.transformers.payTakerTransformer,
contractAddresses.transformers.fillQuoteTransformer,
contractAddresses.transformers.affiliateFeeTransformer,
contractAddresses.transformers.positiveSlippageFeeTransformer,
];
addresses.forEach(address => {
expect(address).to.eq(address.toLowerCase());
});
});
it('all transformer addresses are valid', async () => {
const transformerAddresses = [
contractAddresses.transformers.wethTransformer,
contractAddresses.transformers.payTakerTransformer,
contractAddresses.transformers.fillQuoteTransformer,
contractAddresses.transformers.affiliateFeeTransformer,
contractAddresses.transformers.positiveSlippageFeeTransformer,
].filter(address => address !== '0x0000000000000000000000000000000000000000');
transformerAddresses.forEach(transformerAddress => {
expect(
isValidDeployedAddress(contractAddresses.exchangeProxyTransformerDeployer, transformerAddress),
).to.true;
});
});
});
});
});

View File

@@ -6,6 +6,6 @@
"resolveJsonModule": true,
"esModuleInterop": true
},
"include": ["./src/**/*"],
"include": ["./src/**/*", "./test/**/*"],
"files": ["./addresses.json"]
}

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1661145612,
"version": "3.18.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.18.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.18.1 - _August 22, 2022_
* Dependencies updated
## v3.18.0 - _March 31, 2022_
* Regenerate all artifacts (#449)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
"version": "3.18.0",
"version": "3.18.1",
"engines": {
"node": ">=6.12"
},
@@ -30,7 +30,7 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-artifacts",
"devDependencies": {
"@0x/utils": "^6.5.3",
"@0x/utils": "^7.0.0",
"@types/mocha": "^5.2.7",
"chai": "^4.0.1",
"lodash": "^4.17.11",

View File

@@ -0,0 +1,22 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"migrations/*",
"src/generated-wrappers/**/*",
"src/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,111 @@
[
{
"timestamp": 1665013355,
"version": "13.22.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1663786955,
"version": "13.22.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "13.22.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "13.22.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "13.22.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "13.22.0",
"changes": [
{
"note": "Remove deprecated contracts"
}
],
"timestamp": 1662046042
},
{
"timestamp": 1661462289,
"version": "13.21.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "13.21.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "13.21.1",
"changes": [
{
"note": "Revert: Remove deprecated contracts"
}
],
"timestamp": 1661145612
},
{
"version": "13.21.0",
"changes": [
{
"note": "Remove deprecated contracts"
}
]
},
{
"timestamp": 1660093941,
"version": "13.20.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "13.20.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "13.20.6",

View File

@@ -5,6 +5,54 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v13.22.5 - _October 5, 2022_
* Dependencies updated
## v13.22.4 - _September 21, 2022_
* Dependencies updated
## v13.22.3 - _September 12, 2022_
* Dependencies updated
## v13.22.2 - _September 7, 2022_
* Dependencies updated
## v13.22.1 - _September 2, 2022_
* Dependencies updated
## v13.22.0 - _September 1, 2022_
* Remove deprecated contracts
## v13.21.3 - _August 25, 2022_
* Dependencies updated
## v13.21.2 - _August 25, 2022_
* Dependencies updated
## v13.21.1 - _August 22, 2022_
* Revert: Remove deprecated contracts
## v13.21.0 - _Invalid date_
* Remove deprecated contracts
## v13.20.8 - _August 10, 2022_
* Dependencies updated
## v13.20.7 - _August 9, 2022_
* Dependencies updated
## v13.20.6 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "13.20.6",
"version": "13.22.5",
"engines": {
"node": ">=6.12"
},
@@ -18,8 +18,8 @@
"rebuild": "yarn wrappers:clean && yarn wrappers:generate && yarn wrappers:prettier && yarn build",
"build:ci": "yarn build",
"publish:private": "yarn rebuild && gitpkg publish",
"lint": "tslint --format stylish --project . --exclude **/lib/**/*",
"fix": "tslint --fix --format stylish --project . --exclude **/lib/**/*",
"lint": "eslint src",
"fix": "eslint --fix src",
"prettier": "prettier --write **/* --config ../../.prettierrc",
"clean": "shx rm -rf lib generated_docs",
"docs_test": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --out generated_docs ./src/generated-wrappers/*",
@@ -48,21 +48,23 @@
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/contract-wrappers",
"devDependencies": {
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"gitpkg": "https://github.com/0xProject/gitpkg.git",
"tslint": "5.11.0",
"typedoc": "~0.16.11",
"typescript": "4.6.3"
},
"dependencies": {
"@0x/assert": "^3.0.34",
"@0x/base-contract": "^6.5.0",
"@0x/contract-addresses": "^6.19.0",
"@0x/assert": "^3.0.35",
"@0x/base-contract": "^7.0.0",
"@0x/contract-addresses": "^6.24.0",
"@0x/json-schemas": "^6.4.4",
"@0x/types": "^3.3.6",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"ethereum-types": "^3.7.0",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"ethereum-types": "^3.7.1",
"ethers": "~4.0.4"
},
"publishConfig": {

View File

@@ -6,11 +6,6 @@ import { SupportedProvider } from 'ethereum-types';
import { ContractWrappersConfigSchema } from './contract_wrappers_config_schema';
import { CoordinatorContract } from './generated-wrappers/coordinator';
import { DevUtilsContract } from './generated-wrappers/dev_utils';
import { ERC20TokenContract } from './generated-wrappers/erc20_token';
import { ERC721TokenContract } from './generated-wrappers/erc721_token';
import { ExchangeContract } from './generated-wrappers/exchange';
import { ForwarderContract } from './generated-wrappers/forwarder';
import { IZeroExContract } from './generated-wrappers/i_zero_ex';
import { StakingContract } from './generated-wrappers/staking';
import { WETH9Contract } from './generated-wrappers/weth9';
@@ -25,27 +20,11 @@ export class ContractWrappers {
* An index of the default contract addresses for this chain.
*/
public contractAddresses: ContractAddresses;
/**
* An instance of the ExchangeContract class containing methods for interacting with the 0x Exchange smart contract.
*/
public exchange: ExchangeContract;
/**
* An instance of the WETH9Contract class containing methods for interacting with the
* WETH9 smart contract.
*/
public weth9: WETH9Contract;
/**
* An instance of the ForwarderContract class containing methods for interacting with any Forwarder smart contract.
*/
public forwarder: ForwarderContract;
/**
* An instance of the DevUtilsContract class containing methods for interacting with the DevUtils smart contract.
*/
public devUtils: DevUtilsContract;
/**
* An instance of the CoordinatorContract class containing methods for interacting with the Coordinator extension contract.
*/
public coordinator: CoordinatorContract;
/**
* An instance of the StakingContract class containing methods for interacting with the Staking contracts.
*/
@@ -69,17 +48,7 @@ export class ContractWrappers {
gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(supportedProvider, txDefaults);
const contractsArray = [
CoordinatorContract,
DevUtilsContract,
ERC20TokenContract,
ERC721TokenContract,
ExchangeContract,
ForwarderContract,
StakingContract,
WETH9Contract,
IZeroExContract,
];
const contractsArray = [CoordinatorContract, StakingContract, WETH9Contract, IZeroExContract];
contractsArray.forEach(contract => {
this._web3Wrapper.abiDecoder.addABI(contract.ABI(), contract.contractName);
});
@@ -88,11 +57,7 @@ export class ContractWrappers {
? _getDefaultContractAddresses(config.chainId)
: config.contractAddresses;
this.weth9 = new WETH9Contract(contractAddresses.etherToken, this.getProvider());
this.exchange = new ExchangeContract(contractAddresses.exchange, this.getProvider());
this.forwarder = new ForwarderContract(contractAddresses.forwarder, this.getProvider());
this.staking = new StakingContract(contractAddresses.stakingProxy, this.getProvider());
this.devUtils = new DevUtilsContract(contractAddresses.devUtils, this.getProvider());
this.coordinator = new CoordinatorContract(contractAddresses.coordinator, this.getProvider());
this.exchangeProxy = new IZeroExContract(contractAddresses.exchangeProxy, this.getProvider());
this.contractAddresses = contractAddresses;
}
@@ -100,7 +65,6 @@ export class ContractWrappers {
* Unsubscribes from all subscriptions for all contracts.
*/
public unsubscribeAll(): void {
this.exchange.unsubscribeAll();
this.weth9.unsubscribeAll();
}
/**

View File

@@ -8,13 +8,8 @@ export const ContractWrappersConfigSchema = {
contractAddresses: {
type: 'object',
properties: {
erc20Proxy: { $ref: '/addressSchema' },
erc721Proxy: { $ref: '/addressSchema' },
zrxToken: { $ref: '/addressSchema' },
etherToken: { $ref: '/addressSchema' },
exchange: { $ref: '/addressSchema' },
assetProxyOwner: { $ref: '/addressSchema' },
forwarder: { $ref: '/addressSchema' },
staking: { $ref: '/addressSchema' },
},
},

View File

@@ -0,0 +1,24 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"overrides": [],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"ignorePatterns": [
"lib/**/*",
"migrations/*",
"generated-wrappers/**/*",
"generated-artifacts/**/*",
"test/generated-wrappers/**/*",
"test/generated-artifacts/**/*"
],
"rules": {}
}

View File

@@ -1,4 +1,105 @@
[
{
"version": "11.16.12",
"changes": [
{
"note": "tslint -> eslint",
"pr": "582"
}
],
"timestamp": 1665013355
},
{
"timestamp": 1663786955,
"version": "11.16.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662998180,
"version": "11.16.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662559804,
"version": "11.16.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1662147076,
"version": "11.16.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "11.16.7",
"changes": [
{
"note": "Add otc order info to transformer_utils",
"pr": "565"
}
],
"timestamp": 1662046042
},
{
"timestamp": 1661462289,
"version": "11.16.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661459661,
"version": "11.16.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1661145612,
"version": "11.16.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660093941,
"version": "11.16.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1660073235,
"version": "11.16.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1659750766,
"version": "11.16.1",

View File

@@ -5,6 +5,50 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v11.16.12 - _October 5, 2022_
* tslint -> eslint (#582)
## v11.16.11 - _September 21, 2022_
* Dependencies updated
## v11.16.10 - _September 12, 2022_
* Dependencies updated
## v11.16.9 - _September 7, 2022_
* Dependencies updated
## v11.16.8 - _September 2, 2022_
* Dependencies updated
## v11.16.7 - _September 1, 2022_
* Add otc order info to transformer_utils (#565)
## v11.16.6 - _August 25, 2022_
* Dependencies updated
## v11.16.5 - _August 25, 2022_
* Dependencies updated
## v11.16.4 - _August 22, 2022_
* Dependencies updated
## v11.16.3 - _August 10, 2022_
* Dependencies updated
## v11.16.2 - _August 9, 2022_
* Dependencies updated
## v11.16.1 - _August 6, 2022_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/protocol-utils",
"version": "11.16.1",
"version": "11.16.12",
"engines": {
"node": ">=6.12"
},
@@ -19,8 +19,8 @@
"test:coverage": "mkdir -p ./coverage && nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"clean": "shx rm -rf lib generated_docs",
"lint": "tslint --format stylish --project .",
"fix": "tslint --fix --format stylish --project .",
"lint": "eslint src --max-warnings 32",
"fix": "eslint --fix --quiet src test",
"diff_docs": "git diff --exit-code ./docs",
"s3:sync_md_docs": "aws s3 sync ./docs s3://docs-markdown/${npm_package_name}/v${npm_package_version} --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"docs:md": "ts-doc-gen --sourceDir='$PROJECT_FILES' --output=$MD_FILE_DIR --fileExtension=mdx --tsconfig=./typedoc-tsconfig.json",
@@ -41,9 +41,8 @@
},
"homepage": "https://github.com/0xProject/protocol/tree/main/packages/protocol-utils",
"devDependencies": {
"@0x/dev-utils": "^4.2.14",
"@0x/dev-utils": "^5.0.0",
"@0x/ts-doc-gen": "^0.0.28",
"@0x/tslint-config": "^4.1.4",
"@0x/types": "^3.3.6",
"@0x/typescript-typings": "^5.3.1",
"@types/bn.js": "^4.11.0",
@@ -51,24 +50,28 @@
"@types/mocha": "^5.2.7",
"@types/node": "12.12.54",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^3.7.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"ethereum-types": "^3.7.1",
"mocha": "^6.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"sinon": "^4.0.0",
"tslint": "5.11.0",
"typedoc": "~0.16.11",
"typescript": "4.6.3",
"web3-provider-engine": "14.0.6"
},
"dependencies": {
"@0x/assert": "^3.0.34",
"@0x/contract-addresses": "^6.19.0",
"@0x/contract-wrappers": "^13.20.6",
"@0x/assert": "^3.0.35",
"@0x/contract-addresses": "^6.24.0",
"@0x/contract-wrappers": "^13.22.5",
"@0x/json-schemas": "^6.4.4",
"@0x/subproviders": "^6.6.5",
"@0x/utils": "^6.5.3",
"@0x/web3-wrapper": "^7.6.5",
"@0x/subproviders": "^7.0.0",
"@0x/utils": "^7.0.0",
"@0x/web3-wrapper": "^8.0.0",
"@typescript-eslint/parser": "^5.38.0",
"chai": "^4.0.1",
"ethereumjs-util": "^7.0.10",
"ethers": "~4.0.4",

View File

@@ -19,12 +19,10 @@ import {
SignatureType,
} from './signature_utils';
// tslint:disable:enum-naming
export enum TradeDirection {
SellNFT = 0,
BuyNFT = 1,
}
// tslint:enable:enum-naming
export enum OrderStatus {
Invalid = 0,
@@ -136,7 +134,7 @@ export abstract class NFTOrder {
public abstract getEIP712TypedData(): EIP712TypedData;
protected abstract _getProperties(): Property[];
public willExpire(secondsFromNow: number = 0): boolean {
public willExpire(secondsFromNow = 0): boolean {
const millisecondsInSecond = 1000;
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));

View File

@@ -242,7 +242,7 @@ export class LimitOrder extends OrderBase {
};
}
public willExpire(secondsFromNow: number = 0): boolean {
public willExpire(secondsFromNow = 0): boolean {
const millisecondsInSecond = 1000;
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
@@ -338,7 +338,7 @@ export class RfqOrder extends OrderBase {
};
}
public willExpire(secondsFromNow: number = 0): boolean {
public willExpire(secondsFromNow = 0): boolean {
const millisecondsInSecond = 1000;
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
return this.expiry.isLessThan(currentUnixTimestampSec.plus(secondsFromNow));
@@ -368,9 +368,7 @@ export class OtcOrder extends OrderBase {
public nonceBucket: BigNumber;
public nonce: BigNumber;
public static parseExpiryAndNonce(
expiryAndNonce: BigNumber,
): {
public static parseExpiryAndNonce(expiryAndNonce: BigNumber): {
expiry: BigNumber;
nonceBucket: BigNumber;
nonce: BigNumber;
@@ -468,7 +466,7 @@ export class OtcOrder extends OrderBase {
};
}
public willExpire(secondsFromNow: number = 0): boolean {
public willExpire(secondsFromNow = 0): boolean {
const millisecondsInSecond = 1000;
const currentUnixTimestampSec = new BigNumber(Date.now() / millisecondsInSecond).integerValue();
const expiryRightShift = new BigNumber(2).pow(192);

View File

@@ -1,4 +1,3 @@
// tslint:disable: max-classes-per-file
import { Numberish, RevertError } from '@0x/utils';
import { OrderStatus } from '../orders';

View File

@@ -1,4 +1,3 @@
// tslint:disable: max-classes-per-file
import { Numberish, RevertError } from '@0x/utils';
import { OrderStatus } from '../nft_orders';

View File

@@ -1,7 +1,7 @@
import { AbiEncoder, BigNumber, hexUtils, NULL_ADDRESS } from '@0x/utils';
import * as ethjs from 'ethereumjs-util';
import { LimitOrder, LimitOrderFields, RfqOrder, RfqOrderFields } from './orders';
import { LimitOrder, LimitOrderFields, OtcOrder, OtcOrderFields, RfqOrder, RfqOrderFields } from './orders';
import { Signature, SIGNATURE_ABI } from './signature_utils';
const BRIDGE_ORDER_ABI_COMPONENTS = [
@@ -39,6 +39,20 @@ const RFQ_ORDER_INFO_ABI_COMPONENTS = [
{ name: 'maxTakerTokenFillAmount', type: 'uint256' },
];
const OTC_ORDER_INFO_ABI_COMPONENTS = [
{
name: 'order',
type: 'tuple',
components: OtcOrder.STRUCT_ABI,
},
{
name: 'signature',
type: 'tuple',
components: SIGNATURE_ABI,
},
{ name: 'maxTakerTokenFillAmount', type: 'uint256' },
];
/**
* ABI encoder for `FillQuoteTransformer.TransformData`
*/
@@ -60,6 +74,11 @@ export const fillQuoteTransformerDataEncoder = AbiEncoder.create([
type: 'tuple[]',
components: LIMIT_ORDER_INFO_ABI_COMPONENTS,
},
{
name: 'otcOrders',
type: 'tuple[]',
components: OTC_ORDER_INFO_ABI_COMPONENTS,
},
{
name: 'rfqOrders',
type: 'tuple[]',
@@ -87,6 +106,7 @@ export enum FillQuoteTransformerOrderType {
Bridge,
Limit,
Rfq,
Otc,
}
/**
@@ -99,12 +119,12 @@ export interface FillQuoteTransformerData {
bridgeOrders: FillQuoteTransformerBridgeOrder[];
limitOrders: FillQuoteTransformerLimitOrderInfo[];
rfqOrders: FillQuoteTransformerRfqOrderInfo[];
otcOrders: FillQuoteTransformerOtcOrderInfo[];
fillSequence: FillQuoteTransformerOrderType[];
fillAmount: BigNumber;
refundReceiver: string;
}
// tslint:disable: enum-naming
/**
* Identifies the DEX protocol used to fill a bridge order.
* Note: These need to correspond exactly with BridgeProtocols.sol!
@@ -143,7 +163,6 @@ export enum BridgeProtocol {
Synthetix,
WOOFi,
}
// tslint:enable: enum-naming
/**
* `FillQuoteTransformer.BridgeOrder`
@@ -178,6 +197,11 @@ export type FillQuoteTransformerLimitOrderInfo = FillQuoteTransformerNativeOrder
*/
export type FillQuoteTransformerRfqOrderInfo = FillQuoteTransformerNativeOrderInfo<RfqOrderFields>;
/**
* `FillQuoteTransformer.OtcOrderInfo`
*/
export type FillQuoteTransformerOtcOrderInfo = FillQuoteTransformerNativeOrderInfo<OtcOrderFields>;
/**
* ABI-encode a `FillQuoteTransformer.TransformData` type.
*/
@@ -312,11 +336,7 @@ export function decodeAffiliateFeeTransformerData(encoded: string): AffiliateFee
* Find the nonce for a transformer given its deployer.
* If `deployer` is the null address, zero will always be returned.
*/
export function findTransformerNonce(
transformer: string,
deployer: string = NULL_ADDRESS,
maxGuesses: number = 1024,
): number {
export function findTransformerNonce(transformer: string, deployer: string = NULL_ADDRESS, maxGuesses = 1024): number {
if (deployer === NULL_ADDRESS) {
return 0;
}
@@ -335,10 +355,7 @@ export function findTransformerNonce(
* Compute the deployed address for a transformer given a deployer and nonce.
*/
export function getTransformerAddress(deployer: string, nonce: number): string {
return ethjs.bufferToHex(
// tslint:disable-next-line: custom-no-magic-numbers
ethjs.rlphash([deployer, nonce] as any).slice(12),
);
return ethjs.bufferToHex(ethjs.rlphash([deployer, nonce] as any).slice(12));
}
/**

Some files were not shown because too many files have changed in this diff Show More