Compare commits

...

168 Commits

Author SHA1 Message Date
Jacob Evans
c78a602990 Publish
- 0x.js@6.0.6
 - @0x/abi-gen@2.0.9
 - @0x/abi-gen-templates@2.0.2
 - @0x/abi-gen-wrappers@4.2.0
 - @0x/assert@2.0.9
 - @0x/asset-buyer@6.1.0
 - @0x/base-contract@5.0.5
 - @0x/connect@5.0.5
 - @0x/contract-addresses@2.3.1
 - @0x/contract-artifacts@1.5.0
 - @0x/contract-wrappers@9.0.0
 - @0x/contracts-gen@1.0.8
 - @0x/dev-tools-pages@0.0.25
 - @0x/dev-utils@2.2.1
 - ethereum-types@2.1.2
 - @0x/fill-scenarios@3.0.5
 - @0x/instant@1.0.20
 - @0x/json-schemas@3.0.9
 - @0x/metacoin@0.0.47
 - @0x/migrations@4.1.1
 - @0x/monorepo-scripts@1.0.30
 - @0x/order-utils@7.2.0
 - @0x/order-watcher@4.0.6
 - @0x/pipeline@1.0.17
 - @0x/react-docs@2.0.10
 - @0x/react-shared@2.0.10
 - @0x/sol-compiler@3.1.6
 - @0x/sol-coverage@3.0.3
 - @0x/sol-doc@2.0.10
 - @0x/sol-profiler@3.1.5
 - @0x/sol-resolver@2.0.7
 - @0x/sol-trace@2.0.11
 - @0x/sol-tracing-utils@6.0.10
 - @0x/sra-spec@2.0.9
 - @0x/subproviders@4.0.5
 - @0x/testnet-faucets@1.0.76
 - @0x/tslint-config@3.0.1
 - @0x/types@2.2.2
 - @0x/typescript-typings@4.2.2
 - @0x/utils@4.3.1
 - @0x/web3-wrapper@6.0.5
 - @0x/website@0.0.79
 - @0x/contracts-asset-proxy@2.1.1
 - @0x/contracts-coordinator@2.0.0
 - @0x/contracts-erc1155@1.1.1
 - @0x/contracts-erc20@2.2.0
 - @0x/contracts-erc721@2.1.1
 - @0x/contracts-exchange@2.1.1
 - @0x/contracts-exchange-forwarder@2.1.1
 - @0x/contracts-exchange-libs@2.1.1
 - @0x/contracts-extensions@3.1.1
 - @0x/contracts-multisig@3.1.1
 - @0x/contracts-test-utils@3.1.2
 - @0x/contracts-utils@3.1.1
2019-04-11 17:00:06 +01:00
Jacob Evans
0acec57ba9 Updated CHANGELOGS 2019-04-11 16:59:38 +01:00
Xianny
7423028fea Replace lodash with built-ins where possible to reduce bundle size (#1766)
* add tslint rule to disallow lodash.isUndefined

* add tslint rule to disallow lodash.isNull

* apply fixes
2019-04-10 09:36:32 -07:00
David Sun
49d951b7be Merge pull request #1772 from 0xProject/bug/website-photos
Fix bug with photo name url
2019-04-09 23:44:55 -07:00
David Sun
a554c9518d changed photo name url 2019-04-09 23:43:23 -07:00
David Sun
f3c7ba445e Merge pull request #1771 from 0xProject/feature/website/new-team-photos
Website new team photos
2019-04-09 23:30:51 -07:00
David Sun
3abff41385 commiting photos 2019-04-09 23:08:29 -07:00
Ryan Chow
6c36832f0e Stop using deprecated web3.py interface (#1759)
* Refactor contract function call to support web3.py v5.0.0. (backwards compatible with v4)
2019-04-09 09:33:36 -04:00
David Sun
2ff5c39712 Merge pull request #1767 from dave4506/fix/website/bug-sort-menu
Fix for menu z-index for explore
2019-04-05 15:03:13 -07:00
David Sun
ded849fd6d fix for menu z-index 2019-04-05 15:01:07 -07:00
David Sun
02f7064953 Merge pull request #1763 from dave4506/fix/website/flash-css-error
Fix Explore Issues with flash of css + other minor bugs
2019-04-05 14:57:19 -04:00
David Sun
1ddadfce1e added animation to tiles 2019-04-05 11:26:14 -07:00
David Sun
7720e5007c added animations to explore 2019-04-05 11:17:56 -07:00
David Sun
ccfd021796 switched header 'href' to 'to' 2019-04-05 11:17:56 -07:00
F. Eugene Aumson
fdcad84cee Delete merge conflict artifact (#1758) 2019-04-04 18:08:13 -04:00
Alex Browne
ad3e3b8421 Merge pull request #1755 from 0xProject/fix/circleci-yarn-permission-denied
Fix yarn permission denied errors in CircleCI
2019-04-04 13:21:36 -07:00
Jacob Evans
f67b4f8902 Merge pull request #1747 from 0xProject/feature/cut-the-package-fat
Cut the package fat! Part 1: Unwanted files
2019-04-04 14:26:23 +01:00
Jacob Evans
3c0d7319ba Update artifacts and remove top level artifacts 2019-04-04 12:30:41 +01:00
Jacob Evans
7f0aab6ec6 Remove unused deps 2019-04-04 12:30:41 +01:00
Jacob Evans
669578a926 Add contract-artifacts to circleci 2019-04-04 12:30:41 +01:00
Jacob Evans
fa1db64a8e Add a test to keep artifact sizes down 2019-04-04 12:30:41 +01:00
Jacob Evans
7cf60fa927 Remove sourcecode and opcodes from artifacts 2019-04-04 12:30:41 +01:00
Jacob Evans
75a0d3e494 Update all .npmignores 2019-04-04 12:30:41 +01:00
Jacob Evans
a98218ae22 Whitelist npmignore 2019-04-04 12:30:40 +01:00
Jacob Evans
10952e9dc4 Cut the package fat 2019-04-04 12:30:33 +01:00
Alex Browne
b36e23471b Fix yarn permission denied errors in CircleCI 2019-04-03 17:19:58 -07:00
Alex Browne
f45bf1c95b Merge pull request #1754 from 0xProject/fix/skip-geth-tests-ci
Disable Geth tests in CircleCI
2019-04-03 17:06:09 -07:00
Alex Browne
d4db2587aa Disable Geth tests in CircleCI 2019-04-03 16:38:58 -07:00
F. Eugene Aumson
62e6336a7d Fix race condition in CI runs of Python SRA client tests (#1751)
* In CI, don't start Launch Kit til Ganache is ready

* Re-enable Python SRA client tests

* For local testing, await service readiness
2019-04-03 18:22:26 -04:00
F. Eugene Aumson
2d8acd4711 Disable Python SRA tests against Launch Kit (#1750)
These tests have worked multiple times in Circle CI, but now they're not, and it seems to be misbehaving intermittently, so just disabling them for now.
2019-04-02 13:24:27 -04:00
Brandon Millman
d7d95be042 Merge pull request #1745 from 0xProject/fix/website/fix-codesandbox
Fix code sandbox link and 0x.js dep in website
2019-04-01 10:21:17 -07:00
David Sun
e3c97f0681 Merge pull request #1748 from dave4506/fix/website/pixure+bugs
Switched Pixura link
2019-04-01 08:59:20 -04:00
David Sun
1a4fa015b9 switched back to roboto 2019-04-01 08:54:02 -04:00
David Sun
63dacfaac5 switched pixura link 2019-04-01 08:48:46 -04:00
Brandon Millman
f7263ac2c6 Fix 0x.js dep 2019-03-29 16:54:41 -07:00
Brandon Millman
c7d7e1f0e3 Fix codesandbox link 2019-03-29 16:53:13 -07:00
Daniel Pyrathon
9c54b615f5 Merge pull request #1744 from 0xProject/feature/website/moar-Explore-updates
updates explore page
2019-03-29 16:28:02 -07:00
F. Eugene Aumson
69fe1aa981 Remove doctest skip for get_order method (#1743)
* Remove doctest skip for get_order method

* Set ganache env for Launch Kit in Circle CI

* Unpin Launch Kit version used in CI
2019-03-29 18:54:46 -04:00
rsingireddy
bfb3d19e3b fixes by way of yarn prettier 2019-03-29 15:45:49 -07:00
rsingireddy
0b4e62a63e updates explore page 2019-03-29 15:26:44 -07:00
David Sun
5cdbc03e71 Merge pull request #1676 from dave4506/website/feature/explore-page
Explore page
2019-03-28 21:10:57 -04:00
David Sun
16cd6dd25d removed .DS_Store 2019-03-28 20:54:00 -04:00
David Sun
fc71e7f99f updated to svg assets + new description 2019-03-28 20:51:56 -04:00
David Sun
e740380731 added changes for PR 2019-03-28 17:33:26 -04:00
Jacob Evans
f9921d2c91 Merge pull request #1714 from 0xProject/feature/order-utils/one-sided-transfer-validation
Simulate Maker transfer in order validation
2019-03-28 15:10:00 +01:00
Jacob Evans
d8bfc92cc5 Update documentation and changelog 2019-03-28 14:49:22 +01:00
Jacob Evans
1f2214f891 Major bump as this change could break existing orderbooks 2019-03-28 14:19:33 +01:00
Jacob Evans
50835e317f Update CHANGELOG 2019-03-28 14:00:40 +01:00
Jacob Evans
6c8d4dcc1e Allow simulation taker address to be specified 2019-03-28 14:00:40 +01:00
Jacob Evans
85a7efbd61 Change to accept maker amount 2019-03-28 14:00:40 +01:00
Jacob Evans
6b5ef10467 Remove unused imports 2019-03-28 14:00:39 +01:00
Jacob Evans
0bf46bfcb5 Re-use order relevant state 2019-03-28 14:00:39 +01:00
Jacob Evans
8b8dc7ac78 Update jsdoc 2019-03-28 14:00:39 +01:00
Fabio B
a017122c44 Update packages/contract-wrappers/src/types.ts
Co-Authored-By: dekz <dekz@dekz.net>
2019-03-28 14:00:39 +01:00
Fabio B
86a9a892d2 Update packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
Co-Authored-By: dekz <dekz@dekz.net>
2019-03-28 14:00:39 +01:00
Fabio B
f31a141d78 Update packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
Co-Authored-By: dekz <dekz@dekz.net>
2019-03-28 14:00:39 +01:00
Jacob Evans
fa67997424 Move order_utils from asset-buyer to order-utils package 2019-03-28 14:00:39 +01:00
Jacob Evans
a5f06c577d Remove unused pause 2019-03-28 14:00:38 +01:00
Jacob Evans
e575672877 Update CHANGELOGs 2019-03-28 14:00:38 +01:00
Jacob Evans
a34d5b29e8 Return eventually rejectedWith 2019-03-28 14:00:38 +01:00
Jacob Evans
91ec65da1b Await in tests to prevent clash in before blocks 2019-03-28 14:00:38 +01:00
Jacob Evans
ee8d40a66e Add IAssetProxy to python 2019-03-28 14:00:38 +01:00
Jacob Evans
38ac2e80ed Remove unused code 2019-03-28 14:00:38 +01:00
Jacob Evans
8b70762e34 Add a Test for an Untransferrable ERC20 token 2019-03-28 14:00:37 +01:00
Jacob Evans
18c613a611 Update comments 2019-03-28 14:00:37 +01:00
Jacob Evans
957f8c56a1 validateRemainingOrderAmountIsFillable 2019-03-28 14:00:37 +01:00
Jacob Evans
b16446877e only 2019-03-28 14:00:37 +01:00
Jacob Evans
9164d58dc7 Simulate maker transfer in order validation 2019-03-28 14:00:27 +01:00
Francesco Agosti
0beb2f9d3c Merge pull request #1740 from 0xProject/feature/website/add-Lawrence-change-Mel-role-change-Alex-Browne-role
adds lawrence forman to the website. changes mel role and alex browne…
2019-03-27 11:58:34 -07:00
Brandon Millman
ccdd66052a Merge pull request #1737 from 0xProject/feature/instant/update-infura
[instant] Add infura project id via env variables when bundling instant
2019-03-26 19:04:57 -07:00
Brandon Millman
518fd814b6 Merge branch 'development' into feature/website/add-Lawrence-change-Mel-role-change-Alex-Browne-role 2019-03-26 17:23:58 -07:00
rsingireddy
f49bb78dba adds lawrennce picture 2019-03-26 17:13:56 -07:00
rsingireddy
a54aa77d28 adds lawrence forman to the website. changes mel role and alex browne role 2019-03-26 16:51:07 -07:00
Brandon Millman
f85e443c9c Add instant.0x.org to host domains 2019-03-26 16:33:16 -07:00
Alex Browne
399e004e7f Merge pull request #1738 from 0xProject/fix/test-python-ci-failure-launch-kit-needs-pinning
Pin Launch Kit version in test-python CI task
2019-03-26 16:26:07 -07:00
Michael Huang
3099ba71eb New demos for Python packages (#1734)
End-to-end demos of constructing and signing an order and submitting it to a Relayer.  Docs are generated from the code, and include usage examples that are verified through automated testing.
2019-03-26 19:07:04 -04:00
F. Eugene Aumson
951fcf384c pin launch kit version in test-python ci task 2019-03-26 18:00:16 -04:00
Brandon Millman
c750368a3e Add infura project id via env variables when bundling instant 2019-03-26 14:17:57 -07:00
David Sun
3149d86855 lint + prettier 2019-03-26 16:55:10 -04:00
David Sun
3aaf21e34e removed banner and lint + prettier 2019-03-26 16:20:03 -04:00
David Sun
519c375a42 added responsive features 2019-03-26 16:20:03 -04:00
David Sun
3ed2c732bd added announcement banner 2019-03-26 16:20:02 -04:00
David Sun
0aa5550d0f Rearchitected Explore Page + added new features 2019-03-26 16:20:02 -04:00
David Sun
1bc8dd83d3 added settings dropdown 2019-03-26 16:20:02 -04:00
David Sun
c642cd6fed changed to popular 2019-03-26 16:20:01 -04:00
David Sun
f72918362d created most of the page's functionality 2019-03-26 16:20:01 -04:00
Leonid Logvinov
28c4ca73ab Merge pull request #1728 from ochikov/patch-6
Update constants.ts
2019-03-26 14:46:15 +01:00
Michael Huang
a256494ec8 Python contract wrappers (#1721) 2019-03-25 19:25:41 -04:00
Michael Huang
e043735362 Fix regex validation on numeric inputs (#1731)
* Fix regex validation on numeric inputs
2019-03-25 15:18:58 -04:00
Amir Bandeali
7010b1adb9 Merge pull request #1729 from 0xProject/feat/coordinator/functionVisibility
Modify function visibilities in Coordinator contract
2019-03-25 11:51:23 -07:00
Amir Bandeali
17ff262729 Update CHANGELOG 2019-03-25 10:11:37 -07:00
Amir Bandeali
1c18838cd8 Fix typos and add tests for decodeOrdersFromFillData 2019-03-25 10:11:37 -07:00
Amir Bandeali
55b87ae78d Make decodeOrdersFromFillData oublic and assertValidTransactionOrdersApproval internal 2019-03-25 10:11:37 -07:00
Amir Bandeali
e446e902f3 Remove TestMixins contract 2019-03-25 10:11:37 -07:00
Amir Bandeali
095b52e0b2 Make hashing methods public 2019-03-25 10:11:37 -07:00
Michael Huang
4f25ff6a50 local_message_signer middleware for web3.py (#1713) 2019-03-25 11:25:41 -04:00
ochikov
6242e0aeec Update constants.ts 2019-03-25 00:21:07 +02:00
Francesco Agosti
fde9fc9dd4 Merge pull request #1722 from 0xProject/fix/instant-polling
Unmount Instant when closing
2019-03-22 17:03:16 -07:00
fragosti
c481e42673 Reset yarn.lock 2019-03-22 16:21:02 -07:00
fragosti
5e228d7232 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into fix/instant-polling 2019-03-22 15:03:15 -07:00
fragosti
6b8e40fdc9 Make unrender idempotent 2019-03-22 15:02:12 -07:00
Alex Svanevik
bca44bf9e3 Merge pull request #1684 from 0xProject/pull-github-data
Pull Github data
2019-03-22 18:33:40 +08:00
askeluv
08e49dcf2e Throttling to respect rate limits 2019-03-22 18:15:49 +08:00
Fabio Berger
0f45409b4d Publish
- 0x.js@6.0.5
 - @0x/abi-gen@2.0.8
 - @0x/abi-gen-wrappers@4.1.0
 - @0x/assert@2.0.8
 - @0x/asset-buyer@6.0.5
 - @0x/base-contract@5.0.4
 - @0x/connect@5.0.4
 - @0x/contract-addresses@2.3.0
 - @0x/contract-artifacts@1.4.0
 - @0x/contract-wrappers@8.0.5
 - @0x/contracts-gen@1.0.7
 - @0x/dev-tools-pages@0.0.24
 - @0x/dev-utils@2.2.0
 - @0x/fill-scenarios@3.0.4
 - @0x/instant@1.0.19
 - @0x/json-schemas@3.0.8
 - @0x/metacoin@0.0.46
 - @0x/migrations@4.1.0
 - @0x/monorepo-scripts@1.0.29
 - @0x/order-utils@7.1.1
 - @0x/order-watcher@4.0.5
 - @0x/pipeline@1.0.16
 - @0x/react-docs@2.0.9
 - @0x/react-shared@2.0.9
 - @0x/sol-compiler@3.1.5
 - @0x/sol-coverage@3.0.2
 - @0x/sol-doc@2.0.9
 - @0x/sol-profiler@3.1.4
 - @0x/sol-resolver@2.0.6
 - @0x/sol-trace@2.0.10
 - @0x/sol-tracing-utils@6.0.9
 - @0x/sra-spec@2.0.8
 - @0x/subproviders@4.0.4
 - @0x/testnet-faucets@1.0.75
 - @0x/types@2.2.1
 - @0x/typescript-typings@4.2.1
 - @0x/utils@4.3.0
 - @0x/web3-wrapper@6.0.4
 - @0x/website@0.0.78
 - @0x/contracts-asset-proxy@2.1.0
 - @0x/contracts-coordinator@1.1.0
 - @0x/contracts-erc1155@1.1.0
 - @0x/contracts-erc20@2.1.0
 - @0x/contracts-erc721@2.1.0
 - @0x/contracts-exchange@2.1.0
 - @0x/contracts-exchange-forwarder@2.1.0
 - @0x/contracts-exchange-libs@2.1.0
 - @0x/contracts-extensions@3.1.0
 - @0x/contracts-multisig@3.1.0
 - @0x/contracts-test-utils@3.1.1
 - @0x/contracts-utils@3.1.0
2019-03-21 17:07:20 +01:00
Fabio Berger
5469d3ec13 Updated CHANGELOGS 2019-03-21 17:07:04 +01:00
Fabio B
d12f8410b9 Merge pull request #1689 from 0xProject/addCoordinatorSupport
Add Coordinator contracts support in dev tools
2019-03-21 16:04:19 +01:00
Fabio Berger
704c52d229 Move @0x/contracts-test-utils dependency from devDep to deps to fix publish test 2019-03-21 15:33:47 +01:00
Fabio Berger
7dcdda14f5 modify types 2019-03-21 15:13:39 +01:00
Fabio Berger
0f59256ca7 merge development 2019-03-21 15:04:52 +01:00
Fabio Berger
ddee04e98c Try import instead of const 2019-03-21 14:46:47 +01:00
Steve Klebanoff
50f5002b71 Unmount component when closing 2019-03-21 14:43:31 +01:00
Fabio Berger
e866add4b0 Add artifacts to python packages 2019-03-21 14:33:54 +01:00
Fabio Berger
39b93b88c5 Fix prettier 2019-03-21 14:32:21 +01:00
Fabio Berger
deb7e95567 Revert change 2019-03-21 14:29:26 +01:00
Jacob Evans
91500501ce Merge pull request #1695 from 0xProject/feature/reduce-excess-block-polling
Reduce excess block polling when using Web3ProviderEngine
2019-03-21 13:37:07 +01:00
Jacob Evans
6a1caeb9a1 Update CHANGELOGs 2019-03-21 12:33:09 +01:00
Jacob Evans
cee7803c37 Remove IAssetProxy 2019-03-21 12:02:38 +01:00
Jacob Evans
4e8d0ac7cb Add IAssetProxy to python 2019-03-21 11:52:43 +01:00
Jacob Evans
47bbcb9935 Add HACK explanation 2019-03-21 11:52:43 +01:00
Jacob Evans
c0288c5f26 Fix changelog, remove migrate_testnet 2019-03-21 11:52:28 +01:00
Jacob Evans
18c2013625 Update contract CHANGELOGs 2019-03-21 11:51:53 +01:00
Jacob Evans
548089888d Remove excess web3providernegine polling from contracts 2019-03-21 11:50:19 +01:00
Jacob Evans
180c65cfeb Change all packages to use web3providerengine without excess polling 2019-03-21 11:50:19 +01:00
Jacob Evans
6a28e41bc8 Remove unnecessary type assertion 2019-03-21 11:50:19 +01:00
Jacob Evans
f9ef942a98 Use providerUtils.startProviderEngine to minimize the HACK 2019-03-21 11:50:18 +01:00
Jacob Evans
8272c7a74e Reduce excess block polling when using Web3ProviderEngine 2019-03-21 11:49:26 +01:00
Amir Bandeali
4e745489db Merge pull request #1720 from 0xProject/fix/remove-tec
Remove TEC package artifacts
2019-03-20 14:01:39 -07:00
Amir Bandeali
fc2625a0c0 Remove TEC package artifacts 2019-03-20 13:28:37 -07:00
Amir Bandeali
d0e43ebaf1 Merge pull request #1712 from merklejerk/fix/feature/contracts/LibAddressArray-tests
Fix LibAddressArray.indexOf() and add LibAddressArray tests.
2019-03-20 11:38:08 -07:00
Fabio Berger
879805e316 merge development 2019-03-20 17:07:02 +01:00
Fabio Berger
6845d2e0ef Add coordinator artifacts to python package 2019-03-20 16:56:08 +01:00
Fabio Berger
542d1c1c41 In-line the declaration 2019-03-20 16:27:13 +01:00
Greg Hysen
31568e7abb Merge pull request #1716 from 0xProject/contracts-asset-proxy/updateProxyId
ERC1155 ProxyId - ERC1155Token -> ERC1155Assets
2019-03-20 08:12:58 -07:00
Lawrence
4b2488b124 Ran prettier. 2019-03-20 10:58:25 -04:00
Lawrence
6ed1412bdd Remove unnecessary copy operation in TestLibAddressArray.testAppendRealloc().
Test explicitly for newly allocated address in LibAddressArray "append" tests.
2019-03-20 10:19:46 -04:00
Lawrence
78b9a45158 Add PR#s to changelogs. 2019-03-20 10:19:46 -04:00
Lawrence
b8925baa88 Add unit tests for contracts/utils/LibAddressArray.
Fix `LibAddressArray.indexOf` returning wrong index.
2019-03-20 10:19:46 -04:00
Lawrence
87fd3f2a82 Add RevertReason.InvalidFreeMemoryPtr to packages/types. 2019-03-20 10:19:46 -04:00
Fabio Berger
8af164dbd2 Attempt to fix type issue 2019-03-20 15:05:21 +01:00
Fabio Berger
c994afbf3c Fix Pylint 2019-03-20 15:02:49 +01:00
Fabio Berger
843caf86fb merge development 2019-03-20 14:32:26 +01:00
Fabio Berger
44eef5b0e0 Fix comment 2019-03-20 14:31:10 +01:00
askeluv
346c6fc590 Deal with failing Github API for issues 2019-03-20 12:41:56 +08:00
Greg Hysen
7ed3afe9f0 Updated function signature for ERC1155 ProxyId - ERC1155Token -> ERC1155Assets 2019-03-19 15:35:08 -07:00
Fabio Berger
2fbe0aed32 Fix Python tests 2019-03-19 14:53:43 +01:00
Alex Svanevik
3bdc1802cb Merge branch 'development' into pull-github-data 2019-03-19 14:31:31 +08:00
Fabio Berger
849ca58228 Fix PR number 2019-03-18 20:40:29 +01:00
Fabio Berger
9991fca2e5 Add changelog entry for contract-addressesa 2019-03-18 20:39:02 +01:00
Fabio Berger
9c7bdcfeef Add testnet and mainnet coordinator and coordinatorRegistry addresses 2019-03-18 20:37:01 +01:00
Fabio Berger
b5463d522b Add PR numbers 2019-03-18 17:30:10 +01:00
Fabio Berger
af0d830103 Update coordinator wrapper 2019-03-18 17:20:58 +01:00
Fabio Berger
d4187dffa3 Add createCoordinatorApprovalTypedData method to order-utils and use in Coordinator tests 2019-03-18 17:20:51 +01:00
Fabio Berger
a7f06f2be5 Update coordinator abi-gen-wrapper 2019-03-18 16:44:11 +01:00
Fabio Berger
7ff7d1a185 Merge branch 'development' into addCoordinatorSupport
* development:
  Fix order-watcher version
2019-03-18 12:00:18 +01:00
Fabio Berger
e3bc80e027 Merge branch 'development' into addCoordinatorSupport
* development: (93 commits)
  Linting
  Copied MixinAssetProxyDispatcher from exchange
  Added deployed contract packages to readme (and link to top-level readme)
  Bumped version of ERC1155Proxy to 0.5.5 + merged ERC20Proxy/ERC721Proxy/MultiAssetProxy dependencies into base contract files
  Make credits program participants 1 row
  Correct comment in `hashEIP712Message()` in `LibEIP712Domai.sol`. Merge janky changelog notes in `types` package. Correct changelog note in `coordinator` changelog.
  Add PR numbers to changelogs.
  additional zero outcome tests
  renamed perUnitValue to valueMultiplier
  added test for amount=0
  Adjusted changelog version since nothing has been published during this PR
  Added calldatacopy comment
  Do not revert if value or amount are zero. Only if amount is non-zero and there is an overflow.
  updated comment for calldatacopy
  yarn.lock for erc1155 proxy
  added exports for 1155 proxy
  Renamed tokenIds -> ids, tokenValues -> values, callbackData -> data to be consistent with the ERC1155 reference implementation.
  Rebased against development
  Ran prettier
  Updated changelogs and documentation for erc1155 proxy
  ...
2019-03-18 11:20:22 +01:00
askeluv
095882d016 Added Github issue entity 2019-03-13 16:30:10 +08:00
askeluv
1693506f80 name -> full_name + fixed error message for missing access token 2019-03-13 11:47:42 +08:00
Fabio Berger
9366fa3b45 Add CHANGELOG entries 2019-03-11 15:29:26 +01:00
Fabio Berger
d356e9e65f Add deploying Coordinator contracts to migration script 2019-03-11 14:38:51 +01:00
Fabio Berger
230ebffd0e Generate Coordinator contract wrappers and add to abi-gen-wrappers package 2019-03-11 14:38:35 +01:00
Fabio Berger
5eedc1edca Add Coordinator contracts to contract-artifacts package 2019-03-11 14:38:00 +01:00
askeluv
b88e42a52d Prettier 2019-03-11 14:33:17 +08:00
askeluv
8d1b27d130 Added entity tests 2019-03-11 14:31:51 +08:00
askeluv
1148d37102 Added comparison details to forks vs main branch 2019-03-11 14:10:08 +08:00
askeluv
88704ce417 Prettier 2019-03-08 20:07:26 +08:00
askeluv
9f69d2cb76 Third entity: Github fork 2019-03-08 20:04:03 +08:00
askeluv
55fd71c5e1 Second entity: Github pull request 2019-03-08 14:37:36 +08:00
askeluv
1991bd437f First entity: Github repo 2019-03-08 12:32:21 +08:00
718 changed files with 17542 additions and 4195 deletions

View File

@@ -11,9 +11,14 @@ jobs:
steps:
- checkout
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
- run:
# HACK(albrow): Without this, yarn commands will sometimes
# fail with a "permission denied" error.
name: Set npm path
command: npm set prefix=/home/circleci/npm && echo 'export PATH=$HOME/circleci/npm/bin:$PATH' >> /home/circleci/.bashrc
- run:
name: install-yarn
command: sudo npm install --global yarn@1.9.4
command: npm install --global yarn@1.9.4
- run:
name: yarn
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
@@ -119,6 +124,7 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-test-utils
- run: yarn wsrun test:circleci @0x/abi-gen
- run: yarn wsrun test:circleci @0x/contract-artifacts
- run: yarn wsrun test:circleci @0x/assert
- run: yarn wsrun test:circleci @0x/base-contract
- run: yarn wsrun test:circleci @0x/connect
@@ -201,8 +207,11 @@ jobs:
- image: circleci/python
- image: 0xorg/ganache-cli:2.2.2
- image: 0xorg/launch-kit-ci
command: |
yarn start:ts -p 3000:3000
environment:
RPC_URL: http://localhost:8545
NETWORK_ID: 50
WHITELIST_ALL_TOKENS: True
command: bash -c "until curl -sfd'{\"method\":\"net_listening\"}' http://localhost:8545 | grep true; do continue; done; forever ts/lib/index.js"
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
@@ -390,9 +399,11 @@ workflows:
- test-contracts-ganache:
requires:
- build
- test-contracts-geth:
requires:
- build
# TODO(albrow): Tests always fail on Geth right now because our fork
# is outdated. Uncomment once we have updated our Geth fork.
# - test-contracts-geth:
# requires:
# - build
- test-pipeline:
requires:
- build

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _April 11, 2019_
* Dependencies updated
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Do not reexport external dependencies (#1682)

View File

@@ -26,7 +26,7 @@ contract ERC1155Proxy is
{
// Id of this proxy.
bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC1155Token(address,uint256[],uint256[],bytes)"));
bytes4 constant internal PROXY_ID = bytes4(keccak256("ERC1155Assets(address,uint256[],uint256[],bytes)"));
function ()
external

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "2.0.0",
"version": "2.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,17 +68,17 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-erc1155": "^1.0.1",
"@0x/contracts-erc20": "^2.0.0",
"@0x/contracts-erc721": "^2.0.0",
"@0x/contracts-utils": "^3.0.0",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-erc1155": "^1.1.1",
"@0x/contracts-erc20": "^2.2.0",
"@0x/contracts-erc721": "^2.1.1",
"@0x/contracts-utils": "^3.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -15,7 +15,7 @@ import {
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { RevertReason } from '@0x/types';
import { AssetProxyId, RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
@@ -123,8 +123,7 @@ describe('ERC1155Proxy', () => {
});
it('should have an id of 0x9645780d', async () => {
const proxyId = await erc1155Proxy.getProxyId.callAsync();
// proxy computed using -- bytes4(keccak256("erc1155Token(address,uint256[],uint256[],bytes)"));
const expectedProxyId = '0x9645780d';
const expectedProxyId = AssetProxyId.ERC1155;
expect(proxyId).to.equal(expectedProxyId);
});
});

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -115,7 +115,7 @@ export class ERC1155ProxyWrapper {
valuesToTransfer,
receiverCallbackData,
);
if (!_.isUndefined(extraData)) {
if (extraData !== undefined) {
encodedAssetData = `${encodedAssetData}${extraData}`;
}
const data = this._assetProxyInterface.transferFrom.getABIEncodedTransactionData(
@@ -199,10 +199,10 @@ export class ERC1155ProxyWrapper {
// Mint tokens for each owner for this token
for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
// tslint:disable-next-line:no-unused-variable
if (_.isUndefined(fungibleHoldingsByOwner[tokenOwnerAddress])) {
if (fungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
fungibleHoldingsByOwner[tokenOwnerAddress] = {};
}
if (_.isUndefined(fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress])) {
if (fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] === undefined) {
fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] = {};
}
fungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] =
@@ -221,13 +221,13 @@ export class ERC1155ProxyWrapper {
const tokenIdAsString = tokenId.toString();
this._nonFungibleTokenIds.push(tokenIdAsString);
_.each(this._tokenOwnerAddresses, async (tokenOwnerAddress: string, i: number) => {
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress])) {
if (nonFungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
nonFungibleHoldingsByOwner[tokenOwnerAddress] = {};
}
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress])) {
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] === undefined) {
nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress] = {};
}
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString])) {
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] === undefined) {
nonFungibleHoldingsByOwner[tokenOwnerAddress][dummyAddress][tokenIdAsString] = [];
}
this._nfts.push({ id: nftIds[i], tokenId });
@@ -278,26 +278,25 @@ export class ERC1155ProxyWrapper {
for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
// Fungible tokens
for (const tokenId of this._fungibleTokenIds) {
if (_.isUndefined(tokenHoldingsByOwner[tokenOwnerAddress])) {
if (tokenHoldingsByOwner[tokenOwnerAddress] === undefined) {
tokenHoldingsByOwner[tokenOwnerAddress] = {};
}
if (_.isUndefined(tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress])) {
if (tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress] = {};
}
tokenHoldingsByOwner[tokenOwnerAddress][tokenAddress][tokenId] = balances[i++];
}
// Non-fungible tokens
for (const nft of this._nfts) {
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress])) {
if (nonFungibleHoldingsByOwner[tokenOwnerAddress] === undefined) {
nonFungibleHoldingsByOwner[tokenOwnerAddress] = {};
}
if (_.isUndefined(nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress])) {
if (nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress] = {};
}
if (
_.isUndefined(
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()],
)
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()] ===
undefined
) {
nonFungibleHoldingsByOwner[tokenOwnerAddress][tokenAddress][nft.tokenId.toString()] = [];
}
@@ -348,25 +347,25 @@ export class ERC1155ProxyWrapper {
const tokenWrapper = _.find(this._dummyTokenWrappers, (wrapper: Erc1155Wrapper) => {
return wrapper.getContract().address === contractAddress;
});
if (_.isUndefined(tokenWrapper)) {
if (tokenWrapper === undefined) {
throw new Error(`Contract: ${contractAddress} was not deployed through ERC1155ProxyWrapper`);
}
return tokenWrapper;
}
private _getContractFromAddress(tokenAddress: string): ERC1155MintableContract {
const tokenContractIfExists = _.find(this._dummyTokenWrappers, c => c.getContract().address === tokenAddress);
if (_.isUndefined(tokenContractIfExists)) {
if (tokenContractIfExists === undefined) {
throw new Error(`Token: ${tokenAddress} was not deployed through ERC1155ProxyWrapper`);
}
return tokenContractIfExists.getContract();
}
private _validateDummyTokenContractsExistOrThrow(): void {
if (_.isUndefined(this._dummyTokenWrappers)) {
if (this._dummyTokenWrappers === undefined) {
throw new Error('Dummy ERC1155 tokens not yet deployed, please call "deployDummyTokensAsync"');
}
}
private _validateProxyContractExistsOrThrow(): void {
if (_.isUndefined(this._proxyContract)) {
if (this._proxyContract === undefined) {
throw new Error('ERC1155 proxy contract not yet deployed, please call "deployProxyAsync"');
}
}

View File

@@ -133,7 +133,7 @@ export class ERC20Wrapper {
_.forEach(balances, (balance, balanceIndex) => {
const tokenAddress = balanceInfo[balanceIndex].tokenAddress;
const tokenOwnerAddress = balanceInfo[balanceIndex].tokenOwnerAddress;
if (_.isUndefined(balancesByOwner[tokenOwnerAddress])) {
if (balancesByOwner[tokenOwnerAddress] === undefined) {
balancesByOwner[tokenOwnerAddress] = {};
}
const wrappedBalance = new BigNumber(balance);
@@ -142,7 +142,7 @@ export class ERC20Wrapper {
return balancesByOwner;
}
public addDummyTokenContract(dummy: DummyERC20TokenContract): void {
if (!_.isUndefined(this._dummyTokenContracts)) {
if (this._dummyTokenContracts !== undefined) {
this._dummyTokenContracts.push(dummy);
}
}
@@ -160,18 +160,18 @@ export class ERC20Wrapper {
const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
const tokenAddress = erc20ProxyData.tokenAddress;
const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
if (_.isUndefined(tokenContractIfExists)) {
if (tokenContractIfExists === undefined) {
throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
}
return tokenContractIfExists;
}
private _validateDummyTokenContractsExistOrThrow(): void {
if (_.isUndefined(this._dummyTokenContracts)) {
if (this._dummyTokenContracts === undefined) {
throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"');
}
}
private _validateProxyContractExistsOrThrow(): void {
if (_.isUndefined(this._proxyContract)) {
if (this._proxyContract === undefined) {
throw new Error('ERC20 proxy contract not yet deployed, please call "deployProxyAsync"');
}
}

View File

@@ -62,12 +62,12 @@ export class ERC721Wrapper {
for (const i of _.times(constants.NUM_ERC721_TOKENS_TO_MINT)) {
const tokenId = generatePseudoRandomSalt();
await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress);
if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) {
if (this._initialTokenIdsByOwner[tokenOwnerAddress] === undefined) {
this._initialTokenIdsByOwner[tokenOwnerAddress] = {
[dummyTokenContract.address]: [],
};
}
if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address])) {
if (this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] === undefined) {
this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = [];
}
this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId);
@@ -189,12 +189,12 @@ export class ERC721Wrapper {
_.forEach(tokenOwnerAddresses, (tokenOwnerAddress, ownerIndex) => {
const tokenAddress = tokenInfo[ownerIndex].tokenAddress;
const tokenId = tokenInfo[ownerIndex].tokenId;
if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress])) {
if (tokenIdsByOwner[tokenOwnerAddress] === undefined) {
tokenIdsByOwner[tokenOwnerAddress] = {
[tokenAddress]: [],
};
}
if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress][tokenAddress])) {
if (tokenIdsByOwner[tokenOwnerAddress][tokenAddress] === undefined) {
tokenIdsByOwner[tokenOwnerAddress][tokenAddress] = [];
}
tokenIdsByOwner[tokenOwnerAddress][tokenAddress].push(tokenId);
@@ -210,18 +210,18 @@ export class ERC721Wrapper {
}
private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract {
const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
if (_.isUndefined(tokenContractIfExists)) {
if (tokenContractIfExists === undefined) {
throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
}
return tokenContractIfExists;
}
private _validateDummyTokenContractsExistOrThrow(): void {
if (_.isUndefined(this._dummyTokenContracts)) {
if (this._dummyTokenContracts === undefined) {
throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"');
}
}
private _validateProxyContractExistsOrThrow(): void {
if (_.isUndefined(this._proxyContract)) {
if (this._proxyContract === undefined) {
throw new Error('ERC721 proxy contract not yet deployed, please call "deployProxyAsync"');
}
}

View File

@@ -1,4 +1,28 @@
[
{
"version": "2.0.0",
"changes": [
{
"note": "Make `decodeOrdersFromFillData`, `getCoordinatorApprovalHash`, and `getTransactionHash` public",
"pr": 1729
},
{
"note": "Make `assertValidTransactionOrdersApproval` internal",
"pr": 1729
}
],
"timestamp": 1554997931
},
{
"version": "1.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "1.0.0",
"changes": [

View File

@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.0 - _April 11, 2019_
* Make `decodeOrdersFromFillData`, `getCoordinatorApprovalHash`, and `getTransactionHash` public (#1729)
* Make `assertValidTransactionOrdersApproval` internal (#1729)
## v1.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v1.0.0 - _March 20, 2019_
* Created Coordinator package

View File

@@ -21,10 +21,5 @@
}
}
},
"contracts": [
"src/Coordinator.sol",
"src/registry/CoordinatorRegistry.sol",
"test/TestLibs.sol",
"test/TestMixins.sol"
]
"contracts": ["src/Coordinator.sol", "src/registry/CoordinatorRegistry.sol"]
}

View File

@@ -58,7 +58,7 @@ contract MixinCoordinatorApprovalVerifier is
view
{
// Get the orders from the the Exchange calldata in the 0x transaction
LibOrder.Order[] memory orders = decodeFillDataOrders(transaction.data);
LibOrder.Order[] memory orders = decodeOrdersFromFillData(transaction.data);
// No approval is required for non-fill methods
if (orders.length > 0) {
@@ -74,6 +74,57 @@ contract MixinCoordinatorApprovalVerifier is
}
}
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeOrdersFromFillData(bytes memory data)
public
pure
returns (LibOrder.Order[] memory orders)
{
bytes4 selector = data.readBytes4(0);
if (
selector == FILL_ORDER_SELECTOR ||
selector == FILL_ORDER_NO_THROW_SELECTOR ||
selector == FILL_OR_KILL_ORDER_SELECTOR
) {
// Decode single order
(LibOrder.Order memory order) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order)
);
orders = new LibOrder.Order[](1);
orders[0] = order;
} else if (
selector == BATCH_FILL_ORDERS_SELECTOR ||
selector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
selector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
selector == MARKET_SELL_ORDERS_SELECTOR ||
selector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
) {
// Decode all orders
// solhint-disable indent
(orders) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order[])
);
} else if (selector == MATCH_ORDERS_SELECTOR) {
// Decode left and right orders
(LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order, LibOrder.Order)
);
// Create array of orders
orders = new LibOrder.Order[](2);
orders[0] = leftOrder;
orders[1] = rightOrder;
}
return orders;
}
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param orders Array of order structs containing order specifications.
@@ -89,7 +140,7 @@ contract MixinCoordinatorApprovalVerifier is
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
internal
view
{
// Verify that Ethereum tx signer is the same as the approved txOrigin
@@ -149,55 +200,4 @@ contract MixinCoordinatorApprovalVerifier is
);
}
}
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeFillDataOrders(bytes memory data)
internal
pure
returns (LibOrder.Order[] memory orders)
{
bytes4 selector = data.readBytes4(0);
if (
selector == FILL_ORDER_SELECTOR ||
selector == FILL_ORDER_NO_THROW_SELECTOR ||
selector == FILL_OR_KILL_ORDER_SELECTOR
) {
// Decode single order
(LibOrder.Order memory order) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order)
);
orders = new LibOrder.Order[](1);
orders[0] = order;
} else if (
selector == BATCH_FILL_ORDERS_SELECTOR ||
selector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
selector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
selector == MARKET_SELL_ORDERS_SELECTOR ||
selector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
) {
// Decode all orders
// solhint-disable indent
(orders) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order[])
);
} else if (selector == MATCH_ORDERS_SELECTOR) {
// Decode left and right orders
(LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order, LibOrder.Order)
);
// Create array of orders
orders = new LibOrder.Order[](2);
orders[0] = leftOrder;
orders[1] = rightOrder;
}
return orders;
}
}

View File

@@ -42,21 +42,11 @@ contract ICoordinatorApprovalVerifier {
public
view;
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param orders Array of order structs containing order specifications.
/// @param txOrigin Required signer of Ethereum transaction calling this function.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
function assertValidTransactionOrdersApproval(
LibZeroExTransaction.ZeroExTransaction memory transaction,
LibOrder.Order[] memory orders,
address txOrigin,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeOrdersFromFillData(bytes memory data)
public
view;
pure
returns (LibOrder.Order[] memory orders);
}

View File

@@ -17,6 +17,7 @@
*/
pragma solidity ^0.5.5;
pragma experimental "ABIEncoderV2";
import "./LibEIP712Domain.sol";
@@ -37,16 +38,16 @@ contract LibCoordinatorApproval is
struct CoordinatorApproval {
address txOrigin; // Required signer of Ethereum transaction that is submitting approval.
bytes32 transactionHash; // EIP712 hash of the transaction, using the domain separator of this contract.
bytes32 transactionHash; // EIP712 hash of the transaction.
bytes transactionSignature; // Signature of the 0x transaction.
uint256 approvalExpirationTimeSeconds; // Timestamp in seconds for which the signature expires.
uint256 approvalExpirationTimeSeconds; // Timestamp in seconds for which the approval expires.
}
/// @dev Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.
/// @param approval Coordinator approval message containing the transaction hash, transaction signature, and expiration of the approval.
/// @return EIP712 hash of the Coordinator approval message with the domain separator of this contract.
function getCoordinatorApprovalHash(CoordinatorApproval memory approval)
internal
public
view
returns (bytes32 approvalHash)
{
@@ -71,9 +72,10 @@ contract LibCoordinatorApproval is
// Assembly for more efficiently computing:
// keccak256(abi.encodePacked(
// EIP712_COORDINATOR_APPROVAL_SCHEMA_HASH,
// approval.txOrigin,
// approval.transactionHash,
// keccak256(approval.transactionSignature)
// approval.expiration,
// approval.approvalExpirationTimeSeconds,
// ));
assembly {

View File

@@ -17,6 +17,7 @@
*/
pragma solidity ^0.5.5;
pragma experimental "ABIEncoderV2";
import "./LibEIP712Domain.sol";
@@ -40,11 +41,11 @@ contract LibZeroExTransaction is
bytes data; // AbiV2 encoded calldata.
}
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of this contract.
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @return EIP712 hash of the transaction with the domain separator of this contract.
function getTransactionHash(ZeroExTransaction memory transaction)
internal
public
view
returns (bytes32 transactionHash)
{

View File

@@ -26,11 +26,21 @@ import "../interfaces/ICoordinatorApprovalVerifier.sol";
contract MCoordinatorApprovalVerifier is
ICoordinatorApprovalVerifier
{
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeFillDataOrders(bytes memory data)
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param orders Array of order structs containing order specifications.
/// @param txOrigin Required signer of Ethereum transaction calling this function.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
function assertValidTransactionOrdersApproval(
LibZeroExTransaction.ZeroExTransaction memory transaction,
LibOrder.Order[] memory orders,
address txOrigin,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
internal
pure
returns (LibOrder.Order[] memory orders);
view;
}

View File

@@ -1,61 +0,0 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.5;
pragma experimental "ABIEncoderV2";
import "../src/libs/LibConstants.sol";
import "../src/libs/LibCoordinatorApproval.sol";
import "../src/libs/LibZeroExTransaction.sol";
// solhint-disable no-empty-blocks
contract TestLibs is
LibConstants,
LibCoordinatorApproval,
LibZeroExTransaction
{
constructor (address _exchange)
public
LibConstants(_exchange)
{}
/// @dev Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract.
/// @param approval Coordinator approval message containing the transaction hash, transaction signature, and expiration of the approval.
/// @return EIP712 hash of the Coordinator approval message with the domain separator of this contract.
function publicGetCoordinatorApprovalHash(CoordinatorApproval memory approval)
public
view
returns (bytes32 approvalHash)
{
approvalHash = getCoordinatorApprovalHash(approval);
return approvalHash;
}
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @return EIP712 hash of the transaction with the domain separator of the Exchange contract.
function publicGetTransactionHash(ZeroExTransaction memory transaction)
public
view
returns (bytes32 transactionHash)
{
transactionHash = getTransactionHash(transaction);
return transactionHash;
}
}

View File

@@ -1,37 +0,0 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.5;
pragma experimental "ABIEncoderV2";
import "../src/libs/LibConstants.sol";
import "../src/MixinSignatureValidator.sol";
import "../src/MixinCoordinatorApprovalVerifier.sol";
// solhint-disable no-empty-blocks
contract TestMixins is
LibConstants,
MixinSignatureValidator,
MixinCoordinatorApprovalVerifier
{
constructor (address _exchange)
public
LibConstants(_exchange)
{}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-coordinator",
"version": "1.0.0",
"version": "2.0.0",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -33,7 +34,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "./generated-artifacts/@(Coordinator|CoordinatorRegistry|TestLibs|TestMixins).json",
"abis": "./generated-artifacts/@(Coordinator|CoordinatorRegistry).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,18 +68,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-asset-proxy": "^2.0.0",
"@0x/contracts-erc20": "^2.0.0",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-erc20": "^2.2.0",
"@0x/contracts-exchange": "1.0.2",
"@0x/contracts-exchange-libs": "^2.0.0",
"@0x/contracts-utils": "^3.0.0",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/contracts-exchange-libs": "^2.1.1",
"@0x/contracts-utils": "^3.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"
},

View File

@@ -7,11 +7,7 @@ import { ContractArtifact } from 'ethereum-types';
import * as Coordinator from '../generated-artifacts/Coordinator.json';
import * as CoordinatorRegistry from '../generated-artifacts/CoordinatorRegistry.json';
import * as TestLibs from '../generated-artifacts/TestLibs.json';
import * as TestMixins from '../generated-artifacts/TestMixins.json';
export const artifacts = {
Coordinator: Coordinator as ContractArtifact,
CoordinatorRegistry: CoordinatorRegistry as ContractArtifact,
TestLibs: TestLibs as ContractArtifact,
TestMixins: TestMixins as ContractArtifact,
};

View File

@@ -5,5 +5,3 @@
*/
export * from '../generated-wrappers/coordinator';
export * from '../generated-wrappers/coordinator_registry';
export * from '../generated-wrappers/test_libs';
export * from '../generated-wrappers/test_mixins';

View File

@@ -435,7 +435,7 @@ describe('Coordinator tests', () => {
describe('cancels', () => {
it('cancelOrder call should be successful without an approval', async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDER, orders);
const transaction = makerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await coordinatorContract.executeTransaction.sendTransactionAsync(

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -4,14 +4,14 @@ import { transactionHashUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { artifacts, hashUtils, TestLibsContract } from '../src';
import { artifacts, CoordinatorContract, hashUtils } from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('Libs tests', () => {
let testLibs: TestLibsContract;
let coordinatorContract: CoordinatorContract;
const exchangeAddress = addressUtils.generatePseudoRandomAddress();
before(async () => {
@@ -21,8 +21,8 @@ describe('Libs tests', () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
testLibs = await TestLibsContract.deployFrom0xArtifactAsync(
artifacts.TestLibs,
coordinatorContract = await CoordinatorContract.deployFrom0xArtifactAsync(
artifacts.Coordinator,
provider,
txDefaults,
exchangeAddress,
@@ -44,7 +44,7 @@ describe('Libs tests', () => {
data: '0x1234',
};
const expectedTxHash = transactionHashUtils.getTransactionHashHex(tx);
const txHash = await testLibs.publicGetTransactionHash.callAsync(tx);
const txHash = await coordinatorContract.getTransactionHash.callAsync(tx);
expect(expectedTxHash).to.eq(txHash);
});
});
@@ -68,11 +68,11 @@ describe('Libs tests', () => {
};
const expectedApprovalHash = hashUtils.getApprovalHashHex(
signedTx,
testLibs.address,
coordinatorContract.address,
txOrigin,
approvalExpirationTimeSeconds,
);
const approvalHash = await testLibs.publicGetCoordinatorApprovalHash.callAsync(approval);
const approvalHash = await coordinatorContract.getCoordinatorApprovalHash.callAsync(approval);
expect(expectedApprovalHash).to.eq(approvalHash);
});
});

View File

@@ -16,7 +16,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as ethUtil from 'ethereumjs-util';
import { ApprovalFactory, artifacts, constants, exchangeDataEncoder, TestMixinsContract } from '../src';
import { ApprovalFactory, artifacts, constants, CoordinatorContract, exchangeDataEncoder } from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -26,7 +26,7 @@ describe('Mixins tests', () => {
let transactionSignerAddress: string;
let approvalSignerAddress1: string;
let approvalSignerAddress2: string;
let mixins: TestMixinsContract;
let mixins: CoordinatorContract;
let transactionFactory: TransactionFactory;
let approvalFactory1: ApprovalFactory;
let approvalFactory2: ApprovalFactory;
@@ -40,8 +40,8 @@ describe('Mixins tests', () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
mixins = await TestMixinsContract.deployFrom0xArtifactAsync(
artifacts.TestMixins,
mixins = await CoordinatorContract.deployFrom0xArtifactAsync(
artifacts.Coordinator,
provider,
txDefaults,
exchangeAddress,
@@ -135,6 +135,70 @@ describe('Mixins tests', () => {
});
});
describe('decodeOrdersFromFillData', () => {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
const decodedSignedOrders = decodedOrders.map(order => ({
...order,
exchangeAddress: devConstants.NULL_ADDRESS,
signature: devConstants.NULL_BYTES,
}));
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of constants.BATCH_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
const decodedSignedOrders = decodedOrders.map(order => ({
...order,
exchangeAddress: devConstants.NULL_ADDRESS,
signature: devConstants.NULL_BYTES,
}));
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of constants.MARKET_FILL_FN_NAMES) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
const decodedSignedOrders = decodedOrders.map(order => ({
...order,
exchangeAddress: devConstants.NULL_ADDRESS,
signature: devConstants.NULL_BYTES,
}));
expect(orders).to.deep.eq(decodedSignedOrders);
});
}
for (const fnName of [constants.CANCEL_ORDER, constants.BATCH_CANCEL_ORDERS, constants.CANCEL_ORDERS_UP_TO]) {
it(`should correctly decode the orders for ${fnName} data`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
const emptyArray: any[] = [];
expect(emptyArray).to.deep.eq(decodedOrders);
});
}
it('should decode an empty array for invalid data', async () => {
const data = '0x0123456789';
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
const emptyArray: any[] = [];
expect(emptyArray).to.deep.eq(decodedOrders);
});
it('should revert if data is less than 4 bytes long', async () => {
const data = '0x010203';
await expectContractCallFailedAsync(
mixins.decodeOrdersFromFillData.callAsync(data),
RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
);
});
});
describe('Single order approvals', () => {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1], expiration=[valid]`, async () => {
@@ -148,15 +212,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -181,15 +236,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -203,15 +249,6 @@ describe('Mixins tests', () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
approvalSignerAddress1,
@@ -234,15 +271,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
approvalSignerAddress1,
@@ -256,15 +284,6 @@ describe('Mixins tests', () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
approvalSignerAddress1,
@@ -288,18 +307,6 @@ describe('Mixins tests', () => {
approvalExpirationTimeSeconds,
);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -323,18 +330,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -358,18 +353,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidOrigin,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -401,15 +384,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -433,15 +407,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -458,15 +423,6 @@ describe('Mixins tests', () => {
}));
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[],
[],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -487,15 +443,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -521,15 +468,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
transactionSignerAddress,
@@ -543,15 +481,6 @@ describe('Mixins tests', () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
approvalSignerAddress1,
@@ -572,18 +501,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
),
RevertReason.InvalidOrigin,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -600,18 +517,6 @@ describe('Mixins tests', () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTransaction(data);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[],
[],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -636,18 +541,6 @@ describe('Mixins tests', () => {
approvalExpirationTimeSeconds,
);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -677,18 +570,6 @@ describe('Mixins tests', () => {
approvalExpirationTimeSeconds,
);
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approvalSignature2],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -713,18 +594,6 @@ describe('Mixins tests', () => {
approvalExpirationTimeSeconds,
);
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[approvalExpirationTimeSeconds],
[approvalSignature2],
{ from: approvalSignerAddress1 },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -754,18 +623,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds2,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds1, approvalExpirationTimeSeconds2],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -789,18 +646,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
approvalSignerAddress1,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -824,18 +669,6 @@ describe('Mixins tests', () => {
transactionSignerAddress,
approvalExpirationTimeSeconds,
);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transactionSignerAddress,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval1.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidOrigin,
);
expectContractCallFailedAsync(
mixins.assertValidCoordinatorApprovals.callAsync(
transaction,
@@ -851,9 +684,9 @@ describe('Mixins tests', () => {
}
});
describe('cancels', () => {
it('should allow the tx signer to call `cancelOrders` without approval', async () => {
it('should allow the tx signer to call `cancelOrder` without approval', async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDER, orders);
const transaction = transactionFactory.newSignedTransaction(data);
await mixins.assertValidCoordinatorApprovals.callAsync(
transaction,

View File

@@ -5,7 +5,7 @@ export const constants = {
BATCH_FILL_FN_NAMES: ['batchFillOrders', 'batchFillOrKillOrders', 'batchFillOrdersNoThrow'],
MARKET_FILL_FN_NAMES: ['marketBuyOrders', 'marketBuyOrdersNoThrow', 'marketSellOrders', 'marketSellOrdersNoThrow'],
MATCH_ORDERS: 'matchOrders',
CANCEL_ORDERS: 'cancelOrders',
CANCEL_ORDER: 'cancelOrder',
BATCH_CANCEL_ORDERS: 'batchCancelOrders',
CANCEL_ORDERS_UP_TO: 'cancelOrdersUpTo',
TIME_BUFFER: new BigNumber(1000),

View File

@@ -1,7 +1,6 @@
import { LogDecoder, txDefaults } from '@0x/contracts-test-utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, CoordinatorRegistryContract } from '../../src';
@@ -26,7 +25,7 @@ export class CoordinatorRegistryWrapper {
this._provider,
txDefaults,
);
if (_.isUndefined(this._coordinatorRegistryContract)) {
if (this._coordinatorRegistryContract === undefined) {
throw new Error(`Failed to deploy Coordinator Registry contract.`);
}
return this._coordinatorRegistryContract;
@@ -56,7 +55,7 @@ export class CoordinatorRegistryWrapper {
return coordinatorEndpoint;
}
private _assertCoordinatorRegistryDeployed(): void {
if (_.isUndefined(this._coordinatorRegistryContract)) {
if (this._coordinatorRegistryContract === undefined) {
throw new Error(
'The Coordinator Registry contract was not deployed through the CoordinatorRegistryWrapper. Call `deployCoordinatorRegistryAsync` to deploy.',
);

View File

@@ -37,7 +37,7 @@ export const exchangeDataEncoder = {
orders[0].signature,
orders[1].signature,
);
} else if (fnName === constants.CANCEL_ORDERS) {
} else if (fnName === constants.CANCEL_ORDER) {
data = exchangeInstance.cancelOrder.getABIEncodedTransactionData(orders[0]);
} else if (fnName === constants.BATCH_CANCEL_ORDERS) {
data = exchangeInstance.batchCancelOrders.getABIEncodedTransactionData(orders);

View File

@@ -1,5 +1,4 @@
import { eip712Utils, transactionHashUtils } from '@0x/order-utils';
import { constants } from '@0x/order-utils/lib/src/constants';
import { eip712Utils } from '@0x/order-utils';
import { SignedZeroExTransaction } from '@0x/types';
import { BigNumber, signTypedDataUtils } from '@0x/utils';
import * as _ from 'lodash';
@@ -11,25 +10,11 @@ export const hashUtils = {
txOrigin: string,
approvalExpirationTimeSeconds: BigNumber,
): Buffer {
const domain = {
name: constants.COORDINATOR_DOMAIN_NAME,
version: constants.COORDINATOR_DOMAIN_VERSION,
const typedData = eip712Utils.createCoordinatorApprovalTypedData(
transaction,
verifyingContractAddress,
};
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
const approval = {
txOrigin,
transactionHash,
transactionSignature: transaction.signature,
approvalExpirationTimeSeconds: approvalExpirationTimeSeconds.toString(),
};
const typedData = eip712Utils.createTypedData(
constants.COORDINATOR_APPROVAL_SCHEMA.name,
{
CoordinatorApproval: constants.COORDINATOR_APPROVAL_SCHEMA.parameters,
},
approval,
domain,
approvalExpirationTimeSeconds,
);
const hashBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
return hashBuffer;

View File

@@ -2,11 +2,6 @@
"extends": "../../tsconfig",
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/Coordinator.json",
"generated-artifacts/CoordinatorRegistry.json",
"generated-artifacts/TestLibs.json",
"generated-artifacts/TestMixins.json"
],
"files": ["generated-artifacts/Coordinator.json", "generated-artifacts/CoordinatorRegistry.json"],
"exclude": ["./deploy/solc/solc_bin"]
}

View File

@@ -1,4 +1,23 @@
[
{
"version": "1.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "1.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"timestamp": 1553091633,
"version": "1.0.1",

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.1 - _April 11, 2019_
* Dependencies updated
## v1.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v1.0.1 - _March 20, 2019_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc1155",
"version": "1.0.1",
"version": "1.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,13 +67,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-utils": "^3.0.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/contracts-utils": "^3.1.1",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -36,8 +36,8 @@ export class Erc1155Wrapper {
callbackData?: string,
delegatedSpender?: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const spender = _.isUndefined(delegatedSpender) ? from : delegatedSpender;
const callbackDataHex = _.isUndefined(callbackData) ? '0x' : callbackData;
const spender = delegatedSpender === undefined ? from : delegatedSpender;
const callbackDataHex = callbackData === undefined ? '0x' : callbackData;
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(
await this._erc1155Contract.safeTransferFrom.sendTransactionAsync(from, to, token, value, callbackDataHex, {
from: spender,
@@ -53,8 +53,8 @@ export class Erc1155Wrapper {
callbackData?: string,
delegatedSpender?: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const spender = _.isUndefined(delegatedSpender) ? from : delegatedSpender;
const callbackDataHex = _.isUndefined(callbackData) ? '0x' : callbackData;
const spender = delegatedSpender === undefined ? from : delegatedSpender;
const callbackDataHex = callbackData === undefined ? '0x' : callbackData;
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(
await this._erc1155Contract.safeBatchTransferFrom.sendTransactionAsync(
from,

View File

@@ -1,4 +1,24 @@
[
{
"version": "2.2.0",
"changes": [
{
"note": "Added UntransferrableDummyERC20Token",
"pr": 1714
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.0 - _April 11, 2019_
* Added UntransferrableDummyERC20Token (#1714)
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Upgrade contracts to Solidity 0.5.5 (#1682)

View File

@@ -32,6 +32,7 @@
"src/interfaces/IEtherToken.sol",
"test/DummyERC20Token.sol",
"test/DummyMultipleReturnERC20Token.sol",
"test/DummyNoReturnERC20Token.sol"
"test/DummyNoReturnERC20Token.sol",
"test/UntransferrableDummyERC20Token.sol"
]
}

View File

@@ -0,0 +1,61 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.5;
import "./DummyERC20Token.sol";
// solhint-disable no-empty-blocks
contract UntransferrableDummyERC20Token is
DummyERC20Token
{
constructor (
string memory _name,
string memory _symbol,
uint256 _decimals,
uint256 _totalSupply
)
public
DummyERC20Token(
_name,
_symbol,
_decimals,
_totalSupply
)
{}
/// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
function transferFrom(
address _from,
address _to,
uint256 _value
)
external
returns (bool)
{
require(
false,
"TRANSFER_DISABLED"
);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "2.0.0",
"version": "2.2.0",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,14 +68,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-exchange-libs": "^2.0.0",
"@0x/contracts-utils": "^3.0.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-exchange-libs": "^2.1.1",
"@0x/contracts-utils": "^3.1.1",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _April 11, 2019_
* Dependencies updated
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Upgrade contracts to Solidity 0.5.5 (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "2.0.0",
"version": "2.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,13 +68,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-utils": "^3.0.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-utils": "^3.1.1",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _April 11, 2019_
* Dependencies updated
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Do not reexport external dependencies (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "2.0.0",
"version": "2.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,13 +47,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contract-wrappers": "^8.0.4",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contract-wrappers": "^9.0.0",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -68,19 +69,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-asset-proxy": "^2.0.0",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-erc20": "1.0.8",
"@0x/contracts-erc721": "1.0.8",
"@0x/contracts-exchange": "1.0.2",
"@0x/contracts-exchange-libs": "1.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -76,8 +76,8 @@ export class ForwarderWrapper {
): Promise<TransactionReceiptWithDecodedLogs> {
const params = ForwarderWrapper._createOptimizedOrders(orders);
const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
const feePercentage = opts.feePercentage === undefined ? constants.ZERO_AMOUNT : opts.feePercentage;
const feeRecipient = opts.feeRecipient === undefined ? constants.NULL_ADDRESS : opts.feeRecipient;
const txHash = await this._forwarderContract.marketSellOrdersWithEth.sendTransactionAsync(
params.orders,
params.signatures,
@@ -99,8 +99,8 @@ export class ForwarderWrapper {
): Promise<TransactionReceiptWithDecodedLogs> {
const params = ForwarderWrapper._createOptimizedOrders(orders);
const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
const feePercentage = opts.feePercentage === undefined ? constants.ZERO_AMOUNT : opts.feePercentage;
const feeRecipient = opts.feeRecipient === undefined ? constants.NULL_ADDRESS : opts.feeRecipient;
const txHash = await this._forwarderContract.marketBuyOrdersWithEth.sendTransactionAsync(
params.orders,
makerAssetFillAmount,

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _April 11, 2019_
* Dependencies updated
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Upgrade contracts to Solidity 0.5.5 (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "2.0.0",
"version": "2.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,14 +68,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-utils": "^3.0.0",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-utils": "^3.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -1,4 +1,23 @@
[
{
"version": "2.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "2.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.1 - _April 11, 2019_
* Dependencies updated
## v2.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v2.0.0 - _March 20, 2019_
* Do not reexport external dependencies (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "2.0.0",
"version": "2.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,19 +68,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-asset-proxy": "^2.0.0",
"@0x/contracts-erc1155": "^1.0.1",
"@0x/contracts-erc20": "^2.0.0",
"@0x/contracts-erc721": "^2.0.0",
"@0x/contracts-exchange-libs": "^2.0.0",
"@0x/contracts-utils": "^3.0.0",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-erc1155": "^1.1.1",
"@0x/contracts-erc20": "^2.2.0",
"@0x/contracts-erc721": "^2.1.1",
"@0x/contracts-exchange-libs": "^2.1.1",
"@0x/contracts-utils": "^3.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"
},

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -437,7 +437,7 @@ export class FillOrderCombinatorialUtils {
lazyStore: BalanceAndProxyAllowanceLazyStore,
fillRevertReasonIfExists: RevertReason | undefined,
): Promise<void> {
if (!_.isUndefined(fillRevertReasonIfExists)) {
if (fillRevertReasonIfExists !== undefined) {
return expectTransactionFailedAsync(
this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
fillRevertReasonIfExists,

View File

@@ -1,4 +1,23 @@
[
{
"version": "3.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "3.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "3.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.1 - _April 11, 2019_
* Dependencies updated
## v3.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v3.0.0 - _March 20, 2019_
* Do not reexport external dependencies (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "3.0.0",
"version": "3.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,13 +47,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contract-wrappers": "^8.0.4",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contract-wrappers": "^9.0.0",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -68,19 +69,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-asset-proxy": "^2.0.0",
"@0x/contracts-erc20": "^2.0.0",
"@0x/contracts-erc721": "^2.0.0",
"@0x/contracts-exchange": "^2.0.0",
"@0x/contracts-exchange-libs": "^2.0.0",
"@0x/contracts-utils": "^3.0.0",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-erc20": "^2.2.0",
"@0x/contracts-erc721": "^2.1.1",
"@0x/contracts-exchange": "^2.1.1",
"@0x/contracts-exchange-libs": "^2.1.1",
"@0x/contracts-utils": "^3.1.1",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -12,7 +12,6 @@ import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, BalanceThresholdFilterContract } from '../../src';
@@ -264,7 +263,7 @@ export class BalanceThresholdWrapper {
gas?: number,
): Promise<TransactionReceiptWithDecodedLogs> {
const signedExchangeTx = this._signerTransactionFactory.newSignedTransaction(abiEncodedExchangeTxData);
const txOpts = _.isUndefined(gas) ? { from } : { from, gas };
const txOpts = gas === undefined ? { from } : { from, gas };
const txHash = await this._balanceThresholdFilter.executeTransaction.sendTransactionAsync(
signedExchangeTx.salt,
signedExchangeTx.signerAddress,

View File

@@ -1,4 +1,23 @@
[
{
"version": "3.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "3.1.0",
"changes": [
{
"note": "Run Web3ProviderEngine without excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "3.0.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.1 - _April 11, 2019_
* Dependencies updated
## v3.1.0 - _March 21, 2019_
* Run Web3ProviderEngine without excess block polling (#1695)
## v3.0.0 - _March 20, 2019_
* Do not reexport external dependencies (#1682)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "3.0.0",
"version": "3.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../packages/abi-gen-templates/contract.handlebars --partials '../../packages/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
@@ -67,15 +68,15 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/contracts-asset-proxy": "^2.0.0",
"@0x/contracts-erc20": "^2.0.0",
"@0x/base-contract": "^5.0.5",
"@0x/contracts-asset-proxy": "^2.1.1",
"@0x/contracts-erc20": "^2.2.0",
"@0x/contracts-utils": "2.0.1",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"ethereum-types": "^2.1.1",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"ethereum-types": "^2.1.2",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,9 +1,9 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { env, EnvVars } from '@0x/dev-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider engine', () => {
provider.start();
before('start web3 provider', () => {
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {

View File

@@ -70,7 +70,7 @@ describe('MultiSigWalletWithTimeLock', () => {
REQUIRED_APPROVALS,
secondsTimeLocked,
);
expect(_.isUndefined((multiSig as any).external_call)).to.be.equal(true);
expect((multiSig as any).external_call === undefined).to.be.equal(true);
});
});
describe('confirmTransaction', () => {
@@ -271,7 +271,7 @@ describe('MultiSigWalletWithTimeLock', () => {
const blockNum = await web3Wrapper.getBlockNumberAsync();
const blockInfo = await web3Wrapper.getBlockIfExistsAsync(blockNum);
if (_.isUndefined(blockInfo)) {
if (blockInfo === undefined) {
throw new Error(`Unexpectedly failed to fetch block at #${blockNum}`);
}
const timestamp = new BigNumber(blockInfo.timestamp);

View File

@@ -3,7 +3,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
import { artifacts } from '../../src/artifacts';
@@ -23,7 +22,7 @@ export class AssetProxyOwnerWrapper {
from: string,
opts: { value?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, {
from,
});

View File

@@ -2,7 +2,6 @@ import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
import { artifacts } from '../../src/artifacts';
@@ -22,7 +21,7 @@ export class MultiSigWrapper {
from: string,
opts: { value?: BigNumber } = {},
): Promise<TransactionReceiptWithDecodedLogs> {
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
const value = opts.value === undefined ? new BigNumber(0) : opts.value;
const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, {
from,
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,192 +0,0 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
/* istanbul ignore next */
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class TestMixinsContract extends BaseContract {
public getSignerAddress = {
async callAsync(
hash: string,
signature: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as TestMixinsContract;
const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash,
signature
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)');
// tslint:disable boolean-naming
const result = abiEncoder.strictDecodeReturnValue<string
>(rawCallResult);
// tslint:enable boolean-naming
return result;
},
};
public assertValidTransactionOrdersApproval = {
async callAsync(
transaction: {salt: BigNumber;signerAddress: string;data: string},
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
transactionSignature: string,
approvalExpirationTimeSeconds: BigNumber[],
approvalSignatures: string[],
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<void
> {
const self = this as any as TestMixinsContract;
const encodedData = self._strictEncodeArguments('assertValidTransactionOrdersApproval((uint256,address,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes,uint256[],bytes[])', [transaction,
orders,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('assertValidTransactionOrdersApproval((uint256,address,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes,uint256[],bytes[])');
// tslint:disable boolean-naming
const result = abiEncoder.strictDecodeReturnValue<void
>(rawCallResult);
// tslint:enable boolean-naming
return result;
},
};
public assertValidTECApprovals = {
async callAsync(
transaction: {salt: BigNumber;signerAddress: string;data: string},
transactionSignature: string,
approvalExpirationTimeSeconds: BigNumber[],
approvalSignatures: string[],
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<void
> {
const self = this as any as TestMixinsContract;
const encodedData = self._strictEncodeArguments('assertValidTECApprovals((uint256,address,bytes),bytes,uint256[],bytes[])', [transaction,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('assertValidTECApprovals((uint256,address,bytes),bytes,uint256[],bytes[])');
// tslint:disable boolean-naming
const result = abiEncoder.strictDecodeReturnValue<void
>(rawCallResult);
// tslint:enable boolean-naming
return result;
},
};
public EIP712_DOMAIN_HASH = {
async callAsync(
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<string
> {
const self = this as any as TestMixinsContract;
const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()');
// tslint:disable boolean-naming
const result = abiEncoder.strictDecodeReturnValue<string
>(rawCallResult);
// tslint:enable boolean-naming
return result;
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
supportedProvider: SupportedProvider,
txDefaults: Partial<TxData>,
): Promise<TestMixinsContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return TestMixinsContract.deployAsync(bytecode, abi, provider, txDefaults, );
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
supportedProvider: SupportedProvider,
txDefaults: Partial<TxData>,
): Promise<TestMixinsContract> {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, []);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
txDefaults,
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
);
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
logUtils.log(`transactionHash: ${txHash}`);
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`TestMixins successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new TestMixinsContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('TestMixins', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method

View File

@@ -1,4 +1,22 @@
[
{
"version": "3.1.2",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"timestamp": 1553183790,
"version": "3.1.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.1.0",
"changes": [

View File

@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.2 - _April 11, 2019_
* Dependencies updated
## v3.1.1 - _March 21, 2019_
* Dependencies updated
## v3.1.0 - _March 20, 2019_
* Added ERC1155Proxy test constants and interfaces (#1661)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "3.1.0",
"version": "3.1.2",
"engines": {
"node": ">=6.12"
},
@@ -17,6 +17,7 @@
"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",
"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",
@@ -40,19 +41,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/dev-utils": "^2.1.4",
"@0x/order-utils": "^7.1.0",
"@0x/sol-compiler": "^3.1.4",
"@0x/sol-coverage": "^3.0.1",
"@0x/sol-profiler": "^3.1.3",
"@0x/sol-trace": "^2.0.9",
"@0x/subproviders": "^4.0.3",
"@0x/tslint-config": "^3.0.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"@0x/abi-gen": "^2.0.9",
"@0x/dev-utils": "^2.2.1",
"@0x/order-utils": "^7.2.0",
"@0x/sol-compiler": "^3.1.6",
"@0x/sol-coverage": "^3.0.3",
"@0x/sol-profiler": "^3.1.5",
"@0x/sol-trace": "^2.0.11",
"@0x/subproviders": "^4.0.5",
"@0x/tslint-config": "^3.0.1",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"@types/bn.js": "^4.11.0",
"@types/js-combinatorics": "^0.5.29",
"@types/lodash": "4.14.104",
@@ -62,7 +63,7 @@
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"ethereum-types": "^2.1.1",
"ethereum-types": "^2.1.2",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"js-combinatorics": "^0.5.3",

View File

@@ -24,7 +24,7 @@ export type sendTransactionResult = Promise<TransactionReceipt | TransactionRece
* node.
*/
async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: string): Promise<string> {
if (_.isUndefined(nodeType)) {
if (nodeType === undefined) {
nodeType = await web3Wrapper.getNodeTypeAsync();
}
switch (nodeType) {
@@ -99,7 +99,7 @@ export async function expectTransactionFailedAsync(p: sendTransactionResult, rea
_.noop(e);
});
if (_.isUndefined(nodeType)) {
if (nodeType === undefined) {
nodeType = await web3Wrapper.getNodeTypeAsync();
}
switch (nodeType) {

View File

@@ -1,5 +1,3 @@
import * as _ from 'lodash';
import { constants } from './constants';
import { web3Wrapper } from './web3_wrapper';
@@ -13,7 +11,7 @@ let firstAccount: string | undefined;
* reject if the time could not be increased.
*/
export async function increaseTimeAndMineBlockAsync(seconds: number): Promise<number> {
if (_.isUndefined(firstAccount)) {
if (firstAccount === undefined) {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
firstAccount = accounts[0];
}
@@ -36,7 +34,7 @@ export async function increaseTimeAndMineBlockAsync(seconds: number): Promise<nu
*/
export async function getLatestBlockTimestampAsync(): Promise<number> {
const currentBlockIfExists = await web3Wrapper.getBlockIfExistsAsync('latest');
if (_.isUndefined(currentBlockIfExists)) {
if (currentBlockIfExists === undefined) {
throw new Error(`Unable to fetch latest block.`);
}
return currentBlockIfExists.timestamp;

View File

@@ -1,12 +1,10 @@
import { devConstants } from '@0x/dev-utils';
import { CoverageSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-coverage';
import * as _ from 'lodash';
let coverageSubprovider: CoverageSubprovider;
export const coverage = {
getCoverageSubproviderSingleton(): CoverageSubprovider {
if (_.isUndefined(coverageSubprovider)) {
if (coverageSubprovider === undefined) {
coverageSubprovider = coverage._getCoverageSubprovider();
}
return coverageSubprovider;

View File

@@ -37,7 +37,7 @@ export class LogDecoder {
public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
// tslint:disable-next-line:no-unnecessary-type-assertion
if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
if ((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args === undefined) {
throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
}
LogDecoder.wrapLogBigNumbers(logWithDecodedArgsOrLog);

View File

@@ -1,6 +1,5 @@
import { devConstants } from '@0x/dev-utils';
import { ProfilerSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-profiler';
import * as _ from 'lodash';
let profilerSubprovider: ProfilerSubprovider;
@@ -12,7 +11,7 @@ export const profiler = {
profiler.getProfilerSubproviderSingleton().stop();
},
getProfilerSubproviderSingleton(): ProfilerSubprovider {
if (_.isUndefined(profilerSubprovider)) {
if (profilerSubprovider === undefined) {
profilerSubprovider = profiler._getProfilerSubprovider();
}
return profilerSubprovider;

View File

@@ -1,12 +1,11 @@
import { devConstants } from '@0x/dev-utils';
import { RevertTraceSubprovider, SolCompilerArtifactAdapter } from '@0x/sol-trace';
import * as _ from 'lodash';
let revertTraceSubprovider: RevertTraceSubprovider;
export const revertTrace = {
getRevertTraceSubproviderSingleton(): RevertTraceSubprovider {
if (_.isUndefined(revertTraceSubprovider)) {
if (revertTraceSubprovider === undefined) {
revertTraceSubprovider = revertTrace._getRevertTraceSubprovider();
}
return revertTraceSubprovider;

View File

@@ -1,4 +1,23 @@
[
{
"version": "3.1.1",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"version": "3.1.0",
"changes": [
{
"note": "Added `startProviderEngine` to `providerUtils`. Preventing excess block polling",
"pr": 1695
}
],
"timestamp": 1553183790
},
{
"version": "3.0.0",
"changes": [
@@ -13,6 +32,14 @@
{
"note": "Added Address.sol with test for whether or not an address is a contract",
"pr": 1657
},
{
"note": "Add unit tests for `LibAddressArray`",
"pr": 1712
},
{
"note": "Fix `LibAddressArray.indexOf` returning incorrect index.",
"pr": 1712
}
],
"timestamp": 1553091633

View File

@@ -5,11 +5,21 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.1.1 - _April 11, 2019_
* Dependencies updated
## v3.1.0 - _March 21, 2019_
* Added `startProviderEngine` to `providerUtils`. Preventing excess block polling (#1695)
## v3.0.0 - _March 20, 2019_
* Optimize loops in LibAddressArray (#1668)
* Upgrade contracts to Solidity 0.5.5 (#1682)
* Added Address.sol with test for whether or not an address is a contract (#1657)
* Add unit tests for `LibAddressArray` (#1712)
* Fix `LibAddressArray.indexOf` returning incorrect index. (#1712)
## v2.0.8 - _March 1, 2019_

View File

@@ -30,6 +30,7 @@
"src/SafeMath.sol",
"src/interfaces/IOwnable.sol",
"test/TestConstants.sol",
"test/TestLibAddressArray.sol",
"test/TestLibBytes.sol"
]
}

View File

@@ -30,7 +30,7 @@ library LibAddressArray {
/// @param addressArray Array of addresses.
/// @param addressToAppend Address to append.
/// @return Array of addresses: [... addressArray, addressToAppend]
function append(address[] memory addressArray, address addressToAppend)
function append(address[] memory addressArray, address addressToAppend)
internal
pure
returns (address[] memory)
@@ -148,7 +148,7 @@ library LibAddressArray {
if eq(target, arrayElement) {
// Set success and index
success := 1
index := div(i, 32)
index := div(sub(i, arrayContentsStart), 32)
// Break loop
i := arrayContentsEnd
}

View File

@@ -0,0 +1,106 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.5;
import "../src/LibAddressArray.sol";
contract TestLibAddressArray {
using LibAddressArray for address[];
/// @dev Append a new address to an array of addresses.
/// The `addressArray` may need to be reallocated to make space
/// for the new address. Because of this we return the resulting
/// memory location of `addressArray`.
/// @param addressArray Array of addresses.
/// @param addressToAppend Address to append.
/// @return Array of addresses: [... addressArray, addressToAppend]
function publicAppend(address[] memory addressArray, address addressToAppend)
public
pure
returns (address[] memory)
{
return addressArray.append(addressToAppend);
}
/// @dev Moves the free memory pointer by `freeMemOffset` bytes,
/// then performs the append.
/// This tests the behavior of the address array being reallocated if
/// the memory immediately after the old array is claimed.
/// @param addressArray Array of addresses.
/// @param freeMemOffset Number of (signed) bytes to offset the free memory pointer (0x40).
/// @param addressToAppend Address to append.
/// @return The new address array.
/// @return The memory address of the old address array.
/// @return The memory address of the new address array.
function testAppendRealloc(
address[] memory addressArray,
int256 freeMemOffset,
address addressToAppend
)
public
pure
returns (
address[] memory result,
uint256 oldArrayMemStart,
uint256 newArrayMemStart
)
{
assembly {
// Remember the original memory address of the array.
oldArrayMemStart := addressArray
// Move the free memory pointer.
mstore(0x40, add(mload(0x40), freeMemOffset))
}
// Call append.
result = addressArray.append(addressToAppend);
// Get the new array memory address.
assembly {
newArrayMemStart := result
}
}
/// @dev Checks if an address array contains the target address.
/// @param addressArray Array of addresses.
/// @param target Address to search for in array.
/// @return True if the addressArray contains the target.
function publicContains(address[] memory addressArray, address target)
public
pure
returns (bool success)
{
return addressArray.contains(target);
}
/// @dev Finds the index of an address within an array.
/// @param addressArray Array of addresses.
/// @param target Address to search for in array.
/// @return Existence and index of the target in the array.
function publicIndexOf(address[] memory addressArray, address target)
public
pure
returns (bool success, uint256 index)
{
(success, index) = addressArray.indexOf(target);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "3.0.0",
"version": "3.1.1",
"engines": {
"node": ">=6.12"
},
@@ -24,6 +24,7 @@
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -33,7 +34,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "./generated-artifacts/@(IOwnable|LibBytes|Ownable|ReentrancyGuard|SafeMath|TestConstants|TestLibBytes).json",
"abis": "./generated-artifacts/@(Address|IOwnable|LibBytes|Ownable|ReentrancyGuard|SafeMath|TestConstants|TestLibAddressArray|TestLibBytes).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
@@ -46,12 +47,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.7",
"@0x/contracts-gen": "^1.0.6",
"@0x/contracts-test-utils": "^3.1.0",
"@0x/dev-utils": "^2.1.4",
"@0x/sol-compiler": "^3.1.4",
"@0x/tslint-config": "^3.0.0",
"@0x/abi-gen": "^2.0.9",
"@0x/contracts-gen": "^1.0.8",
"@0x/contracts-test-utils": "^3.1.2",
"@0x/dev-utils": "^2.2.1",
"@0x/sol-compiler": "^3.1.6",
"@0x/tslint-config": "^3.0.1",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -68,14 +69,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.3",
"@0x/order-utils": "^7.1.0",
"@0x/types": "^2.2.0",
"@0x/typescript-typings": "^4.2.0",
"@0x/utils": "^4.2.3",
"@0x/web3-wrapper": "^6.0.3",
"@0x/base-contract": "^5.0.5",
"@0x/order-utils": "^7.2.0",
"@0x/types": "^2.2.2",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"@0x/web3-wrapper": "^6.0.5",
"bn.js": "^4.11.8",
"ethereum-types": "^2.1.1",
"ethereum-types": "^2.1.2",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"
},

View File

@@ -5,14 +5,17 @@
*/
import { ContractArtifact } from 'ethereum-types';
import * as Address from '../generated-artifacts/Address.json';
import * as IOwnable from '../generated-artifacts/IOwnable.json';
import * as LibBytes from '../generated-artifacts/LibBytes.json';
import * as Ownable from '../generated-artifacts/Ownable.json';
import * as ReentrancyGuard from '../generated-artifacts/ReentrancyGuard.json';
import * as SafeMath from '../generated-artifacts/SafeMath.json';
import * as TestConstants from '../generated-artifacts/TestConstants.json';
import * as TestLibAddressArray from '../generated-artifacts/TestLibAddressArray.json';
import * as TestLibBytes from '../generated-artifacts/TestLibBytes.json';
export const artifacts = {
Address: Address as ContractArtifact,
LibBytes: LibBytes as ContractArtifact,
Ownable: Ownable as ContractArtifact,
ReentrancyGuard: ReentrancyGuard as ContractArtifact,
@@ -20,4 +23,5 @@ export const artifacts = {
IOwnable: IOwnable as ContractArtifact,
TestConstants: TestConstants as ContractArtifact,
TestLibBytes: TestLibBytes as ContractArtifact,
TestLibAddressArray: TestLibAddressArray as ContractArtifact,
};

View File

@@ -3,10 +3,12 @@
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/address';
export * from '../generated-wrappers/i_ownable';
export * from '../generated-wrappers/lib_bytes';
export * from '../generated-wrappers/ownable';
export * from '../generated-wrappers/reentrancy_guard';
export * from '../generated-wrappers/safe_math';
export * from '../generated-wrappers/test_constants';
export * from '../generated-wrappers/test_lib_address_array';
export * from '../generated-wrappers/test_lib_bytes';

View File

@@ -1,8 +1,10 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
import { providerUtils } from '@0x/utils';
before('start web3 provider', () => {
provider.start();
providerUtils.startProviderEngine(provider);
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {

View File

@@ -0,0 +1,161 @@
import {
addressUtils,
chaiSetup,
expectContractCallFailedAsync,
provider,
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { RevertReason } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import { artifacts, TestLibAddressArrayContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('LibAddressArray', () => {
let lib: TestLibAddressArrayContract;
before(async () => {
await blockchainLifecycle.startAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
// Deploy LibAddressArray
lib = await TestLibAddressArrayContract.deployFrom0xArtifactAsync(
artifacts.TestLibAddressArray,
provider,
txDefaults,
);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('append', () => {
it('should append to empty array', async () => {
const addr = addressUtils.generatePseudoRandomAddress();
const result = await lib.publicAppend.callAsync([], addr);
const expected = [addr];
expect(result).to.deep.equal(expected);
});
it('should append to non-empty array', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const expected = [...arr, addr];
const result = await lib.publicAppend.callAsync(arr, addr);
expect(result).to.deep.equal(expected);
});
it('should revert if the free memory pointer was moved to before the end of the array', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const freeMemOffset = new BigNumber(-1);
return expectContractCallFailedAsync(
lib.testAppendRealloc.callAsync(arr, freeMemOffset, addr),
RevertReason.InvalidFreeMemoryPtr,
);
});
it('should keep the same memory address if free memory pointer does not move', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const freeMemOffset = new BigNumber(0);
const expected = [...arr, addr];
const [result, oldArrayMemStart, newArrayMemStart] = await lib.testAppendRealloc.callAsync(
arr,
freeMemOffset,
addr,
);
expect(result).to.deep.equal(expected);
expect(newArrayMemStart).bignumber.to.be.equal(oldArrayMemStart);
});
it('should change memory address if free memory pointer advances', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const freeMemOffset = new BigNumber(1);
const expectedArray = [...arr, addr];
const [result, oldArrayMemStart, newArrayMemStart] = await lib.testAppendRealloc.callAsync(
arr,
freeMemOffset,
addr,
);
// The new location should be the end of the old array + freeMemOffset.
const expectedNewArrayMemStart = oldArrayMemStart.plus((arr.length + 1) * 32).plus(freeMemOffset);
expect(result).to.deep.equal(expectedArray);
expect(newArrayMemStart).bignumber.to.be.equal(expectedNewArrayMemStart);
});
});
describe('contains', () => {
it('should return false on an empty array', async () => {
const addr = addressUtils.generatePseudoRandomAddress();
const isFound = await lib.publicContains.callAsync([], addr);
expect(isFound).to.equal(false);
});
it('should return false on a missing item', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const isFound = await lib.publicContains.callAsync(arr, addr);
expect(isFound).to.equal(false);
});
it('should return true on an included item', async () => {
const arr = _.times(4, () => addressUtils.generatePseudoRandomAddress());
const addr = _.sample(arr) as string;
const isFound = await lib.publicContains.callAsync(arr, addr);
expect(isFound).to.equal(true);
});
it('should return true on the only item in the array', async () => {
const arr = _.times(1, () => addressUtils.generatePseudoRandomAddress());
const isFound = await lib.publicContains.callAsync(arr, arr[0]);
expect(isFound).to.equal(true);
});
});
describe('indexOf', () => {
it('should fail on an empty array', async () => {
const addr = addressUtils.generatePseudoRandomAddress();
const [isSuccess] = await lib.publicIndexOf.callAsync([], addr);
expect(isSuccess).to.equal(false);
});
it('should fail on a missing item', async () => {
const arr = _.times(3, () => addressUtils.generatePseudoRandomAddress());
const addr = addressUtils.generatePseudoRandomAddress();
const [isSuccess] = await lib.publicIndexOf.callAsync(arr, addr);
expect(isSuccess).to.equal(false);
});
it('should succeed on an included item', async () => {
const arr = _.times(4, () => addressUtils.generatePseudoRandomAddress());
const expectedIndexOf = _.random(0, arr.length - 1);
const addr = arr[expectedIndexOf];
const [isSuccess, index] = await lib.publicIndexOf.callAsync(arr, addr);
expect(isSuccess).to.equal(true);
expect(index).bignumber.to.equal(expectedIndexOf);
});
it('should succeed on the only item in the array', async () => {
const arr = _.times(1, () => addressUtils.generatePseudoRandomAddress());
const [isSuccess, index] = await lib.publicIndexOf.callAsync(arr, arr[0]);
expect(isSuccess).to.equal(true);
expect(index).bignumber.to.equal(0);
});
});
});
// tslint:disable:max-file-line-count

View File

@@ -3,12 +3,14 @@
"compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": [
"generated-artifacts/Address.json",
"generated-artifacts/IOwnable.json",
"generated-artifacts/LibBytes.json",
"generated-artifacts/Ownable.json",
"generated-artifacts/ReentrancyGuard.json",
"generated-artifacts/SafeMath.json",
"generated-artifacts/TestConstants.json",
"generated-artifacts/TestLibAddressArray.json",
"generated-artifacts/TestLibBytes.json"
],
"exclude": ["./deploy/solc/solc_bin"]

View File

@@ -10,6 +10,7 @@
],
"scripts": {
"deps_versions:ci": "node ./packages/monorepo-scripts/lib/deps_versions.js",
"fix": "wsrun fix $PKG --fast-exit --parallel --exclude-missing",
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",

View File

@@ -1,10 +1,10 @@
# Blacklist all files
.*
tsconfig.json
webpack.config.js
yarn-error.log
test/
/src/
/abi-gen-templates/
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/
*
# Whitelist lib
!lib/**/*
# Blacklist tests and publish scripts
/lib/test/*
/lib/monorepo_scripts/
# Package specific ignore
!_bundles/**/*

View File

@@ -1,4 +1,22 @@
[
{
"version": "6.0.6",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"timestamp": 1553183790,
"version": "6.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1553091633,
"version": "6.0.4",

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