Compare commits

...

2975 Commits

Author SHA1 Message Date
Fabio Berger
b756f76b0e Publish
- 0x.js@1.0.1-rc.1
 - @0xproject/abi-gen@1.0.2
 - @0xproject/assert@1.0.2
 - @0xproject/base-contract@1.0.2
 - @0xproject/connect@1.0.2
 - @0xproject/contract-wrappers@1.0.1-rc.1
 - contracts@2.1.37
 - @0xproject/dev-utils@1.0.2
 - ethereum-types@1.0.2
 - @0xproject/fill-scenarios@1.0.1-rc.1
 - @0xproject/json-schemas@1.0.1-rc.1
 - @0xproject/metacoin@0.0.12
 - @0xproject/migrations@1.0.2
 - @0xproject/monorepo-scripts@1.0.3
 - @0xproject/order-utils@1.0.1-rc.1
 - @0xproject/order-watcher@1.0.1-rc.1
 - @0xproject/react-docs@1.0.2
 - @0xproject/react-docs-example@0.0.17
 - @0xproject/react-shared@1.0.3
 - @0xproject/sol-compiler@1.0.2
 - @0xproject/sol-cov@1.0.2
 - @0xproject/sol-resolver@1.0.2
 - @0xproject/sra-report@1.0.2
 - @0xproject/subproviders@1.0.2
 - @0xproject/testnet-faucets@1.0.38
 - @0xproject/tslint-config@1.0.3
 - @0xproject/types@1.0.1-rc.1
 - @0xproject/typescript-typings@1.0.2
 - @0xproject/utils@1.0.2
 - @0xproject/web3-wrapper@1.1.0
 - @0xproject/website@0.0.41
2018-07-26 13:53:36 +02:00
Fabio Berger
034948065d Updated CHANGELOGS 2018-07-26 13:53:27 +02:00
Fabio Berger
0c2df7e589 Fix linter 2018-07-26 13:40:37 +02:00
Fabio Berger
2ae6a71ca3 Revert to using execAsync 2018-07-26 13:27:21 +02:00
Fabio Berger
206fd0f78e update yarn.lock 2018-07-26 13:20:35 +02:00
Fabio Berger
b84225ac70 Revert to publishing ethereum-types 2018-07-26 13:05:36 +02:00
Fabio Berger
5ebcea53d6 Fix marshaller import 2018-07-26 12:59:48 +02:00
Fabio Berger
a491e01144 Update yarn.lock 2018-07-26 12:52:25 +02:00
Fabio Berger
1236efc008 Temporarily have all packages depend on an older, published version of ethereum-types since we cannot publish a new one 2018-07-26 12:50:15 +02:00
Fabio Berger
e63bbdeb87 Temporarily make ethereum-types private to exclude from publishing 2018-07-26 12:40:31 +02:00
Fabio Berger
084ccb62a6 Add order-watcher artifacts to gitignore 2018-07-26 12:35:22 +02:00
Fabio Berger
015469885d Fix changelogs 2018-07-26 12:34:41 +02:00
Fabio Berger
061f223269 Remove artifacts for git 2018-07-26 12:15:01 +02:00
Fabio Berger
88ee35d5f9 Call 'lerna publish' with spawn so we see stderr and stdout in real-time 2018-07-26 12:14:13 +02:00
Francesco Agosti
6c5b33ec71 Merge pull request #902 from 0xProject/feature/web3-wrapper/unexport-marshaller
Stop exporting marshaller from web3-wrapper
2018-07-25 16:32:04 -07:00
Brandon Millman
31b8dd1bfc Remove careers page feature flag 2018-07-26 06:55:06 +08:00
Brandon Millman
35113487f1 Merge pull request #893 from 0xProject/feature/website/jobs-page-part2
Jobs page
2018-07-25 15:31:54 -07:00
Brandon Millman
9ce8e10115 Header copy change 2018-07-26 06:28:17 +08:00
Brandon Millman
d07d059eda Margin polish 2018-07-26 06:00:35 +08:00
Fabio Berger
d836b0f815 Also skip prompt when publishing for real 2018-07-25 22:34:50 +02:00
Fabio Berger
1b1733ce7c Merge pull request #911 from 0xProject/fix-v2-beta-migration
Update/Fix V2-beta-testnet migration & Use it in all RC packages
2018-07-25 22:21:32 +02:00
Fabio Berger
5fd64a969b Add order-watcher artifacts to prettierignore 2018-07-25 22:04:12 +02:00
Fabio Berger
9a762e584c Add contract-wrappers artifacts to prettierignore 2018-07-25 21:51:36 +02:00
Fabio Berger
7fc0fd9fb6 Prettier fixes 2018-07-25 21:36:56 +02:00
fragosti
da4b70fcae Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/web3-wrapper/unexport-marshaller 2018-07-25 10:33:13 -07:00
Fabio Berger
a0db69ee05 Missing artifact 2018-07-25 19:10:36 +02:00
Fabio Berger
2c62504b79 Replace hard-coded compact_artifacts with migrations artifacts 2018-07-25 18:47:40 +02:00
Fabio Berger
67303106dc Update order-utils to use 2.0.0-beta-testnet artifacts 2018-07-25 18:28:09 +02:00
Fabio Berger
600d574042 Remove artifacts which should no longer be commited 2018-07-25 18:18:28 +02:00
Fabio Berger
07d4f21807 Add artifacts to gitignore 2018-07-25 18:16:09 +02:00
Fabio Berger
4da12067b9 New WETH9 artifacts 2018-07-25 18:12:28 +02:00
Fabio Berger
24ab24879c Modify WETH9 event arg names to be identical to ERC20 standard suggested names 2018-07-25 18:10:10 +02:00
Fabio Berger
dc51741b83 Update artifacts in contract-wrappers, generate artifacts and improve README 2018-07-25 18:07:12 +02:00
Fabio Berger
dd979dbf6d Update the kovan addresses in artifacts 2018-07-25 14:58:04 +02:00
Fabio Berger
0cfea5613a Improve the README instructions for migrations 2018-07-25 14:57:38 +02:00
Fabio Berger
98dd3ecab7 Use infura 2018-07-25 14:49:33 +02:00
Fabio Berger
fe05e0bac3 Fix typo 2018-07-25 14:48:28 +02:00
Fabio Berger
d3f9b72c84 Update v2-beta-testnet migration 2018-07-25 13:12:26 +02:00
Fabio Berger
05b35c0fdc Merge pull request #908 from 0xProject/publish-fixes-rc
Publish Flow Fixes For RC releases
2018-07-25 12:33:08 +02:00
Fabio Berger
36b61650b3 Update yarn.lock to not use local npm registry 2018-07-25 12:13:45 +02:00
Brandon Millman
c37b6f0eeb Update open positions section 2018-07-25 18:08:05 +08:00
Fabio Berger
28114c3b5a Remove unused import 2018-07-25 12:04:45 +02:00
Fabio Berger
2617df4ec7 Update artifact 2018-07-25 12:04:00 +02:00
Fabio Berger
0d28c48eb9 update yarn.lock 2018-07-25 12:02:16 +02:00
Fabio Berger
c6a6a54cce Fix dep collision 2018-07-25 12:02:10 +02:00
Fabio Berger
e5aa03da64 merge v2-prototype 2018-07-25 11:59:29 +02:00
Fabio Berger
47c0195b07 Leave react-dom type version also unspecified 2018-07-25 11:57:17 +02:00
Fabio Berger
f13d43dbf5 Remove unused typwe 2018-07-25 11:54:51 +02:00
Fabio Berger
f9e99a27d3 Remove force publish 2018-07-25 11:51:06 +02:00
Brandon Millman
854b8fad22 Update benefits section 2018-07-25 17:48:12 +08:00
Fabio Berger
91c7105d43 Revert "Temporarily add changelog & package.json version changes"
This reverts commit 97268d2253.
2018-07-25 11:48:01 +02:00
Fabio Berger
c1e3533287 Add back build step 2018-07-25 11:47:52 +02:00
Brandon Millman
bb7c308081 Update mission section 2018-07-25 15:35:26 +08:00
Brandon Millman
fcbaf2f4e3 Header copy updates 2018-07-25 14:41:26 +08:00
Brandon Millman
109c5df973 Use isMobileWidth util 2018-07-25 14:24:00 +08:00
Brandon Millman
b0fab3ea4a Use our image component in mission 2018-07-25 14:21:39 +08:00
Leonid Logvinov
c40b3dea6c Specify registry url only if local publish attempted 2018-07-24 21:57:47 +02:00
Leonid Logvinov
dbc798596b Replace dry mode with local publishing mode 2018-07-24 21:57:47 +02:00
Amir Bandeali
fac90c446c Update orderEpoch comments 2018-07-24 10:46:08 -07:00
Fabio Berger
c5859b65a3 Install our fork of lerna and use it 2018-07-24 19:35:13 +02:00
Francesco Agosti
14bb697924 Merge pull request #891 from 0xProject/bug/website/wiki-page-topbar
Make topbar zIndex 1
2018-07-24 10:22:18 -07:00
Fabio Berger
dbd815c1e0 Merge pull request #905 from 0xProject/fix-rc-packages
Fix Published Packages Type Issues
2018-07-24 18:45:10 +02:00
Fabio Berger
9592a9a821 Omit specific version of react types 2018-07-24 17:15:25 +02:00
Fabio Berger
dd9f020c9b Correct next version 2018-07-24 17:15:18 +02:00
Fabio Berger
56f21f4bab Merge v2-prototype 2018-07-24 17:13:21 +02:00
Fabio Berger
91bc1b468b Omit specific version of react types 2018-07-24 16:44:40 +02:00
Fabio Berger
97268d2253 Temporarily add changelog & package.json version changes 2018-07-24 16:33:16 +02:00
Fabio Berger
14b3c50b69 Fix lerna verson 2018-07-24 16:29:55 +02:00
Fabio Berger
333bf9de05 Correct next version 2018-07-24 16:29:37 +02:00
Fabio Berger
16a38c687e Merge fix-rc-packages 2018-07-24 16:20:25 +02:00
Leonid Logvinov
24aa5cd1bf Make the test:installation work with the local npm registry 2018-07-24 16:08:17 +02:00
Leonid Logvinov
f699da90ba Pretend we defined types for @lerna/batch-packages 2018-07-24 16:07:32 +02:00
Leonid Logvinov
d1e33a3dff Add utils.getTopologicallySortedPackages 2018-07-24 16:07:11 +02:00
Leonid Logvinov
f50ac932d6 Introduce PackageJson file 2018-07-24 16:06:51 +02:00
Leonid Logvinov
cab32d7593 Add .npmrc to gitignore 2018-07-24 16:05:25 +02:00
Leonid Logvinov
2073aa9abc Test installation on latest version, not the packed one 2018-07-24 15:19:57 +02:00
Leonid Logvinov
0386025395 Temp: Force publish 2018-07-24 15:19:36 +02:00
Leonid Logvinov
0772403ea9 Fix(lerna): Change lerna version 2018-07-24 15:18:46 +02:00
Fabio Berger
8acfc9a2f9 improve logs 2018-07-24 13:43:27 +02:00
Fabio Berger
de087abc8d remove legacy prepublishOnly 2018-07-24 13:32:39 +02:00
Fabio Berger
98b2875512 Add --yes flag 2018-07-24 13:28:02 +02:00
Fabio Berger
e9e73aa0a3 Add node 2018-07-24 13:21:28 +02:00
Fabio Berger
d280311734 Use relative path to lerna executable 2018-07-24 13:19:31 +02:00
Fabio Berger
789762617f Upgrade to new lerna 2018-07-24 13:05:18 +02:00
Fabio Berger
6f38d1bee5 Add missing 'publish' 2018-07-24 12:46:40 +02:00
Fabio Berger
73d75bc405 Fix publish command 2018-07-24 12:44:38 +02:00
Fabio Berger
91dcfd5ee8 Use cdVersions flag instead of interactive prompt 2018-07-24 12:39:41 +02:00
Fabio Berger
5fe0e9f2e7 Temporarily use local lerna 2018-07-24 12:36:53 +02:00
Brandon Millman
51fb6e6a23 Always go to open positions when clicking CTA 2018-07-24 14:06:53 +08:00
Brandon Millman
9392d5c84f Fix hiding of dots on small screens 2018-07-24 13:51:37 +08:00
Brandon Millman
e49d136b99 Merge branch 'v2-prototype' into feature/website/jobs-page-part2
* v2-prototype: (38 commits)
  Revert "Publish"
  Publish
  Remove ERC721 callback functions
  Use != instead of > in loops, add sanity checks to market fill functions
  Add more tests and fixes
  Remove MConstants and MixinConstants for LibConstants
  Remove redundant external call by reimplementing fillOrderNoThrow
  Remove orders length check
  Add assertValidFillResults
  Update web3Wrapper CHANGELOG
  Get actual gasPrice from transaction instead of setting default
  Store orders length in varible before looping over orders
  Use transferFrom instead of safeTransferFrom
  Fix minimal tests
  Fix rounding error issues, use different logic when makerAsset is ZRX
  Rename marketSellEth => marketSellWeth
  Update percentage constants
  Update transferEthFeeAndRefund, add check to ERC721 transfer
  Refactor forwarding contract architecture, remove batch functions
  Updated CHANGELOGS
  ...
2018-07-24 13:43:26 +08:00
Fabio Berger
d50174b89e Add ignore flag 2018-07-23 21:33:03 +02:00
Fabio Berger
1d9a77027e Use include 2018-07-23 21:23:09 +02:00
Fabio Berger
b4cd8897b2 Dedup versionPrompt being triggered multiple times 2018-07-23 21:20:09 +02:00
Fabio Berger
df341717f7 Remove regex 2018-07-23 21:14:51 +02:00
Fabio Berger
68974313e1 Make regex less strict 2018-07-23 21:12:47 +02:00
Fabio Berger
39a06e1d3b Add timeout before writing to stdin 2018-07-23 21:10:44 +02:00
Fabio Berger
bfe57b84d6 Use string equals and remove returns 2018-07-23 20:59:41 +02:00
Fabio Berger
dae975b08c Add in print statements 2018-07-23 20:51:25 +02:00
Fabio Berger
27d44e3021 Add missing vars 2018-07-23 20:46:10 +02:00
Fabio Berger
df00d93b9c Also add private package new versions to packageToNextVersion 2018-07-23 20:44:47 +02:00
Fabio Berger
15bbbb3762 Make sure private packages have a next version 2018-07-23 20:36:03 +02:00
Fabio Berger
c9ee526d8b more bogus 2018-07-23 20:30:51 +02:00
Fabio Berger
b110d95de1 testing 2018-07-23 20:29:14 +02:00
Fabio Berger
76eab5d3ec Fix publish to give lerna actual version rather then the semver diff 2018-07-23 20:21:49 +02:00
Fabio Berger
4a2715e61f Update lerna.json 2018-07-23 20:19:04 +02:00
Fabio Berger
7fbcc3999f Changed artifacts 2018-07-23 20:16:16 +02:00
Fabio Berger
e873b8948f And also temporarily remove rebuilding from publish flow 2018-07-23 20:15:35 +02:00
Fabio Berger
c8108a1db2 Temporarily uncommented parts of publish flow 2018-07-23 20:12:18 +02:00
Fabio Berger
195c3af84e Fix lerna publish to include publishing prerelease versions 2018-07-23 19:56:53 +02:00
Fabio Berger
39724292e3 Omit building website before publish 2018-07-23 19:28:27 +02:00
Fabio Berger
24b5aa0e82 Add new RC versions to changelog so that these packages are publised as RC's 2018-07-23 19:18:09 +02:00
Fabio Berger
3af2ef8439 Revert "Revert "Publish""
This reverts commit a66ccaa1da.
2018-07-23 19:11:48 +02:00
Fabio Berger
e2d027e252 Add skip-git for testing 2018-07-23 19:09:35 +02:00
Fabio Berger
bddcebfbb1 Allow registry to be configured in lerna.json 2018-07-23 19:09:24 +02:00
Amir Bandeali
a05b14e4d9 Merge pull request #847 from 0xProject/refactor/contracts/simplify-forwarder
Refactor forwarding contract architecture, remove batch functions
2018-07-23 10:50:39 -05:00
Fabio Berger
9a36e73f4e Move solidity-parser-antlr type to dependencies since it's used as part of the packages public interface 2018-07-23 17:35:16 +02:00
Leonid Logvinov
a66ccaa1da Revert "Publish"
This reverts commit 3dc94051713e4a32796ce3b4ae4b70b527e24cfe.
2018-07-23 17:13:44 +02:00
Leonid Logvinov
f05a563802 Publish
- 0x.js@1.0.0
 - @0xproject/abi-gen@1.0.1
 - @0xproject/assert@1.0.1
 - @0xproject/base-contract@1.0.1
 - @0xproject/connect@1.0.1
 - @0xproject/contract-wrappers@1.0.0
 - contracts@2.1.36
 - @0xproject/dev-utils@1.0.1
 - ethereum-types@1.0.1
 - @0xproject/fill-scenarios@1.0.0
 - @0xproject/json-schemas@1.0.0
 - @0xproject/metacoin@0.0.11
 - @0xproject/migrations@1.0.1
 - @0xproject/monorepo-scripts@1.0.1
 - @0xproject/order-utils@1.0.0
 - @0xproject/order-watcher@1.0.0
 - @0xproject/react-docs@1.0.1
 - @0xproject/react-docs-example@0.0.16
 - @0xproject/react-shared@1.0.1
 - @0xproject/sol-compiler@1.0.1
 - @0xproject/sol-cov@1.0.1
 - @0xproject/sol-resolver@1.0.1
 - @0xproject/sra-report@1.0.1
 - @0xproject/subproviders@1.0.1
 - @0xproject/testnet-faucets@1.0.37
 - @0xproject/tslint-config@1.0.1
 - @0xproject/types@1.0.0
 - @0xproject/typescript-typings@1.0.1
 - @0xproject/utils@1.0.1
 - @0xproject/web3-wrapper@1.0.1
 - @0xproject/website@0.0.40
2018-07-23 17:13:44 +02:00
Amir Bandeali
06396b8874 Remove ERC721 callback functions 2018-07-23 10:02:51 -05:00
Amir Bandeali
e5e68de2d7 Use != instead of > in loops, add sanity checks to market fill functions 2018-07-23 10:02:51 -05:00
Amir Bandeali
dcc0908617 Add more tests and fixes 2018-07-23 10:02:51 -05:00
Amir Bandeali
45d68285f1 Remove MConstants and MixinConstants for LibConstants 2018-07-23 10:02:51 -05:00
Amir Bandeali
e20f3a0f97 Remove redundant external call by reimplementing fillOrderNoThrow 2018-07-23 10:02:51 -05:00
Amir Bandeali
c5029e61e3 Remove orders length check 2018-07-23 10:02:51 -05:00
Amir Bandeali
e90ed01105 Add assertValidFillResults 2018-07-23 10:02:51 -05:00
Amir Bandeali
d8099d53fe Update web3Wrapper CHANGELOG 2018-07-23 10:02:51 -05:00
Amir Bandeali
0a976a3fb8 Get actual gasPrice from transaction instead of setting default 2018-07-23 10:00:23 -05:00
Amir Bandeali
4636d5fbc2 Store orders length in varible before looping over orders 2018-07-23 10:00:23 -05:00
Amir Bandeali
3506ec1caa Use transferFrom instead of safeTransferFrom 2018-07-23 10:00:23 -05:00
Amir Bandeali
1f0e819756 Fix minimal tests 2018-07-23 10:00:23 -05:00
Amir Bandeali
799ff2a5c3 Fix rounding error issues, use different logic when makerAsset is ZRX 2018-07-23 10:00:23 -05:00
Amir Bandeali
ec5f768f9b Rename marketSellEth => marketSellWeth 2018-07-23 10:00:23 -05:00
Amir Bandeali
66ab010055 Update percentage constants 2018-07-23 10:00:23 -05:00
Amir Bandeali
6fb157488c Update transferEthFeeAndRefund, add check to ERC721 transfer 2018-07-23 10:00:23 -05:00
Amir Bandeali
814518dd80 Refactor forwarding contract architecture, remove batch functions 2018-07-23 10:00:23 -05:00
Amir Bandeali
554b18a466 Merge pull request #906 from 0xProject/refactor/contracts/examples
[contracts] Add `examples` directory
2018-07-23 10:00:06 -05:00
Leonid Logvinov
855b6b1dc5 Updated CHANGELOGS 2018-07-23 16:58:40 +02:00
Amir Bandeali
c2ae9f62a4 Add tests to verify ZRX_ASSET_DATA 2018-07-23 09:34:47 -05:00
Amir Bandeali
4159a8fe6e Add comments for deploying with constant ZRX_ASSET_DATA 2018-07-23 09:34:47 -05:00
Amir Bandeali
d8b44283a2 Move example contracts into new examples dir 2018-07-23 09:34:47 -05:00
Leonid Logvinov
2c1daf9c9a Add missing timestamps in CHANGELOGs 2018-07-23 16:24:13 +02:00
Fabio Berger
c7962216e9 Omit verson of react types 2018-07-23 16:02:03 +02:00
Leonid Logvinov
ffdaf88fd0 Add missing timestamps in CHANGELOGs 2018-07-23 15:57:16 +02:00
Fabio Berger
f84f879950 Stop specifying a specific version of @types/react so there can't be two instances of the type installed 2018-07-23 14:39:34 +02:00
Fabio Berger
eb6027fba7 Move hdkey typings to dependencies since it's part of the exported interface 2018-07-23 13:45:43 +02:00
Fabio Berger
9a1f0ac8e2 Add dependent types of the react-popper typings 2018-07-23 11:43:01 +02:00
Fabio Berger
51b6f8bc71 Revert "Move frontend package types out of typescript-typings since this package will be used in both node and browser contexts"
This reverts commit 74483631d0.
2018-07-23 11:42:01 +02:00
Fabio Berger
4f73b81b9c Add troubleshooting section to utils README 2018-07-23 11:00:27 +02:00
Amir Bandeali
195d11f9d0 Merge pull request #877 from 0xProject/feature/contracts/removeERC721Callback
Removed receiverData and `onReceive` callback from ERC721 proxy.
2018-07-22 18:14:09 -05:00
Fabio Berger
b325ad1735 Add additional required tsconfig option for utils package since it now relies on RequestInit & Response types defined in lib.dom.d.ts 2018-07-22 18:27:36 +02:00
Fabio Berger
74483631d0 Move frontend package types out of typescript-typings since this package will be used in both node and browser contexts 2018-07-22 16:22:19 +02:00
Fabio Berger
89b24a21a0 Add bn.js types as dep of typescript-typings since they are needed by ethereumjs-utils types 2018-07-22 15:57:47 +02:00
Fabio Berger
f0f13aa1dd Move ECSignature type from types package into eth-light-wallet type dec since only used there 2018-07-22 15:52:52 +02:00
Fabio Berger
06f61949f9 Merge pull request #880 from feuGeneA/patch-5
make PR template checklist more useful
2018-07-22 15:35:15 +02:00
Francesco Agosti
0e72b67865 Merge pull request #895 from 0xProject/feature/website/send-eth-from-portal
Send Ether from Portal
2018-07-22 03:45:21 -07:00
Fabio Berger
b987eebf21 Fix version of ethereumjs-abi to 0.6.5 to fix decoding bug 2018-07-22 07:37:12 +02:00
Fabio Berger
c808d12b74 Merge pull request #904 from lukeautry/luke/leading_zero_encode
0x.js v2: fix decodeAssetData for addresses starting in 0
2018-07-22 07:16:49 +02:00
Luke Autry
b466431ede fix decodeAssetData for addresses starting in 0 2018-07-21 18:05:33 -04:00
Amir Bandeali
bf69ca6e53 Merge pull request #899 from kroitor/patch-1
Deduplicate assert web3-wrapper signMessageAsync
2018-07-20 20:28:29 -07:00
Brandon Millman
6ffa907f0e Merge branch 'v2-prototype' into feature/website/jobs-page-part2
* v2-prototype: (103 commits)
  Add changelog entry for @0xproject/utils
  Add AbortController polyfill to fetchAsync in utils
  Increase node heap size for webpack command
  Add missing timestamp to CHANGELOG entries
  Upgrade some @0xproject packages to 1.0.0 in website
  Hard code fillOrder selector into abiEncodeFillOrder
  Returns byte array instead of memory range for encoding fillOrder calldata
  Created LibAbiEncoder with `fillOrderNoThrow`
  Add missing dep in migrations
  Fix the abi-gen entry point
  Fix linter error
  Remove the postinstall hook
  Update website package.json with original imports
  @0xproject/sra-report@1.0.0
  Change all package to depend on the new @0xproject/connect@1.0.0
  @0xproject/connect@1.0.0
  Use old assert version in @0xproject/connect
  FIx a typo
  Remove rc versions from unmigrated packages
  0x.js@1.0.0-rc.2
  ...
2018-07-20 16:15:04 -07:00
Brandon Millman
e54501522d Merge pull request #903 from 0xProject/bug/website/fix-website
Add AbortController polyfill to fetchAsync in utils
2018-07-20 13:51:12 -07:00
Brandon Millman
f2baeddc30 Merge branch 'v2-prototype' into bug/website/fix-website
* v2-prototype:
  Add missing timestamp to CHANGELOG entries
2018-07-20 12:07:27 -07:00
Brandon Millman
fd349b618a Add changelog entry for @0xproject/utils 2018-07-20 12:05:47 -07:00
Brandon Millman
6ca2a02766 Add AbortController polyfill to fetchAsync in utils 2018-07-20 11:58:38 -07:00
Brandon Millman
d9a282bd92 Increase node heap size for webpack command 2018-07-20 11:56:20 -07:00
Fabio Berger
dc151f7290 Add missing timestamp to CHANGELOG entries 2018-07-20 20:13:53 +02:00
Brandon Millman
cce2127f72 Upgrade some @0xproject packages to 1.0.0 in website 2018-07-20 10:55:47 -07:00
fragosti
ad4c2b95e4 Add remove marshaller to changelog notes 2018-07-20 08:51:16 -07:00
Amir Bandeali
8e7c395f59 Merge pull request #892 from 0xProject/refactor/contracts/LibAbiEncoder
Created LibAbiEncoder with `fillOrderNoThrow`
2018-07-20 07:43:40 -07:00
Amir Bandeali
02d50a513a Hard code fillOrder selector into abiEncodeFillOrder 2018-07-20 07:37:40 -07:00
Greg Hysen
d61759f6dd Returns byte array instead of memory range for encoding fillOrder calldata 2018-07-20 07:37:40 -07:00
Greg Hysen
5790ed7ba9 Created LibAbiEncoder with fillOrderNoThrow 2018-07-20 07:37:40 -07:00
fragosti
067adbfb62 Stop exporting marshaller from web3-wrapper 2018-07-20 07:37:17 -07:00
Leonid Logvinov
7fadba59e7 Merge pull request #901 from 0xProject/feature/abi-gen-fix
Fix the abi-gen entry point
2018-07-20 16:34:17 +02:00
Fabio Berger
bcde0731db Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo:
  Fix linter error
  Remove the postinstall hook
2018-07-20 16:31:49 +02:00
Fabio Berger
052afb67a4 Add missing dep in migrations 2018-07-20 16:31:39 +02:00
Leonid Logvinov
6e15d7bb0f Fix the abi-gen entry point 2018-07-20 16:30:47 +02:00
Igor Kroitor
5bb68974ec Deduplicate assert web3-wrapper signMessageAsync 2018-07-20 08:49:16 +03:00
Leonid Logvinov
0a3ba4d27d Fix linter error 2018-07-20 02:06:11 +02:00
Leonid Logvinov
482a226dc5 Remove the postinstall hook 2018-07-20 02:02:16 +02:00
Fabio Berger
9e69458ba8 Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo:
  @0xproject/sra-report@1.0.0
  Change all package to depend on the new @0xproject/connect@1.0.0
2018-07-20 01:24:19 +02:00
Fabio Berger
71e386d5fa Update website package.json with original imports 2018-07-20 01:22:48 +02:00
Leonid Logvinov
60b501b137 @0xproject/sra-report@1.0.0 2018-07-20 01:07:44 +02:00
Leonid Logvinov
36f8e9f1d5 Change all package to depend on the new @0xproject/connect@1.0.0 2018-07-20 01:06:14 +02:00
Leonid Logvinov
78707bd3ca @0xproject/connect@1.0.0 2018-07-20 01:03:15 +02:00
Leonid Logvinov
56137d0605 Use old assert version in @0xproject/connect 2018-07-20 01:01:54 +02:00
Leonid Logvinov
681a582630 FIx a typo 2018-07-20 00:54:44 +02:00
Leonid Logvinov
846a447c4d Remove rc versions from unmigrated packages 2018-07-20 00:50:13 +02:00
Leonid Logvinov
f76be4f016 0x.js@1.0.0-rc.2 2018-07-20 00:45:19 +02:00
Fabio Berger
ed19067096 Move methods in ZeroEx.assetData to ZeroEx itself 2018-07-20 00:39:23 +02:00
Leonid Logvinov
eb9f7c2c9d Fix scoping of assets in 0x.js 2018-07-20 00:21:59 +02:00
Leonid Logvinov
52693f7d0a 0x.js@1.0.0-rc.1 2018-07-20 00:11:00 +02:00
Leonid Logvinov
5e015872ef Remove bundles config 2018-07-20 00:07:25 +02:00
Leonid Logvinov
08c291bd3f @0xproject/order-watcher@1.0.0-rc.1 2018-07-20 00:05:44 +02:00
Leonid Logvinov
48c5d69c9d Add monorepo-scripts postpublish.ts 2018-07-20 00:05:25 +02:00
Leonid Logvinov
0f9c262bb0 Change all package to depend on the new @0xproject/contract-wrappers@1.0.0-rc.1 2018-07-20 00:01:24 +02:00
Leonid Logvinov
dff0fc65bf @0xproject/contract-wrappers@1.0.0-rc.1 2018-07-19 23:56:46 +02:00
Leonid Logvinov
161f96c07d Change all package to depend on the new @0xproject/migrations@1.0.0 2018-07-19 23:50:46 +02:00
Leonid Logvinov
67ad21b368 @0xproject/migrations@1.0.0 2018-07-19 23:46:23 +02:00
Leonid Logvinov
d5e633c38f Change all package to depend on the new @0xproject/sol-cov@1.0.0 2018-07-19 23:44:51 +02:00
Leonid Logvinov
617ef5b6ce @0xproject/sol-cov@1.0.0 2018-07-19 23:42:28 +02:00
Leonid Logvinov
8bd4e38d02 Change all package to depend on the new @0xproject/react-docs@1.0.0 2018-07-19 23:39:28 +02:00
Leonid Logvinov
f364b5c5ab @0xproject/react-docs@1.0.0 2018-07-19 23:38:13 +02:00
Leonid Logvinov
6486fced34 Change all package to depend on the new @0xproject/react-shared@1.0.0 2018-07-19 23:37:01 +02:00
Leonid Logvinov
bc9f2a51a2 @0xproject/react-shared@1.0.0 2018-07-19 23:35:14 +02:00
Leonid Logvinov
9c03b54d75 Copy postpublish scripts on build in fill-scenarios 2018-07-19 23:32:46 +02:00
Leonid Logvinov
eae08ea1e4 Change all package to depend on the new @0xproject/fill-scenarios@1.0.0-rc.1 2018-07-19 23:32:31 +02:00
Leonid Logvinov
6f276223c6 @0xproject/fill-scenarios@1.0.0-rc.1 2018-07-19 23:28:05 +02:00
Leonid Logvinov
21effcaa8b Change all package to depend on the new @0xproject/order-utils@1.0.0-rc.1 2018-07-19 23:26:32 +02:00
Leonid Logvinov
114b31a813 @0xproject/order-utils@1.0.0-rc.1 2018-07-19 23:23:37 +02:00
Leonid Logvinov
1a1b7a2bc4 Change all package to depend on the new @0xproject/sol-compiler@1.0.0 2018-07-19 23:21:29 +02:00
Leonid Logvinov
c9b213839a @0xproject/sol-compiler@1.0.0 2018-07-19 23:19:38 +02:00
Leonid Logvinov
4043fa76cc Change all package to depend on the new @0xproject/dev-utils@1.0.0 2018-07-19 23:16:47 +02:00
Leonid Logvinov
9c8e3bc4c9 @0xproject/dev-utils@1.0.0 2018-07-19 23:14:30 +02:00
Leonid Logvinov
18b1f01641 Change all package to depend on the new @0xproject/subproviders@1.0.0 2018-07-19 23:12:44 +02:00
Leonid Logvinov
9085c674e4 @0xproject/subproviders@1.0.0 2018-07-19 23:10:57 +02:00
Leonid Logvinov
b5d19d3fb1 Change all package to depend on the new @0xproject/base-contract@1.0.0 2018-07-19 23:05:01 +02:00
Leonid Logvinov
cc0477153b Fix the scripts build 2018-07-19 23:03:55 +02:00
Leonid Logvinov
76008b41c5 @0xproject/base-contract@1.0.0 2018-07-19 23:02:15 +02:00
Leonid Logvinov
8193fdc304 Change all package to depend on the new @0xproject/web3-wrapper@1.0.0 2018-07-19 22:57:27 +02:00
Leonid Logvinov
9d06c81078 FIx a typo 2018-07-19 22:56:17 +02:00
Leonid Logvinov
cdf85e5eee @0xproject/web3-wrapper@1.0.0 2018-07-19 22:54:32 +02:00
Leonid Logvinov
d774dbc432 Change all package to depend on the new @0xproject/abi-gen@1.0.0 2018-07-19 22:47:58 +02:00
Leonid Logvinov
0369f5ebc4 @0xproject/abi-gen@1.0.0 2018-07-19 22:46:33 +02:00
Leonid Logvinov
1e6b11b27e Change all package to depend on the new @0xproject/assert@1.0.0 2018-07-19 22:45:22 +02:00
Leonid Logvinov
7a8231435b Add forgotten file to git 2018-07-19 22:43:56 +02:00
Leonid Logvinov
b1aa7725df @0xproject/assert@1.0.0 2018-07-19 22:41:35 +02:00
Leonid Logvinov
bfe0ba3e9a Change all package to depend on the new @0xproject/sol-resolver@1.0.0 2018-07-19 22:39:42 +02:00
Leonid Logvinov
2d39329ee7 Add monorepo-scripts to sol-resolver 2018-07-19 22:38:19 +02:00
Leonid Logvinov
761b0063a0 @0xproject/sol-resolver@1.0.0 2018-07-19 22:33:24 +02:00
Leonid Logvinov
0f27ce3424 Change all package to depend on the new @0xproject/json-schemas@1.0.0-rc.1 2018-07-19 22:30:09 +02:00
Leonid Logvinov
2b0c0a6ff7 @0xproject/json-schemas@1.0.0-rc.1 2018-07-19 22:26:35 +02:00
Leonid Logvinov
5bd96f6fe9 Change the next @0xproject/json-schemas version to be 1.0.0-rc.1 2018-07-19 22:26:13 +02:00
Leonid Logvinov
37ac6749ba Change all package to depend on the new @0xproject/utils@1.0.0 2018-07-19 22:22:51 +02:00
Leonid Logvinov
bf955bd87f @0xproject/utils@1.0.0 2018-07-19 22:20:35 +02:00
Leonid Logvinov
6bd921d0bc Add a missing CHANGELOG entry 2018-07-19 22:20:08 +02:00
Leonid Logvinov
534decea95 Change all package to depend on the new @0xproject/types@1.0.0-rc.1 2018-07-19 22:17:55 +02:00
Leonid Logvinov
267830d463 FIx a typo 2018-07-19 22:15:31 +02:00
Leonid Logvinov
e82d0c21ec @0xproject/types@1.0.0-rc.1 2018-07-19 22:06:05 +02:00
Leonid Logvinov
ece6417699 Change the next @0xproject/types version to be 1.0.0-rc.1 2018-07-19 22:05:22 +02:00
Leonid Logvinov
74d5449719 Change all package to depend on the new @0xproject/tslint-config@1.0.0 2018-07-19 22:03:23 +02:00
Leonid Logvinov
4af7ff9cc3 @0xproject/tslint-config@1.0.0 2018-07-19 22:01:18 +02:00
Leonid Logvinov
46dedfcb67 Change the next @0xproject/tslint-config version to be 1.0.0 2018-07-19 22:00:58 +02:00
Leonid Logvinov
a9fa1a0df6 Change all package to depend on the new @0xproject/typescript-typings@1.0.0 2018-07-19 21:54:44 +02:00
Leonid Logvinov
a8572b4944 @0xproject/typescript-typings@1.0.0 2018-07-19 21:51:38 +02:00
Leonid Logvinov
91c0d47ad4 Change the next @0xproject/typescript-typings version to be 1.0.0 2018-07-19 21:51:12 +02:00
Leonid Logvinov
fd2611794a Change all package to depend on the new @0xproject/monorepo-scripts@1.0.0 2018-07-19 21:49:03 +02:00
Leonid Logvinov
1fe1c5321b @0xproject/monorepo-scripts@1.0.0 2018-07-19 21:45:38 +02:00
Leonid Logvinov
f063a5db0f Change all package to depend on the new ethereum-types@1.0.0 2018-07-19 21:44:09 +02:00
Leonid Logvinov
3883315447 Make PR numbers links on Github releases 2018-07-19 21:40:50 +02:00
Leonid Logvinov
7679e07957 v1.0.0 2018-07-19 21:28:51 +02:00
Leonid Logvinov
c39ba37ad8 Change the next ethereum-types version to be 1.0.0 2018-07-19 21:28:06 +02:00
Fabio Berger
f1c3840c3b Merge pull request #897 from 0xProject/doc-changes
Doc Changes for RC publish
2018-07-19 21:10:06 +02:00
Fabio Berger
e5c5b36a73 Specify exact version 2018-07-19 21:05:37 +02:00
Fabio Berger
c51f7a8375 Add PR nr. 2018-07-19 20:51:33 +02:00
Fabio Berger
e53e2ac31b Fix version dropdown so it also renders RC versions properly 2018-07-19 20:45:20 +02:00
Fabio Berger
b72857cd8b Update doc md files for v2 packages 2018-07-19 20:45:00 +02:00
Fabio Berger
cc223b9eab Compare host rather then origin so that it comes without the http/https prefix 2018-07-19 19:01:25 +02:00
Fabio Berger
f2c49e8b37 Merge branch 'v2-prototype' into doc-changes
* v2-prototype:
  Add missing import
  Remove comment and add assertion
  Add ability to nest doc ref markdown under specific versions
2018-07-19 18:15:35 +02:00
Fabio Berger
9b6476a6b7 Merge pull request #844 from 0xProject/support-multiple-doc-md
Support version-specific doc ref markdown sections
2018-07-19 18:14:58 +02:00
Fabio Berger
d8898cf9a3 merge v2-prototype 2018-07-19 17:48:06 +02:00
Fabio Berger
34df5af295 Don't export object literal because the docs cannot yet render them, moved type to types file 2018-07-19 17:46:24 +02:00
Fabio Berger
3de88d5345 Merge pull request #896 from 0xProject/update-lerna
Update Lerna & other small changes
2018-07-19 17:37:04 +02:00
Fabio Berger
9ab6ab1bf9 Improve log 2018-07-19 17:22:26 +02:00
Fabio Berger
b6de0bdd43 Merge branch 'v2-prototype' into update-lerna
* v2-prototype: (48 commits)
  Update CHANGELOG
  Rename call data schema id to CallData. Check for TypedArray when hashing data in order-utils crypto
  Fix broken links in sol-cov documentation
  Fix 0x.js ts warnings
  Update yarn.lock
  Fix 0x.js ts warnings
  Fix 0x.js tests on CI
  Fix a bad merge
  Update package versions
  Merge
  Update changelogs
  Add a test for ERC721 Allowance
  Use allowance instead of approval for all in fill-scenarios
  Upgrade sha3 to 1.2.2 to work with node v10
  Check if the token doesn't exist before minting in fill scenarios
  Make downlevelIteration a global config
  Fix tests descriptions
  DRY up the code in order-watcher collision-resistant abi decoder
  Await transactions in fillScenarios
  Rename decodeAssetData to decodeAssetDataOrThrow
  ...
2018-07-19 16:38:33 +02:00
Fabio Berger
a2b62fd808 Update yarn.lock 2018-07-19 16:38:02 +02:00
fragosti
fc166dea26 Add zIndex 1 to topbar and fix issue where no box-shadow present on /docs 2018-07-19 07:36:41 -07:00
Fabio Berger
f9c4d0925e Add additional pattern removal and added HACK comment 2018-07-19 16:32:03 +02:00
Fabio Berger
1df9370bc2 Renames to remove mention of Lerna 2018-07-19 16:26:45 +02:00
Fabio Berger
7d840c7a18 Remove unused declaration 2018-07-19 16:26:00 +02:00
fragosti
ff12aafc0f Remove TODO 2018-07-19 07:04:48 -07:00
fragosti
c08b4aa6a1 Remove unused Token import 2018-07-19 06:59:35 -07:00
fragosti
52a6e6357b Add lifecycle messages 2018-07-19 06:57:00 -07:00
Fabio Berger
74c0fd419b Upgrade Lerna to 3.0-Beta14 2018-07-19 15:51:38 +02:00
Fabio Berger
6f540e3e58 Replace lerna-get-packages with our own implementation 2018-07-19 15:50:21 +02:00
fragosti
dead04dce8 WIP for sending ether from portal (works) 2018-07-19 04:11:44 -07:00
Jacob Evans
886a03fdcd Merge pull request #894 from 0xProject/bug/minor-fixes-json-schema-order-utils
Rename json schema call data id to CallData.
2018-07-19 20:06:37 +10:00
Jacob Evans
81007c453c Update CHANGELOG 2018-07-19 19:51:07 +10:00
Jacob Evans
6529e06057 Rename call data schema id to CallData.
Check for TypedArray when hashing data in order-utils crypto
2018-07-19 17:51:03 +10:00
Brandon Millman
55336f96d7 Fix broken links in sol-cov documentation 2018-07-18 15:53:33 -07:00
Brandon Millman
938aabde3d Update hr color 2018-07-18 14:47:02 -07:00
Brandon Millman
c7f196b579 Fix lint errors 2018-07-18 14:30:44 -07:00
Brandon Millman
b28a88dbb2 Add /careers route and fix hr styling 2018-07-18 14:27:06 -07:00
Brandon Millman
e6558b7135 Fix typos 2018-07-18 14:10:17 -07:00
Brandon Millman
2c8fb9aa31 Fix key errors and typo 2018-07-18 13:59:50 -07:00
Brandon Millman
f48c6b6285 Fix padding on open positions section 2018-07-18 13:59:50 -07:00
Brandon Millman
4f42f60bde Add dots on hero 2018-07-18 13:59:50 -07:00
Brandon Millman
3942647910 Padding fixes 2018-07-18 13:59:50 -07:00
Brandon Millman
e0fbc78925 Update open positions section 2018-07-18 13:59:50 -07:00
Brandon Millman
f3e43d7d94 Benefits and values sections 2018-07-18 13:59:50 -07:00
Brandon Millman
f36547241c Remove sections 2018-07-18 13:59:49 -07:00
Brandon Millman
7ad29950a8 Update mission section 2018-07-18 13:59:49 -07:00
Brandon Millman
cbf91ad45c Updates to the Join 0x section 2018-07-18 13:59:49 -07:00
Brandon Millman
a039b66533 Fix development environment check 2018-07-18 13:59:49 -07:00
Fabio Berger
3a18c249f5 Merge pull request #889 from 0xProject/update_versions
Update Versions & Changelogs
2018-07-18 17:20:38 +02:00
Fabio Berger
7c0775aa1b Fix 0x.js ts warnings 2018-07-18 17:06:05 +02:00
fragosti
6514c34ed8 Make topbar zIndex 1 2018-07-18 08:05:19 -07:00
Fabio Berger
ba92754669 Update yarn.lock 2018-07-18 17:00:14 +02:00
Fabio Berger
30afd39129 Fix 0x.js ts warnings 2018-07-18 17:00:07 +02:00
Leonid Logvinov
41699406cf Fix 0x.js tests on CI 2018-07-18 16:44:45 +02:00
Greg Hysen
9aa49e59d0 Fixed merge errors 2018-07-18 16:44:24 +02:00
Fabio Berger
29d5034260 merge v2-prototype 2018-07-18 16:43:25 +02:00
Leonid Logvinov
00d1622b3f Merge pull request #887 from 0xProject/feature/order-watcher-v2
Order watcher v2
2018-07-18 16:38:16 +02:00
Leonid Logvinov
a1acf19ff3 Fix a bad merge 2018-07-18 16:31:17 +02:00
Greg Hysen
86328af6b7 Fixed merge error 2018-07-18 16:27:26 +02:00
Greg Hysen
36c27bdbf8 Ran prettier 2018-07-18 16:18:54 +02:00
Fabio Berger
c839965c05 Update to Lerna v3.0-beta 2018-07-18 16:06:39 +02:00
Greg Hysen
e1a9f3435f Removed receiverData from ERC721 Proxy Id generation 2018-07-18 15:52:14 +02:00
Greg Hysen
9f74feb347 Removed receiverData and onReceive callback from ERC721 proxy. 2018-07-18 15:50:58 +02:00
Fabio Berger
f99232095b Update package versions 2018-07-18 15:48:09 +02:00
Leonid Logvinov
5044fe4fe4 Merge branch 'v2-prototype' into feature/order-watcher-v2 2018-07-18 15:40:45 +02:00
Leonid Logvinov
8e49169e6b Merge branch 'feature/order-watcher-v2' of github.com:0xProject/0x-monorepo into feature/order-watcher-v2 2018-07-18 15:39:11 +02:00
Leonid Logvinov
c71781d9ab Merge 2018-07-18 15:38:10 +02:00
Fabio Berger
8a2a4052f3 Update changelogs 2018-07-18 15:30:38 +02:00
Leonid Logvinov
dad557164e Merge branch 'v2-prototype' into feature/order-watcher-v2 2018-07-18 15:27:38 +02:00
Fabio Berger
e2fb49a8f8 Merge pull request #884 from 0xProject/export-more-0x.js
Export missing V2 pieces from 0x.js
2018-07-18 15:18:54 +02:00
Leonid Logvinov
f3241ff86a Merge pull request #883 from 0xProject/feature/tslint-improvements
New tslint rules
2018-07-18 14:54:47 +02:00
Fabio Berger
b9e7973a0f edit changelog message 2018-07-18 14:53:38 +02:00
Fabio Berger
004b1f5288 Fix prettier 2018-07-18 14:53:31 +02:00
Leonid Logvinov
857bd24c6d Merge branch 'v2-prototype' into feature/order-watcher-v2 2018-07-18 14:51:24 +02:00
Leonid Logvinov
904968cf4a Fix an inconsistency in abi-gen CHANGELOG.json 2018-07-18 14:31:03 +02:00
Fabio Berger
83747934ad Fix linter 2018-07-18 12:11:11 +02:00
Fabio Berger
7f90f5ecd4 merge v2-prototype 2018-07-18 12:04:57 +02:00
Fabio Berger
12f02b9814 Rename decodeAssetDataId to decodeAssetProxyId for consistency 2018-07-18 11:49:30 +02:00
Fabio Berger
8931388309 Add java doc comments to assetDataUtils 2018-07-18 11:47:42 +02:00
Fabio Berger
25160d7344 Move encodeUint256 & decodeUint256 out of assetDataUtils since we don't want them exported 2018-07-18 11:32:01 +02:00
Leonid Logvinov
ab6bf6edc7 Merge pull request #879 from 0xProject/feature/order-watcher-erc721-tests
Add ERC721 tests for order watcher v2
2018-07-18 10:38:07 +02:00
Amir Bandeali
56a4a374cd Merge pull request #857 from 0xProject/feature/contracts/batchGetOrderInfo
Add getOrdersInfo function
2018-07-17 14:13:33 -07:00
Amir Bandeali
caa5b4e342 Add tests for getOrderInfo and getOrdersInfo 2018-07-17 13:59:14 -07:00
Amir Bandeali
b6172c3965 Reorder checks in getOrderInfo 2018-07-17 12:18:16 -07:00
Amir Bandeali
02ddfa07a7 Add getOrdersInfo function 2018-07-17 12:18:16 -07:00
Alex Browne
5022878680 Merge pull request #886 from 0xProject/fix/time-offset-accidental-revert
Mine a dummy block in blockchain_lifecycle to re-apply any time offset
2018-07-17 12:12:12 -07:00
Alex Browne
2bfacbb8ba Mine a dummy block in blockchain_lifecycle to re-apply any time offset 2018-07-17 11:48:39 -07:00
Alex Browne
b18d2b0274 Merge pull request #881 from 0xProject/fix/timestamp-conversions
Fix bugs having to do with block timestamps and order expirationTimes
2018-07-17 10:57:39 -07:00
Leonid Logvinov
f20b496dca Add a test for ERC721 Allowance 2018-07-17 18:46:58 +02:00
Leonid Logvinov
cca17f70b8 Use allowance instead of approval for all in fill-scenarios 2018-07-17 18:45:35 +02:00
Leonid Logvinov
b8e69718a1 Upgrade sha3 to 1.2.2 to work with node v10 2018-07-17 16:54:25 +02:00
Fabio Berger
50ed7d2af2 Export missing types and add to doc ref whitelist 2018-07-17 16:41:55 +02:00
Fabio Berger
698de932ed Remove unused dep 2018-07-17 16:27:59 +02:00
Fabio Berger
a3d8858bb1 Fix typing 2018-07-17 16:27:46 +02:00
Fabio Berger
83f3ba21b8 Move type decl. to typescript-typings 2018-07-17 16:01:01 +02:00
Leonid Logvinov
2aa729b212 Check if the token doesn't exist before minting in fill scenarios 2018-07-17 15:56:10 +02:00
Fabio Berger
1de70e4474 Add PR 2018-07-17 15:40:06 +02:00
Fabio Berger
f2393de59b Make assetData a static property and add to CHANGELOG 2018-07-17 15:33:49 +02:00
Fabio Berger
94ea7cc451 Export assetDataUtils from 0x.js 2018-07-17 15:31:25 +02:00
Fabio Berger
f8dbf57582 Rename assetProxyUtils to assetDataUtils 2018-07-17 15:26:55 +02:00
Leonid Logvinov
c59cd36da6 Make downlevelIteration a global config 2018-07-17 15:25:20 +02:00
Fabio Berger
15e92958d6 Merge pull request #875 from 0xProject/fix-order-watcher
OrderWatcher Fixes
2018-07-17 13:47:23 +02:00
Leonid Logvinov
96c648c4b4 Fix tests descriptions 2018-07-17 13:29:59 +02:00
Fabio Berger
f56a7d0cb2 Fix linter 2018-07-17 13:29:36 +02:00
Leonid Logvinov
01e617bb83 DRY up the code in order-watcher collision-resistant abi decoder 2018-07-17 13:28:27 +02:00
Fabio Berger
59fd5c69c0 Remove no-longer needed tests 2018-07-17 13:27:41 +02:00
Leonid Logvinov
28a9a8c380 Await transactions in fillScenarios 2018-07-17 13:26:49 +02:00
Leonid Logvinov
6c2796b433 Rename decodeAssetData to decodeAssetDataOrThrow 2018-07-17 13:16:47 +02:00
Leonid Logvinov
82ad5f7897 Use normalizedAddress 2018-07-17 13:13:05 +02:00
Leonid Logvinov
bf8ac3b9e6 Fix tslint issues 2018-07-17 12:59:02 +02:00
Leonid Logvinov
edcdc9b1b9 Upgrade tslint to the newest version 2018-07-17 12:58:42 +02:00
Leonid Logvinov
4227aaa68a Add new tslint rules 2018-07-17 12:58:04 +02:00
Fabio Berger
b750ce8be6 Stop subscriptions from unsubscribing on recoverable network issues 2018-07-17 12:33:43 +02:00
Fabio Berger
03a6a088c5 Merge branch 'v2-prototype' into fix-order-watcher
* v2-prototype: (39 commits)
  Add chris to website
  Fix ocean link
  Move update onboarding step tracking to onboarding flow code
  Bump npm-run-all from 4.1.2 to 4.1.3
  Move format to helper function
  Fix linter
  Add assertion to make sure caller to fetchAsync isn't trying to set timeout in a context-specific way
  Fix linter issues
  Remove unused import
  Switch conditional
  Update yarn.lock and artifact
  Fix abi-gen tests to not rely on sleep, since it causes intermittent failures
  Add missing assertion
  Move type defs to typescript-typingsd
  Fix linter
  Make createFinalPayload protected
  Replace process.browser with detect-node library
  Export Web3ProviderEngine and RPCSubprovider from 0x.js
  Export Web3ProviderEngine from subproviders package
  Update deps
  ...
2018-07-17 12:06:35 +02:00
Fabio Berger
1e787a7646 Remove stateLayer OrderWatcher config and instead temporarily hard-code until we get pending block to work with Blockstream 2018-07-17 12:04:29 +02:00
Fabio Berger
766ac3f1fe Remove blockRetention config 2018-07-17 11:57:52 +02:00
fragosti
a9038f2afc Add chris to website 2018-07-17 01:16:29 -07:00
Alex Browne
9828fa335e Fix bugs having to do with block timestamps and order expirationTimes 2018-07-16 18:41:37 -07:00
Brandon Millman
0c04d490bb Fix ocean link 2018-07-16 17:48:24 -07:00
F. Eugene Aumson
bffffffc95 make PR template checklist more useful
Goal is to make it so that every PR should check off every checklist
item before it is considered complete.

Removed mention of labels.  Since contributors outside the org don't
have permission to add labels, it's not possible for any such
contributor to ever check those items off.  Opted instead to prescribe
bracketed PR title prefixes, which are accessible to all.

Re-ordered checklist items to better represent chronological progress.
2018-07-16 17:50:24 -04:00
Leonid Logvinov
e9589ff786 Sort the config file lexicographically 2018-07-16 15:59:00 +02:00
Leonid Logvinov
c3bd3437f5 Make addOrder async 2018-07-16 15:50:06 +02:00
Leonid Logvinov
01789e6750 Merge pull request #800 from feuGeneA/patch-2
use bullets, not a task list, for Types of Changes
2018-07-16 15:24:18 +02:00
Leonid Logvinov
c3f7ba1b91 Merge pull request #872 from 0xProject/dependabot/npm_and_yarn/npm-run-all-4.1.3
Bump npm-run-all from 4.1.2 to 4.1.3
2018-07-16 15:22:58 +02:00
Leonid Logvinov
90d72a3683 Await the promise in order watcher assertion 2018-07-16 14:54:36 +02:00
Leonid Logvinov
f9bcf936ed Merge branch 'feature/order-watcher-v2' into feature/order-watcher-erc721-tests 2018-07-16 14:38:51 +02:00
Leonid Logvinov
acff177c54 Merge branch 'v2-prototype' into feature/order-watcher-v2 2018-07-16 14:38:27 +02:00
Leonid Logvinov
658214a2e2 Yarn lock changes 2018-07-16 14:31:46 +02:00
Leonid Logvinov
55f6f02c9b Import AssetproxyId 2018-07-16 14:31:33 +02:00
Leonid Logvinov
c5ba52910a Add ERC721 tests to order watcher 2018-07-16 14:30:48 +02:00
Leonid Logvinov
994ccd6694 Enable downlevelIteration 2018-07-16 14:29:59 +02:00
Leonid Logvinov
4921a83813 Register asset types within collisionResistantAbiDecoder 2018-07-16 14:29:23 +02:00
Leonid Logvinov
a97ba41b86 Add ERC721 support to fill-scenarios 2018-07-16 14:28:44 +02:00
Leonid Logvinov
67e2623d2c Remove no-unused-variable rule from tslint as it's buggy and has side-effects 2018-07-16 14:28:22 +02:00
Leonid Logvinov
4111095da3 Don't throw on transferFrom is the sender is an owner 2018-07-16 14:27:53 +02:00
Leonid Logvinov
6c21ddcedb Pass erc721ProxyAddress to fillScenarios 2018-07-16 14:27:34 +02:00
Leonid Logvinov
d86349658f Fix postinstall hook for contracts -> types 2018-07-16 14:26:23 +02:00
Fabio Berger
151ce6e3c7 Pass stateLater into getBlockAsync call 2018-07-16 10:24:34 +02:00
Francesco Agosti
6bdee26c30 Merge pull request #876 from 0xProject/feature/website/heap-tracking-sanity
Move update onboarding step tracking to onboarding flow code
2018-07-13 14:34:54 -07:00
fragosti
5e4b1eed30 Move update onboarding step tracking to onboarding flow code 2018-07-13 14:09:34 -07:00
Francesco Agosti
ab5cd95ccc Merge pull request #867 from 0xProject/bug/website/txhash-error
Only upload sourcemaps to rollbar on live deploys, and handle NaN error by using 0
2018-07-13 13:35:01 -07:00
dependabot[bot]
a3dc398da5 Bump npm-run-all from 4.1.2 to 4.1.3
Bumps [npm-run-all](https://github.com/mysticatea/npm-run-all) from 4.1.2 to 4.1.3.
- [Release notes](https://github.com/mysticatea/npm-run-all/releases)
- [Commits](https://github.com/mysticatea/npm-run-all/compare/v4.1.2...v4.1.3)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-13 18:25:06 +00:00
fragosti
b70f5d1a1e Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into bug/website/txhash-error 2018-07-13 11:15:50 -07:00
Francesco Agosti
26363931ed Merge pull request #866 from 0xProject/feature/website/integrate-heap
Integrate Heap analytics into the website
2018-07-13 11:14:38 -07:00
Fabio Berger
e2438330f5 Merge pull request #874 from 0xProject/fix/request-timeout-issue
Fix Fetch Timeout Issue
2018-07-13 20:12:37 +02:00
fragosti
c5fcdd0657 Move format to helper function 2018-07-13 11:11:49 -07:00
Fabio Berger
345f3c07a5 Add PR numbers 2018-07-13 20:04:21 +02:00
Fabio Berger
f3477ff28c Add changelog entries 2018-07-13 20:03:22 +02:00
Fabio Berger
7ac4fa50b5 Update yarn.lock 2018-07-13 19:55:45 +02:00
Fabio Berger
2f0a914838 Fix linter 2018-07-13 19:53:49 +02:00
Fabio Berger
5fc7d9a603 Fix bug that make all getBlock and getLog requests go to latest block 2018-07-13 19:44:56 +02:00
Fabio Berger
ced68e4e02 Expose Blockstreams blockRetention config as an OrderWatcher config 2018-07-13 19:44:21 +02:00
Fabio Berger
80071beaac Add assertion to make sure caller to fetchAsync isn't trying to set timeout in a context-specific way 2018-07-13 19:38:35 +02:00
Fabio Berger
de1029d5ef Fix linter issues 2018-07-13 18:51:21 +02:00
Leonid Logvinov
ffeb3194a8 Fix a dependency version 2018-07-13 17:46:53 +02:00
Leonid Logvinov
95e9f33f6a Migrate order-watcher to v2 2018-07-13 17:45:25 +02:00
Leonid Logvinov
c599a20b34 Enable prefer-readonly rule 2018-07-13 17:44:39 +02:00
Leonid Logvinov
ca59528a32 Add OrderWatcherPartialConfigSchema 2018-07-13 17:44:00 +02:00
Leonid Logvinov
6f4fd06d38 Use migrated package versions as order-watcher dependencies 2018-07-13 17:43:32 +02:00
Leonid Logvinov
4715c2d006 Update compact_artifacts in order-watcher 2018-07-13 17:42:50 +02:00
Leonid Logvinov
fcfa43b6f1 Export newly created store from order-utils 2018-07-13 17:42:27 +02:00
Leonid Logvinov
56b4c55654 Add OrderFilledCancelledLazyStore 2018-07-13 17:41:30 +02:00
Leonid Logvinov
830790eeac Add AbstractOrderFilledCancelledLazyStore 2018-07-13 17:39:41 +02:00
Leonid Logvinov
39de9c7879 Export forgotten stuff from contract-wrappers 2018-07-13 17:38:02 +02:00
Leonid Logvinov
7b6cc14b71 Make getZRXAssetData not async 2018-07-13 17:37:33 +02:00
Leonid Logvinov
ec749a4033 Add order-watcher to a postinstall HACK 2018-07-13 17:36:20 +02:00
Leonid Logvinov
fe32214613 Add no-return-await, no-duplicate-switch-case, no-implicit-dependencies rules 2018-07-13 17:30:44 +02:00
Leonid Logvinov
f6fcb775b7 Upgrade tslint to use prefer-readonly 2018-07-13 17:30:44 +02:00
Leonid Logvinov
d209108a95 Update contract artifacts 2018-07-13 17:30:00 +02:00
Fabio Berger
efc64cf17f Remove unused import 2018-07-13 17:17:45 +02:00
Fabio Berger
2f41ed50c1 Switch conditional 2018-07-13 16:47:32 +02:00
Fabio Berger
fcc8cdd36a Update yarn.lock and artifact 2018-07-13 16:40:06 +02:00
Fabio Berger
248632ce76 Merge branch 'v2-prototype' into fix/request-timeout-issue
* v2-prototype:
  Remove legacy portal code
2018-07-13 16:12:49 +02:00
Fabio Berger
25681754bd Fix abi-gen tests to not rely on sleep, since it causes intermittent failures 2018-07-13 16:06:15 +02:00
Fabio Berger
179c487da9 Add missing assertion 2018-07-13 15:25:48 +02:00
Fabio Berger
350989bbec Move type defs to typescript-typingsd 2018-07-13 15:25:37 +02:00
Fabio Berger
f5293e6c38 Fix linter 2018-07-13 15:09:51 +02:00
Fabio Berger
70c3515c94 Make createFinalPayload protected 2018-07-13 15:04:17 +02:00
Fabio Berger
4c7fd5a4e8 Replace process.browser with detect-node library 2018-07-13 15:03:13 +02:00
Fabio Berger
9d24341d94 Export Web3ProviderEngine and RPCSubprovider from 0x.js 2018-07-13 14:35:31 +02:00
Fabio Berger
512502ca08 Export Web3ProviderEngine from subproviders package 2018-07-13 14:26:02 +02:00
Fabio Berger
6ce662c7a4 Update deps 2018-07-13 13:05:38 +02:00
Fabio Berger
701ea5c46b Add typedoc for json-rpc-error package 2018-07-13 13:05:21 +02:00
Fabio Berger
2e5ff53d72 -fetch'; 2018-07-13 12:42:01 +02:00
Fabio Berger
1229c61ba4 Make timeout configurable on RPCSubprovider 2018-07-13 12:05:02 +02:00
fragosti
ee54438e92 Fix logging typo 2018-07-12 18:30:01 -07:00
fragosti
65af78c85d Fix indentify typo 2018-07-12 18:20:46 -07:00
fragosti
b4747c3f85 Refactor utils and add UNNKOWN environment type 2018-07-12 18:11:25 -07:00
fragosti
1df074b73e Make Analytics API non-async 2018-07-12 16:57:03 -07:00
fragosti
254d30b8df Fix linting errors 2018-07-12 15:56:01 -07:00
fragosti
ac5588c7c4 Make error reporter not return a promise and add more environment possibilities 2018-07-12 15:56:01 -07:00
fragosti
ddb70a89ad Do not crash on NaN, and provide default 2018-07-12 15:54:45 -07:00
fragosti
f4b2a9625d Only upload sourcemaps to rollbar on live deploys, and log NaN error for future debugging 2018-07-12 15:54:45 -07:00
Fabio Berger
c2a1317c38 Adjust timeout 2018-07-12 23:17:35 +02:00
Fabio Berger
49f1a6933c Add fetchAsync util and RPCSubprovider 2018-07-12 23:13:47 +02:00
Brandon Millman
9b387b8ec3 Merge pull request #865 from 0xProject/refactor/website/remove-legacy-portal
Remove legacy portal code
2018-07-12 11:01:14 -07:00
Fabio Berger
a45a29432e Merge pull request #863 from 0xProject/refactor/0x.js
Refactor 0x.js
2018-07-12 15:53:31 +02:00
Fabio Berger
819d069edc Add missing param 2018-07-12 15:25:35 +02:00
Fabio Berger
b0a57a5091 remove non-existent param comment 2018-07-12 15:25:25 +02:00
Fabio Berger
d8678d562d Add assertions to SignatureUtils exported methods 2018-07-12 15:22:21 +02:00
Leonid Logvinov
34a9035164 Merge pull request #788 from feuGeneA/abi-gen-ignore-unchanged
Using timestamps, skip generation of already-up-to-date contract wrappers
2018-07-12 11:53:21 +02:00
fragosti
0941e0a929 Add no-floating-promises ignore comments 2018-07-11 16:50:00 -07:00
fragosti
1ee78062d7 Remove unused configs and constants 2018-07-11 15:43:37 -07:00
Brandon Millman
09f5609618 Remove legacy portal code 2018-07-11 15:42:20 -07:00
fragosti
098322c564 Integrate heap analytics 2018-07-11 15:39:12 -07:00
Fabio Berger
365e24c1cd Fix prettier 2018-07-11 23:58:22 +02:00
Brandon Millman
b82fdd59e7 Merge pull request #626 from 0xProject/refactor/connect/browser-websocket-support
Add support for browser websocket client and fix multiple subscriptions bug
2018-07-11 14:40:19 -07:00
Brandon Millman
6190ac7791 Change version to 1.0.0 2018-07-11 14:31:39 -07:00
Brandon Millman
ed3aeb7997 Fix lint for order watcher 2018-07-11 13:35:21 -07:00
Brandon Millman
33f92b6bcf Fix lint for order-utils 2018-07-11 13:15:28 -07:00
fragosti
9131a72a47 Replace calls to google analytics with calls to heap 2018-07-11 12:14:23 -07:00
Brandon Millman
e5617dfe61 Lint fixes 2018-07-11 11:46:28 -07:00
Brandon Millman
e67d67419f Prettier 2018-07-11 11:29:34 -07:00
Brandon Millman
17c34716f9 Provide subscriptionOpts in error callback and include url in error messages 2018-07-11 11:16:45 -07:00
Brandon Millman
e12f7c3026 Remove outdated comments 2018-07-11 10:27:05 -07:00
Brandon Millman
af395eccda Update orderbook channel and factory tests 2018-07-11 10:25:54 -07:00
Brandon Millman
c403dcdabf Update tests 2018-07-11 10:25:54 -07:00
Brandon Millman
c500cc095f Enforce one handler per channel 2018-07-11 10:25:54 -07:00
Brandon Millman
6ecda647ad Add TODO comment for switching requestIds to strings 2018-07-11 10:25:54 -07:00
Brandon Millman
3e7ee1f090 Add explicit HACK comment when we import assert 2018-07-11 10:25:54 -07:00
Brandon Millman
0c120cb7a3 Assert that connection is opening before attempting to subscribe 2018-07-11 10:19:36 -07:00
Brandon Millman
cab6829df9 Remove unused import 2018-07-11 10:19:36 -07:00
Brandon Millman
0efe6df416 Add CHANGELOG entry 2018-07-11 10:19:36 -07:00
Brandon Millman
a4b6112a31 Consolidate back to one channel and expose only the factory 2018-07-11 10:18:15 -07:00
Brandon Millman
47debf0134 Initial implementation of OrderbookChannelFactory 2018-07-11 10:17:45 -07:00
Brandon Millman
16ddd1edfc Implement web browser socket 2018-07-11 10:17:45 -07:00
Fabio Berger
0f1fd0e90d prettier fix 2018-07-11 19:16:12 +02:00
Fabio Berger
ef76d83d2a Fix linter issues 2018-07-11 19:15:39 +02:00
Fabio Berger
df9f6004f2 Rename compact_artifacts to artifacts and update them 2018-07-11 19:09:02 +02:00
Fabio Berger
9a87f99dcd Add PR to changelog 2018-07-11 19:08:05 +02:00
Fabio Berger
30011db6d7 Add changelog entry 2018-07-11 19:06:38 +02:00
Fabio Berger
b6ac132c78 Refactor 0x.js to V2 2018-07-11 18:53:50 +02:00
Fabio Berger
abf87a643d Remove artifact tests since no testnet deployments are finalized 2018-07-11 18:49:37 +02:00
Fabio Berger
3824ea9079 Remove TokenRegistry from 0x.js 2018-07-11 18:46:12 +02:00
Fabio Berger
5e22ce05c5 Remove duplicate sol-compiler dep 2018-07-11 18:34:38 +02:00
Jacob Evans
8fcc7aefa7 Merge pull request #840 from 0xProject/feature/migrations/forwarder-migrations
Add Migrations for Forwarder and miscellaneous fixes
2018-07-11 20:59:23 +10:00
Jacob Evans
0b6ea1d046 Contract Wrappers - Ether token block range
Start after migrations to avoid any unexpected logs
2018-07-11 20:45:18 +10:00
Fabio Berger
22d3981a74 Temporarily remove OrderWatcher from 0x.js 2018-07-11 12:34:13 +02:00
Jacob Evans
81b4f4928d Remove extra ERC20ProxyId from Forwarder constructor 2018-07-11 20:16:59 +10:00
Jacob Evans
dd77a38535 Add Migrations for Forwarder 2018-07-11 20:16:04 +10:00
fragosti
d319b53e23 Add Heap snippet 2018-07-10 15:13:54 -07:00
Alex Browne
b9627e14d0 Merge pull request #848 from 0xProject/feature/contracts/safeMath
Add revert reasons and optimization to safeMath
2018-07-10 14:01:13 -07:00
Brandon Millman
56a96d36a1 Merge pull request #849 from 0xProject/feature/website/tokens-backend
Grab token registry information from our DB for mainnet
2018-07-10 13:57:14 -07:00
Amir Bandeali
e60630fa73 Update artifacts 2018-07-10 12:55:31 -07:00
Amir Bandeali
5ef6613024 Add revert reasons and optimization to safeMath 2018-07-10 12:53:47 -07:00
Amir Bandeali
af7e02de27 Merge pull request #837 from 0xProject/fix/contracts/assetProxyOwnerVersion
Use 0.4.10 in AssetProxyOwner
2018-07-10 12:46:53 -07:00
Brandon Millman
51d5b9d35d Grab token registry information from our DB for mainnet 2018-07-10 12:01:51 -07:00
Amir Bandeali
092ca6bcf5 Use 0.4.10 in AssetProxyOwner, add readBytes4 to contract and remove LibBytes 2018-07-10 11:24:22 -07:00
Francesco Agosti
2625cbbfed Merge pull request #846 from 0xProject/feature/website/add-peter-to-about
Add Peter to about page
2018-07-10 10:31:01 -07:00
fragosti
cedd1d5596 Add LinkedIn for Peter 2018-07-10 10:30:25 -07:00
Francesco Agosti
fb9e14a229 Merge pull request #845 from 0xProject/bug/website/portal-soft-launch-fixes
Enable sourceMaps on Rollbar and fix some small issues
2018-07-10 10:26:40 -07:00
fragosti
4e1bd7b5f0 Add Peter to about page 2018-07-09 19:02:50 -07:00
fragosti
5dfed8cd00 Update rollbar for telemetry 2018-07-09 18:17:14 -07:00
fragosti
a2672a0d78 Get rollbar uploads working by enabling sourcemaps 2018-07-09 18:04:55 -07:00
fragosti
ee5ac6b800 Fix unsubscribe bug 2018-07-09 16:16:48 -07:00
fragosti
a481d2ab46 Use JSON stringify around GIT_SHA 2018-07-09 16:07:16 -07:00
fragosti
c8bb21d12d Add sourcemaps for rollbar 2018-07-09 14:26:05 -07:00
fragosti
e817cd7d43 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into v2-prototype 2018-07-09 13:27:05 -07:00
fragosti
bd6085fffd Change Jacobs title to Ecosystem Engineer 2018-07-09 13:25:18 -07:00
Brandon Millman
7efe9a9385 Delete wings.png 2018-07-09 13:21:46 -07:00
Brandon Millman
50da40a727 Delete taas.png 2018-07-09 13:21:29 -07:00
Brandon Millman
48390a1875 Delete qtum.png 2018-07-09 13:21:12 -07:00
Brandon Millman
a3d27cd128 Delete eos.png 2018-07-09 13:20:49 -07:00
Brandon Millman
589c814ee6 Update icon file names 2018-07-09 13:17:57 -07:00
Leonid Logvinov
4b60a3cbab Merge branch 'v2-prototype' into abi-gen-ignore-unchanged 2018-07-09 20:08:28 +02:00
Fabio Berger
1aaf633df8 Add missing import 2018-07-09 19:59:26 +02:00
Fabio Berger
82771ec64a Remove comment and add assertion 2018-07-09 19:53:54 +02:00
Fabio Berger
ada8a402da merge v2-prototype 2018-07-09 19:46:28 +02:00
Fabio Berger
17956efe35 Merge pull request #843 from 0xProject/update-after-dev-publish
Update CHANGELOG & Versions After Development Publish
2018-07-09 19:40:37 +02:00
Fabio Berger
8378c9f85e Fix changelogs 2018-07-09 19:27:18 +02:00
Fabio Berger
324b1079e7 Add ability to nest doc ref markdown under specific versions 2018-07-09 19:05:38 +02:00
Fabio Berger
c6da829713 Remaining version fixes 2018-07-09 18:55:22 +02:00
Fabio Berger
844b0687a6 Update incorrect versions 2018-07-09 18:22:18 +02:00
Fabio Berger
2ed2dd2fb7 Update package versions 2018-07-09 18:16:02 +02:00
Fabio Berger
d2f7dd3d5a Update changelogs 2018-07-09 17:49:28 +02:00
F. Eugene Aumson
9f08916cf1 add tests of abi-gen 2018-07-09 10:56:18 -04:00
F. Eugene Aumson
a0e3676e3a move abi-gen funcs from index to utils for testing
preparing for unit testing. purely refactoring (no functionality
changed).
2018-07-09 10:45:21 -04:00
F. Eugene Aumson
2276793629 using timestamps, skip gen of up-to-date wrappers 2018-07-09 10:36:41 -04:00
Fabio Berger
a9b320e636 Add back timestamp 2018-07-09 15:49:24 +02:00
Leonid Logvinov
ecdc0636d8 Merge pull request #841 from 0xProject/feature/v2-contract-wrappers-validation
Feature/v2 contract wrappers validation
2018-07-09 12:21:32 +02:00
Leonid Logvinov
ea12e34809 Ignore coverage of generated files 2018-07-09 12:07:42 +02:00
Leonid Logvinov
9fb7865292 Dedupe AssetProxyId types 2018-07-09 11:43:00 +02:00
Leonid Logvinov
12f30c78ff Fix a typo 2018-07-09 11:29:42 +02:00
Leonid Logvinov
e3bed5cc71 Default shouldValidate to true 2018-07-09 11:29:09 +02:00
Leonid Logvinov
0f8f5ca5ff Add basic validation for exchange contract wrapper 2018-07-09 11:13:21 +02:00
Leonid Logvinov
0fe0433b9a Add type for AssetProxyId 2018-07-09 11:13:21 +02:00
Leonid Logvinov
ab1e38701d Add revert reason parsing to error handling decorator 2018-07-09 11:13:21 +02:00
Leonid Logvinov
258fe8ea50 Render callAsync in templates even if it returns nothing 2018-07-09 11:13:21 +02:00
Leonid Logvinov
813824868e Return AssetProxyId instead of string from proxy.getProxyIdAsync() 2018-07-09 11:13:21 +02:00
Fabio Berger
028184947f Merge pull request #833 from feuGeneA/issue-823
document how to check test coverage on a fork
2018-07-09 10:10:31 +02:00
Amir Bandeali
14c96e0b97 Merge pull request #839 from 0xProject/refactor/contracts/forwarder-interfaces
Refactor forwarder file structure
2018-07-08 20:29:31 -07:00
Brandon Millman
ef03d1ae13 Give environment enums string values 2018-07-08 01:37:22 -07:00
Amir Bandeali
f1613d36ac Move functions out of Forwarder.sol 2018-07-07 23:23:22 -07:00
Amir Bandeali
8314bbbbac Add interfaces and mixins 2018-07-07 22:57:09 -07:00
Amir Bandeali
462f1f00d8 Combine mixins 2018-07-07 22:11:36 -07:00
Amir Bandeali
1c80bba4dd Use interfaces instead of full contracts 2018-07-07 22:11:36 -07:00
fragosti
d22cff0976 Shim shouldShowPortalV2 to always return true 2018-07-06 16:08:35 -07:00
Francesco Agosti
269b56b907 Merge pull request #838 from 0xProject/feature/website/portal-final-touches
Some final polish touches for portal!
2018-07-06 15:38:51 -07:00
fragosti
60ebfcf36d Fix lint errors 2018-07-06 15:21:50 -07:00
fragosti
824c331ea0 Make unlock metamask step look more like mock 2018-07-06 15:17:23 -07:00
fragosti
b9e51d2fad Add updated asset for unlock metamask portal onboarding step 2018-07-06 14:23:00 -07:00
fragosti
9669a4d121 Create Balance component and make token symbols smaller than token amounts 2018-07-06 14:21:30 -07:00
Amir Bandeali
e929fb4337 Merge pull request #826 from 0xProject/refactor/contracts/todos
Address TODOs and small fixes
2018-07-06 13:41:06 -07:00
Brandon Millman
80da9cd31f Merge pull request #835 from 0xProject/feature/website/token-updates
Update token registry icons and asset picker flows
2018-07-06 13:24:55 -07:00
Amir Bandeali
5ed7a1baba Add lint-contracts to default lint command 2018-07-06 13:23:09 -07:00
Amir Bandeali
07c111d1f5 Remove TODOs that won't be addressed 2018-07-06 13:23:09 -07:00
Amir Bandeali
a2024da955 Remove AbiV2 where unused 2018-07-06 13:23:05 -07:00
fragosti
7418926ebb Give Wallet a min height 2018-07-06 13:17:28 -07:00
Brandon Millman
4cc33d270e Merge pull request #828 from 0xProject/feature/website/portal-improvements
Fix some portal bugs, and poll for best gas price
2018-07-06 13:05:27 -07:00
Brandon Millman
f767f5c12c Hard code exchange abi 2018-07-06 13:03:35 -07:00
Amir Bandeali
0ea3b10efd Only reset currentContextAddress if it was previously updated 2018-07-06 11:53:59 -07:00
Amir Bandeali
d634775d40 Change uint => uint256 2018-07-06 11:53:59 -07:00
Francesco Agosti
c4ab5bc653 Merge pull request #829 from 0xProject/bug/web3-wrapper/fix-invalid-transaction-format
Fix invalid transaction format errors when going through `SingerSubprovider`
2018-07-06 11:46:03 -07:00
Amir Bandeali
1d3bdfc374 Merge pull request #834 from 0xProject/fix/contracts/linter
Apply linter to nested contracts
2018-07-06 11:45:06 -07:00
fragosti
72fb1ee36f Fix linting issues 2018-07-06 11:30:01 -07:00
fragosti
afbc4989d5 address CR feedback 2018-07-06 11:23:41 -07:00
Amir Bandeali
d2e422cd5e Apply new linter rules 2018-07-06 10:58:28 -07:00
Brandon Millman
49c7365d93 Update token registry icons and asset picker flows 2018-07-06 10:51:46 -07:00
fragosti
c753e24f0a Export marshaller and use it to unmarshal tx dataa 2018-07-06 10:35:13 -07:00
fragosti
acfbba5476 Revert moving formatUtils into utils 2018-07-06 10:23:24 -07:00
Amir Bandeali
e796734659 Update linter config 2018-07-06 09:51:09 -07:00
F. Eugene Aumson
f172908bde document how to check test coverage on a fork 2018-07-06 10:26:24 -04:00
Leonid Logvinov
16dc4e9f66 Instantiate BlockAndLogStreamer with generic type parameters 2018-07-06 13:36:23 +02:00
Fabio Berger
8eefc89d55 Merge pull request #831 from 0xProject/fix-readme-intros
Update Package Descriptions
2018-07-06 13:10:00 +02:00
Fabio Berger
20d349cea7 Merge pull request #825 from 0xProject/fix-order-watcher
OrderWatcher Fixes
2018-07-06 13:06:12 +02:00
Fabio Berger
22f408f713 Update readme and doc intros 2018-07-06 13:05:13 +02:00
Fabio Berger
1e0fa776c1 Add isVerbose flag and log blockstream recoverable errors rather then bubbling them up 2018-07-06 12:34:03 +02:00
Leonid Logvinov
faf5c84082 Fix imports 2018-07-06 11:21:49 +02:00
Leonid Logvinov
b21f6e4d86 Merge pull request #822 from 0xProject/v2-contract-wrappers-WIP
V2 contract wrappers
2018-07-06 12:10:55 +03:00
Jacob Evans
bc52303402 Types: Move Forwarder Revert Reason into types package 2018-07-06 18:26:59 +10:00
Jacob Evans
2da705e81c Forwarder specify the revert reasons 2018-07-06 18:09:56 +10:00
Jacob Evans
a0601cd052 Forwarder fix linter error 2018-07-06 17:44:17 +10:00
Jacob Evans
ed2c06508b Update to new assertions 2018-07-06 17:43:15 +10:00
Jacob Evans
03b3d74748 Merge pull request #522 from 0xProject/feature/contracts/forwarder
Forwarding contract
2018-07-06 16:29:56 +10:00
Jacob Evans
0557d6a9bf Forwarding contract (squashed commits) 2018-07-06 15:30:07 +10:00
Brandon Millman
d975c0cef3 Merge pull request #827 from 0xProject/feature/website/landing-page-cta
Landing page CTA for portal
2018-07-05 22:03:13 -07:00
fragosti
188bf000b7 Add formatUtils 2018-07-05 18:59:01 -07:00
fragosti
608442b2e8 Add to changelog, rename to formatUtils and lint 2018-07-05 18:56:58 -07:00
fragosti
aefc122caf Add conversion utility file 2018-07-05 18:38:25 -07:00
fragosti
a72eae7ea8 Unmarshall txn data in SignerSubprovider before calling web3wrapper sendTransactionAsync 2018-07-05 18:32:28 -07:00
fragosti
30e3afc0fb Add unmarshallTxData to marshaller 2018-07-05 17:48:02 -07:00
fragosti
97809a03eb Make wallet height responsive 2018-07-05 17:11:50 -07:00
fragosti
f894ffc0cc Poll for gas prices and use fast instead of average for better UX 2018-07-05 15:37:35 -07:00
fragosti
127fbc6e94 Just disable closing onboarding by clicking outside for firefox 2018-07-05 15:16:46 -07:00
Brandon Millman
9f870b3d4e Change call to action link to /portal 2018-07-05 15:12:22 -07:00
Amir Bandeali
51b86742d1 Merge pull request #824 from protofire/v2-prototype-solhint
Add and apply solidity linter (V2, updated)
2018-07-05 15:09:41 -07:00
Brandon Millman
3a85b3212b Unify large and small padding in Portal 2018-07-05 14:42:22 -07:00
Brandon Millman
fd6445439e Implement landing page change in preperation for portal 2018-07-05 14:34:34 -07:00
Brandon Millman
51fa8d3e24 Merge pull request #820 from 0xProject/bug/website/top-bar-layout
Various mobile portal fixes and top bar layout refactor
2018-07-05 14:33:22 -07:00
Brandon Millman
7b8db1156d Various fixes for portal on mobile and top bar layout 2018-07-05 14:31:05 -07:00
Fabio Berger
32ad34d224 properly stop blockstream and pass stateLayer into blockstream 2018-07-05 23:18:55 +02:00
Fabio Berger
cfbb1c440e Add pr number 2018-07-05 22:33:11 +02:00
Fabio Berger
ade2f96ca3 Add changelog notes 2018-07-05 22:32:25 +02:00
Fabio Berger
abb38e1bc0 Don't unsubscribe on Blockstream errors 2018-07-05 22:25:47 +02:00
Fabio Berger
0df36471b7 Pass actual networkId 2018-07-05 22:24:21 +02:00
fragosti
97312c2656 Use default networkId of 1 for ledger dropdown 2018-07-05 11:45:54 -07:00
fragosti
e9e4df4891 Fix onboarding closing on unlock metamask step on click outside 2018-07-05 11:28:34 -07:00
Francesco Agosti
e0f80c5e6a Merge pull request #816 from 0xProject/feature/website/portal-mobile-improvements
Make onboarding and wallet copy dynamic based on OS
2018-07-05 11:09:25 -07:00
Alex Shafranovich
f21b042ed1 Contracts 2.0.0 were linted with solhint 2018-07-05 21:01:14 +03:00
Alex Shafranovich
d8c7c9803c Added Solhint package and 'lint-contracts' npm script 2018-07-05 20:58:52 +03:00
fragosti
302b9deef3 Rename getBestDownloadLink to getBestWalletDownloadLinkAndIsMobile 2018-07-05 10:54:13 -07:00
Leonid Logvinov
0c8264801a Fix tests 2018-07-05 19:11:41 +02:00
Leonid Logvinov
54d1a0359f Fix prettier 2018-07-05 17:09:14 +02:00
Leonid Logvinov
b87e48c113 Fix merge conflicts 2018-07-05 16:51:37 +02:00
Fabio Berger
a874cd2424 Remove legacy logic 2018-07-05 16:42:01 +02:00
Fabio Berger
d9e308e53a Refactor order-watcher to use Blockstream under-the-hood 2018-07-05 16:39:53 +02:00
Leonid Logvinov
efc3536283 Add CHANGELOG entries 2018-07-05 16:30:36 +02:00
Leonid Logvinov
4b7e669d29 Upgrade artifacts 2018-07-05 16:02:26 +02:00
Leonid Logvinov
01c6efeaf1 Merge branch 'v2-prototype' into v2-contract-wrappers-WIP 2018-07-05 17:00:50 +03:00
Leonid Logvinov
22cf7bee5b Merge pull request #814 from 0xProject/feature/fill-scenarios-v2
@0xproject/contract-wrappers V2 refactor. Part 2
2018-07-05 16:59:12 +03:00
Leonid Logvinov
ef890aeac4 Adjust comments 2018-07-05 15:58:42 +02:00
Leonid Logvinov
91e8c00076 Fix comments 2018-07-05 15:58:42 +02:00
Leonid Logvinov
20bf4d8ef9 Improve the comment 2018-07-05 15:58:42 +02:00
Leonid Logvinov
795da130a2 Rename Proxie to Proxy 2018-07-05 15:58:41 +02:00
Leonid Logvinov
51a625d4af Rename compact_artifacts to artifacts 2018-07-05 15:58:41 +02:00
Leonid Logvinov
ab8544b0ff Rearrange assertions t match parameter order 2018-07-05 15:58:41 +02:00
Leonid Logvinov
b68d16820f Fix match orders test and add a validation TODO 2018-07-05 15:58:41 +02:00
Leonid Logvinov
61d9cdced0 Add tests for exchange contract wrapper 2018-07-05 15:58:41 +02:00
Leonid Logvinov
714f9ed207 Add Exchange contract wrapper 2018-07-05 15:56:32 +02:00
Leonid Logvinov
ccccaf8e12 Pass through blockPollingInterval down to contract wrapper 2018-07-05 15:56:31 +02:00
Leonid Logvinov
c3ce9d6104 Export orderStatus and OrderInfo 2018-07-05 15:56:31 +02:00
Leonid Logvinov
d3f602f063 Add blockPollingInterval config to contractWrappers config type 2018-07-05 15:56:31 +02:00
Leonid Logvinov
6b379a8a0f Add contractWrappers.erc721Proxy.getproxyIdAsync 2018-07-05 15:56:31 +02:00
Leonid Logvinov
d1d636f1ca Add contractWrappers.erc20Proxy.getproxyIdAsync 2018-07-05 15:56:31 +02:00
Leonid Logvinov
ba9d3cbdb8 Make it possible to configure block polling interval in base contract wrapper 2018-07-05 15:56:31 +02:00
Leonid Logvinov
bcf8d51806 Add blockPollingIntervalMs as an optional field to contract-wrappers config schemas 2018-07-05 15:05:58 +02:00
Leonid Logvinov
66c0d6724a Add even more entries to postinstall hack 2018-07-05 15:05:58 +02:00
Leonid Logvinov
0f477607f9 Update dummy tokens addresses in token_utils 2018-07-05 15:05:58 +02:00
Leonid Logvinov
c1635f2656 Remove only from tests 2018-07-05 15:05:57 +02:00
Leonid Logvinov
029d91bd7a Add OrderInfo and OrderStatus to types 2018-07-05 15:05:57 +02:00
Leonid Logvinov
03dbad6813 Add OrderTxOptsSchema 2018-07-05 15:05:57 +02:00
Leonid Logvinov
c65b2573c4 Refactor fill-scenarios for V2 2018-07-05 15:05:57 +02:00
Leonid Logvinov
7fbee77875 Export ecSignatureParameterSchema from json-schemas 2018-07-05 15:05:57 +02:00
Leonid Logvinov
3cc1a952ca Add ordersSchema to json-schemas 2018-07-05 15:05:57 +02:00
Leonid Logvinov
9c8de3e933 Fix VRS signature generation in order-utils 2018-07-05 15:05:57 +02:00
Leonid Logvinov
cbdce6b67e Update ABI in compact_artifacts 2018-07-05 15:05:57 +02:00
Leonid Logvinov
a6746ae5cd Upgrade artifacts 2018-07-05 15:05:57 +02:00
Leonid Logvinov
7111f3ffc6 Dump assert version and make the order-watcher depend on the old assert version 2018-07-05 15:05:57 +02:00
Fabio Berger
87a7a4ad2d Merge pull request #821 from 0xProject/remove-web3-from-wrapper
Remove Web3.js From 0x-monorepo 🍾
2018-07-05 15:04:58 +02:00
Leonid Logvinov
1ee2d6ed54 Merge branch 'v2-prototype' into v2-contract-wrappers-WIP 2018-07-05 15:04:01 +02:00
Leonid Logvinov
1eba78e20a Revert all changes to the contracts 2018-07-05 14:49:05 +02:00
Fabio Berger
a1fb438a8c Prettier fixes 2018-07-05 13:03:33 +02:00
Fabio Berger
40d1b0a23c Update json-schema version used by web3-wrapper 2018-07-05 12:35:38 +02:00
Fabio Berger
1c9a657693 Add schema assertion checks for callData and txData 2018-07-05 12:35:16 +02:00
Fabio Berger
11747c6cf4 Make sure from is included in txData 2018-07-05 12:34:15 +02:00
Fabio Berger
2a7b3aecc3 Add CallData schema to json-schemas 2018-07-05 12:33:48 +02:00
Fabio Berger
75babed693 Update assert changelog 2018-07-05 12:07:17 +02:00
Fabio Berger
0a32ae6cb5 Add defaultBlock param to getBalanceInWeiAsync 2018-07-05 12:04:08 +02:00
Fabio Berger
3d67f122a5 Move 'from' check to sendTransaction 2018-07-05 12:03:34 +02:00
Fabio Berger
b0daec8384 Remove bn.js unused dep 2018-07-05 01:56:40 +02:00
Fabio Berger
f5b1fe0e6b Fix linter issues 2018-07-05 01:45:56 +02:00
Fabio Berger
139d289b01 remove stray console.log 2018-07-05 01:39:46 +02:00
Fabio Berger
fd242a9cba Remove web3Utils dep and write necessary utility methods 2018-07-05 01:38:14 +02:00
Fabio Berger
7efa17ef7d Add new param javadoc comment 2018-07-05 00:40:43 +02:00
Fabio Berger
a0b9c7777b merge v2-prototype 2018-07-05 00:38:15 +02:00
Fabio Berger
5204e4c08d Pass 'from' param to estimateGas since it is required 2018-07-05 00:36:30 +02:00
Fabio Berger
1050ecdf3c Refactor Web3Wrapper to no longer use Web3.js & add more test coverage 2018-07-05 00:36:01 +02:00
Fabio Berger
5176d929fa Merge pull request #817 from 0xProject/remove-web3
Remove Web3 Dependencies (exept for in web3-wrapper)
2018-07-04 18:51:17 +02:00
Fabio Berger
d712dc47d9 Removee getContractFromAbi method since we no longer use it and do not recommend others use it 2018-07-04 18:11:50 +02:00
Fabio Berger
8adc6f0faa merge v2-prototype 2018-07-04 16:35:49 +02:00
Fabio Berger
4e783fba57 Add missing undefined check 2018-07-04 16:34:03 +02:00
Jacob Evans
ade620f4f7 Merge pull request #775 from RadarRelay/eth-lightwallet-subprovider-final
Eth lightwallet subprovider (replaces #660)
2018-07-04 20:49:25 +10:00
Jacob Evans
5915f8430c Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final 2018-07-04 20:29:54 +10:00
Jacob Evans
9e0f06d060 Specify the lint rule to disable 2018-07-04 20:06:10 +10:00
Fabio Berger
ce86ae0191 Add assert dep 2018-07-04 08:56:12 +02:00
Fabio Berger
2bec5cb7fd Fix bug in string enum assertion so that we check enum values not keys 2018-07-04 08:55:16 +02:00
Fabio Berger
cd766ea2a1 Add more assertions to Web3Wrapper public methods 2018-07-04 08:54:43 +02:00
Fabio Berger
aeea3817a4 Merge pull request #818 from 0xProject/fix-intermittent-test-failure
Fix intermittent test failure in Subproviders package
2018-07-04 07:48:37 +02:00
fragosti
0f11ae1875 No longer elevate relayer grid tile on long press 2018-07-03 18:22:19 -07:00
fragosti
6e87e3e1ac Fix issue where onboarding doesn't scroll to wallet when starting from relayers page 2018-07-03 18:05:00 -07:00
Fabio Berger
4ba108d12f Use stub in test to avoid difference in setup, how network requests take place 2018-07-04 00:59:18 +02:00
Fabio Berger
8ff17ff960 improve comment 2018-07-04 00:41:19 +02:00
Fabio Berger
0d56daf7ab remove console.log 2018-07-04 00:37:39 +02:00
Fabio Berger
9db0bc262b Fix conditional 2018-07-04 00:36:57 +02:00
Fabio Berger
f410903465 Rename to InjectedProvider and make publicConfigStore optional 2018-07-04 00:29:29 +02:00
Fabio Berger
5f2c303bd8 Remove hack since latest web3-provider-engine fixed underlying issue 2018-07-04 00:23:40 +02:00
Fabio Berger
6aa4984fed Fix instance variable name 2018-07-04 00:22:21 +02:00
Fabio Berger
f5cd1ac82e Fix linter 2018-07-04 00:18:09 +02:00
Fabio Berger
54c0b7b261 Fix type 2018-07-04 00:13:36 +02:00
Fabio Berger
a7902eca1f Fix package.json 2018-07-03 23:57:33 +02:00
Fabio Berger
2b4bb579d4 Rename subprovider in blockchain.ts 2018-07-03 23:57:19 +02:00
fragosti
52c956222e Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-mobile-improvements 2018-07-03 14:43:23 -07:00
Francesco Agosti
0900e0c85e Merge pull request #811 from 0xProject/feature/website/onboarding-polish-2
Add Hotjar, and other small improvements
2018-07-03 14:43:02 -07:00
Fabio Berger
a5653337c1 Remove unused imported Web3.js 2018-07-03 23:36:14 +02:00
Fabio Berger
d097113639 Remove dep on Web3 in Website. Introduced InjectedWeb3 type. 2018-07-03 23:34:51 +02:00
fragosti
9389d64392 Add toshi logo asset 2018-07-03 14:32:11 -07:00
fragosti
931e7e7d71 Prompt user to download Toshi or MetaMask in install wallet onboarding step 2018-07-03 14:28:49 -07:00
Fabio Berger
cce2fb40a1 Fix import 2018-07-03 23:11:59 +02:00
Fabio Berger
547cf4bef3 Refactor testnet-faucet to use web3Wrapper instead of web3 directly 2018-07-03 23:11:49 +02:00
Fabio Berger
d528ce757c Replace use of web3 w/ web3wrapper in subproviders and rename injectedWeb3 to signer subprovider for clarity 2018-07-03 22:58:17 +02:00
fragosti
3b78188fec Show different download links and icons when on mobile 2018-07-03 13:51:58 -07:00
Alex Browne
d91b30faef Merge pull request #812 from 0xProject/fix/revert-assertions-improvements
Improve robustness of revert reason assertions
2018-07-03 13:42:30 -07:00
Alex Browne
dc956020ef Move NodeType caching out of web3-wrapper and into our internal code 2018-07-03 12:57:11 -07:00
fragosti
a52eb81380 Rename isMobile utility fn to be more specific and add isMobileOperatingSystem 2018-07-03 12:48:19 -07:00
fragosti
ab0055d5c6 Add OperatingSystemType and get OS util 2018-07-03 12:45:28 -07:00
fragosti
32c25a2034 Persist whether onboarding is open or close across refreshes 2018-07-03 11:48:34 -07:00
fragosti
c30b42434a Fix linting 2018-07-03 11:31:40 -07:00
fragosti
3c797a6e11 Merge branch 'fixed-position-onboarding' into feature/website/onboarding-polish-2 2018-07-03 11:26:26 -07:00
Brandon Millman
9b864517e2 Merge pull request #799 from 0xProject/feature/website/wallet-menu
Add menu for at the top of wallet and top right component
2018-07-03 11:19:52 -07:00
Fabio Berger
a858e2870b Merge pull request #815 from 0xProject/update-dependencies
Update Blockstream & ProviderEngine
2018-07-03 20:19:08 +02:00
Alex Browne
ce1542da4f Update CHANGELOG.json for ethereum-types and web3-wrapper 2018-07-03 10:59:45 -07:00
Alex Browne
d2ebf4a777 Add TransactionReceiptStatus type to ethereum-types 2018-07-03 10:49:35 -07:00
Alex Browne
c5fcea1dbd Actually cache node type in web3-wrapper 2018-07-03 10:40:54 -07:00
Fabio Berger
5e8ef070e2 Fix alignment 2018-07-03 18:26:12 +02:00
Brandon Millman
2d30c290e9 Remove InstallPrompt 2018-07-03 09:22:52 -07:00
Fabio Berger
688b34710e Update blockstream to latest version, propogate errors to top-level callers 2018-07-03 18:15:20 +02:00
Brandon Millman
afbfc8ba1c Implement clickaway for wallet menu on mobile 2018-07-03 09:06:29 -07:00
Fabio Berger
671f29774b Update web3-provider-engine version w/o caret 2018-07-03 16:56:49 +02:00
Fabio Berger
4c99ac0ca2 Update web3-provider-engine 2018-07-03 15:59:30 +02:00
Leonid Logvinov
0e690608d3 Merge pull request #782 from 0xProject/feature/contract-wrappers-v2
@0xproject/contract-wrappers V2 refactor. Part 1
2018-07-03 15:32:38 +03:00
Fabio Berger
92f6391df5 Merge pull request #801 from feuGeneA/patch-3
in subproviders/package.json, cite typescript-typings only once
2018-07-03 11:53:23 +02:00
Brandon Millman
f2af6e4b3a Add optional onClick to Link simple menu item 2018-07-03 01:51:59 -07:00
Jacob Evans
27c03cffe2 Fix unused imports 2018-07-03 17:01:08 +10:00
Jacob Evans
499915042e Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final 2018-07-03 16:58:08 +10:00
Jacob Evans
1a901554cc compiler and ts lint are confused about ContractEventArgs 2018-07-03 15:39:15 +10:00
Alex Browne
5b64b3ea93 Improve robustness of revert reason assertions 2018-07-02 18:57:33 -07:00
fragosti
6fc5c0cd46 Remove unused import 2018-07-02 18:36:41 -07:00
Brandon Millman
328da21420 Merge pull request #806 from 0xProject/feature/website/mobile-readable-web3-names
Add detection logic for Toshi and Cipher
2018-07-02 18:26:16 -07:00
Brandon Millman
81062d20eb Merge pull request #808 from 0xProject/feature/website/better-balance-formatting
Add better balance formatting rules for balances and usd values
2018-07-02 18:25:58 -07:00
Brandon Millman
835d06dcdc Merge pull request #810 from 0xProject/feature/wesbite/remove-add-balance
Remove increase balance link from balance_bounded_input component
2018-07-02 18:25:43 -07:00
fragosti
8929543b55 Add end comment to hotjar tracking code 2018-07-02 18:15:41 -07:00
fragosti
f62044c1e3 Add media file and remove stray comment 2018-07-02 18:14:21 -07:00
fragosti
a31f7a5112 Implement fixed position onboarding option 2018-07-02 18:12:08 -07:00
Brandon Millman
fe68114f39 Use new lock svg 2018-07-02 17:56:37 -07:00
fragosti
a5231df6d9 Add media query abstraction around ScreenWidths and stop relayer grid hover effect on mobile 2018-07-02 17:26:48 -07:00
Brandon Millman
fd545ec00f Remove increase balance link from balance_bounded_input component 2018-07-02 17:14:46 -07:00
Brandon Millman
73d8a2adf7 Always show the wrap ether row in between ETH and WETH 2018-07-02 17:02:11 -07:00
Brandon Millman
04d11d6fac Add human readable names for Toshi and Cipher 2018-07-02 16:37:22 -07:00
Brandon Millman
2eede4a09e Update start onboarding copy and relayer grid empty color 2018-07-02 16:30:13 -07:00
Brandon Millman
bc7e8ff471 Add better balance formatting rules for balances and usd values 2018-07-02 16:08:02 -07:00
fragosti
73e81c62fb Remove max-width from onboarding card to support iPad 2018-07-02 15:58:53 -07:00
fragosti
8c5dc7cecd Only auto-start onboarding if blockchain is loaded 2018-07-02 15:52:59 -07:00
Francesco Agosti
300c9f09b9 Merge pull request #805 from 0xProject/feature/website/add-alex-to-about
Add Alex Browne to about page
2018-07-02 14:09:31 -07:00
fragosti
06f4427939 Add Alex Browne to about page 2018-07-02 13:15:40 -07:00
Amir Bandeali
b1dc20bbb3 Add developer mailing list link to README 2018-07-02 09:51:51 -07:00
F. Eugene Aumson
4887d1d42f in subproviders, cite typescript-typings only once
`yarn build` was giving the following warning:

warning package.json: "dependencies" has dependency "@0xproject/typescript-typings" with range "^0.4.1" that collides with a dependency in "devDependencies" of the same name with version "^0.4.2"
2018-07-02 11:23:33 -04:00
Fabio Berger
d247d72e3e Merge pull request #803 from 0xProject/fix/publishing/remote-tag-removal
Small publish fixes
2018-07-02 16:20:34 +02:00
Fabio Berger
50957e1d29 Update incorrect versions of deps 2018-07-02 16:04:48 +02:00
Fabio Berger
6aad12a52f Add new changelog entry 2018-07-02 14:26:52 +02:00
Fabio Berger
db0944acde fix prettier 2018-07-02 14:21:49 +02:00
Fabio Berger
e553ef83de Git command outputs logs to stdErr so only way to check for errors if with try/catch 2018-07-02 14:20:42 +02:00
Fabio Berger
a619949a56 Remove remote tag before local one 2018-07-02 14:19:30 +02:00
Fabio Berger
1346fa792a Add logs for when tags get removed 2018-07-02 13:53:44 +02:00
Fabio Berger
b763cdbd4c combine changelog entries since we haven't published yet 2018-07-02 13:53:24 +02:00
Fabio Berger
e4eac14dc9 version outdated 2018-07-02 13:53:05 +02:00
Fabio Berger
bdda1f2992 Throw if changelog version is below package.json version 2018-07-02 13:32:22 +02:00
Fabio Berger
9c7289d7a3 Update outdated changelogs 2018-07-02 13:31:34 +02:00
Fabio Berger
d861caca23 Fix bug where 18 decimal tokens instead of 5 decimal tokens created 2018-07-02 12:31:02 +02:00
Fabio Berger
590033bcb2 Merge pull request #802 from 0xProject/fix/five_decimal_scenario
FillOrder Combinatorial Testing Fixes
2018-07-02 12:24:57 +02:00
Fabio Berger
af1e4574a8 Disable custom-no-magic-number for block 2018-07-02 11:39:07 +02:00
Fabio Berger
7b806fe84d Remove unused variable 2018-07-02 11:18:48 +02:00
Fabio Berger
e54e2ac67b Add .vscode from .gitignore 2018-07-02 11:13:31 +02:00
Fabio Berger
de9f0732a0 Merge branch 'v2-prototype' into fix/five_decimal_scenario
* v2-prototype: (75 commits)
  Update relayer grid tiles to use Text
  Fix build
  Update file structure
  Update 2.0.0 artifacts
  Move ledgerhq module declarations to typescript-typings
  Export LedgerEthereumClient type in subproviders
  Update artifacts
  Add logging and updated artifacts
  Fix migrations
  Run prettier
  Add Kovan artifacts
  Use ledger subprovider
  Add Kovan migrations
  Remove state variable from Link component in Portal
  Make registerAssetProxy append only
  Update staging api link
  Change getTransactionReceipt to awaitTransactionMined
  Move /docs route to the end
  Remove extra call to scrollIntoView for wallet in onboarding
  Update expectRevertReasonOrAlwaysFailingTransactionAsync to check status codes
  ...
2018-07-02 11:12:01 +02:00
Fabio Berger
20acdbf6c3 Add commented out scenarios not run by default 2018-07-02 11:01:15 +02:00
Fabio Berger
6a6d2f73a8 Fix comment 2018-07-02 11:00:32 +02:00
Fabio Berger
f5a8f00af8 Fix validation logic by checking for 0 maker/taker amount before 0 fillTakerAssetAmount since one causes the other during combinatorial testing 2018-07-02 10:52:49 +02:00
Fabio Berger
018a437d62 Print out entire orderFill scenario 2018-07-02 10:51:28 +02:00
Fabio Berger
32d75b6483 Transfer ERC721 token instead of burning, so we can still set an allowance to it in tests 2018-07-02 10:50:48 +02:00
Fabio Berger
cb6cace910 Fix bug where using nullAddress for order instead of actual taker address 2018-07-02 10:49:41 +02:00
Fabio Berger
0326ddd79d Add maker and taker balance/allowance scenarios to generateFillOrderCombination 2018-07-02 10:48:59 +02:00
Jacob Evans
d6f40a9281 Remove duplicated typescript-typings in package.json 2018-07-02 18:14:19 +10:00
Jacob Evans
687802394a Remove duplicate type definitions.
Clear private key earlier
Fix changelog in typescript-typings from bad merge
2018-07-02 18:09:05 +10:00
Jacob Evans
ad570b8ae1 Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final 2018-07-02 11:21:16 +10:00
Jacob Evans
b9165c03af Use PrivateKeySubprovider inside eth lightwallet
There's a loss of information when hex encoding and passing to eth light wallet (chain id is lost). This results in a different signature. While it may work on testnets it is not sufficient for our test cases. We can export the private key and use it in our PrivateKeyWalletSubprovider
2018-07-02 11:09:32 +10:00
F. Eugene Aumson
cfe57f52f4 use bullets, not a task list, for Types of Changes 2018-07-01 20:44:28 -04:00
Brandon Millman
86d4ffe7e5 Lint fixes 2018-07-01 14:51:02 -07:00
Brandon Millman
2dea179333 More cleanup 2018-07-01 14:51:02 -07:00
Brandon Millman
5a7908984e Consolidate logic for common menu items 2018-07-01 14:51:02 -07:00
Brandon Millman
955fdf5d13 Give connected header accessory more padding 2018-07-01 14:51:02 -07:00
Brandon Millman
a6f40d4187 Implement correct behavior for menu in the wallet 2018-07-01 14:50:55 -07:00
Brandon Millman
6daf754f5b Add menu to wallet 2018-07-01 14:50:55 -07:00
Brandon Millman
da8cf9981e Implement simple menu 2018-07-01 14:50:55 -07:00
Brandon Millman
be64184cfa Clean up a bit of the provider display logic 2018-07-01 14:50:55 -07:00
Brandon Millman
3031598843 Implement icon button 2018-07-01 14:50:55 -07:00
Brandon Millman
b9b00e10d3 Update relayer grid tiles to use Text 2018-06-30 12:37:34 -07:00
Amir Bandeali
6c34255a3e Merge pull request #781 from 0xProject/refactor/contracts/fileStructure
Update contracts file structure
2018-06-29 18:36:00 -07:00
Amir Bandeali
41064adc66 Fix build 2018-06-29 18:20:44 -07:00
Amir Bandeali
2fcc36bbad Update file structure 2018-06-29 18:05:40 -07:00
Amir Bandeali
762c0143eb Merge pull request #770 from 0xProject/feature/migrations/kovan-deploy
Add Kovan migrations
2018-06-29 17:49:15 -07:00
Amir Bandeali
6c6f34ee72 Update 2.0.0 artifacts 2018-06-29 17:41:25 -07:00
Francesco Agosti
42b7b0dab9 Merge pull request #787 from 0xProject/feature/website/portal-onboarding-polish
Portal v2 onboarding polish
2018-06-29 17:40:43 -07:00
Amir Bandeali
e58e35e098 Move ledgerhq module declarations to typescript-typings 2018-06-29 17:25:56 -07:00
Amir Bandeali
654b048602 Export LedgerEthereumClient type in subproviders 2018-06-29 17:25:56 -07:00
Amir Bandeali
3ece72af49 Update artifacts 2018-06-29 17:25:56 -07:00
Amir Bandeali
2ef31991c7 Add logging and updated artifacts 2018-06-29 17:25:56 -07:00
Amir Bandeali
d3293a5571 Fix migrations 2018-06-29 17:25:56 -07:00
Amir Bandeali
854752acdf Run prettier 2018-06-29 17:25:56 -07:00
Amir Bandeali
0c889385f1 Add Kovan artifacts 2018-06-29 17:25:56 -07:00
Amir Bandeali
6e1a549fcb Use ledger subprovider 2018-06-29 17:25:56 -07:00
Amir Bandeali
5f0a2953c6 Add Kovan migrations 2018-06-29 17:25:56 -07:00
Amir Bandeali
78b513c52a Merge pull request #797 from 0xProject/refactor/contracts/registerAssetProxy
Make registerAssetProxy append only
2018-06-29 17:25:21 -07:00
fragosti
8ffce78827 Remove state variable from Link component in Portal 2018-06-29 16:47:58 -07:00
Amir Bandeali
d4852092b8 Make registerAssetProxy append only 2018-06-29 16:25:16 -07:00
Brandon Millman
622ce0bf2e Update staging api link 2018-06-29 16:11:57 -07:00
Amir Bandeali
6a197a64e6 Merge pull request #793 from 0xProject/feature/contracts/transferFromFallback
Optimize transferFrom (saves ~2000 gas /fill)
2018-06-29 15:34:56 -07:00
Amir Bandeali
1e4c3ed22b Change getTransactionReceipt to awaitTransactionMined 2018-06-29 15:21:00 -07:00
Brandon Millman
e3521c6388 Move /docs route to the end 2018-06-29 15:20:44 -07:00
fragosti
9d81e069dc Remove extra call to scrollIntoView for wallet in onboarding 2018-06-29 14:04:41 -07:00
Amir Bandeali
8623a30763 Merge pull request #796 from 0xProject/fix/contracts/failingTransactionAssertions
Update expectRevertReasonOrAlwaysFailingTransactionAsync to check status codes
2018-06-29 14:03:28 -07:00
Alex Browne
6cf39896f1 Update expectRevertReasonOrAlwaysFailingTransactionAsync to check status codes 2018-06-29 13:46:42 -07:00
Amir Bandeali
44b6adaa29 Fix deployment to geth 2018-06-29 13:33:22 -07:00
Amir Bandeali
762a6199b2 Fix tests 2018-06-29 13:33:22 -07:00
Amir Bandeali
8da42b12f4 Remove transferFrom, implement in fallback function 2018-06-29 13:33:22 -07:00
fragosti
c473a0444c Bump automatic show onborading delay by 1000ms 2018-06-29 13:30:43 -07:00
fragosti
e693629bbd Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-onboarding-polish 2018-06-29 13:27:19 -07:00
fragosti
0dbe883c3b Fix onboarding always starting 2018-06-29 13:24:31 -07:00
Brandon Millman
cc12bc9247 Merge pull request #792 from 0xProject/feature/website/wallet-polish
Various wallet polish items
2018-06-29 12:01:13 -07:00
Brandon Millman
ddec01e6c1 Change function to a const 2018-06-29 11:56:31 -07:00
Brandon Millman
03bc7bb935 Move wallet scrollIntoView into PortalOnboardingFlow 2018-06-29 11:55:00 -07:00
fragosti
5207dfdc0e Rename userHasAllowances bool to follow proper convention 2018-06-29 11:50:24 -07:00
fragosti
fc40efb761 Allow you to continue the onboarding flow once youve installed metamask and refreshed the page 2018-06-29 11:47:12 -07:00
Amir Bandeali
50556e2609 Merge pull request #774 from 0xProject/style/contracts/abiEncodeAsmComments
Added some comments for ASM hashing
2018-06-29 11:41:23 -07:00
Alex Browne
7a22298597 Merge pull request #794 from 0xProject/fix/devnet-minimum-blocks
Improve reliability of the minimum block number hack for devnet/geth
2018-06-29 11:21:17 -07:00
fragosti
36cadaae46 Use Image component where relevant and add back tracked token timestamp logic 2018-06-29 11:08:48 -07:00
Leonid Logvinov
09e921a562 Fix build after rebase 2018-06-29 17:52:55 +03:00
Leonid Logvinov
13cbaf56b2 Add a comment 2018-06-29 17:52:55 +03:00
Leonid Logvinov
62910c8e89 Assign true values to names vars 2018-06-29 17:52:55 +03:00
Leonid Logvinov
f20e1acad9 Fix a typo 2018-06-29 17:52:55 +03:00
Leonid Logvinov
5dea432ebf Set the interval to 0 in awaitTranscationSuccessAsync 2018-06-29 17:52:55 +03:00
Leonid Logvinov
016d82d766 Make promises dangerous 2018-06-29 17:52:54 +03:00
Leonid Logvinov
260c72cc20 Add a TODO comment 2018-06-29 17:52:54 +03:00
Leonid Logvinov
3d7bcd7ecb Add isSubscriptionToken assertion 2018-06-29 17:52:54 +03:00
Leonid Logvinov
ac9175bf88 Rename approved to approvedAddress 2018-06-29 17:52:54 +03:00
Leonid Logvinov
294d3bbdc1 Use removeUndefinedProperties for txOpts 2018-06-29 17:52:54 +03:00
Leonid Logvinov
6db614251e Rename getApprovedAsync to getApprovedIfExistsAsync 2018-06-29 17:52:54 +03:00
Leonid Logvinov
bcc588efe7 Add HACK comments 2018-06-29 17:52:54 +03:00
Leonid Logvinov
f7b3fc58bc Add assertions for txOpts and methodOpts 2018-06-29 17:52:54 +03:00
Leonid Logvinov
de40497330 Remove v2 artifact scripts 2018-06-29 17:52:54 +03:00
Leonid Logvinov
d84bb7ed7e Remove tokenTransferProxyAddress from config 2018-06-29 17:52:54 +03:00
Leonid Logvinov
f02ada2d11 Add a hack comment 2018-06-29 17:52:54 +03:00
Leonid Logvinov
48970d3424 Fix a typo 2018-06-29 17:52:54 +03:00
Leonid Logvinov
8940b1759d Fix linter errors 2018-06-29 17:52:54 +03:00
Leonid Logvinov
91a50d0f53 Fix addresses in WETH9 and ZRX token artifacts 2018-06-29 17:52:54 +03:00
Leonid Logvinov
ed4f8c5b66 Fix the token supply in migrations 2018-06-29 17:52:53 +03:00
Leonid Logvinov
2f07ee0a8f Dump assert version and make the order-watcher depend on the old assert version 2018-06-29 17:52:53 +03:00
Leonid Logvinov
8dd00a8eef Change event args names after templates change 2018-06-29 17:52:53 +03:00
Leonid Logvinov
d7845a177e Add contract-wrappers -> json-schemas and order-utils to postinstall hack 2018-06-29 17:52:53 +03:00
Leonid Logvinov
7a3be0a320 Change import paths from z_r_x and e_r_c to zrx and erc in migrations 2018-06-29 17:52:53 +03:00
Leonid Logvinov
14cebce304 Regenerate yarn.lock 2018-06-29 17:52:53 +03:00
Leonid Logvinov
9fcf9f2504 Export newly refactored contracts from contract-wrappers and index.ts 2018-06-29 17:52:53 +03:00
Leonid Logvinov
c466ab6cf2 Change artifacts list and add dependencies to package.json 2018-06-29 17:52:53 +03:00
Leonid Logvinov
01bf789ad4 Bump the version so that order-watcher doesn't pick it up 2018-06-29 17:52:53 +03:00
Leonid Logvinov
1a1ab5af54 Refactor event subscription tests 2018-06-29 17:52:53 +03:00
Leonid Logvinov
4089ad7b4b Refactor types 2018-06-29 17:52:53 +03:00
Leonid Logvinov
2adc299c78 Implement ERC721 token wrapper and token transfer proxy with tests 2018-06-29 17:52:53 +03:00
Leonid Logvinov
3aef323c13 Refactor ERC20 token transfer proxy and it's tests 2018-06-29 17:52:53 +03:00
Leonid Logvinov
a655cd046c Refactor ERC20 token wrapper and it's tests 2018-06-29 17:52:53 +03:00
Leonid Logvinov
9c8701f5f6 Refactor ether token wrapper test 2018-06-29 17:52:52 +03:00
Leonid Logvinov
7ac84aff0a Refactor base contract-wrapper class to use new names, artifact format and only decode logs from that contract 2018-06-29 17:52:52 +03:00
Leonid Logvinov
fd13c8f68c Refactor EtherToken contract wrapper to use new names and artifacts format 2018-06-29 17:52:52 +03:00
Leonid Logvinov
532964af42 Use new signature verification method in assertions 2018-06-29 17:52:52 +03:00
Leonid Logvinov
52d1407215 Export txDefaults from web3_wrapper.ts 2018-06-29 17:52:52 +03:00
Leonid Logvinov
ecb7356345 Refactor tokenUtils to not use tokenRegistry 2018-06-29 17:52:52 +03:00
Leonid Logvinov
edda7dae94 Add new test constants 2018-06-29 17:52:52 +03:00
Leonid Logvinov
32da0a376a Skip & refactor artifacts tests 2018-06-29 17:52:52 +03:00
Leonid Logvinov
073e76ee90 Run V2 migrations instead of V1 before tests 2018-06-29 17:52:52 +03:00
Leonid Logvinov
ceba82260f Remove unused params in filter_utils 2018-06-29 17:52:52 +03:00
Leonid Logvinov
a5a61c87fc Start unused parameter names with underscore 2018-06-29 17:52:52 +03:00
Leonid Logvinov
d34feb1e0a Remove old contracts and add new ones to/from artifacts.ts 2018-06-29 17:52:52 +03:00
Leonid Logvinov
6cc5e45183 Remove exchange-related functionality for now 2018-06-29 17:52:52 +03:00
Leonid Logvinov
618c7ef48a Update compact_wrtifacts 2018-06-29 17:52:52 +03:00
Leonid Logvinov
14047f9c7b Change import paths from z_r_x and e_r_c to zrx and erc. Also rename event args after templates change 2018-06-29 17:52:51 +03:00
Leonid Logvinov
f439f162d2 Change import paths from z_r_x and e_r_c to zrx and erc 2018-06-29 17:52:51 +03:00
Leonid Logvinov
5b685b32bd Rename TransferContractEventArgs to MetacoinTransferEventArgs after changing contracts templates 2018-06-29 17:52:51 +03:00
Leonid Logvinov
6ce151c676 Change import paths from z_r_x and e_r_c to zrx and erc 2018-06-29 17:52:51 +03:00
Leonid Logvinov
eb79b5d651 Pin contract-wrappers version 2018-06-29 17:52:51 +03:00
Leonid Logvinov
608e1c8960 Remove unused code/variables from abi-decoder 2018-06-29 17:52:51 +03:00
Leonid Logvinov
f8772d8850 Rename {{*}}ContractEventArgs to {{*}}EventArgs and append {{contractName}} to each event name (ERC721TransferEventArgs instead of TransferContractEventArgs) 2018-06-29 17:52:51 +03:00
Leonid Logvinov
ce2f408864 Update json-schema version to 1.0.0 2018-06-29 17:52:51 +03:00
Leonid Logvinov
c2a362e3ea Add to postinstall hack: rm fill-scenarios/node_modules/@0xproject 2018-06-29 17:52:51 +03:00
Leonid Logvinov
eafdd4d42d Remove generated contract directory before writing new contracts and replace z_r_x and e_r_c with zrx and erc accordingly 2018-06-29 17:52:51 +03:00
Fabio Berger
1a2c58494f Merge pull request #783 from 0xProject/miscenaleous-fixes
Migration Related Miscellaneous fixes
2018-06-29 11:59:49 +02:00
Fabio Berger
68c00976f1 Fix merge 2018-06-29 11:40:05 +02:00
Fabio Berger
aa2616b307 Merge v2-prototype 2018-06-29 11:34:38 +02:00
Jacob Evans
3062c18ebd Merge pull request #795 from 0xProject/miscellaneous-fixes/v2-exchange-register-assets
Register the asset proxies to exchange
2018-06-29 19:31:10 +10:00
Jacob Evans
a83f5241dc Register the asset proxies to exchange 2018-06-29 19:12:42 +10:00
Brandon Millman
f89acb49be Add dollar sign to NullTokenRow 2018-06-29 01:11:02 -07:00
Brandon Millman
2b5f45676f Remove unused imports and variables 2018-06-29 01:07:50 -07:00
Brandon Millman
aedd51a61b Refactor inline styles out of Wallet 2018-06-29 00:59:24 -07:00
Brandon Millman
0b5a49c17d Remove some hardcoded MetaMask colors 2018-06-28 23:31:17 -07:00
Brandon Millman
08f7666d21 Create AccountConnection component 2018-06-28 23:24:57 -07:00
Brandon Millman
81ff99276b Fix scrollbar bug 2018-06-28 23:03:30 -07:00
fragosti
e71862676c Bold all balances in onboarding 2018-06-28 18:02:32 -07:00
fragosti
67777c586d Customize allowance setting onboarding step if you have your allowances set 2018-06-28 18:00:10 -07:00
fragosti
9ada8e4ddf Re-center react-popper on every step 2018-06-28 17:51:39 -07:00
fragosti
0142e7fa8f Fix button hover and active hover state 2018-06-28 17:37:22 -07:00
fragosti
467e9abf5f Show eth balance in add eth balance onboarding step 2018-06-28 17:34:29 -07:00
fragosti
512980d9bd Change onboarding flow to communicate 3 steps 2018-06-28 17:25:58 -07:00
fragosti
e235a63119 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-onboarding-polish 2018-06-28 17:20:05 -07:00
Alex Browne
4c28b66539 Add @0xproject/utils as dependency to dev-utils/package.json 2018-06-28 15:42:56 -07:00
Greg Hysen
46d79e5115 Updated hashing comments as-per PR 2018-06-28 15:41:06 -07:00
Alex Browne
d79994fbb2 Improve reliability of the minimum block number hack for the devnet/geth 2018-06-28 15:32:14 -07:00
Brandon Millman
518a2da027 Merge pull request #791 from 0xProject/bug/website/broken-not-found
Fix NotFound component and render 0x.js docs for /docs
2018-06-28 12:35:18 -07:00
Brandon Millman
71fa92dbeb Fix NotFound component and render 0x.js docs for /docs 2018-06-28 12:24:34 -07:00
Brandon Millman
172d2353dd Start onboarding from relayer index 2018-06-28 11:50:08 -07:00
Brandon Millman
3315006c45 Fix learn how to set up account layout 2018-06-28 11:50:08 -07:00
Brandon Millman
6700745585 Fix typo 2018-06-28 11:50:08 -07:00
Brandon Millman
0ff18058ab Get rid of unused stuff in wallet 2018-06-28 11:50:08 -07:00
Brandon Millman
1a11283086 Fix body overlay on mobile 2018-06-28 11:50:08 -07:00
Brandon Millman
ed559be47c Change learn how to update your account styling 2018-06-28 11:50:08 -07:00
Brandon Millman
a60dd1cbaf Fix key issue and remove WalletDisconnectedItem 2018-06-28 11:50:08 -07:00
Brandon Millman
7ee37fb62a Implement new locked and uninstalled states 2018-06-28 11:50:08 -07:00
Brandon Millman
2970e103db Fix off center icon in wallet 2018-06-28 11:50:08 -07:00
Brandon Millman
78333b3026 Change wallet margin based on hover to prevent re-layout 2018-06-28 11:50:08 -07:00
Brandon Millman
1ca182e741 Update ProviderDisplay with new design 2018-06-28 11:50:08 -07:00
Brandon Millman
8419db53bb Implement provider name in header 2018-06-28 11:50:08 -07:00
Brandon Millman
f76c9bc226 Implement loading body rows 2018-06-28 11:50:08 -07:00
Brandon Millman
6a39a69afe Added Circle component 2018-06-28 11:50:08 -07:00
Francesco Agosti
2474d1d2f4 Merge pull request #780 from 0xProject/feature/website/support-new-metamask
Refactor Blockchain.ts to allow arbitrary provider state changes
2018-06-28 11:36:49 -07:00
fragosti
e4188f5d4c Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/support-new-metamask 2018-06-28 11:17:30 -07:00
Brandon Millman
0fcbd02d50 Merge pull request #762 from 0xProject/feature/website/scroll-to-token
Sort wallet tokens by timestamp added and scroll to newly added token
2018-06-28 10:47:43 -07:00
Brandon Millman
4969797c23 Remove isTracked field on token in favor of trackedTimestamp 2018-06-28 10:39:16 -07:00
Brandon Millman
0e932286d2 Use moment and lodash 2018-06-28 10:38:07 -07:00
Brandon Millman
366a9502dd Sort wallet tokens by timestamp added and scroll to newly added token 2018-06-28 10:38:07 -07:00
Fabio Berger
988a334758 Merge pull request #707 from 0xProject/feature/combinatorial-testing
OrderFill Declarative Testing & Combinatorial Tests [Merge after #760]
2018-06-28 11:04:16 +02:00
Fabio Berger
4fe6269043 Remove unused constants 2018-06-28 10:45:28 +02:00
Fabio Berger
646927962a Reduce the userAddresses to the individual addresses actually used by tests, as well as only deploy the number of ERC20 tokens needed for each test suite 2018-06-28 10:43:37 +02:00
Fabio Berger
b56baefaa6 Add await time constant 2018-06-28 09:34:13 +02:00
Fabio Berger
f49a507297 Add missing awaitTransactionSuccessAsync calls 2018-06-28 09:13:56 +02:00
fragosti
c20549e88d Scroll to top when going to relayers page from onboarding 2018-06-27 19:23:51 -07:00
fragosti
cd16986942 Bring you directly to relayers page once you finish onboarding 2018-06-27 19:21:09 -07:00
fragosti
e481404a14 Remove period in title from last step 2018-06-27 19:07:53 -07:00
fragosti
3dfde15133 Always restart onboarding from 0 and other small improvements 2018-06-27 18:56:14 -07:00
fragosti
4454cfa65d Customize flow depending on what steps you've completed 2018-06-27 18:21:51 -07:00
fragosti
382839464f Break wrapping ETH into a 3rd step 2018-06-27 17:00:07 -07:00
fragosti
cce5585795 Fix animation when coming from bottom 2018-06-27 16:29:38 -07:00
fragosti
26a9fe9127 Fix width issue with onboarding card on mobile 2018-06-27 16:21:50 -07:00
fragosti
47a267c3fa Clicking overlay closes onboarding 2018-06-27 15:14:21 -07:00
fragosti
36836eb942 Fix z index issue with wrap buttons and onboarding cards 2018-06-27 14:45:01 -07:00
fragosti
aad0804a1e Break wrath ETH step into 2 2018-06-27 14:33:04 -07:00
fragosti
3c68d9c297 Fix skip button position on first step 2018-06-27 13:51:37 -07:00
fragosti
ffdc7d13a9 Make onboarding bounce around less 2018-06-27 13:40:52 -07:00
fragosti
c5085d8364 Scroll to wallet when onboarding automatically starts as well 2018-06-27 13:36:38 -07:00
fragosti
00ad7bc470 Change asset for final onboarding step 2018-06-27 13:23:17 -07:00
fragosti
360927ec77 Changing provider to ledger more consistent with previous experience 2018-06-27 11:37:24 -07:00
fragosti
b6f546ebe0 Fix convention stuff 2018-06-27 11:17:32 -07:00
fragosti
2a092143dc Remove IS_MAINNET_ENABLED config 2018-06-27 10:40:07 -07:00
fragosti
de50407953 Rename all corresponding bools to shouldUseLedgerProvider 2018-06-27 10:34:17 -07:00
Fabio Berger
57d5fbfbd8 Merge pull request #766 from perissology/feature/solcov-ignore
[sol-cov] add ability to ignore covering specific code blocks
2018-06-27 19:00:16 +02:00
Fabio Berger
92322c0e07 Remove network 50 details 2018-06-27 18:42:34 +02:00
Fabio Berger
97ed453eb4 Re-generate and clean up artifacts for 2.0.0 2018-06-27 18:34:44 +02:00
Fabio Berger
654b782810 Add missing AssetProxyOwner from compile:v2 command 2018-06-27 18:34:03 +02:00
Fabio Berger
51211a21ba Improve ganache-core's GanacheOpts type and require it instead of any 2018-06-27 18:33:32 +02:00
Fabio Berger
133b6fe240 Encode ZRX address as needed. 2018-06-27 18:32:48 +02:00
Fabio Berger
c824fe8718 Add optimizer settings to migrations compiler.json 2018-06-27 18:31:34 +02:00
Fabio Berger
26d3a487a5 Update ganache-cli to latest 2018-06-27 18:31:18 +02:00
perissology
e0a2afc068 rename function 2018-06-27 07:26:12 -07:00
Fabio Berger
f6e97bb284 Merge pull request #763 from prettymuchbryce/invalid-argument-error
Fix OrderWatcher uncaught Error
2018-06-27 11:55:04 +02:00
Fabio Berger
6c8b998505 Fix tslint 2018-06-27 11:28:41 +02:00
Fabio Berger
f9fab216e9 Merge branch 'v2-prototype' into invalid-argument-error 2018-06-27 11:02:40 +02:00
Fabio Berger
c308359f59 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype:
  Improve 'web3-provider-engine' typings
  Fix build
  Update artifacts
  Add more revert reasons to tests
  Make dispatchTransferFrom revert with reason from AssetProxy on failure
  Remove redundant files, hard code function selector in dispatchTransferFrom, and modify revert reason
  Updated offset of receiverData length to reflect new assetData encoding.
  ERC20 Custom storage layout
  Golf the authorization check
  ERC20 manual memory layout
  ERC20 inline return
  ERC721 inline return
  Golf ERC721 transferFrom
  Inline ERC20 tranferFrom selector constant
  Optimize ERC20 transferFrom
  Polish asset picker layout
  Update relayer grid fallback icon
  Change metamask install link based on browser
  Use ethereumjs-tx@1.3.5 instead of our fork

# Conflicts:
#	packages/contracts/test/asset_proxy/proxies.ts
#	packages/contracts/test/exchange/core.ts
#	packages/migrations/artifacts/2.0.0/DummyERC721Token.json
2018-06-27 10:59:37 +02:00
Fabio Berger
375d667144 Move combinatorial fillOrder tests into the fill_ordere test file 2018-06-27 10:43:12 +02:00
Nikita Galkin
84bd54ba40 Improve 'web3-provider-engine' typings 2018-06-27 09:26:48 +03:00
Amir Bandeali
73c36fe2d2 Merge pull request #773 from 0xProject/feature/contracts/abi-calldata-proxy
Optimize transfer
2018-06-26 18:38:30 -07:00
Amir Bandeali
ec3e9efdaa Fix build 2018-06-26 18:30:20 -07:00
Amir Bandeali
d5c389b7dc Update artifacts 2018-06-26 17:36:44 -07:00
Amir Bandeali
7f233dcb15 Add more revert reasons to tests 2018-06-26 17:34:43 -07:00
Fabio Berger
6a2421c683 Fix tests 2018-06-26 23:17:29 +02:00
Fabio Berger
d66ca7b5cb Fix enum name 2018-06-26 23:17:20 +02:00
fragosti
5e38cbd69c Never use trackedTokenState when fetching new token state 2018-06-26 13:58:31 -07:00
Amir Bandeali
b6d8dcb6e1 Make dispatchTransferFrom revert with reason from AssetProxy on failure 2018-06-26 13:57:55 -07:00
Amir Bandeali
08ee1ab2e6 Remove redundant files, hard code function selector in dispatchTransferFrom, and modify revert reason 2018-06-26 13:57:51 -07:00
fragosti
26edec5773 Fix bug where we are requesting tokens on a different network 2018-06-26 13:43:25 -07:00
fragosti
d72e06842f Remove unused variables 2018-06-26 12:48:00 -07:00
fragosti
0a0da63ac7 Make unsubscribing work 2018-06-26 12:33:38 -07:00
Greg Hysen
873ec898d8 Updated offset of receiverData length to reflect new assetData encoding. 2018-06-26 12:23:19 -07:00
Remco Bloemen
97a70d14a3 ERC20 Custom storage layout 2018-06-26 12:23:19 -07:00
Remco Bloemen
394fbebfa8 Golf the authorization check 2018-06-26 12:23:19 -07:00
Remco Bloemen
b79588c4a0 ERC20 manual memory layout 2018-06-26 12:23:19 -07:00
Remco Bloemen
3b46e82625 ERC20 inline return 2018-06-26 12:23:19 -07:00
Remco Bloemen
dbaf1fcd43 ERC721 inline return 2018-06-26 12:23:19 -07:00
Remco Bloemen
4caf1271e4 Golf ERC721 transferFrom 2018-06-26 12:23:19 -07:00
Remco Bloemen
6921943aff Inline ERC20 tranferFrom selector constant 2018-06-26 12:23:19 -07:00
Remco Bloemen
3ce90b8257 Optimize ERC20 transferFrom 2018-06-26 12:23:19 -07:00
fragosti
3866154b50 Fix stateful ledger dialog edge state 2018-06-26 12:16:10 -07:00
fragosti
64ed2464cf Get things working with legacy portal 2018-06-26 12:09:20 -07:00
fragosti
e27780aee9 Fix subtle issues with ledger config dialog 2018-06-26 11:59:23 -07:00
Brandon Millman
744e6e60c5 Polish asset picker layout 2018-06-26 11:17:00 -07:00
fragosti
f70c1ff009 Ledger to metamask to ledger working 2018-06-26 11:01:50 -07:00
Brandon Millman
3a808fe7fd Update relayer grid fallback icon 2018-06-26 10:40:59 -07:00
Brandon Millman
2ca169b3c4 Merge pull request #777 from 0xProject/feature/website/browser-detection
Change metamask install link based on browser
2018-06-26 10:29:26 -07:00
Alex Browne
098d486291 Merge pull request #776 from 0xProject/ethereum-js-tx-1.3.5
Use ethereumjs-tx@1.3.5 instead of our fork
2018-06-26 10:22:53 -07:00
Fabio Berger
ec4fb70b80 Merge pull request #760 from 0xProject/refactor/check-revert-reasons
Check Revert Reasons in Contract Tests
2018-06-26 19:20:19 +02:00
Fabio Berger
2a82807be4 Fix type issue 2018-06-26 19:16:57 +02:00
Fabio Berger
43ae868c69 Merge branch 'refactor/check-revert-reasons' into feature/combinatorial-testing
* refactor/check-revert-reasons:
  Temporarily switch revert reasons to `TransferFailed`. Should be `InvalidAmount` but because of an oversight in the assembly implementation of `dispatchTransferFrom`, it always throws `TransferFailed`
  Expect RevertReason be passed in, not string
  Rename RevertReasons to RevertReason since singular enum names are more common

# Conflicts:
#	packages/contracts/test/asset_proxy/proxies.ts
#	packages/contracts/test/exchange/core.ts
2018-06-26 18:53:44 +02:00
Fabio Berger
1bc742aed1 Temporarily switch revert reasons to TransferFailed. Should be InvalidAmount but because of an oversight in the assembly implementation of dispatchTransferFrom, it always throws TransferFailed 2018-06-26 18:49:10 +02:00
Fabio Berger
6dc852774e Update AbstractAssetWrapper 2018-06-26 08:52:25 +02:00
Fabio Berger
7967ebed57 Rename to singular 2018-06-26 08:51:40 +02:00
Fabio Berger
105b927397 Fix merge issues 2018-06-26 08:43:37 +02:00
Fabio Berger
9219f9d8ae Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (21 commits)
  Don't use variables for revert reasons
  Add comments to dispatchTransferFrom
  Document IAssetData
  Compute bytes4 proxyid constants
  Return inplace bytes in LibBytes.readBytesWithLength
  Add Greg's documentation to MixinErc721Transfer
  Add Greg's documentation to MixinErc20Transfer
  Gas golf the transfer success logic
  Optimize like in PR #767
  Run prettier and fix linting errors
  Fix tests
  Update tests
  Fix AssetProxyUtils
  Update tests
  Fix ERC721Proxy TokenId
  Update AssetProxyUtils
  Add IAssetData
  WIP
  ABI encoded asset data
  Remove proxyId argument from dispatchTransferFrom
  ...

# Conflicts:
#	packages/contracts/test/asset_proxy/proxies.ts
2018-06-26 08:13:59 +02:00
Fabio Berger
f780e6f235 Expect RevertReason be passed in, not string 2018-06-26 08:11:32 +02:00
Fabio Berger
27670f4da6 Rename RevertReasons to RevertReason since singular enum names are more common 2018-06-26 08:11:14 +02:00
Fabio Berger
e051743a3d Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype: (21 commits)
  Don't use variables for revert reasons
  Add comments to dispatchTransferFrom
  Document IAssetData
  Compute bytes4 proxyid constants
  Return inplace bytes in LibBytes.readBytesWithLength
  Add Greg's documentation to MixinErc721Transfer
  Add Greg's documentation to MixinErc20Transfer
  Gas golf the transfer success logic
  Optimize like in PR #767
  Run prettier and fix linting errors
  Fix tests
  Update tests
  Fix AssetProxyUtils
  Update tests
  Fix ERC721Proxy TokenId
  Update AssetProxyUtils
  Add IAssetData
  WIP
  ABI encoded asset data
  Remove proxyId argument from dispatchTransferFrom
  ...

# Conflicts:
#	packages/contracts/test/asset_proxy/proxies.ts
2018-06-26 08:07:37 +02:00
Fabio Berger
fb03003b3a Fix inconsistency between contract and reference implementation of order validation logic 2018-06-26 07:50:24 +02:00
Brandon Millman
e52d0a3512 Change metamask install link based on browser 2018-06-25 17:48:36 -07:00
Amir Bandeali
cba92a01b6 Merge pull request #743 from 0xProject/feature/contracts/abi-encoded
ABI encode assetData fields
2018-06-25 16:53:15 -07:00
Alex Browne
0a87364101 Use ethereumjs-tx@1.3.5 instead of our fork 2018-06-25 16:40:33 -07:00
Amir Bandeali
a89908540f Don't use variables for revert reasons 2018-06-25 16:34:06 -07:00
fragosti
c4e2dcafa4 Have basic network switching working 2018-06-25 16:26:34 -07:00
Amir Bandeali
0163984ea4 Add comments to dispatchTransferFrom 2018-06-25 16:19:08 -07:00
Remco Bloemen
db3ce08cab Document IAssetData 2018-06-25 16:19:08 -07:00
Remco Bloemen
1076959006 Compute bytes4 proxyid constants 2018-06-25 16:19:08 -07:00
Remco Bloemen
5127cbb22c Return inplace bytes in LibBytes.readBytesWithLength 2018-06-25 16:19:08 -07:00
Remco Bloemen
9175b43542 Add Greg's documentation to MixinErc721Transfer 2018-06-25 16:19:07 -07:00
Remco Bloemen
562fec01d8 Add Greg's documentation to MixinErc20Transfer 2018-06-25 16:19:07 -07:00
Remco Bloemen
b8051c8fed Gas golf the transfer success logic 2018-06-25 16:19:07 -07:00
Remco Bloemen
4df66a4802 Optimize like in PR #767 2018-06-25 16:19:07 -07:00
Amir Bandeali
a2ff63daa5 Run prettier and fix linting errors 2018-06-25 16:19:07 -07:00
Amir Bandeali
7ce0f9682f Fix tests 2018-06-25 16:19:07 -07:00
Remco Bloemen
3c6d0dc3e0 Update tests 2018-06-25 16:19:07 -07:00
Remco Bloemen
64a6fb2344 Fix AssetProxyUtils 2018-06-25 16:19:07 -07:00
Remco Bloemen
07734a5184 Update tests 2018-06-25 16:19:07 -07:00
Remco Bloemen
32d4994219 Fix ERC721Proxy TokenId 2018-06-25 16:19:07 -07:00
Remco Bloemen
08d22d2f3c Update AssetProxyUtils 2018-06-25 16:19:07 -07:00
Remco Bloemen
b7b0185baf Add IAssetData 2018-06-25 16:19:07 -07:00
Remco Bloemen
7b0c13c121 WIP 2018-06-25 16:19:07 -07:00
Remco Bloemen
a98ecc05af ABI encoded asset data 2018-06-25 16:19:07 -07:00
Remco Bloemen
f7337c1a05 Remove proxyId argument from dispatchTransferFrom 2018-06-25 16:19:07 -07:00
fragosti
53e2cda4c8 Remove existing networkId watching logic from BlockchainWatcher 2018-06-25 16:01:26 -07:00
Fabio Berger
8064914bb7 Prettier fixes 2018-06-25 23:17:56 +02:00
Fabio Berger
6bb2203f79 Small stylistic tweaks 2018-06-25 23:07:27 +02:00
Fabio Berger
3d56817da1 Update yarn.lock 2018-06-25 23:00:19 +02:00
Fabio Berger
31e3b9ff8b Fix and imprrove ethLightWalletSubprovider 2018-06-25 22:59:41 +02:00
Fabio Berger
b2e32aaf58 Remove legacy named subprovider 2018-06-25 22:59:24 +02:00
Fabio Berger
699de9174e Format type 2018-06-25 22:59:04 +02:00
Fabio Berger
1dd9ec4d5a Remove duplicate type 2018-06-25 22:58:50 +02:00
Fabio Berger
87d66ccf6c Fix Tslint issues 2018-06-25 22:58:36 +02:00
Fabio Berger
1134ff1075 Fix tslint issues 2018-06-25 20:17:00 +02:00
Fabio Berger
178676ef8c Fix lint errors 2018-06-25 20:08:00 +02:00
Greg Hysen
94740155e5 Comments for ASM hashing 2018-06-25 11:02:31 -07:00
Fabio Berger
9341afe764 Merge pull request #772 from 0xProject/add-coverage-instructions
Improve Contracts README Testing Section
2018-06-25 19:58:15 +02:00
Cavan
7ce1e9b18d Add eth-lightwallet subprovider and tests 2018-06-25 19:39:23 +02:00
Cavan
1821f60fb5 Move eth-lightwallet declaration to typings 2018-06-25 19:08:16 +02:00
Cavan
235d78565e Format subprovider using prettier 2018-06-25 19:06:22 +02:00
Cavan
db5880539b Update changelogs 2018-06-25 19:01:53 +02:00
Cavan
76f4d67f33 Remove timestamps and fix typings 2018-06-25 18:58:25 +02:00
Bryce
e59c57106c Run prettier 2018-06-25 09:44:56 -07:00
Cavan
bb4c748bf1 Formatting and standards updates 2018-06-25 18:42:13 +02:00
perissology
92cb9c3807 add /*solcov ignore next*/ tests 2018-06-25 08:18:02 -07:00
perissology
1a4e99431b support ignoring entire contracts 2018-06-25 07:55:19 -07:00
Fabio Berger
ec9d1ca57e Document all the contract test options in README 2018-06-25 15:18:02 +02:00
Fabio Berger
71c9b98896 Fix revertReason 2018-06-25 14:23:35 +02:00
Fabio Berger
71bac8c60b Update yarn.lock 2018-06-25 13:51:41 +02:00
Fabio Berger
7b0f7c2e5c Remove no longer used method 2018-06-25 13:51:18 +02:00
Fabio Berger
ad67a6add5 Check revert reasons in declarative and combinatorial tests 2018-06-25 13:51:00 +02:00
Fabio Berger
1353723b58 merge check-revert-reasons 2018-06-25 13:02:38 +02:00
Fabio Berger
f811c07454 Move RevertReasons to @0xproject/types package 2018-06-25 12:59:26 +02:00
Fabio Berger
bb85382824 Add missing import 2018-06-25 12:47:44 +02:00
Fabio Berger
3ed4a1ba20 Add missing import 2018-06-25 12:47:13 +02:00
Fabio Berger
c50da5d034 merge check-revert-reasons 2018-06-25 12:32:16 +02:00
Fabio Berger
9b196ba68c Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (97 commits)
  Fix typos in comments
  Add modifier and tests for removeAuthorizedAddressAtIndex
  Update and add tests
  Change removeAuthorizedAddress => removeAuthorizedAddressAtIndex
  Move isFunctionRemoveAuthorizedAddress to test
  Fix usage of `popLastByte`
  Fix LibBytes is a library
  Remove `areBytesEqual`
  Fix usage of `contentAddress()`
  Clean low bits in bytes4
  Clean high bits in address
  Refactor LibBytes.readBytes4 for consistency
  Fix LibBytes.equals
  Add trailing garbage testcase for LibBytes.equals
  Rename bytes.equals
  Add slice and sliceDestructive
  Rename bytes.rawAddress and add bytes.contentAddress
  Rename read/writeBytesWithLength
  Using LibBytes for bytes
  Make LibBytes a library
  ...

# Conflicts:
#	packages/contracts/src/utils/constants.ts
#	packages/contracts/test/exchange/core.ts
2018-06-25 11:49:14 +02:00
Fabio Berger
df79fb19af Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype: (48 commits)
  Fix typos in comments
  Add modifier and tests for removeAuthorizedAddressAtIndex
  Update and add tests
  Change removeAuthorizedAddress => removeAuthorizedAddressAtIndex
  Move isFunctionRemoveAuthorizedAddress to test
  Fix usage of `popLastByte`
  Fix LibBytes is a library
  Remove `areBytesEqual`
  Fix usage of `contentAddress()`
  Clean low bits in bytes4
  Clean high bits in address
  Refactor LibBytes.readBytes4 for consistency
  Fix LibBytes.equals
  Add trailing garbage testcase for LibBytes.equals
  Rename bytes.equals
  Add slice and sliceDestructive
  Rename bytes.rawAddress and add bytes.contentAddress
  Rename read/writeBytesWithLength
  Using LibBytes for bytes
  Make LibBytes a library
  ...

# Conflicts:
#	packages/contracts/src/contracts/current/utils/Ownable/Ownable.sol
#	packages/contracts/test/libraries/lib_bytes.ts
2018-06-25 11:45:17 +02:00
Leonid Logvinov
f8bde5ab9b Merge pull request #735 from feuGeneA/metacoin-independence
Metacoin independence
2018-06-25 11:35:24 +02:00
Jacob Evans
0cd37cbf7e Merge pull request #758 from 0xProject/fix/order-utils/known-order-hash
Fix known order hash value test in order-utils
2018-06-25 15:47:07 +10:00
Remco Bloemen
d621e4201d Merge pull request #698 from 0xProject/fix/contracts/using-libbytes
Fixes and refactoring regarding LibBytes
2018-06-23 14:08:40 +02:00
Remco Bloemen
82af1df3c3 Fix typos in comments 2018-06-23 13:55:02 +02:00
Amir Bandeali
ea8c2b8d69 Add modifier and tests for removeAuthorizedAddressAtIndex 2018-06-23 13:53:39 +02:00
Amir Bandeali
8ddcb6c841 Update and add tests 2018-06-23 13:53:39 +02:00
Amir Bandeali
1681361aed Change removeAuthorizedAddress => removeAuthorizedAddressAtIndex 2018-06-23 13:53:39 +02:00
Remco Bloemen
6a6f98299d Move isFunctionRemoveAuthorizedAddress to test 2018-06-23 13:53:39 +02:00
Remco Bloemen
19ba272d62 Fix usage of popLastByte 2018-06-23 13:53:39 +02:00
Remco Bloemen
2f8ceca2ef Fix LibBytes is a library 2018-06-23 13:53:39 +02:00
Remco Bloemen
ba1baafca5 Remove areBytesEqual 2018-06-23 13:53:38 +02:00
Remco Bloemen
20a07494f6 Fix usage of contentAddress() 2018-06-23 13:53:38 +02:00
Remco Bloemen
c66477c690 Clean low bits in bytes4 2018-06-23 13:53:38 +02:00
Remco Bloemen
5c612a186f Clean high bits in address 2018-06-23 13:53:38 +02:00
Remco Bloemen
943e556f43 Refactor LibBytes.readBytes4 for consistency 2018-06-23 13:53:38 +02:00
Remco Bloemen
4bf4f96f47 Fix LibBytes.equals 2018-06-23 13:53:38 +02:00
Remco Bloemen
384cd2f605 Add trailing garbage testcase for LibBytes.equals 2018-06-23 13:53:38 +02:00
Remco Bloemen
425af46f98 Rename bytes.equals 2018-06-23 13:53:38 +02:00
Remco Bloemen
c83ee04662 Add slice and sliceDestructive 2018-06-23 13:53:38 +02:00
Remco Bloemen
2054cd78da Rename bytes.rawAddress and add bytes.contentAddress 2018-06-23 13:53:38 +02:00
Remco Bloemen
88982f98ff Rename read/writeBytesWithLength 2018-06-23 13:53:38 +02:00
Remco Bloemen
2ea0b839d3 Using LibBytes for bytes 2018-06-23 13:53:38 +02:00
Remco Bloemen
afd83e59b8 Make LibBytes a library 2018-06-23 13:53:38 +02:00
Remco Bloemen
7f84049538 Merge LibMem and LibBytes 2018-06-23 13:53:38 +02:00
Remco Bloemen
98840c9c5f Use provided mem in refernce memcpy 2018-06-23 13:53:38 +02:00
Amir Bandeali
26cacfa247 Merge pull request #749 from 0xProject/feature/contracts/transactionHashAsm
Converted `hashZeroExTransaction` to assembly. Saves 1k gas
2018-06-22 16:57:50 -07:00
Bryce Neal
4b2d27b5e5 CHANGELOG spacing 2018-06-22 16:57:49 -07:00
Bryce
69625946b1 Typings and comment 2018-06-22 16:56:19 -07:00
Bryce
f7fe9b0961 Update at abi_decoder 2018-06-22 16:41:47 -07:00
Greg Hysen
7fcd34eb36 Apply mask to address to zero-out unused bytes. 2018-06-22 16:35:50 -07:00
Brandon Millman
1f5848ba82 Remove extra border from the bottom of the wallet 2018-06-22 16:07:07 -07:00
perissology
bbd414bdcd add ability to ignore covering specific code blocks 2018-06-22 15:59:36 -07:00
Brandon Millman
a1737a28d0 Do not render ZRX or WETH as removable tracked tokens 2018-06-22 15:57:34 -07:00
Brandon Millman
66be42d1f8 Center items in portal drawer header 2018-06-22 15:33:58 -07:00
Francesco Agosti
c984c0f2c0 Merge pull request #764 from 0xProject/feature/website/relay-grid-stacking-bug
Fix issue where hovered tiles appear over top bar
2018-06-22 15:16:13 -07:00
fragosti
89d2bb7ecd Fix issue where hovered tiles appear over top bar 2018-06-22 14:32:21 -07:00
Bryce Neal
9f8cad93f7 CHANGELOG spacing 2018-06-22 14:08:21 -07:00
Bryce Neal
a207260fe0 Fix CHANGELOG spacing. 2018-06-22 14:07:19 -07:00
Bryce
1ef4a47255 Fix spacing 2018-06-22 14:06:45 -07:00
Bryce
b8aa68b4d1 Add CHANGELOG entry 2018-06-22 14:05:23 -07:00
Bryce
61edbac6e5 Remove package-lock 2018-06-22 14:02:29 -07:00
Bryce
d315133d34 Re-throw if not INVALID_ARGUMENT 2018-06-22 14:01:14 -07:00
Bryce
82d59dbea8 Address INVALID_ARGUMENT issue 2018-06-22 13:35:49 -07:00
Francesco Agosti
42884e0871 Merge pull request #746 from 0xProject/feature/website/relayer-grid-polish
Relayer grid polish
2018-06-22 13:11:33 -07:00
fragosti
7fb8b546f9 Remove unecessary position relative rules 2018-06-22 12:22:31 -07:00
fragosti
80fe1938b8 Fix tslint error 2018-06-22 12:04:45 -07:00
fragosti
2409afae95 Merge https://github.com/0xProject/0x-monorepo into v2-prototype 2018-06-22 11:54:37 -07:00
fragosti
06705f9e88 Remove diverse from about page 2018-06-22 11:54:24 -07:00
fragosti
2b408e71ac Use Ops instead of Operations in Mels description 2018-06-22 11:47:57 -07:00
Brandon Millman
b097193486 Merge pull request #750 from 0xProject/bug/website/fix-add-token
Various add token flow bugs
2018-06-22 11:43:02 -07:00
Brandon Millman
543f2c91fe Pulled out reset AssetPicker state into a common variable 2018-06-22 11:37:57 -07:00
fragosti
05c0088445 Comment out Chris, and move Mel up in about page 2018-06-22 11:22:33 -07:00
Fabio Berger
2f6f815d81 Fix tslint 2018-06-22 18:54:18 +02:00
Fabio Berger
1e03fbe1a8 Fix prettier 2018-06-22 18:50:02 +02:00
Fabio Berger
4409f11b24 Rename ContractLibErrors to RevertReasons 2018-06-22 18:45:45 +02:00
Fabio Berger
7a216901be Remove revert reason 'Exchange' prefix 2018-06-22 18:41:55 +02:00
Fabio Berger
0e7c254b93 Move constants over to ContractLibError enum and update all tests 2018-06-22 18:36:15 +02:00
Fabio Berger
ba14850c9a Standardize ERC20 error strings given convention 2018-06-22 18:35:35 +02:00
Fabio Berger
59d3a21993 Fix test now that contract reverts with message 2018-06-22 17:39:41 +02:00
Fabio Berger
d2faa49bf4 Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype:
  Check that assetProxy exists before attempting transfer
2018-06-22 17:15:51 +02:00
Fabio Berger
438c0e27ea Merge pull request #748 from 0xProject/fix/contracts/nullAssetProxy
Check that assetProxy exists before attempting transfer
2018-06-22 17:14:22 +02:00
Fabio Berger
4c14372b4a Add revert reason checks to wrapper tests 2018-06-22 17:12:52 +02:00
Fabio Berger
8b4077d7de Fix tests 2018-06-22 17:12:31 +02:00
Fabio Berger
914b009361 Change Whitelist error messages to conform to rest and added revert reason checks to transactions tests 2018-06-22 17:12:17 +02:00
Jacob Evans
b2a4b7eb88 Fix known order hash value test 2018-06-22 23:00:22 +10:00
Fabio Berger
daa50442c9 Add revert reason checks to match_orders tests 2018-06-22 14:28:01 +02:00
Fabio Berger
76fd7f47eb Fix tests 2018-06-22 14:13:44 +02:00
Fabio Berger
fbf840cb68 Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype:
  Update ganache-core in yarn.lock
  Add coverage and test:circleci command to sra-report
  Add missing artifacts
  Skip failing tests temporarily
  Fix web3-wrapper test
  fix name
  Add missing package tests from circleci
2018-06-22 13:26:59 +02:00
Fabio Berger
798a647b71 Merge pull request #757 from 0xProject/fix/circle-ci
Add missing package tests from circleci
2018-06-22 13:26:12 +02:00
Fabio Berger
26a0b09064 Update ganache-core in yarn.lock 2018-06-22 13:12:55 +02:00
Fabio Berger
98570b5da1 Add coverage and test:circleci command to sra-report 2018-06-22 12:50:52 +02:00
Fabio Berger
e923d7dafb Add missing artifacts 2018-06-22 12:33:23 +02:00
Fabio Berger
64b6861880 Skip failing tests temporarily 2018-06-22 12:33:10 +02:00
Fabio Berger
c46e11cae2 Fix web3-wrapper test 2018-06-22 12:32:12 +02:00
Fabio Berger
82ccfa21e1 fix name 2018-06-22 12:02:40 +02:00
Fabio Berger
13f7fc1fd2 Add missing package tests from circleci 2018-06-22 11:59:14 +02:00
Fabio Berger
018cc14a87 Fix expected version in test 2018-06-22 10:47:38 +02:00
Fabio Berger
3ce295a2af Merge branch 'v2-prototype' into refactor/check-revert-reasons
* v2-prototype: (40 commits)
  Use make-promises-safe as a preloader instead of manually importing
  Updated compiler runs to be 1,000,000
  Add event to setSignatureValidatorApproval, rename signer => signerAddress accross all contracts
  Add senderAddress to Fill and Cancel logs, add comments to events and types
  Fix Island component
  Add missing image assets for Chris and Mel
  Fix some bugs in sol-cov
  Remove unreachable PreSigned check
  Fix linting
  Buttons look hella disabled now
  Remove border radius, fix width issue for unlock step
  Add Chris and Mel to about page
  fix linter issues
  only call getLocationByOffset if source if defined
  Set settleOrder and settleMatchedOrders to private
  Prevent prettier issue
  Support mobile friendly onboarding flows
  Removed MixinSettlement. Moved `settleOrder` into `MixinExchangeCore` and `settleMatchedOrders` into `MixinMatchOrders`
  Migrations after rebasing
  Linter
  ...
2018-06-22 10:39:07 +02:00
Fabio Berger
a30107ab86 Check revert reason in dispatcher tests 2018-06-22 10:38:08 +02:00
Fabio Berger
d8df6968d3 remove unused import 2018-06-22 10:37:25 +02:00
Fabio Berger
0515c6acde Merge pull request #752 from 0xProject/make-promises-safe-preloader
Use make-promises-safe as a preloader instead of manually importing
2018-06-22 10:32:06 +02:00
Amir Bandeali
607b44e01d Check that assetProxy exists before attempting transfer 2018-06-21 22:45:15 -07:00
Amir Bandeali
5c0bae2070 Merge pull request #751 from 0xProject/feature/contracts/compilerRuns
Updated compiler runs to be 1,000,000
2018-06-21 22:06:31 -07:00
Alex Browne
4012e31115 Use make-promises-safe as a preloader instead of manually importing 2018-06-21 19:17:33 -07:00
Greg Hysen
2d8e9eda56 Converted hashZeroExTransaction to assembly. Saves 1k gas 2018-06-21 18:49:17 -07:00
Brandon Millman
4375a0e07e Fix state mutation in reducer 2018-06-21 18:06:34 -07:00
Brandon Millman
a07cfb7abc Do not add empty token to local storage 2018-06-21 18:06:34 -07:00
Greg Hysen
c131d82699 Updated compiler runs to be 1,000,000 2018-06-21 17:58:39 -07:00
fragosti
de2dcbae5a Lint and fix typo 2018-06-21 17:42:37 -07:00
fragosti
b0000bb276 Fix z-index issues 2018-06-21 17:40:33 -07:00
fragosti
82789d5315 Fix issues that arose from merge 2018-06-21 17:40:33 -07:00
Brandon Millman
3df5882711 Remove Background component 2018-06-21 17:40:33 -07:00
Brandon Millman
b6765b849c Padding adjustment 2018-06-21 17:40:33 -07:00
Brandon Millman
df94e5f164 Remove styles from Portal component 2018-06-21 17:40:33 -07:00
Brandon Millman
79edc12c76 Add Background component 2018-06-21 17:40:33 -07:00
Brandon Millman
bd03151c2a Various relayer grid ui polish items 2018-06-21 17:40:33 -07:00
Amir Bandeali
7c0fdc7ecf Merge pull request #740 from 0xProject/feature/contracts/updateEvents
Update events
2018-06-21 17:14:14 -07:00
Amir Bandeali
b333ed91de Add event to setSignatureValidatorApproval, rename signer => signerAddress accross all contracts 2018-06-21 16:10:12 -07:00
Amir Bandeali
6a073d5f86 Add senderAddress to Fill and Cancel logs, add comments to events and types 2018-06-21 16:09:38 -07:00
Alex Browne
c7159b2be4 Merge pull request #747 from 0xProject/fix/sol-cov-bugs
Fix some bugs in sol-cov
2018-06-21 13:50:30 -07:00
Amir Bandeali
2d98193c83 Merge pull request #744 from NoteGio/v2-prototype-unreachable
Remove unreachable PreSigned check
2018-06-21 13:38:23 -07:00
fragosti
685756f9d5 Fix Island component 2018-06-21 13:26:33 -07:00
fragosti
535bb364b6 Add missing image assets for Chris and Mel 2018-06-21 13:17:51 -07:00
Francesco Agosti
c740539f48 Merge pull request #739 from 0xProject/feature/website/mobile-friendly-onboarding
Add support for mobile-friendly onboarding flows
2018-06-21 13:16:13 -07:00
Alex Browne
4cf331067b Fix some bugs in sol-cov 2018-06-21 13:14:13 -07:00
Austin Roberts
a3ba7683f4 Remove unreachable PreSigned check
This code was unreachable, as it had the exact same condition as line 206.
2018-06-21 14:15:20 -05:00
fragosti
5edfec68cf Fix linting 2018-06-21 12:12:44 -07:00
fragosti
eb494f78fa Buttons look hella disabled now 2018-06-21 12:09:38 -07:00
fragosti
d963941be0 Remove border radius, fix width issue for unlock step 2018-06-21 11:33:47 -07:00
Francesco Agosti
8ab65fdde4 Merge pull request #742 from 0xProject/feature/website/chris-mel-about-page
Add Chris and Mel to about page
2018-06-21 11:32:10 -07:00
fragosti
8e2c0bb977 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/mobile-friendly-onboarding 2018-06-21 11:06:53 -07:00
fragosti
f1f1064f70 Add Chris and Mel to about page 2018-06-21 10:57:26 -07:00
Brandon Millman
88500e3714 Merge pull request #734 from 0xProject/feature/website/shadow-styling
Update Island shadow styling and use Island in more places
2018-06-21 10:31:48 -07:00
Leonid Logvinov
eae2a4df8b Merge pull request #702 from perissology/feature/missing-sources
[sol-cov] Only collect coverage for provided sources
2018-06-21 19:28:35 +02:00
perissology
ade8e95d2e fix linter issues 2018-06-21 09:12:30 -07:00
Fabio Berger
a0b225b8b1 Test revert reasons in proxy tests 2018-06-21 17:43:48 +02:00
Fabio Berger
323e8756ba remove only 2018-06-21 17:27:26 +02:00
Fabio Berger
ada5428df7 Check revert reasons in Authorizable tests 2018-06-21 17:23:59 +02:00
Fabio Berger
7869c19245 Change revert reason in ownable to be similar to all other revert reasons 2018-06-21 17:23:42 +02:00
Fabio Berger
5706b29c8c remove .only 2018-06-21 17:06:44 +02:00
Fabio Berger
8ff7b2405f Update yarn.lock 2018-06-21 16:53:14 +02:00
Fabio Berger
eaabe15863 Update core tests to actually check revert message 2018-06-21 16:53:05 +02:00
Fabio Berger
63b2ae743b Add command to remove all node_modules, nested and hoisted 2018-06-21 16:52:01 +02:00
perissology
c5ea985a70 only call getLocationByOffset if source if defined 2018-06-21 06:24:50 -07:00
Remco Bloemen
11b35b89f5 Merge pull request #692 from 0xProject/refactor/contracts/RemovedMixinSettlement
Removed MixinSettlement
2018-06-21 13:26:40 +02:00
Greg Hysen
6d5b16725d Set settleOrder and settleMatchedOrders to private 2018-06-20 17:27:45 -07:00
fragosti
c34897036e Prevent prettier issue 2018-06-20 16:05:19 -07:00
fragosti
1e51af1d4b Support mobile friendly onboarding flows 2018-06-20 15:51:17 -07:00
Greg Hysen
8ee6e26608 Removed MixinSettlement. Moved settleOrder into MixinExchangeCore and settleMatchedOrders into MixinMatchOrders 2018-06-20 15:36:28 -07:00
Brandon Millman
4d36f38f96 Merge pull request #733 from 0xProject/bug/website/identicon-layout
Move some layout logic out of the Identicon component
2018-06-20 15:25:51 -07:00
Greg Hysen
d31ca444e1 Merge pull request #736 from 0xProject/feature/contracts/MixinSignatureValidatorTests
MixinSignatureValidator Test Cases + Bug Fixes
2018-06-20 14:18:13 -07:00
Greg Hysen
090b3014c0 Migrations after rebasing 2018-06-20 14:00:21 -07:00
Greg Hysen
491a322ceb Linter 2018-06-20 13:54:39 -07:00
Greg Hysen
12e16d532b Renamed constants in test wallet/validator 2018-06-20 13:54:39 -07:00
Greg Hysen
7814a391d8 Few more minor #nit wording changes 2018-06-20 13:54:39 -07:00
Greg Hysen
322151b0d5 Changed wording of two tests #nit 2018-06-20 13:54:39 -07:00
Greg Hysen
4a136cafda Minor improvements to MixinSignatureValidator tests 2018-06-20 13:54:39 -07:00
Greg Hysen
d0df25d9e2 Remove .only 2018-06-20 13:54:39 -07:00
Greg Hysen
8d003dbc30 Fixed two mislabelled revert reasons + Signature Validator revert tests working on Geth 2018-06-20 13:54:39 -07:00
Greg Hysen
2c7358d64f Minor style tweaks 2018-06-20 13:54:39 -07:00
Greg Hysen
94e260cec6 Fixed how trezor messages are signed in signature_utils. Now uses byteLength instead of length. 2018-06-20 13:54:39 -07:00
Greg Hysen
783ac3c105 Fixed callAsync template. Previously did not append callData, so we couldn’t specify from address 2018-06-20 13:54:39 -07:00
Greg Hysen
d46e3f6778 Twenty new tests for MixinSignatureValidator. Fixed handling of unsupported types. Fixed trezor prefix. 2018-06-20 13:54:39 -07:00
Alex Browne
6fe3158778 Merge pull request #725 from 0xProject/feature/revert-trace-code-snippets
Include source code snippets in revert stack traces
2018-06-20 12:36:04 -07:00
Alex Browne
bbd12e33ec Update version for @types/solidity-parser-antlr 2018-06-20 12:22:39 -07:00
Alex Browne
e4d55242d8 Update to match latest type definitions and other small changes 2018-06-20 12:22:39 -07:00
Alex Browne
dedddcfcf5 Update sol-cov CHANGELOG.json 2018-06-20 12:22:39 -07:00
Alex Browne
613a78bcf6 Include source code snippets in revert stack traces 2018-06-20 12:19:30 -07:00
Alex Browne
f5decb1d7e Merge pull request #738 from 0xProject/fix/changelogs
Fix CHANGELOG entries changed during incorrect merge (2a4456b)
2018-06-20 12:19:04 -07:00
Fabio Berger
47b4c236c3 Fix CHANGELOG entries changed during incorrect merge (2a4456b) 2018-06-20 20:29:22 +02:00
fragosti
39ccb2df0b Scroll to wallet for mobile onboarding 2018-06-20 11:25:59 -07:00
Fabio Berger
5bfdffda11 Add support for approveAll in assetWrapper and fillOrderScenarios 2018-06-20 19:14:04 +02:00
Fabio Berger
247f8c8557 Fix orderValidationUtils where was confusing a makerAssetAmount as a takerAssetAmount 2018-06-20 19:13:30 +02:00
Fabio Berger
3ce449e167 Improve verbose logging 2018-06-20 19:12:31 +02:00
F. Eugene Aumson
663f9657ea ethereum-types now only has v0.0.2, no 0.0.1 2018-06-20 09:06:38 -04:00
F. Eugene Aumson
457f951aaf add missing metacoin dependencies 2018-06-20 09:06:38 -04:00
F. Eugene Aumson
feafd57027 make metacoin tsconfig independent 2018-06-20 09:06:32 -04:00
Fabio Berger
5c0183c71e Fix merge variable name issue 2018-06-20 14:08:56 +02:00
Fabio Berger
fb7d425244 Add support for setting allowance to unlimited 2018-06-20 13:56:27 +02:00
Fabio Berger
3fab40efe5 Add noop conditionals for clarity 2018-06-20 13:55:45 +02:00
Fabio Berger
0bbdbc9e63 Rename for clarity 2018-06-20 13:55:28 +02:00
Fabio Berger
9bc481ff62 Split balance and allowance amount types in prep of adding the "unlimited" allowance enum value 2018-06-20 13:36:57 +02:00
Fabio Berger
32dea43d2e Remove unneeded explicit type def 2018-06-20 13:31:57 +02:00
Fabio Berger
632da71a8d Add TS 2.7 numeric separators to improve readability 2018-06-20 13:31:21 +02:00
Fabio Berger
2ffab22185 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (22 commits)
  Fix closing parens in liborder
  Update after rebase
  ERC721Proxy Always call safeTransferFrom
  Rename makerEpoch => orderEpoch
  Make cancelOrdersUpTo compatible with sender abstraction
  Update PR template
  Use Image component instead of img tag
  Assembler orderHash function
  Optimize and remove redundant encodePacked
  Fix linting issue
  Fix bug where we do fetch balances on wallet login
  Check network state immediately instead of waiting for delay
  Fix onboarding persisting when changing routes
  Consolidate account state messaging logic
  Only elevate wallet zIndex when onboarding is in progress
  Rebase and update feedback
  Run linter
  Add Portal v2 logging
  Simplified handling of source < 32 edge case
  Basic EIP712 encoder
  ...
2018-06-20 13:25:29 +02:00
Fabio Berger
5541327968 Add ability for verbose logging 2018-06-20 13:24:09 +02:00
Jacob Evans
096eaa20d7 Merge pull request #637 from 0xProject/bug/contracts/eip712-191-prefix
Add missing EIP191 prefix for EIP712 and Execute Transaction
2018-06-20 10:54:51 +10:00
fragosti
e5fe6b915e Change Island to use styled-components 2018-06-19 17:32:01 -07:00
Jacob Evans
512bd84cc2 Fix closing parens in liborder 2018-06-20 10:27:45 +10:00
Jacob Evans
ebbcbeedd2 Merge pull request #730 from 0xProject/bug/contracts/eip712-191-prefix-asm-orderhash
Assembler orderHash function
2018-06-20 10:25:31 +10:00
Jacob Evans
be17308e50 Merge pull request #717 from 0xProject/feature/contracts/erc721proxy-always-safeTransferFrom
ERC721Proxy Always call safeTransferFrom
2018-06-20 10:24:12 +10:00
Jacob Evans
25fa29e6e1 Update after rebase 2018-06-20 10:01:41 +10:00
Jacob Evans
bddc47f9b2 ERC721Proxy Always call safeTransferFrom 2018-06-20 10:00:59 +10:00
fragosti
51948d7760 Show start onboarding flow button on top of wallet on mobile 2018-06-19 16:39:52 -07:00
Brandon Millman
5817a30031 Update Island shadow styling and use Island in more places 2018-06-19 16:25:43 -07:00
Amir Bandeali
e216eb1e7b Merge pull request #714 from 0xProject/feature/contracts/cancelOrdersUpToSender
Make cancelOrdersUpTo compatible with sender abstraction
2018-06-19 15:23:28 -07:00
Brandon Millman
549c6afa0a Move some layout logic out of the Identicon component 2018-06-19 13:55:29 -07:00
Amir Bandeali
6b08e6b809 Rename makerEpoch => orderEpoch 2018-06-19 13:52:23 -07:00
Francesco Agosti
0438fdde49 Merge pull request #724 from 0xProject/bug/website/onboarding-improvements
Fix Wallet appearing over Drawer, and Onboarding not exiting when changing routes
2018-06-19 13:47:52 -07:00
Francesco Agosti
be4ea18119 Merge pull request #727 from 0xProject/bug/website/fix-fetching-balances-on-wallet-login
Fix bug where we do not fetch balances on wallet login
2018-06-19 13:43:08 -07:00
fragosti
a75d6531f2 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into bug/website/onboarding-improvements 2018-06-19 13:29:54 -07:00
Brandon Millman
da69ddc19b Merge pull request #732 from 0xProject/feature/update-pr-template
Update PR template
2018-06-19 13:16:42 -07:00
Amir Bandeali
e92926e881 Make cancelOrdersUpTo compatible with sender abstraction 2018-06-19 13:04:55 -07:00
Brandon Millman
7dd208fb49 Merge pull request #723 from 0xProject/bug/website/drawer-address
Consolidate account state display message logic
2018-06-19 10:44:18 -07:00
Brandon Millman
5305db689d Update PR template 2018-06-19 10:41:27 -07:00
Francesco Agosti
2338c7a3b3 Merge pull request #706 from 0xProject/feature/website/portal-v2-analytics
Add logging to Portal V2
2018-06-19 10:32:35 -07:00
Brandon Millman
829bc96209 Use Image component instead of img tag 2018-06-19 10:30:28 -07:00
fragosti
7454e16aae Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-v2-analytics 2018-06-19 10:19:38 -07:00
Brandon Millman
e4acad60e9 Merge pull request #726 from 0xProject/bug/website/late-eth-balance
Check network state immediately instead of waiting for delay
2018-06-19 10:03:08 -07:00
Fabio Berger
f35af1fb6d Fix typo 2018-06-19 17:53:16 +02:00
Fabio Berger
c0e008c601 Rename NewOrderFactory to OrderFactoryFromScenario for clarity 2018-06-19 17:41:10 +02:00
Fabio Berger
9acf4458c0 Remove hack in ERC20Wrapper 2018-06-19 17:38:15 +02:00
Fabio Berger
70de264d4d Cleanup coreCombinatorialUtils 2018-06-19 17:31:26 +02:00
Fabio Berger
1a0b9e4612 Comments and cleanup 2018-06-19 17:25:08 +02:00
Remco Bloemen
66dc70c057 Merge pull request #683 from 0xProject/fix/contracts/memcpy
Simplified handling of source < 32 edge case
2018-06-19 13:53:25 +02:00
Fabio Berger
6641f34d76 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype:
  Prettier fix
  Update default params in sendRawPaylodAsync for improved JSON-RPC compatibility
  Fix missed merge conflicts
  Fix additional versions and update yarn.lock
  Add OrderWatcherConfig type to 0x.js docs page
  Export OrderWatcherConfig from 0x.js
  Update all package versions to match latest published to NPM
  Update CHANGELOG's with publishes performed on development branch
  Rebase with latest removing PROXY_ID from transfer
  Split transfer impl and AssetProxyMixin
  change @0xproject/types to ethereum-types
  remove mistaken comment
  workaround for TypeScript trailing comma bug
  Document contract_templates
2018-06-19 13:48:58 +02:00
Fabio Berger
f3ae5d8160 Prettier fix 2018-06-19 13:46:39 +02:00
Fabio Berger
d937541aa0 Merge pull request #701 from feuGeneA/v2-prototype
Document use of contract_templates (take 2; based on v2-prototype, not master)
2018-06-19 13:44:55 +02:00
Fabio Berger
21707d7ff6 Merge pull request #728 from 0xProject/fix/post-dev-publish
Update v2-prototype w/ development changes since publish
2018-06-19 13:18:36 +02:00
Leonid Logvinov
3002bc0eee Merge pull request #731 from avonian/v2-prototype
Fix sendRawPaylodAsync for improved JSON-RPC compatibility
2018-06-19 13:17:20 +02:00
Ara Kevonian
df50232ed9 Update default params in sendRawPaylodAsync for improved JSON-RPC compatibility 2018-06-19 04:13:32 -07:00
Fabio Berger
17d49067e9 Fix missed merge conflicts 2018-06-19 12:56:22 +02:00
Remco Bloemen
9a2e023a51 Assembler orderHash function 2018-06-19 12:55:04 +02:00
Jacob Evans
9c747f3160 Merge pull request #659 from 0xProject/feature/contracts/split-proxy-internal-logic
Split transfer implementation and AssetProxyMixin
2018-06-19 20:41:06 +10:00
Fabio Berger
08ea71cb24 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (40 commits)
  Increase number of columns in relayer grid for small screens
  Make isValidSignature public
  Make batchFill methods return FIllResults struct
  Remove remove_tags script
  Small fixes
  Use semver package instead of getNextPatchVersion
  Use semver library instead of semverUtils
  small fixes
  Show all errors of a given kind at once rather then throwing after the first instance is encountered
  fix package.json
  Add more prepublish checks
  remove remove_tags script
  Create a shared Image component
  Adjust version in changelog
  Update RelayerGridTile render logic to incorportate colors and logos
  Add max width to top bar
  Set max-width for LargeLayout
  Finish last onboarding step
  Finish set allowance step
  Add onboarding assets
  ...
2018-06-19 12:35:32 +02:00
Fabio Berger
a96abe2422 Fix additional versions and update yarn.lock 2018-06-19 12:32:43 +02:00
Fabio Berger
84a4a888e6 Add OrderWatcherConfig type to 0x.js docs page 2018-06-19 11:34:44 +02:00
Fabio Berger
e3299b546e Export OrderWatcherConfig from 0x.js 2018-06-19 11:33:46 +02:00
Fabio Berger
f2e0f1b2f1 Update all package versions to match latest published to NPM 2018-06-19 11:32:55 +02:00
Fabio Berger
2a4456b9ca Update CHANGELOG's with publishes performed on development branch 2018-06-19 11:16:30 +02:00
Jacob Evans
560a55bfd1 Optimize and remove redundant encodePacked 2018-06-19 17:32:17 +10:00
fragosti
d32f0fad12 Fix linting issue 2018-06-18 18:56:31 -07:00
fragosti
031e7d270d Fix bug where we do fetch balances on wallet login 2018-06-18 18:08:38 -07:00
Brandon Millman
3b73a0e269 Check network state immediately instead of waiting for delay 2018-06-18 18:01:38 -07:00
Brandon Millman
0bfcf79e79 Increase number of columns in relayer grid for small screens 2018-06-18 17:44:09 -07:00
fragosti
bdd299dd9e Fix onboarding persisting when changing routes 2018-06-18 17:24:31 -07:00
Brandon Millman
f97e605bf6 Consolidate account state messaging logic 2018-06-18 17:08:44 -07:00
fragosti
db9ff76754 Only elevate wallet zIndex when onboarding is in progress 2018-06-18 16:57:28 -07:00
Amir Bandeali
49f5495c45 Merge pull request #716 from 0xProject/feature/contracts/publicSignatureValidator
Make isValidSignature public
2018-06-18 16:20:16 -07:00
Amir Bandeali
9e431df848 Make isValidSignature public 2018-06-18 16:00:55 -07:00
Amir Bandeali
12476c52a4 Merge pull request #713 from 0xProject/feature/contracts/batchFillReturn
Make batchFill methods return FIllResults struct
2018-06-18 16:00:43 -07:00
Amir Bandeali
8fd9aebcb9 Make batchFill methods return FIllResults struct 2018-06-18 15:50:02 -07:00
Fabio Berger
8c83f4ba3b Merge pull request #722 from 0xProject/improvement/publishing-v2
Improvements to pre-publishing checks
2018-06-18 23:33:17 +02:00
Fabio Berger
25b6d1a232 Remove remove_tags script 2018-06-18 23:20:07 +02:00
Fabio Berger
880cbd88c2 Small fixes 2018-06-18 23:15:52 +02:00
Fabio Berger
dcd53c3c5b Use semver package instead of getNextPatchVersion 2018-06-18 23:08:44 +02:00
Fabio Berger
3e64b3da39 Use semver library instead of semverUtils 2018-06-18 23:08:33 +02:00
Fabio Berger
9a748c8bf1 small fixes 2018-06-18 23:07:03 +02:00
Fabio Berger
53eae14763 Show all errors of a given kind at once rather then throwing after the first instance is encountered 2018-06-18 23:06:55 +02:00
Fabio Berger
074c42e8b6 fix package.json 2018-06-18 23:06:48 +02:00
Fabio Berger
8633fa7024 Add more prepublish checks 2018-06-18 23:06:32 +02:00
Fabio Berger
19668b9b48 remove remove_tags script 2018-06-18 23:05:03 +02:00
Brandon Millman
3f02631b98 Merge pull request #712 from 0xProject/feature/website/portal-facelift
Change relayer grid tile to use logos and primary colors
2018-06-18 12:11:59 -07:00
Brandon Millman
da46eefe2e Create a shared Image component 2018-06-18 12:09:31 -07:00
Francesco Agosti
a3ca3ed33f Merge pull request #704 from 0xProject/bug/website/fix-filling-order
Fix filling orders on Portal
2018-06-18 10:24:42 -07:00
Francesco Agosti
efaa33c4d5 Merge pull request #711 from 0xProject/website/feature/prettier-onboarding-components
Made onboarding look like the mocks
2018-06-18 10:13:19 -07:00
fragosti
0cdfe7f458 Adjust version in changelog 2018-06-18 10:06:38 -07:00
Jacob Evans
190eafc30e Merge branch 'v2-prototype' into bug/contracts/eip712-191-prefix 2018-06-18 21:50:35 +10:00
Jacob Evans
d4ee0e8622 Rebase and update feedback
Cache the domain separator data with address this
Use the EIP712Types enum for types everywhere
Rename EIP712 struct ExecuteTransaction to ZeroExTransaction
2018-06-18 21:46:05 +10:00
Jacob Evans
96c90e6295 Rebase with latest removing PROXY_ID from transfer 2018-06-18 16:36:30 +10:00
Jacob Evans
ff95da411b Split transfer impl and AssetProxyMixin 2018-06-18 15:24:12 +10:00
Brandon Millman
2ad411ea29 Update RelayerGridTile render logic to incorportate colors and logos 2018-06-16 13:34:09 -07:00
Brandon Millman
55cbcd728d Add max width to top bar 2018-06-16 13:34:09 -07:00
Brandon Millman
8880860105 Set max-width for LargeLayout 2018-06-16 13:34:09 -07:00
Remco Bloemen
0c238448fd Merge pull request #700 from 0xProject/fix/contracts/tokenbugs
Handle tokens that do not return bool
2018-06-16 10:10:17 +02:00
fragosti
8a76fdc126 Finish last onboarding step 2018-06-15 18:34:57 -07:00
fragosti
433f830cf3 Finish set allowance step 2018-06-15 18:15:03 -07:00
fragosti
8893bc102c Add onboarding assets 2018-06-15 18:03:10 -07:00
fragosti
0cf9927132 Add all steps to their own file 2018-06-15 18:02:46 -07:00
fragosti
5993125cc7 Prettify account setup and add eth steps of onboarding 2018-06-15 15:17:20 -07:00
fragosti
0c34309133 Make metamask part of the fow pretty 2018-06-15 14:49:01 -07:00
fragosti
3d6ce0fb76 Make start onboarding button pretty 2018-06-15 14:06:17 -07:00
fragosti
54f79c2798 Improve styles of onboarding tooltip 2018-06-15 13:24:59 -07:00
F. Eugene Aumson
8bac1706a1 change @0xproject/types to ethereum-types 2018-06-15 10:37:37 -04:00
fragosti
d0a3779091 Add Pointer component 2018-06-14 18:19:07 -07:00
Alex Browne
ff0960b174 Merge pull request #705 from 0xProject/feature/revert-trace-subprovider
Introduce subprovider for printing revert stack traces
2018-06-14 17:07:03 -07:00
Alex Browne
7032825e35 Change wording of error message when you try to use more than one subprovider 2018-06-14 16:53:48 -07:00
Alex Browne
d118533d87 Remove redundant check in trace.ts and revert_trace.ts 2018-06-14 16:53:29 -07:00
fragosti
35f4f75733 Prettier 2018-06-14 16:49:06 -07:00
Alex Browne
ef61c3543f Fix linter errors 2018-06-14 16:38:21 -07:00
Alex Browne
897560745a De-duplicate code by refactoring subprovider classes 2018-06-14 16:33:09 -07:00
Alex Browne
5a8539a122 Fix linter errors and remove coverage.json 2018-06-14 16:04:08 -07:00
Alex Browne
d9292a70bf Remove unused variables and other small fixes 2018-06-14 16:00:24 -07:00
Alex Browne
a9c23b7c28 Reverse order of stack trace to match behavior of most other language stack traces 2018-06-14 15:50:54 -07:00
fragosti
2cc7289b7b Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/portal-v2-analytics 2018-06-14 15:50:46 -07:00
fragosti
81d6df925e Run linter 2018-06-14 15:47:59 -07:00
Alex Browne
263bfb1bda Fix a bug in revert_trace.ts 2018-06-14 15:46:59 -07:00
fragosti
677e77d0ae Add Portal v2 logging 2018-06-14 15:43:10 -07:00
Fabio Berger
0d0c1af7f7 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype:
  Run prettify
  Implement allowance and final flow step
  Render TokenAllowance
  Add utilities for getting tokens from tokensByAddress
  Wrap AllowanceToggle in redux container
2018-06-15 00:03:47 +02:00
Fabio Berger
fb55def54f Add ability to tweak the relevant balances/allowances for the maker and taker for a fillScenario. Convert more of the core tests to the declarative form. 2018-06-15 00:03:00 +02:00
Fabio Berger
eea86757d5 - Refactor assetWrapper to contain more of the normalizing logic instead of erc20Wrapper and erc721Wrapper
- Add burn method to DummyERC721Token
- Add additional methods to assetWrapper to set balance/allowances on ERC20 and ERC721 tokens
- Use approve instead of approveAll for ERC721 tokens
2018-06-15 00:00:02 +02:00
Francesco Agosti
e7eb220c50 Merge pull request #695 from 0xProject/feature/website/onboarding-flow-allowances
Implement allowances and final "congrats" onboarding flow step
2018-06-14 14:41:42 -07:00
fragosti
7d67005820 Run prettify 2018-06-14 14:26:17 -07:00
fragosti
fadd91b6a2 Add to changelog for contract-wrappers 2018-06-14 14:22:53 -07:00
fragosti
5fa6a2848f Fix typo 2018-06-14 14:07:41 -07:00
Alex Browne
7ab921669b Introduce subprovider for printing revert stack traces 2018-06-14 13:58:54 -07:00
fragosti
4811dfa663 Fix filling orders on Portal 2018-06-14 13:56:36 -07:00
perissology
7a41a5249f Collect coverage for provided sources
When solidity generates source maps during contract compilation, the
contracts are referred to by an id, which corresponds to an array index.

We may not want to cover all sources that were included in a compilation,
but because we use array indexes (vs. the id that is provided by solidity
compiler) to map the contract to the sourceMap, the provided sourceCodes
array must include the code at the correct index. This can result in
empty slots in the sourceCodes array.

This commit allows the coverage to only be collected for the contracts
with provided sourceCode.
2018-06-14 11:17:04 -07:00
F. Eugene Aumson
f9e05d0cad remove mistaken comment
It must have been left over from when an abi-gen output was modified to
be the source of this template.
2018-06-14 13:52:10 -04:00
F. Eugene Aumson
15a63c4bc5 workaround for TypeScript trailing comma bug
before this change, TypeScript compilation of the generated contract
wrapper was giving me the following errors:

$ abi-gen --abis 'build/contracts/*.json' --out build/types --template contract_templates/contract.handlebars --partials 'contract_templates/partials/*.handlebars'
Found 7 partial templates
Found 1 ABI files
Processing: Migrations...
Created: build/types/migrations.ts
$ tsc
build/types/migrations.ts(81,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(108,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(130,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(146,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(173,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(195,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Here is the generated code around the first error:

74:    public setCompleted = {
75:        async sendTransactionAsync(
76:            completed: BigNumber,
77:            txData: Partial<TxData> = {},
78:        ): Promise<string> {
79:            const self = this as any as MigrationsContract;
80:            const inputAbi = self._lookupAbi('setCompleted(uint256)').inputs;
81:            [completed,
82:    ] = BaseContract._formatABIDataItemList(inputAbi, [completed,
83:    ], BaseContract._bigNumberToString.bind(self));

All of the other errors are the same, a destructuring assignment with a
single element but with a trailing comma.

This is legal JavaScript but it is not allowed by the TypeScript
compiler, apparently per the bug described at
https://github.com/Microsoft/TypeScript/issues/24628 .

While awaiting the 3.0 version of TypeScript, it's a simple enough
change to have the template not append a trailing comma.
2018-06-14 13:51:18 -04:00
F. Eugene Aumson
4a2e4d2b55 Document contract_templates 2018-06-14 13:51:10 -04:00
Fabio Berger
12033abe09 Rename OrderAmountScenario to OrderAssetAmountScenario and convert generateOrderCombinations to generateFillOrderCombinations 2018-06-14 12:07:57 +02:00
Fabio Berger
f9410d5d00 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (27 commits)
  Add back redirector behind feature flag
  Update minHeight in Text
  Use Text components in Values
  Use spread operator instead of React.createElement
  Fix issue with positions hash
  Revert localhost config
  Use Text in Teams
  Use Text in OpenPositions
  Use Text component for HeaderItem
  Remove FloatingImage
  Move FilledImage into components/ui
  Replace FlatButton with Button in Retry
  Fix incorrect colors
  Add font family to Button component and use in Join0x component
  Consolidate jobs page grey colors with shared colors
  Fix lint errors
  Remove extra packages
  Implement small open positions
  Implement large screen open positions
  Teams section
  ...
2018-06-14 11:17:58 +02:00
Fabio Berger
c232a32991 Use a defaultFillScenario in fillOrder tests 2018-06-14 11:17:13 +02:00
Fabio Berger
57f37939d5 Fix incorrect string values in enum 2018-06-14 11:16:51 +02:00
Fabio Berger
432ff58107 Fix calculation of expFilledTakerAmount and expected values in events emitted 2018-06-14 11:16:32 +02:00
Remco Bloemen
2c7d6a7711 Handle tokens that do not return bool 2018-06-14 10:54:54 +02:00
Fabio Berger
d31b051fc5 Replace initial set of legacy manually written fillOrder tests with declarative FillScenario tests 2018-06-14 10:41:04 +02:00
Fabio Berger
98405a39db Add ability to specify takerAssetFillAmount and taker scenarios as part of a FillScenario 2018-06-14 10:40:17 +02:00
Brandon Millman
0e354e5ea1 Merge pull request #685 from 0xProject/feature/website/jobs-page
Jobs page
2018-06-13 13:34:54 -07:00
Brandon Millman
d172a97247 Add back redirector behind feature flag 2018-06-13 12:29:36 -07:00
Brandon Millman
8a3df7e434 Update minHeight in Text 2018-06-13 12:19:14 -07:00
Brandon Millman
eafcbabaa2 Use Text components in Values 2018-06-13 12:10:21 -07:00
Brandon Millman
14071ea119 Use spread operator instead of React.createElement 2018-06-13 12:01:08 -07:00
Fabio Berger
6239686afa Fix divide by zero bug 2018-06-13 18:36:30 +02:00
Fabio Berger
45186b70ec Move orderFill combinatorialTests to exchange folder 2018-06-13 16:14:48 +02:00
Fabio Berger
b4fead9606 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (26 commits)
  Rename _coverageCollector -> _profilerCollector in TraceCollectionSubprovider
  Refactor sol-cov to de-duplicate code for coverage and profiling
  Rename popByte and popAddress
  Hard code test addresses/bytes32 instead of generating pseudorandom ones
  Update artifacts
  Rename computeCoverageAsync -> computeSingleTraceCoverageAsync
  Fix linter errors
  Refactor sol-cov to avoid keeping traceInfo in memory
  Unpop byte rather than making deep copy
  Pass gas in to marketBuyOrdersNoThrow
  Looks up the memory location of makerAssetData/takerAssetData
  Make ZRX_PROXY_ID constant rather than popping it from ZRX_ASSET_DATA
  Add tests for deepCopyBytes and missing write methods from LibBytes
  Pop id from assetData before dispatching to AssetProxies
  Upgrade solidity-parser-entlr 0.2.11 => 0.2.12
  Fix import order
  Fix typos
  Add CHANGELOGs
  Speed-up sol-cov
  Increase delay when sending transactions during devnet startup
  ...
2018-06-13 16:10:05 +02:00
Fabio Berger
61243b418e Implement initial set of orderFill combinatorial tests 2018-06-13 16:09:04 +02:00
Fabio Berger
fe75660e88 Refactor ERC20 and ERC721 wrappers for V2 and introduce the assetWrapper superset 2018-06-13 16:01:01 +02:00
Fabio Berger
946e6c1644 Remaining refactors of order-utils components for V2 2018-06-13 13:20:13 +02:00
Fabio Berger
3eb232b3fc For some reason order-watcher tests were timeing out so I increased the timeout limit 2018-06-13 13:18:19 +02:00
Fabio Berger
38de1c9a31 Remove comment since we have added the tests 2018-06-13 13:16:22 +02:00
Fabio Berger
78dcb87a75 Variable rename for clarity 2018-06-13 13:11:45 +02:00
fragosti
421e568232 Implement allowance and final flow step 2018-06-12 16:54:37 -07:00
Alex Browne
4efd28c092 Merge pull request #694 from 0xProject/refactor-sol-cov
Refactor sol-cov to de-duplicate code for coverage and profiling
2018-06-12 16:51:58 -07:00
Brandon Millman
d0bbee7e8c Fix issue with positions hash 2018-06-12 16:11:31 -07:00
Brandon Millman
7640563991 Revert localhost config 2018-06-12 16:09:23 -07:00
Amir Bandeali
90cf85c3f0 Merge pull request #682 from 0xProject/feature/contracts/popProxyId
Remove proxyId checks in AssetProxies
2018-06-12 16:05:46 -07:00
Brandon Millman
f1a98693d0 Use Text in Teams 2018-06-12 15:58:24 -07:00
Brandon Millman
2794d64d3e Use Text in OpenPositions 2018-06-12 15:54:27 -07:00
Alex Browne
82743cca92 Rename _coverageCollector -> _profilerCollector in TraceCollectionSubprovider 2018-06-12 15:46:41 -07:00
Alex Browne
d0c348e595 Refactor sol-cov to de-duplicate code for coverage and profiling 2018-06-12 15:40:18 -07:00
Alex Browne
f50d3088dc Merge pull request #691 from 0xProject/fix/sol-cov-memory
Refactor sol-cov to avoid keeping traceInfo in memory
2018-06-12 15:38:28 -07:00
Amir Bandeali
0917fa0d75 Rename popByte and popAddress 2018-06-12 15:30:46 -07:00
Amir Bandeali
cfb73dd534 Hard code test addresses/bytes32 instead of generating pseudorandom ones 2018-06-12 15:30:46 -07:00
Amir Bandeali
ef497b7989 Update artifacts 2018-06-12 15:30:41 -07:00
Brandon Millman
9d9341901f Use Text component for HeaderItem 2018-06-12 15:25:47 -07:00
Brandon Millman
155e3d225d Remove FloatingImage 2018-06-12 15:03:16 -07:00
Brandon Millman
ca41f100ab Move FilledImage into components/ui 2018-06-12 14:49:42 -07:00
Brandon Millman
084285a760 Replace FlatButton with Button in Retry 2018-06-12 14:26:48 -07:00
Brandon Millman
982391cd7c Fix incorrect colors 2018-06-12 14:23:47 -07:00
Brandon Millman
d206d0a3ae Add font family to Button component and use in Join0x component 2018-06-12 14:23:03 -07:00
Alex Browne
627ea6c860 Rename computeCoverageAsync -> computeSingleTraceCoverageAsync 2018-06-12 14:11:11 -07:00
Alex Browne
bcc76b3764 Fix linter errors 2018-06-12 14:09:42 -07:00
fragosti
39692a8b3f Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/onboarding-flow-allowances 2018-06-12 14:01:19 -07:00
Brandon Millman
eba8b4bf00 Consolidate jobs page grey colors with shared colors 2018-06-12 13:45:56 -07:00
Brandon Millman
f149665660 Fix lint errors 2018-06-12 13:40:15 -07:00
Brandon Millman
e3bb64cf35 Remove extra packages 2018-06-12 12:52:36 -07:00
Alex Browne
33f0669100 Refactor sol-cov to avoid keeping traceInfo in memory 2018-06-12 12:42:14 -07:00
Amir Bandeali
3a5f3e8b55 Unpop byte rather than making deep copy 2018-06-12 11:45:02 -07:00
Amir Bandeali
a0a90afbc0 Pass gas in to marketBuyOrdersNoThrow 2018-06-12 11:45:02 -07:00
Greg Hysen
2f96cb257c Looks up the memory location of makerAssetData/takerAssetData 2018-06-12 11:45:02 -07:00
Amir Bandeali
5910bec52e Make ZRX_PROXY_ID constant rather than popping it from ZRX_ASSET_DATA 2018-06-12 11:45:02 -07:00
Amir Bandeali
764b1c35cb Add tests for deepCopyBytes and missing write methods from LibBytes 2018-06-12 11:45:02 -07:00
Amir Bandeali
ee8c9b764d Pop id from assetData before dispatching to AssetProxies 2018-06-12 11:45:02 -07:00
Brandon Millman
7080f0c35a Implement small open positions 2018-06-12 10:44:03 -07:00
Brandon Millman
679d60cd5a Implement large screen open positions 2018-06-12 10:41:09 -07:00
Brandon Millman
bc36c0faed Teams section 2018-06-12 10:41:09 -07:00
Brandon Millman
3c073bc360 Benefits section 2018-06-12 10:41:08 -07:00
Brandon Millman
c52d5e1084 Refactor into BulletedItemList component 2018-06-12 10:41:08 -07:00
Brandon Millman
b7bb27fa21 Rework values section 2018-06-12 10:41:08 -07:00
Brandon Millman
087aaa2f94 Polish mission section and photo section 2018-06-12 10:41:08 -07:00
Brandon Millman
474b93a22f Add link to open positions section 2018-06-12 10:41:08 -07:00
Brandon Millman
0c2f002a7d Add scroll to top for jobs page 2018-06-12 10:41:08 -07:00
Brandon Millman
3d76d83a39 Skeleton for jobs page and initial implementation 2018-06-12 10:41:05 -07:00
Leonid Logvinov
787015f537 Upgrade solidity-parser-entlr 0.2.11 => 0.2.12 2018-06-12 10:22:15 -07:00
Leonid Logvinov
fb624fddc4 Fix import order 2018-06-11 22:30:14 -07:00
Leonid Logvinov
605ddacb71 Merge pull request #689 from 0xProject/geth-increase-startup-tx-delay
Increase delay when sending transactions during devnet startup
2018-06-11 22:15:51 -07:00
Leonid Logvinov
71934f05a8 Merge pull request #687 from 0xProject/feature/metacoin-docs
Add profiler and geth tests to metacoin
2018-06-11 22:03:22 -07:00
Leonid Logvinov
534a0d6836 Fix typos 2018-06-11 22:03:07 -07:00
Leonid Logvinov
746b1d0c4d Merge pull request #688 from 0xProject/feature/await-transaction-speedup
Speedup awaitTransactionMinedAsync and reduce polling interval in contracts tests
2018-06-11 21:56:56 -07:00
Leonid Logvinov
387c80e00a Merge pull request #690 from 0xProject/feature/truffle-sol-cov-fixes
Sol-cov fixes
2018-06-11 21:55:38 -07:00
Leonid Logvinov
05c914691f Add CHANGELOGs 2018-06-11 18:12:32 -07:00
Leonid Logvinov
94398d70f4 Speed-up sol-cov 2018-06-11 18:01:33 -07:00
Alex Browne
915ddb2b2b Increase delay when sending transactions during devnet startup 2018-06-11 17:26:10 -07:00
Alex Browne
b916e7f7ef Add note to web3-wrapper CHANGELOG.json 2018-06-11 17:13:58 -07:00
Alex Browne
3cc30f91a9 Speedup awaitTransactionMinedAsync and reduce polling interval in contracts tests 2018-06-11 17:07:28 -07:00
Leonid Logvinov
f4a61b4c70 Don't throw when no config file is found 2018-06-11 16:10:56 -07:00
Leonid Logvinov
6eebd693ce Fix solidityVersion schema regex 2018-06-11 16:10:15 -07:00
Fabio Berger
7e78f5941a Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype: (68 commits)
  Stop exporting ArtifactWriter
  Fix no-unused-variable tslint rule to include parameters and fix issues
  Fix linter exclude rule
  Validate all signature types rather then only ECSignatures
  Store the instantiated OrderValidationUtils
  Remove global hooks from tests and deploy contracts from within the specific tests
  Add EmitStatement to ASTVisitor
  Fix tslint issues
  Add back artifacts file
  Fix a bug in SolCompilerArtifacts adapter config overriding
  Move OrderValidationUtils (+ tests) and ExchangeTransferSimulator to order-utils
  export parseECSignature method
  Export ArtifactWriter from migrations package
  Remove unused artifact file
  Pass in generated contract wrapper to orderValidationUtils at instantiation
  Refactor orderValidationUtils to use the generated contract wrapper instead of the higher-level one
  Refactor ExchangeTransferSimulator public interface to accet an AbstractBalanceAndProxyAllowanceLazyStore so that this module could be re-used in different contexts.
  Increase timeout for contract migrations
  Remove some copy-paste code
  Await transactions in migrations
  ...
2018-06-12 00:23:48 +02:00
Fabio Berger
bc0ae6be31 Merge pull request #684 from 0xProject/fix/contract-wrappers/exchangeTransferSimulator
Move ExchangeTransferSimulator & OrderValidationUtils to Order-Utils
2018-06-12 00:14:19 +02:00
Fabio Berger
c03119d10a Stop exporting ArtifactWriter 2018-06-12 00:13:57 +02:00
Fabio Berger
e1879ef4d9 Fix no-unused-variable tslint rule to include parameters and fix issues 2018-06-11 23:42:30 +02:00
Fabio Berger
b6df727efb Fix linter exclude rule 2018-06-11 23:15:03 +02:00
Fabio Berger
fe58b44916 Validate all signature types rather then only ECSignatures 2018-06-11 22:14:03 +02:00
Fabio Berger
0a2694811d Store the instantiated OrderValidationUtils 2018-06-11 22:13:36 +02:00
Fabio Berger
31fe232bac Remove global hooks from tests and deploy contracts from within the specific tests 2018-06-11 22:13:12 +02:00
Leonid Logvinov
682f6d273c Fix linter issues 2018-06-11 12:49:46 -07:00
Leonid Logvinov
83ddaccf4a Add profiler and geth tests to metacoin 2018-06-11 11:59:48 -07:00
Leonid Logvinov
e0c0584c59 Add EmitStatement to ASTVisitor 2018-06-11 11:14:49 -07:00
Fabio Berger
60f5a52964 Merge branch 'v2-prototype' into fix/contract-wrappers/exchangeTransferSimulator
* v2-prototype:
  Fix a bug in SolCompilerArtifacts adapter config overriding
  Increase timeout for contract migrations
  Remove some copy-paste code
  Await transactions in migrations
  Fix typos
  Await transactions in migrations
  Await fake transactions
  Fix a typo
  Implement SolidityProfiler & adapt sol-cov to work with Geth

# Conflicts:
#	packages/migrations/CHANGELOG.json
2018-06-11 19:54:59 +02:00
Leonid Logvinov
7e5866ce3f Merge pull request #675 from 0xProject/feature/sol-cov-geth
`ProfilerSubprovider` & Geth-related fixes for `sol-cov`
2018-06-11 10:48:18 -07:00
Fabio Berger
89b7b56a2c Fix tslint issues 2018-06-11 19:43:40 +02:00
Fabio Berger
ae54b13d4b Add back artifacts file 2018-06-11 19:43:25 +02:00
Leonid Logvinov
927ccc489c Fix a bug in SolCompilerArtifacts adapter config overriding 2018-06-11 10:28:30 -07:00
Fabio Berger
21f7722f10 Move OrderValidationUtils (+ tests) and ExchangeTransferSimulator to order-utils 2018-06-11 19:21:32 +02:00
Fabio Berger
e4afe603f9 export parseECSignature method 2018-06-11 19:15:41 +02:00
Fabio Berger
30d15a1438 Export ArtifactWriter from migrations package 2018-06-11 19:12:55 +02:00
Fabio Berger
c84586dd66 Remove unused artifact file 2018-06-11 19:12:35 +02:00
Fabio Berger
e9f87c2026 Pass in generated contract wrapper to orderValidationUtils at instantiation 2018-06-11 14:44:53 +02:00
Fabio Berger
afa27a3c2a Refactor orderValidationUtils to use the generated contract wrapper instead of the higher-level one 2018-06-11 14:34:00 +02:00
Fabio Berger
ce6078ed94 Refactor ExchangeTransferSimulator public interface to accet an AbstractBalanceAndProxyAllowanceLazyStore so that this module could be re-used in different contexts. 2018-06-11 10:24:55 +02:00
Remco Bloemen
82d1412d45 Simplified handling of source < 32 edge case 2018-06-11 09:19:52 +02:00
Leonid Logvinov
6d5949ba9c Increase timeout for contract migrations 2018-06-08 15:27:59 -07:00
Leonid Logvinov
cdb165af7f Remove some copy-paste code 2018-06-08 14:56:46 -07:00
Leonid Logvinov
88a3f8e4aa Await transactions in migrations 2018-06-08 14:56:46 -07:00
Leonid Logvinov
1c3dc757c3 Fix typos 2018-06-08 14:56:45 -07:00
Leonid Logvinov
25866095db Await transactions in migrations 2018-06-08 14:56:45 -07:00
Leonid Logvinov
b6c8d8e971 Await fake transactions 2018-06-08 14:56:45 -07:00
Leonid Logvinov
ab94b0b231 Fix a typo 2018-06-08 14:56:45 -07:00
Leonid Logvinov
760bab8f86 Implement SolidityProfiler & adapt sol-cov to work with Geth 2018-06-08 14:56:45 -07:00
Greg Hysen
817c332d11 Merge pull request #627 from 0xProject/feature/contracts/erc721SafeTransferFrom
On-Chain AssetData Decoding Lib + safeTransferFrom for ERC721 + Memcpy
2018-06-08 11:58:23 -07:00
Greg Hysen
05fbc8e6b0 Linter changes to contracts 2018-06-08 11:43:47 -07:00
Greg Hysen
c39301b6da Fixed assetProxyUtils for linter 2018-06-08 11:04:07 -07:00
Alex Browne
add9a9db9b Merge pull request #674 from 0xProject/feature/geth-test-ci
Run contracts tests against Geth in CI
2018-06-08 10:53:22 -07:00
Greg Hysen
05123ea6f4 Updated LibBytes error messages 2018-06-07 16:32:42 -07:00
Jacob Evans
a8d328bfc9 Basic EIP712 encoder 2018-06-07 16:09:30 -07:00
Greg Hysen
d62ff34a5a Cleanup after last rebase 2018-06-07 15:53:30 -07:00
Alex Browne
a8b8d53d9d Run contracts tests against Geth in CI 2018-06-07 15:47:43 -07:00
Greg Hysen
0d4ff5a916 Updated tests to use new revert handler 2018-06-07 15:39:40 -07:00
Greg Hysen
8ace41d144 Minor fixes after rebase 2018-06-07 15:39:40 -07:00
Greg Hysen
5bb7219f4b Camelcase in memCopy 2018-06-07 15:39:40 -07:00
Greg Hysen
f0200ab697 Moved some constants to global scope in assetProxyUtils 2018-06-07 15:39:40 -07:00
Greg Hysen
f457a56d4a Style updates to contracts 2018-06-07 15:39:40 -07:00
Greg Hysen
db086de84a Union types for generalized decodeAssetData 2018-06-07 15:39:40 -07:00
Greg Hysen
37684c6af0 Fixed a styling throughout contracts. Moved closing parenthesis for long list of function parameters to next line. 2018-06-07 15:39:40 -07:00
Greg Hysen
3c75d4f1dd Removed setting makerAssetData/takerAssetData from tests where values are same as defaultOrderParams. 2018-06-07 15:39:40 -07:00
Greg Hysen
b19276bb0f Fixed merge error when rebasing wrt length variable in asset data decoders 2018-06-07 15:39:40 -07:00
Greg Hysen
774d831fae Style updates to ERC721 onReceiver 2018-06-07 15:39:40 -07:00
Greg Hysen
a1b49d8389 Fixed after rebase 2018-06-07 15:39:40 -07:00
Greg Hysen
12e2bfc794 Fixes after rebasing 2018-06-07 15:39:38 -07:00
Greg Hysen
6e5abade3c updated migrations artifacts 2018-06-07 15:38:48 -07:00
Greg Hysen
e4e3676095 Fixed up after rebasing. Contracts build and tests pass 2018-06-07 15:38:48 -07:00
Greg Hysen
3ed13150e1 Style audit for proxies + libmem + libbytes 2018-06-07 15:38:48 -07:00
Greg Hysen
f03e5c6bd1 Style audit proxies 2018-06-07 15:38:48 -07:00
Greg Hysen
8496c1cdd3 Call safeTransferFrom only when there is receiver data present 2018-06-07 15:38:48 -07:00
Greg Hysen
3c3851c221 Fixed formatting in memory layout 2018-06-07 15:38:48 -07:00
Greg Hysen
05f1e9e3b8 Resolved edge case in Memcpy where where send would eventually turn "negative" and wrap around. 2018-06-07 15:38:48 -07:00
Greg Hysen
249a1e6d8d Removed the LibAssetProxyDecoder. Merged decode functions into the proxies. This way they can still be used by the forwarding contract. TestAssetDataDecoders inherits them in the same way the forwarding contract would 2018-06-07 15:38:48 -07:00
Greg Hysen
e042e0ad32 Converged on naming scheme for asset data: renamed all instances of assetMetadata, proxyData, proxyMetadata to assetData 2018-06-07 15:38:48 -07:00
Greg Hysen
5db15ca54c proxyData -> assetData 2018-06-07 15:38:48 -07:00
Remco Bloemen
069b89b208 Implement memcpy using masking and end-aligned words 2018-06-07 15:38:48 -07:00
Remco Bloemen
63014aeb6b Add tests for word loop iteration 2018-06-07 15:38:48 -07:00
Remco Bloemen
31e21db5b5 Add test for zero-size overlap 2018-06-07 15:38:48 -07:00
Remco Bloemen
7f21872510 Add test cases 2018-06-07 15:38:47 -07:00
Remco Bloemen
27351c9a90 Cleanup test script 2018-06-07 15:38:47 -07:00
Remco Bloemen
76b918d40e Convert Solidity tests to vectors 2018-06-07 15:38:47 -07:00
Remco Bloemen
f5bc0b205c Generate tests from vectors 2018-06-07 15:38:47 -07:00
Greg Hysen
b3c253ea2a Tests for writing bytes to nested bytes 2018-06-07 15:38:47 -07:00
Greg Hysen
d17e031259 Fixed up wording in memcpy 2018-06-07 15:38:47 -07:00
Greg Hysen
842363200b Tons of tests around nested byte arrays and ERC721 receiver 2018-06-07 15:38:42 -07:00
Greg Hysen
d9f9895b2b Test for onReceived erc721 callback 2018-06-07 15:37:42 -07:00
Greg Hysen
bc0edd4042 LibAssetProxyDecoder tests 2018-06-07 15:36:18 -07:00
Greg Hysen
9b82e2df58 Foundation for TestLibAssetProxyDecoder 2018-06-07 15:36:18 -07:00
Greg Hysen
3d65341080 Tests for libMem 2018-06-07 15:36:18 -07:00
Greg Hysen
80215ea181 LibMem + TestLibMem + LibAssetProxyDecoder + DummyERC721Receiver 2018-06-07 15:36:17 -07:00
Leonid Logvinov
78d8526e41 Merge pull request #679 from 0xProject/fix/await-transactions
Add missing awaitTransactionSuccessAsync calls
2018-06-07 15:34:46 -07:00
Alex Browne
0ddaabe377 Add missing awaitTransactionSuccessAsync calls 2018-06-07 14:46:03 -07:00
Fabio Berger
20f9318597 Merge branch 'v2-prototype' into feature/combinatorial-testing
* v2-prototype:
  Fix linter issue
  Fix linter issue
  Fix tslint issues
  Fix missing paths
  Fixed path
  Use source-map-support package to include correct line numbers in mocha
  move generated contract wrappers from `contract_wrappers/generated/` to `generated_contract_wrappers` in package with no non-generated contract wrappers
2018-06-07 21:45:48 +02:00
Fabio Berger
9bc6ebde4e Merge pull request #671 from 0xProject/refactor/move-spawn-switch-to-utils
Move spawnSwitchErr to @0xproject/utils
2018-06-07 21:44:22 +02:00
Fabio Berger
011f14d115 Fix linter issue 2018-06-07 21:24:27 +02:00
Fabio Berger
62a5cbb5ce Fix linter issue 2018-06-07 21:15:12 +02:00
Fabio Berger
5aaf87d612 Merge branch 'v2-prototype' into refactor/move-spawn-switch-to-utils
* v2-prototype:
  Fix tslint issues
  Fix tslint failure
  Pass in fee and assetAmount rather then the whole signedOrder
  Fix missing paths
  Revert to returning orderState on invalid order
  - Refactor remainingFillableCalculator so it can be used for the maker and taker side - Moved the tests over from order-watcher - Did some token -> asset renaming
  Update naming in orderStateUtils to use asset over token, also removed cancelledAmount since in V2 it's binary.
  Fixed path
  Use source-map-support package to include correct line numbers in mocha
  move generated contract wrappers from `contract_wrappers/generated/` to `generated_contract_wrappers` in package with no non-generated contract wrappers
2018-06-07 21:13:30 +02:00
Fabio Berger
96b31f3974 Merge pull request #678 from 0xProject/fix/order-utils/remaining-v2-changes
Remaining Order-utils V2 Changes
2018-06-07 21:12:21 +02:00
Fabio Berger
09e387bf09 Merge pull request #670 from 0xProject/fix/generated-nesting
Remove unnecessary folder nesting
2018-06-07 21:12:10 +02:00
Alex Browne
05fe8792ea Merge pull request #676 from 0xProject/feature/mocha-source-maps
Use source-map-support package to include correct line numbers in mocha
2018-06-07 11:55:47 -07:00
Fabio Berger
18ed45597a Fix tslint issues 2018-06-07 18:58:51 +02:00
Fabio Berger
b646c84414 Merge branch 'fix/order-utils/remaining-v2-changes' into feature/combinatorial-testing
* fix/order-utils/remaining-v2-changes:
  Fix tslint failure
  Pass in fee and assetAmount rather then the whole signedOrder
2018-06-07 18:52:14 +02:00
Fabio Berger
a200eaacaa Fix tslint failure 2018-06-07 18:51:52 +02:00
Fabio Berger
f5ad553be3 Pass in fee and assetAmount rather then the whole signedOrder 2018-06-07 18:33:42 +02:00
Fabio Berger
7b7664bd66 Merge branch 'fix/order-utils/remaining-v2-changes' into feature/combinatorial-testing
* fix/order-utils/remaining-v2-changes:
  Revert to returning orderState on invalid order
  - Refactor remainingFillableCalculator so it can be used for the maker and taker side - Moved the tests over from order-watcher - Did some token -> asset renaming
  Update naming in orderStateUtils to use asset over token, also removed cancelledAmount since in V2 it's binary.
2018-06-07 18:22:00 +02:00
Fabio Berger
4f4acc04fe Fix missing paths 2018-06-07 18:14:35 +02:00
Fabio Berger
dee0fec9e9 Revert to returning orderState on invalid order 2018-06-07 18:10:56 +02:00
Fabio Berger
73cc2a140c - Refactor remainingFillableCalculator so it can be used for the maker and taker side
- Moved the tests over from order-watcher
- Did some token -> asset renaming
2018-06-07 18:03:50 +02:00
Fabio Berger
6058a74da5 Update naming in orderStateUtils to use asset over token, also removed cancelledAmount since in V2 it's binary. 2018-06-07 18:02:48 +02:00
Fabio Berger
ab5e021bda POC: Generates an order from spec, get's the amount fillable 2018-06-07 18:00:13 +02:00
Fabio Berger
bd3b652cfc Fixed path 2018-06-07 13:15:13 +02:00
Fabio Berger
73429fc720 merge v2-prototype 2018-06-07 12:27:03 +02:00
Fabio Berger
10478a6b2f Merge branch 'v2-prototype' into refactor/move-spawn-switch-to-utils
* v2-prototype: (66 commits)
  Run prettier
  Remove unused variable
  Fix linting issues
  Change shouldRenderHeader prop to shouldHideHeader
  Get build and tests to pass
  typo
  Apply prettier
  Update contracts tests after rebase
  Apply various fixes based on PR feedback
  Document debug_increaseTime method and fix typo in devnet README
  Use an enum for ProviderType in contracts/src/utils/web3_wrapper
  Update contracts package README
  Update relevant changelogs
  Remove global gas estimate buffer
  Add Async suffix to relevant assertions
  Fix linter errors
  Update package.json and yarn.lock
  Update more things to work with both Geth and Ganache
  Small fixes and cleanup
  Add additional gas to calls to fillOrderNoThrow
  ...

# Conflicts:
#	packages/order-watcher/src/order_watcher/order_watcher.ts
#	packages/react-docs/src/components/type.tsx
#	packages/website/ts/components/ui/lifecycle_raised_button.tsx
#	packages/website/ts/components/wallet/wallet.tsx
2018-06-07 12:21:44 +02:00
Fabio Berger
0fc9814004 merge v2-prototype 2018-06-07 12:18:53 +02:00
Fabio Berger
e0bc01eea1 Merge pull request #673 from mohoff/patch-1
typo
2018-06-07 08:54:05 +01:00
fragosti
2af6d3f6bc Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/onboarding-flow-allowances 2018-06-06 18:07:22 -07:00
fragosti
cbe5438a31 Render TokenAllowance 2018-06-06 18:06:03 -07:00
Francesco Agosti
67c4ad128c Merge pull request #662 from 0xProject/feature/improve-linting
Tried enabling no-unused-variable...
2018-06-06 17:21:09 -07:00
fragosti
870eca0d9f Run prettier 2018-06-06 16:59:28 -07:00
Alex Browne
d299458084 Use source-map-support package to include correct line numbers in mocha 2018-06-06 16:54:20 -07:00
fragosti
e0cf68f1d5 Remove unused variable 2018-06-06 16:45:26 -07:00
fragosti
64906a1ba5 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting 2018-06-06 16:43:37 -07:00
fragosti
e75721016e Fix linting issues 2018-06-06 16:43:05 -07:00
fragosti
e0d5b9daf8 Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting 2018-06-06 16:36:11 -07:00
Brandon Millman
5989844f1c Merge pull request #672 from 0xProject/feature/website/account-management-polish
Account management polish
2018-06-06 16:12:47 -07:00
Brandon Millman
14e3f413a2 Change shouldRenderHeader prop to shouldHideHeader 2018-06-06 16:11:23 -07:00
fragosti
a97d77064a Get build and tests to pass 2018-06-06 15:26:40 -07:00
mohoff
3342dd4001 typo 2018-06-06 23:21:53 +02:00
Alex Browne
785b9811f3 Merge pull request #622 from 0xProject/geth-devnet-rebase-on-v2
Run contract tests against private Geth network
2018-06-06 13:43:29 -07:00
Alex Browne
643c77ded0 Apply prettier 2018-06-06 13:28:32 -07:00
Fabio Berger
e617da3bbf Implement initial generateOrder function that given the scenario values for an order, generates the actual order. 2018-06-06 22:13:50 +02:00
Alex Browne
76f01511a3 Update contracts tests after rebase 2018-06-06 13:10:59 -07:00
Alex Browne
dd8727d3ae Apply various fixes based on PR feedback 2018-06-06 12:41:15 -07:00
Alex Browne
b933946f33 Document debug_increaseTime method and fix typo in devnet README 2018-06-06 12:41:15 -07:00
Alex Browne
5d2f9d7a33 Use an enum for ProviderType in contracts/src/utils/web3_wrapper 2018-06-06 12:41:15 -07:00
Alex Browne
3baf14b793 Update contracts package README 2018-06-06 12:41:15 -07:00
Alex Browne
c57e4ba508 Update relevant changelogs 2018-06-06 12:41:14 -07:00
Alex Browne
98656289ea Remove global gas estimate buffer 2018-06-06 12:41:14 -07:00
Alex Browne
167a38e27d Add Async suffix to relevant assertions 2018-06-06 12:41:14 -07:00
Alex Browne
ba6806df5d Fix linter errors 2018-06-06 12:41:14 -07:00
Alex Browne
fe12101278 Update package.json and yarn.lock 2018-06-06 12:41:14 -07:00
Alex Browne
d6d7f4e875 Update more things to work with both Geth and Ganache 2018-06-06 12:40:31 -07:00
Alex Browne
63caddea62 Small fixes and cleanup 2018-06-06 12:40:31 -07:00
Alex Browne
36b01fbdcf Add additional gas to calls to fillOrderNoThrow 2018-06-06 12:40:31 -07:00
Alex Browne
45a3d8b75a Remove extra logs and other small fixes 2018-06-06 12:40:31 -07:00
Alex Browne
bca62c813d Throw in web3-wrapper when rawCallResult is '0x' 2018-06-06 12:40:30 -07:00
Alex Browne
ae1cf74dcd Remove outdated todo 2018-06-06 12:40:30 -07:00
Alex Browne
577a8dd005 Fix some more test cases, especially those that call increaseTime 2018-06-06 12:40:30 -07:00
Alex Browne
5900899c01 Add support for TEST_PROVIDER env var 2018-06-06 12:40:30 -07:00
Alex Browne
2dfc468094 Update more tests to pass on Geth 2018-06-06 12:40:30 -07:00
Alex Browne
98ffe9931d Get LibBytes tests working on both Ganache and Geth 2018-06-06 12:40:30 -07:00
Alex Browne
2004c0d739 Add ability to quickly switch between Geth and Ganache by changing a const 2018-06-06 12:39:44 -07:00
Alex Browne
cd7cb025ad Update exchange/transactions tests for Geth error messages 2018-06-06 12:39:43 -07:00
Alex Browne
96da267778 Fix ethers.js version override (the package is just called 'ethers') 2018-06-06 12:39:43 -07:00
Alex Browne
5816e410e9 Use our fork of ethers.js 2018-06-06 12:39:43 -07:00
Alex Browne
31c98fc0db Update some tests after rebase 2018-06-06 12:39:43 -07:00
Alex Browne
00bf957b53 Add more transactions to Geth on init. Skip tests that are failing. 2018-06-06 12:39:43 -07:00
Alex Browne
5b999c2f7d Increase gas limit to account for bigger ExchangeContract 2018-06-06 12:39:42 -07:00
Alex Browne
1cc9d9c071 Replace constant.REVERT test assertions with expectRevertOrAlwaysFailingTransaction 2018-06-06 12:39:42 -07:00
Alex Browne
72fb8460e9 Update code after rebase 2018-06-06 12:39:42 -07:00
Alex Browne
577156fe5f Use Geth for contract tests 2018-06-06 12:39:39 -07:00
fragosti
612cc96e41 Add utilities for getting tokens from tokensByAddress 2018-06-06 11:47:11 -07:00
Brandon Millman
da3f783a9f Merge pull request #669 from 0xProject/bug/website/fix-balance-rendering
Update balance amount rendering logic
2018-06-06 11:44:06 -07:00
Leonid Logvinov
b1e8545981 Merge pull request #653 from 0xProject/feature/ethereum-types-docs
Add a documentation page for ethereum-types package
2018-06-06 11:38:43 -07:00
fragosti
6a2da6dc06 Fix merge conflict 2018-06-06 11:23:57 -07:00
fragosti
58603e2a5a Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting 2018-06-06 11:17:13 -07:00
fragosti
d97184880c Use CLI for exclude 2018-06-06 11:10:06 -07:00
Leonid Logvinov
625f40cfa6 Add EthereumTypes to _renderDrawer 2018-06-06 10:31:38 -07:00
Leonid Logvinov
49049b8c12 Merge pull request #657 from 0xProject/feature/build-speed
Speedup CI builds
2018-06-06 10:25:43 -07:00
fragosti
037912ccab Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/improve-linting 2018-06-06 10:20:35 -07:00
Leonid Logvinov
8b05b864fb Don't build website if no changes were made to it 2018-06-06 10:11:51 -07:00
Leonid Logvinov
319135c8fe Remove lerna bootstrap 2018-06-06 10:11:51 -07:00
Leonid Logvinov
61d9e418e8 Fix linter issues in generated contract wrappers 2018-06-06 10:11:51 -07:00
Leonid Logvinov
475bb2845d Add generated contract artifacts to prettierignore 2018-06-06 10:11:51 -07:00
Leonid Logvinov
42f39de0f9 Stop running prettier on generated files 2018-06-06 10:11:51 -07:00
fragosti
3898b8e8ab Wrap AllowanceToggle in redux container 2018-06-06 10:11:30 -07:00
Leonid Logvinov
b1fd005c95 Enable skipLibCheck flag in ts 2018-06-06 10:00:21 -07:00
Fabio Berger
cf8fdd3a70 Move spawnSwitchErr to @0xproject/utils 2018-06-06 16:26:04 +02:00
Fabio Berger
cb754ee125 move generated contract wrappers from contract_wrappers/generated/ to generated_contract_wrappers in package with no non-generated contract wrappers 2018-06-06 15:39:38 +02:00
Fabio Berger
cea81df969 Add missing import 2018-06-06 14:49:41 +02:00
Fabio Berger
af1d5fce6e Merge pull request #665 from 0xProject/fix/fix-build-watch
Improve Build/Watch Commands
2018-06-06 13:46:52 +01:00
Fabio Berger
54b86b6131 Add missing yarn 2018-06-06 13:40:34 +02:00
Fabio Berger
ec2b83515b Add missing build:all command 2018-06-06 13:26:08 +02:00
Fabio Berger
2f2724dff5 Fix remaining tslint issues 2018-06-06 12:39:15 +02:00
Fabio Berger
271fa26890 merge v2-prototype 2018-06-06 12:31:30 +02:00
Fabio Berger
fe437da751 Exclude generate contract wrappers from tslint 2018-06-06 12:23:50 +02:00
Fabio Berger
129876d1be remove unused imports from 0x.js test 2018-06-06 12:22:15 +02:00
Fabio Berger
f2ced67a8d Remove unused imports from contract handlebar template 2018-06-06 12:21:12 +02:00
Fabio Berger
787eec8be4 Merge v2-prototype 2018-06-06 11:30:57 +02:00
Fabio Berger
cc39eea999 Merge pull request #664 from 0xProject/fixes/misc-small-fixes
Small miscellaneous fixes
2018-06-06 10:26:50 +01:00
Fabio Berger
cbfed99bc6 Merge branch 'v2-prototype' into fixes/misc-small-fixes
* v2-prototype:
  Remove TranslatedText
  Fix prettier
  Add back UMD bundles for 0x.js
  Move portal disclaimer to the account management section
  Move prices into portal
  Use stricter check for subscribe input text
  Make buttons stack on mobile
  Do not show subscribe form if language is not english
  Address PR feedback
  Lint and cleanup
  Implement subscription form
  Add styled-components and polished
  Have basic newsletter subscribe form working
2018-06-06 11:10:27 +02:00
Brandon Millman
2b4cd8b2ec Fix undefined ether balance 2018-06-06 01:33:35 -07:00
Brandon Millman
b5dc72b126 Make scrollability a prop on TradeHistory 2018-06-06 01:33:35 -07:00
Brandon Millman
ab4d2faea3 Fix EthWrappers background color 2018-06-06 01:33:35 -07:00
Brandon Millman
1677817d9f Update GenerateOrderForm and FillOrder components 2018-06-06 01:33:35 -07:00
Brandon Millman
03854baf53 Update EthWrappers component 2018-06-06 01:33:35 -07:00
Brandon Millman
61dc253de1 Update TradeHistory component 2018-06-06 01:33:35 -07:00
Brandon Millman
a0e8f410d1 Hide action column on mainnet 2018-06-06 01:33:35 -07:00
Brandon Millman
2865f63c5d Fix TokenBalances background color 2018-06-06 01:33:35 -07:00
Brandon Millman
3f19ab1a87 Add isFullWidth prop to TokenBalances component 2018-06-06 01:33:35 -07:00
Brandon Millman
d75fec0cee Update balance amount rendering logic 2018-06-05 22:03:26 -07:00
fragosti
39570a9663 Remove TranslatedText 2018-06-05 21:49:14 -07:00
Brandon Millman
479c18e21f Fix prettier 2018-06-05 16:41:17 -07:00
Brandon Millman
fd4453d85e Merge pull request #668 from 0xProject/feature/website/move-disclaimer
Move portal disclaimer to the account management section
2018-06-05 16:40:08 -07:00
Leonid Logvinov
7ee7f99780 Add back UMD bundles for 0x.js 2018-06-05 16:29:18 -07:00
Brandon Millman
4c0b8e3113 Merge pull request #666 from 0xProject/bug/website/fix-missing-prices
Move price fetching from wallet into portal
2018-06-05 16:11:04 -07:00
Brandon Millman
e0af60d8a7 Move portal disclaimer to the account management section 2018-06-05 16:10:15 -07:00
Brandon Millman
afcb7f00da Move prices into portal 2018-06-05 15:37:51 -07:00
Jacob Evans
a59e9f024e Update Order utils to use eip712 2018-06-05 14:08:04 -07:00
Francesco Agosti
e1b06bfce2 Merge pull request #652 from 0xProject/feature/website/landing-subscribe-button-2
Implement subscribe form on landing page
2018-06-05 13:16:10 -07:00
fragosti
8de3f03b49 Use stricter check for subscribe input text 2018-06-05 12:59:10 -07:00
fragosti
db8f018b42 Some cleanup 2018-06-05 11:51:07 -07:00
fragosti
59cb2132f2 Linter now passes 2018-06-05 11:46:05 -07:00
Fabio Berger
25f62daf14 - Rename watch to watch_without_deps in sub-packages, so dev's don't confuse running watch from root dir, with sub-package dir
- stop using special prebuild script name and run pre_build steps for `watch` and `build` commands
- Remove `clean` step from `build`/`watch`
2018-06-05 15:38:40 +02:00
Fabio Berger
05b9dfbe30 Mention the gasLimit until in the doc comment 2018-06-05 12:29:32 +02:00
Fabio Berger
3db4e2ee2f Merge branch 'v2-prototype' into fixes/misc-small-fixes
* v2-prototype:
  Fix broken link to `contract_templates`

# Conflicts:
#	packages/abi-gen/README.md
2018-06-05 12:22:24 +02:00
Fabio Berger
86a6a5b826 Replace - with _ in yarn script name so that we are consistent across yarn script names 2018-06-05 12:20:23 +02:00
Fabio Berger
cc6338d048 Add switch-default tslint rule and add missing default statement 2018-06-05 12:19:28 +02:00
Fabio Berger
57b65726d6 Remove outdated link in ABI-gen README 2018-06-05 12:16:25 +02:00
Fabio Berger
44a736c53b Merge pull request #661 from feuGeneA/patch-1
Fix broken link to `contract_templates`
2018-06-05 02:47:45 -07:00
Fabio Berger
38cbd42d81 Merge pull request #656 from 0xProject/refactor/fill-scenarios/for-v2
Refactor fill-scenarios for v2
2018-06-05 02:15:27 -07:00
Fabio Berger
28d019f824 Use _.omit for conciseness 2018-06-05 11:13:55 +02:00
Alex Browne
54b8e1be89 Merge pull request #658 from 0xProject/dont-automatically-rebuild-for-tests
Don't automatically rebuild when running yarn test
2018-06-05 01:00:51 -07:00
fragosti
9778695b4a Try enabling no-unused-variable... 2018-06-04 19:48:21 -07:00
Alex Browne
44b6285268 Remove duplicate cleans in package.json when clean is called in prebuild 2018-06-04 18:40:16 -07:00
F. Eugene Aumson
6c6fb2e287 Fix broken link to contract_templates
Note there is still a broken link here, the "wrapper files" one in the second paragraph.
2018-06-04 21:37:47 -04:00
Alex Browne
ecdfde8c38 Remove common-js/umd differentiation from 0x.js/package.json 2018-06-04 18:24:20 -07:00
fragosti
ea2d5b9d4a Make buttons stack on mobile 2018-06-04 17:52:39 -07:00
Jacob Evans
4670cc1a5f Add missing EIP191 prefix for EIP712 2018-06-04 17:41:00 -07:00
Leonid Logvinov
1e0522fe8f Add a TODO comment on StructLog type in the docs 2018-06-04 17:31:30 -07:00
Jacob Evans
70858603ed Merge pull request #633 from 0xProject/feature/contracts/errors
Update error handling
2018-06-04 17:25:45 -07:00
fragosti
3c508c1d27 Do not show subscribe form if language is not english 2018-06-04 17:06:23 -07:00
Jacob Evans
5c44db341f rename GT to GREATER_THAN 2018-06-04 17:04:16 -07:00
fragosti
cf73363016 Address PR feedback 2018-06-04 17:02:10 -07:00
Jacob Evans
351173e554 Rebase from v2-prototype 2018-06-04 16:55:22 -07:00
Amir Bandeali
342432dc76 Update Exchange statuses, revert instead of emmitting event on fill/cancel failures, and remove redundant logic in matchOrders 2018-06-04 15:55:28 -07:00
Alex Browne
c4538cada7 Don't automatically rebuild when running yarn test 2018-06-04 14:13:17 -07:00
Fabio Berger
de532bb2fc revert multisig change 2018-06-04 21:54:16 +01:00
Fabio Berger
f525afa5de reset multisign 2018-06-04 21:49:04 +01:00
Fabio Berger
9fba470364 Add PR to changelog 2018-06-04 21:29:17 +01:00
Fabio Berger
6cd5bf31c9 Update fill-scenarios for V2 and add CHANGELOG entry 2018-06-04 20:54:39 +01:00
Fabio Berger
321c0a8537 Remove unused compact artifacts from order-utils 2018-06-04 20:54:04 +01:00
Fabio Berger
b9bc58ef10 Add missing exports to order-utils and add CHANGELOG entry 2018-06-04 20:53:48 +01:00
Fabio Berger
7bcf05fd19 Add new 2.0 artifacts to migrations 2018-06-04 20:53:08 +01:00
Fabio Berger
f816bdf541 Remove compact_artifacts and replace with updated artifacts 2018-06-04 20:52:37 +01:00
Alex Browne
79472552aa Merge pull request #655 from 0xProject/update-migrations
Update artifacts in migrations
2018-06-04 12:47:11 -07:00
Fabio Berger
c5e5c8288e Update fill-scenarios to depend on v2 updated order-utils and types. Needed to re-employ the symlink hack. 2018-06-04 20:45:35 +01:00
Alex Browne
fd1c7f7169 Update artifacts in migrations 2018-06-04 12:45:23 -07:00
Leonid Logvinov
9212d67e2f Add a documentation page for ethereum types 2018-06-04 10:54:14 -07:00
Francesco Agosti
f5c74d123a Merge pull request #644 from 0xProject/feature/website/refactor-token-state-fetching
Move TokenState fetching logic up into Portal.tsx so it can be used by Wallet and PortalOnboardingFlow
2018-06-04 10:46:08 -07:00
fragosti
c8421efcd3 Address feedback 2018-06-04 10:27:24 -07:00
fragosti
f382609d01 Implement WETH step logic for continue 2018-06-04 10:25:38 -07:00
fragosti
f9615c18a1 Move trackedTokenStateByAddress logic into portal 2018-06-04 10:25:38 -07:00
fragosti
a74597c7cd Lint and cleanup 2018-06-01 17:37:32 -07:00
Fabio Berger
d50fbac5f9 Merge pull request #636 from 0xProject/refactor/order-utils/for-v2
Refactor order-utils for v2
2018-06-01 17:29:44 -07:00
fragosti
95086a75e6 Merge branch 'feature/website/landing-subscribe-button' into feature/website/landing-subscribe-button-2 2018-06-01 17:28:04 -07:00
fragosti
073a96cf63 Implement subscription form 2018-06-01 17:25:50 -07:00
Fabio Berger
d3c64bd5b4 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype:
  Set contract expiration time to a constant 10 minutes
  Remove unused promises array
  Make erc20_wrapper and erc721_wrapper serial
  Rename changelogs to changelog
  Add CHANGELOG entry
  Check that git branch is up to date before publishing
  Move prepublish checks before building packages for publishing
  Refactor changelog utils to a separate module
2018-06-01 17:13:02 -07:00
Fabio Berger
7024a7468a Improve comments and remove unused imports 2018-06-01 17:02:54 -07:00
Alex Browne
62e60e2ba6 Merge pull request #651 from 0xProject/serial-contract-wrappers
Make erc20_wrapper and erc721_wrapper serial and increase contract expiration time
2018-06-01 16:56:32 -07:00
Alex Browne
fb3860757c Set contract expiration time to a constant 10 minutes 2018-06-01 16:40:38 -07:00
Alex Browne
e4a8b17522 Remove unused promises array 2018-06-01 16:18:22 -07:00
Alex Browne
448df1bb9c Make erc20_wrapper and erc721_wrapper serial 2018-06-01 16:09:49 -07:00
Leonid Logvinov
bf6900fb2a Merge pull request #650 from 0xProject/feature/publishing
Improve publishing flow
2018-06-01 15:50:13 -07:00
Leonid Logvinov
50552546f3 Rename changelogs to changelog 2018-06-01 15:46:16 -07:00
Fabio Berger
324fab8186 Fix tslint issues 2018-06-01 14:12:18 -07:00
Fabio Berger
7ab80f01b5 Add comment to exported method 2018-06-01 14:09:47 -07:00
Fabio Berger
9ce4a5c7b1 Add missing dep 2018-06-01 14:09:16 -07:00
Fabio Berger
c9a0525a10 Fix types version 2018-06-01 14:02:15 -07:00
Fabio Berger
83465bb7f5 Also manually symlink types package in contracts 2018-06-01 14:02:00 -07:00
Leonid Logvinov
e8771fb36a Add CHANGELOG entry 2018-06-01 13:59:45 -07:00
Leonid Logvinov
d4d03f3d7f Check that git branch is up to date before publishing 2018-06-01 13:55:40 -07:00
Fabio Berger
d567d667e8 Remove usage of prebuild since it doesn't run on watch 2018-06-01 13:49:30 -07:00
Fabio Berger
3d55bbbc29 remove artifactsDir and contracts from compiler.json 2018-06-01 13:42:06 -07:00
Leonid Logvinov
2f8e52f905 Move prepublish checks before building packages for publishing 2018-06-01 13:39:04 -07:00
Fabio Berger
a5896ac6b6 Add postinstall hack to get around yarn not setting up symlinks properly. This is a temporary fix while we wait on: https://github.com/yarnpkg/yarn/issues/5907 2018-06-01 13:36:22 -07:00
Fabio Berger
94b9d5644c Fix type imports 2018-06-01 13:33:46 -07:00
Leonid Logvinov
06e5fc233c Refactor changelog utils to a separate module 2018-06-01 13:12:45 -07:00
Fabio Berger
aefb922a05 Remove ISigner artifact 2018-06-01 13:11:18 -07:00
Fabio Berger
a22434fd73 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype:
  Update v2 artifacts
  Add IWallet and IValidator to compiled contracts
  Split migrations compile command into one for V1 and another for V2

# Conflicts:
#	packages/migrations/artifacts/2.0.0/Exchange.json
#	packages/migrations/artifacts/2.0.0/TestSignatureValidator.json
2018-06-01 13:08:38 -07:00
Fabio Berger
c41846805d Merge pull request #649 from 0xProject/addArtifacts
Add Updated V2 Artifacts
2018-06-01 13:06:42 -07:00
Fabio Berger
b7b45b69a6 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype: (33 commits)
  Only show ProviderDisplay in portal
  Improve sol-cov docs
  Remove old parse code
  Refactor order parser and add shared order support to new portal
  Add generate and fill order routes
  Address feedback
  Override ethereumjs-tx version
  Fix missing key
  Update placeholder param ordering
  Change userEtherBalanceInWei to optional so we can know if its loading
  Add loading state to ProviderDisplay
  Tweaks
  Add Placeholder component
  Add StandardIconRow
  Split render into loading and loaaded
  Fix linter errors
  Fix linter errors
  Add ethereum-types to extraFileIncludes
  Introduce ethereum-types package
  Remove merge conflicts from yarn.lock
  ...

# Conflicts:
#	packages/contracts/src/utils/exchange_wrapper.ts
#	packages/contracts/src/utils/match_order_tester.ts
#	packages/contracts/src/utils/types.ts
#	packages/contracts/test/exchange/core.ts
#	packages/contracts/test/exchange/match_orders.ts
#	packages/contracts/test/libraries/lib_bytes.ts
#	packages/sol-cov/package.json
2018-06-01 13:05:17 -07:00
Fabio Berger
ed5528664c Update v2 artifacts 2018-06-01 12:20:54 -07:00
Fabio Berger
fe88d3c225 Add IWallet and IValidator to compiled contracts 2018-06-01 12:20:36 -07:00
Fabio Berger
aed4ee8694 Split migrations compile command into one for V1 and another for V2 2018-06-01 12:05:57 -07:00
fragosti
817d9b0d3e Add styled-components and polished 2018-06-01 11:49:58 -07:00
Fabio Berger
df9cfe7840 Update json-schemas version to 1.0.0 to avoid possible conflicts 2018-06-01 11:48:55 -07:00
Fabio Berger
8cd4578d83 Add signature specific validation methods, and other refactors 2018-06-01 11:34:12 -07:00
Brandon Millman
9ca41b9536 Merge pull request #648 from 0xProject/feature/website/fill-order
Add shared order support
2018-06-01 11:22:25 -07:00
Brandon Millman
559743c911 Only show ProviderDisplay in portal 2018-06-01 11:05:01 -07:00
fragosti
3a7f26f620 Have basic newsletter subscribe form working 2018-06-01 11:04:56 -07:00
Leonid Logvinov
04a0eae241 Improve sol-cov docs 2018-06-01 10:43:33 -07:00
Brandon Millman
0500d2fb6e Remove old parse code 2018-06-01 10:37:44 -07:00
Brandon Millman
31f1a9e5aa Refactor order parser and add shared order support to new portal 2018-06-01 10:37:44 -07:00
Brandon Millman
6387aae471 Add generate and fill order routes 2018-06-01 10:37:44 -07:00
Fabio Berger
152082e182 Fix TODOs 2018-05-31 21:32:20 -07:00
Fabio Berger
08eb2b3df7 Update all artifacts 2018-05-31 21:32:13 -07:00
Fabio Berger
846ec87249 List V2 contracts in compile.json now 2018-05-31 21:28:58 -07:00
Fabio Berger
62690b5159 Fix sol-cov issue by changing it's dep to current version of types 2018-05-31 21:23:28 -07:00
Fabio Berger
719c432ca8 Rename ISigner to IWallet and implement SignatureType.Validator 2018-05-31 21:23:08 -07:00
Fabio Berger
e654616b6d Bump types to a major version to avoid the caret 2018-05-31 20:39:10 -07:00
Fabio Berger
f0473b0320 Fix metadata offsets 2018-05-31 16:12:56 -07:00
Fabio Berger
fcc627e6e1 fix method rename 2018-05-31 16:12:36 -07:00
Fabio Berger
fe17802cd2 Rename Ecrecover to EthSign 2018-05-31 16:12:21 -07:00
Leonid Logvinov
384c05ccc7 Merge pull request #642 from 0xProject/feature/ethereum-types
Introduce ethereum-types package
2018-05-31 14:33:28 -07:00
Leonid Logvinov
193e4f3275 Address feedback 2018-05-31 13:43:53 -07:00
Brandon Millman
6fd87568e7 Merge pull request #643 from 0xProject/feature/website/wallet-loading
Add loading states to wallet and provider display
2018-05-31 13:34:12 -07:00
Alex Browne
484fd68495 Merge pull request #647 from 0xProject/override-ethereumjs-tx-version
Override ethereumjs-tx version
2018-05-31 12:19:37 -07:00
Alex Browne
792be54443 Override ethereumjs-tx version 2018-05-31 12:05:13 -07:00
Brandon Millman
00df102c29 Fix missing key 2018-05-31 11:54:25 -07:00
Brandon Millman
90e68ddd73 Update placeholder param ordering 2018-05-31 11:54:25 -07:00
Brandon Millman
df27f4f118 Change userEtherBalanceInWei to optional so we can know if its loading 2018-05-31 11:54:25 -07:00
Brandon Millman
bee26daf0c Add loading state to ProviderDisplay 2018-05-31 11:54:25 -07:00
Brandon Millman
b76c738785 Tweaks 2018-05-31 11:54:25 -07:00
Brandon Millman
8ca9fb0251 Add Placeholder component 2018-05-31 11:54:25 -07:00
Brandon Millman
3b26a656f7 Add StandardIconRow 2018-05-31 11:54:25 -07:00
Brandon Millman
2f5ac5d993 Split render into loading and loaaded 2018-05-31 11:54:25 -07:00
Leonid Logvinov
a2fc9a964b Fix linter errors 2018-05-31 11:19:18 -07:00
Leonid Logvinov
b8a267370d Fix linter errors 2018-05-31 11:04:06 -07:00
Leonid Logvinov
fa3d011f68 Add ethereum-types to extraFileIncludes 2018-05-31 11:04:05 -07:00
Leonid Logvinov
a7fc9caacb Introduce ethereum-types package 2018-05-31 11:04:05 -07:00
Leonid Logvinov
c284f6dcd4 Merge pull request #624 from 0xProject/feature/fast-ci2
Rebalance CI tests to run faster
2018-05-31 11:02:56 -07:00
Fabio Berger
368d59c3ca Update artifacts 2018-05-31 11:02:45 -07:00
Fabio Berger
94ee82e076 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype: (45 commits)
  Check length before accessing indices, add awaitTransactionSuccess where needed, and rename function
  Add back before/after snapshots for each test
  Rename Signer to Wallet, rename GAS_ESTIMATE to GAS_LIMIT
  Make preSigned and allowedValidators mappings public
  Change names of signature types
  Fix formatting and tests
  Make AssetProxyId last byte of assetData
  Add signer to txHash, allow approveValidator to be used with executeTransaction
  Update Whitelist
  Fix Exchange interface
  Increase block gas limit
  Use last byte of signature as signature type
  Remove TxOrigin signature type, modify whitelist to use Validator signature type
  Update Whitelist contract with comments, also require maker to be whitelisted
  Fix build
  Add example whitelist contract and minimum tests
  Add sample whitelist contract
  Add TxOrigin signature type and rearrange order of types
  Add approveValidator function
  Add Validator signature type
  ...

# Conflicts:
#	packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
#	packages/contracts/src/utils/types.ts
#	packages/contracts/test/exchange/transactions.ts
#	packages/order-utils/src/asset_proxy_utils.ts
2018-05-31 10:45:34 -07:00
Leonid Logvinov
bfefb6e696 Remove merge conflicts from yarn.lock 2018-05-31 10:36:34 -07:00
Leonid Logvinov
95b7601e2b Don't wait con contract tests to submit coverage 2018-05-31 10:34:24 -07:00
Leonid Logvinov
f9c8bd868c Keep node versions consistent 2018-05-31 10:33:56 -07:00
Leonid Logvinov
a773973b1b Split tests into two buckets 2018-05-31 10:33:56 -07:00
Leonid Logvinov
a60006366b Use a newer version of node/yarn to speed-up deps instaation 2018-05-31 10:33:56 -07:00
Leonid Logvinov
a66bb7889a Try to cache dependencies 2018-05-31 10:32:43 -07:00
Leonid Logvinov
adfba06e85 Combine lint and pretttier tests together 2018-05-31 10:32:43 -07:00
Leonid Logvinov
6ee4e954f6 Rebalance tests 2018-05-31 10:32:43 -07:00
Leonid Logvinov
a11d139ff6 Merge pull request #641 from 0xProject/feature/remove-types
Remove types
2018-05-31 10:29:42 -07:00
Leonid Logvinov
85a3e66314 Add changelog entry for typescript-typings 2018-05-31 10:29:05 -07:00
Leonid Logvinov
1a3958ed60 Remove some types 2018-05-31 10:20:36 -07:00
Leonid Logvinov
743c957918 Remove published types 2018-05-31 10:20:35 -07:00
Amir Bandeali
224a6c192b Fix build 2018-05-31 10:19:10 -07:00
Alex Browne
ae47da3801 Merge pull request #640 from 0xProject/await-transaction-success
Add awaitTransactionSuccess where needed
2018-05-30 22:28:37 -07:00
Alex Browne
a6d669453f Pass in a provider and instantiate a new web3Wrapper in token_registry_wrapper 2018-05-30 22:27:07 -07:00
Fabio Berger
0beab9eec4 Expose isValidPresignedSignatureAsync method 2018-05-30 17:55:33 -07:00
Fabio Berger
aa997f1be5 Move isValidOrderHash to the order_hash_test file 2018-05-30 17:55:16 -07:00
Fabio Berger
4eb58a70bb Decide to throw for Caller signature type for now 2018-05-30 17:54:59 -07:00
Amir Bandeali
5b31d0aa36 Merge pull request #561 from 0xProject/feature/contracts/txorigin
Add Validator signature type
2018-05-30 17:53:22 -07:00
Amir Bandeali
79e7c44884 Check length before accessing indices, add awaitTransactionSuccess where needed, and rename function 2018-05-30 17:52:37 -07:00
Amir Bandeali
1382c1243a Add back before/after snapshots for each test 2018-05-30 17:11:31 -07:00
Amir Bandeali
8f2fd9b603 Rename Signer to Wallet, rename GAS_ESTIMATE to GAS_LIMIT 2018-05-30 17:11:31 -07:00
Amir Bandeali
d625b65a09 Make preSigned and allowedValidators mappings public 2018-05-30 17:11:31 -07:00
Amir Bandeali
101e9be7b9 Change names of signature types 2018-05-30 17:11:31 -07:00
Amir Bandeali
9f93d8f533 Fix formatting and tests 2018-05-30 17:11:31 -07:00
Amir Bandeali
6050a59e4a Make AssetProxyId last byte of assetData 2018-05-30 17:11:30 -07:00
Amir Bandeali
e5b7e29113 Add signer to txHash, allow approveValidator to be used with executeTransaction 2018-05-30 17:11:30 -07:00
Amir Bandeali
ecdd0ce9f2 Update Whitelist 2018-05-30 17:11:30 -07:00
Amir Bandeali
fc5c598f8f Fix Exchange interface 2018-05-30 17:11:30 -07:00
Amir Bandeali
18ebed3c5d Increase block gas limit 2018-05-30 17:11:30 -07:00
Amir Bandeali
822e319efe Use last byte of signature as signature type 2018-05-30 17:11:30 -07:00
Amir Bandeali
6d462fc961 Remove TxOrigin signature type, modify whitelist to use Validator signature type 2018-05-30 17:11:30 -07:00
Amir Bandeali
4b71c65aea Update Whitelist contract with comments, also require maker to be whitelisted 2018-05-30 17:11:30 -07:00
Amir Bandeali
34ab53173d Fix build 2018-05-30 17:11:30 -07:00
Amir Bandeali
d6be6f79ce Add example whitelist contract and minimum tests 2018-05-30 17:11:30 -07:00
Amir Bandeali
87d36f06fd Add sample whitelist contract 2018-05-30 17:11:30 -07:00
Amir Bandeali
3eb05b4505 Add TxOrigin signature type and rearrange order of types 2018-05-30 17:11:30 -07:00
Amir Bandeali
0789c6a3d8 Add approveValidator function 2018-05-30 17:11:30 -07:00
Amir Bandeali
b587f076fe Add Validator signature type 2018-05-30 17:11:30 -07:00
Amir Bandeali
a5a7217c8f Add deepCopyBytes method to LibBytes 2018-05-30 17:11:30 -07:00
Amir Bandeali
c0cf55b40b Merge pull request #639 from 0xProject/fix/contracts/multisigWrapper
Update LogDecoder
2018-05-30 17:10:39 -07:00
Fabio Berger
9200ed2216 Introduce OrderWithoutExchangeAddress type since this is what get's sent to the smart contracts 2018-05-30 14:45:20 -07:00
Fabio Berger
e1f7dd1372 Add ISigner artifacts 2018-05-30 14:08:58 -07:00
Fabio Berger
32833b7301 Fix order-utils tests 2018-05-30 14:08:43 -07:00
Fabio Berger
3302c89284 Revivie the ECSignatureSchema 2018-05-30 13:52:27 -07:00
Francesco Agosti
e18d61b31a Merge pull request #635 from 0xProject/feature/website/custom-onboarding-tooltip
Remove react-joyride and some more refactoring
2018-05-30 11:49:04 -07:00
Francesco Agosti
61cd1ae525 Merge pull request #638 from 0xProject/feature/website/onboarding-eth-flow
Onboarding: implement add ETH step, and stub for add WETH step
2018-05-30 11:17:38 -07:00
Alex Browne
064608a8ef Add awaitTransactionSuccess where needed 2018-05-30 11:10:30 -07:00
Amir Bandeali
5a840c88b5 Change logDecoder back into class, remove awaitTransactionMined from multiSigWrapper 2018-05-30 10:00:58 -07:00
fragosti
b14c3fe48d Onboarding: implement add ETH step, and stub for add WETH step 2018-05-29 17:57:22 -07:00
Fabio Berger
4874d55d03 Initial refactor of order-utils. Move many utils from contracts into this package. 2018-05-29 16:58:30 -07:00
Brandon Millman
b20e40dd6f Fix unselected relayer drawer item 2018-05-29 16:04:25 -07:00
fragosti
bc28a08dd0 Address PR feedback 2018-05-29 15:49:13 -07:00
fragosti
0d3010f6fc Remove react-joyride from deps 2018-05-29 15:27:30 -07:00
fragosti
399a651fa3 Add entry to CHANGELOG.json 2018-05-29 15:24:10 -07:00
fragosti
30ac5fcb5e Remove blacklist concept 2018-05-29 15:18:43 -07:00
fragosti
92cb5e10be Some cleanup 2018-05-29 14:26:38 -07:00
Fabio Berger
10faa47495 Freeze order-utils at 0.0.5 for all packages except contracts 2018-05-29 13:38:19 -07:00
fragosti
f0bbf2cab0 Improve tooltip look 2018-05-29 12:53:18 -07:00
fragosti
338e8be327 Add types for react-popper, remove types for react-joyride 2018-05-29 11:21:14 -07:00
Leonid Logvinov
a4726a0e0d Merge pull request #621 from 0xProject/feature/compiler-assertions
Add schema assertions on public methods of @0xproject/sol-compiler
2018-05-29 10:58:46 -07:00
fragosti
d4a366aeb1 Replace react-joyride with react-popper 2018-05-29 10:48:44 -07:00
Leonid Logvinov
98652997f9 Add a CHANGELOG entry 2018-05-29 10:09:09 -07:00
Leonid Logvinov
f5a39c2f7b Make opts param optional in Compiler 2018-05-29 10:09:09 -07:00
Leonid Logvinov
9854db0a63 Throw if trying to schema-validate an undefined 2018-05-29 10:09:09 -07:00
Leonid Logvinov
cc7b0f4623 Add CHANGELOG entry 2018-05-29 10:09:09 -07:00
Leonid Logvinov
549e6d57c4 Add schema assertions on public methods of @0xproject/sol-compiler 2018-05-29 10:09:07 -07:00
Fabio Berger
dea322e2c5 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype:
  Hide wallet management option and expand component on small screens
  Remove registry override
  Revert "Change the registry in yarn.lock"
  Change the registry in yarn.lock
  Remove contracts -> @0xproject/order-utils dependency
2018-05-25 19:54:11 -07:00
Fabio Berger
ed5b9c2b56 Merge pull request #625 from 0xProject/feature/contracts-without-contract-wrappers
Remove contracts -> @0xproject/contract-wrappers dependency
2018-05-25 19:52:47 -07:00
Brandon Millman
c31ca4af90 Hide wallet management option and expand component on small screens 2018-05-25 18:34:07 -07:00
Leonid Logvinov
2c9ec4bee8 Remove registry override 2018-05-25 17:01:50 -07:00
Leonid Logvinov
6dcfc36a4a Revert "Change the registry in yarn.lock"
This reverts commit 76579a3004.
2018-05-25 16:36:56 -07:00
Leonid Logvinov
76579a3004 Change the registry in yarn.lock 2018-05-25 16:13:48 -07:00
Leonid Logvinov
1d68692bb6 Remove contracts -> @0xproject/order-utils dependency 2018-05-25 16:09:17 -07:00
Fabio Berger
790af0fd72 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype:
  Fix imports in order_utils
  Use web3-wrapper instead of 0x.js, update logDecoder
  Cleanup tests
  Add errMsg when throwing on unrecognized error
  Move readFirst4 to LibBytes
  Add old MultiSig to previous contracts, cleanup file structure
  Fix build
  Address feedback, rename contract to AssetProxyOwner
  Update multisig tests and utils
  Update MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress to use a mapping of registered proxies
  Implement design for relayers with no volume or tokens
2018-05-25 15:39:02 -07:00
fragosti
39008372e5 Write custom tooltip component 2018-05-25 15:31:27 -07:00
fragosti
1026952f26 Run linter 2018-05-25 13:13:06 -07:00
fragosti
9631927a8c Add localstorage helper 2018-05-25 12:03:18 -07:00
fragosti
b0e6ce581a Add next button 2018-05-25 12:03:18 -07:00
fragosti
e575323c60 Auto-show onboarding flow on first page view 2018-05-25 12:03:18 -07:00
fragosti
809ac3340c Add ability to blacklist onboarding steps 2018-05-25 12:03:18 -07:00
fragosti
f0af638874 Fix PortalOnboardingFlowProps 2018-05-25 12:03:18 -07:00
fragosti
b49148ec54 Implement metamask installation flow 2018-05-25 12:03:18 -07:00
Brandon Millman
c7f5e77b3f Merge pull request #620 from 0xProject/feature/website/relayer-empty
Implement design for relayers with no volume or tokens
2018-05-24 23:16:44 -07:00
Leonid Logvinov
817248369a Fix imports in order_utils 2018-05-24 18:30:48 -07:00
Amir Bandeali
654698b208 Merge pull request #571 from 0xProject/feature/contracts/proxyOwner
Update MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress
2018-05-24 17:24:52 -07:00
Fabio Berger
4e5bfae332 Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype:
  Temporarily disable installation tests
  Use domain separator for exchange address
  publicGetOrderSchemaHash -> getOrderSchemaHash
  Update order hash to match latest eip712
  Pin connect in sra-report
  Fix a typo
  Pin types in sra-report
  Fix linter issues
  Unpin types version in @0xproject/connect
  Pin types version in website
  Do a fake version bump on types so that yarn doesn't try to install updated version for not yet migrated packages
  Migrate migrations to v2
2018-05-24 16:31:21 -07:00
Fabio Berger
895a9093aa Merge pull request #575 from 0xProject/feature/contracts/eip712-order-hash
Update order hash to match latest eip712
2018-05-24 16:30:46 -07:00
Fabio Berger
35121f0b78 Merge branch 'v2-prototype' into feature/contracts/eip712-order-hash
* v2-prototype:
  Temporarily disable installation tests
  Pin connect in sra-report
  Fix a typo
  Pin types in sra-report
  Fix linter issues
  Unpin types version in @0xproject/connect
  Pin types version in website
  Do a fake version bump on types so that yarn doesn't try to install updated version for not yet migrated packages
  Migrate migrations to v2

# Conflicts:
#	packages/contracts/src/utils/order_utils.ts
2018-05-24 16:30:30 -07:00
Leonid Logvinov
c4a7574f7b Merge pull request #618 from 0xProject/feature/v2-migrations
Migrate migrations, types to v2
2018-05-24 16:18:44 -07:00
Leonid Logvinov
4ee636ecca Temporarily disable installation tests 2018-05-24 16:07:11 -07:00
Fabio Berger
662dc12877 Add senderAddress to order schema 2018-05-24 16:05:07 -07:00
Jacob Evans
3cc8af819c Use domain separator for exchange address 2018-05-24 16:00:22 -07:00
Jacob Evans
fcf4a958c3 publicGetOrderSchemaHash -> getOrderSchemaHash 2018-05-24 16:00:22 -07:00
Jacob Evans
65676c22f9 Update order hash to match latest eip712 2018-05-24 16:00:22 -07:00
Leonid Logvinov
3e907d7f4f Pin connect in sra-report 2018-05-24 15:45:11 -07:00
Leonid Logvinov
9fa567aa78 Fix a typo 2018-05-24 15:42:29 -07:00
Amir Bandeali
237ebb0716 Use web3-wrapper instead of 0x.js, update logDecoder 2018-05-24 15:39:19 -07:00
Amir Bandeali
fdea260e41 Cleanup tests 2018-05-24 15:39:19 -07:00
Amir Bandeali
9af77dc835 Add errMsg when throwing on unrecognized error 2018-05-24 15:39:19 -07:00
Amir Bandeali
d4aacd218a Move readFirst4 to LibBytes 2018-05-24 15:39:19 -07:00
Amir Bandeali
326a566db2 Add old MultiSig to previous contracts, cleanup file structure 2018-05-24 15:39:19 -07:00
Amir Bandeali
84257dac2b Fix build 2018-05-24 15:39:19 -07:00
Amir Bandeali
22ad9e1e1a Address feedback, rename contract to AssetProxyOwner 2018-05-24 15:39:19 -07:00
Amir Bandeali
cc44f5f75d Update multisig tests and utils 2018-05-24 15:39:19 -07:00
Amir Bandeali
23df5cc201 Update MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress to use a mapping of registered proxies 2018-05-24 15:39:19 -07:00
Brandon Millman
dab2d5db44 Implement design for relayers with no volume or tokens 2018-05-24 15:37:04 -07:00
Leonid Logvinov
1717c5c00d Pin types in sra-report 2018-05-24 15:28:37 -07:00
Leonid Logvinov
ea3f82ccc2 Fix linter issues 2018-05-24 14:56:20 -07:00
Leonid Logvinov
fd6ce470e7 Unpin types version in @0xproject/connect 2018-05-24 14:40:53 -07:00
Leonid Logvinov
6d3fbbe256 Pin types version in website 2018-05-24 14:40:32 -07:00
Leonid Logvinov
45c4de16d2 Do a fake version bump on types so that yarn doesn't try to install updated version for not yet migrated packages 2018-05-24 14:33:48 -07:00
Leonid Logvinov
92b0efff5a Migrate migrations to v2 2018-05-24 13:59:30 -07:00
Leonid Logvinov
bc550c3265 Merge pull request #617 from 0xProject/feature/no-coverage-ci-contracts
Disable contracts coverage on CI
2018-05-24 13:37:55 -07:00
Francesco Agosti
b39aa5d359 Merge pull request #607 from 0xProject/feature/website/onboarding-setup
Set up structure for onboarding flow along with basic step 0
2018-05-24 13:02:45 -07:00
fragosti
f8f8bd95ca Improve OnboardingFlow API and typescript types 2018-05-24 11:24:10 -07:00
fragosti
d057b77dc5 Address PR feedback 2018-05-24 10:53:13 -07:00
fragosti
27d637195d Undo change to react-highlight 2018-05-24 10:52:11 -07:00
fragosti
46919ce797 Fix build errors 2018-05-24 10:52:11 -07:00
fragosti
b4e1ce59f9 Fix issue where modal can be out of sync with app state 2018-05-24 10:52:11 -07:00
fragosti
7af77d3eb0 Basic onboarding flow infrastructure set up 2018-05-24 10:51:06 -07:00
Francesco Agosti
de1ff52de3 Merge pull request #612 from 0xProject/feature/website/add-redux-devtools
Add redux-devtools-extension to project
2018-05-24 10:12:57 -07:00
Leonid Logvinov
69c1df68c8 Disable contracts coverage on CI 2018-05-24 09:57:13 -07:00
Fabio Berger
62431fee8e Merge pull request #615 from 0xProject/refactor/json-schemas/for-v2
Refactor order schemas in json-schemas for v2
2018-05-24 09:39:28 -07:00
Fabio Berger
357201869a Change all wsrun commands so that they fast-exit (e.g any one failing stops the entire process from executing) 2018-05-23 21:27:37 -07:00
Fabio Berger
a88e8ffe79 Have source-map-loader ignore node_modules packages 2018-05-23 21:27:08 -07:00
Fabio Berger
5c88f43e15 Revert to an earlier version that works 2018-05-23 21:26:17 -07:00
Alex Browne
2f7ab3e32d Merge pull request #613 from 0xProject/check-tx-receipt-status
Check transaction receipt status
2018-05-23 18:12:41 -07:00
Fabio Berger
3ec05bb5d8 Force hex to have at least two hex values after the prefix, but it could be two zeros 2018-05-23 17:36:34 -07:00
Fabio Berger
59890f2c83 Fix Hex regex and tests 2018-05-23 17:28:17 -07:00
Fabio Berger
2c70162bee Remove the caret so it actually installs this version 2018-05-23 17:28:03 -07:00
Brandon Millman
2f1a4042bf Merge pull request #603 from 0xProject/feature/website/wallet-flex-box
Improve wallet layout using flexbox
2018-05-23 17:03:54 -07:00
Fabio Berger
4af7740907 Merge branch 'v2-prototype' into refactor/json-schemas/for-v2
* v2-prototype:
  Ignore v2 artifacts
2018-05-23 17:01:14 -07:00
Fabio Berger
f64ea361d4 Add CHANGELOG entry 2018-05-23 17:00:32 -07:00
Fabio Berger
9c850d152c Updated Order, SignedOrder schemas, removed ECSignature schema types and added Hex basic type 2018-05-23 16:52:41 -07:00
Fabio Berger
71266c0220 Merge pull request #614 from 0xProject/bug/prettier/ignore-v2-artifacts
Ignore v2 artifacts
2018-05-23 15:47:43 -07:00
Brandon Millman
0801457ff0 Use visibility property instead of placeholder div in wrap ether item 2018-05-23 15:28:51 -07:00
Jacob Evans
ba7c9ceccc Ignore v2 artifacts 2018-05-23 15:21:43 -07:00
Alex Browne
f6f2818a02 Change error message for awaitTransactionSuccessAsync 2018-05-23 15:09:19 -07:00
Alex Browne
b05a3b7aed Check transaction receipt status codes where applicable 2018-05-23 15:09:17 -07:00
Brandon Millman
3fe94891d3 Merge branch 'v2-prototype' into feature/website/wallet-flex-box
* v2-prototype: (95 commits)
  Add missing dep to website
  Upgrade solidity parser
  Fix trace test
  Fix linter issues
  Move contract utils
  Fix prettier
  Fix NameResolver
  Fix prettier
  Remove 0x.js as a dependency from website
  Enable 0x.js tests
  Fix small bug in order-utils
  Address feedback
  Fix Tslint error caused by "PromiseLike" value
  Fix Tslint error caused by "PromiseLike" value
  Update dogfood url
  fix contract-wrappers version
  Parse compiler.json in SolCompilerArtifactsAdapter
  Fix TokenTransferProxy artifact name since it's now suffixed with _v1
  Update yarn.lock
  Fix signature verification test
  ...
2018-05-23 14:16:32 -07:00
Fabio Berger
9d11028fce Bump all dependencies on json-schemas down a patch version so that they don't auto-magically get upgraded to the next version during the next publish 2018-05-23 13:56:52 -07:00
Fabio Berger
f6b81f588d Add missing dep to website 2018-05-23 13:30:09 -07:00
Fabio Berger
513007a82c Merge pull request #589 from 0xProject/feature/truffle-sol-cov
Sol-cov artifact Adapters (truffle)
2018-05-23 12:01:38 -07:00
Leonid Logvinov
bf18a90da7 Upgrade solidity parser 2018-05-23 11:21:33 -07:00
Leonid Logvinov
2ddd53b355 Fix trace test 2018-05-23 10:49:08 -07:00
Leonid Logvinov
c9aef16649 Fix linter issues 2018-05-23 10:39:56 -07:00
Leonid Logvinov
6a77e0fe56 Move contract utils 2018-05-23 10:32:14 -07:00
Leonid Logvinov
0a725415a4 Merge branch 'v2-prototype' into feature/truffle-sol-cov 2018-05-23 10:19:10 -07:00
Leonid Logvinov
af0d9439d4 Merge pull request #611 from 0xProject/feature/remove-0x-from=-website
Remove 0x.js as a dependency from website
2018-05-23 10:16:00 -07:00
Leonid Logvinov
65f09d0528 Fix prettier 2018-05-23 10:15:03 -07:00
Leonid Logvinov
48e6695447 Fix NameResolver 2018-05-23 09:57:43 -07:00
Leonid Logvinov
e3604c1662 Fix prettier 2018-05-23 09:41:35 -07:00
Leonid Logvinov
5913d654bd Remove 0x.js as a dependency from website 2018-05-23 09:41:35 -07:00
Fabio Berger
f3fe9661f6 Merge pull request #609 from 0xProject/refactor/contracts/remove0xjsDep
Remove 0x.js dep from Contracts
2018-05-23 09:04:59 -07:00
Fabio Berger
17cfd7b001 Enable 0x.js tests 2018-05-23 08:37:43 -07:00
Fabio Berger
e941bdd945 Merge branch 'v2-prototype' into refactor/contracts/remove0xjsDep
* v2-prototype:
  Fix small bug in order-utils
  Fix Tslint error caused by "PromiseLike" value
  Update dogfood url
2018-05-22 18:15:38 -07:00
Alex Browne
e7e8773cd4 Fix small bug in order-utils 2018-05-22 18:14:23 -07:00
Leonid Logvinov
ebc750d5bf Address feedback 2018-05-22 17:41:48 -07:00
Fabio Berger
3507fe6d5b Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo:
  Update dogfood url
2018-05-22 17:37:23 -07:00
Fabio Berger
f9ef6491e6 Fix Tslint error caused by "PromiseLike" value 2018-05-22 17:37:06 -07:00
Fabio Berger
61e487224f Fix Tslint error caused by "PromiseLike" value 2018-05-22 17:36:41 -07:00
Brandon Millman
85eb82acb2 Update dogfood url 2018-05-22 17:36:22 -07:00
Fabio Berger
4d364ea261 fix contract-wrappers version 2018-05-22 17:18:09 -07:00
Fabio Berger
577528bb9c merge v2-prototype 2018-05-22 16:56:09 -07:00
Leonid Logvinov
d49f2c40ae Parse compiler.json in SolCompilerArtifactsAdapter 2018-05-22 16:41:50 -07:00
Fabio Berger
706bfafe74 Fix TokenTransferProxy artifact name since it's now suffixed with _v1 2018-05-22 16:38:26 -07:00
Fabio Berger
1b8204dabe Update yarn.lock 2018-05-22 16:37:33 -07:00
Fabio Berger
05cabded02 Fix signature verification test 2018-05-22 16:37:17 -07:00
Fabio Berger
1578402cbe Fix TokenTransferProxy artifact name since it's now suffixed with _v1 2018-05-22 16:37:04 -07:00
fragosti
49ee56b22c Move to deps from devDeps and use in development only 2018-05-22 16:32:26 -07:00
Leonid Logvinov
8c7f0902c0 Add a more verbose comment for self-destruct 2018-05-22 16:29:10 -07:00
Leonid Logvinov
056ef9ccd1 Merge pull request #610 from 0xProject/feature/sra-report-without-0x
Remove 0x.js dependency from sra-report
2018-05-22 16:18:42 -07:00
fragosti
dfc635b451 Add redux-devtools-extension to project 2018-05-22 16:08:04 -07:00
Leonid Logvinov
68321362c5 Remove 0x.js dependency from sra-report 2018-05-22 15:45:44 -07:00
Leonid Logvinov
f7560036b8 Merge branch 'v2-prototype' into feature/truffle-sol-cov 2018-05-22 15:33:36 -07:00
Leonid Logvinov
fc87caa348 Merge branch 'development' into v2-prototype 2018-05-22 15:30:39 -07:00
Leonid Logvinov
6e0aef5f2b Fix depth tracking in a tracer 2018-05-22 15:27:18 -07:00
Leonid Logvinov
127b3e7d60 Fix sol-compiler version 2018-05-22 15:27:17 -07:00
Leonid Logvinov
9740199870 Fix sol-cov tests 2018-05-22 15:27:17 -07:00
Leonid Logvinov
06be580d2c Fix a bug in CALL-like opcode handling 2018-05-22 15:27:17 -07:00
Leonid Logvinov
6540343f45 Remove trace.json 2018-05-22 15:27:17 -07:00
Leonid Logvinov
447b305e3c Suppport subcalls in constructor 2018-05-22 15:27:17 -07:00
Leonid Logvinov
0c53d276f8 Use BlockParamLiteral.Latest 2018-05-22 15:27:17 -07:00
Leonid Logvinov
83c37c6a7a Address feedback 2018-05-22 15:27:17 -07:00
Leonid Logvinov
ac52ad88a1 Use loglevel instead of verbose flag 2018-05-22 15:26:29 -07:00
Leonid Logvinov
84a1b5612d Publish
- 0x.js@0.38.0
 - @0xproject/abi-gen@0.3.0
 - @0xproject/assert@0.2.10
 - @0xproject/base-contract@0.3.2
 - @0xproject/connect@0.6.13
 - @0xproject/contract-wrappers@0.0.2
 - contracts@2.1.29
 - @0xproject/dev-utils@0.4.2
 - @0xproject/fill-scenarios@0.0.2
 - @0xproject/json-schemas@0.7.24
 - @0xproject/metacoin@0.0.7
 - @0xproject/migrations@0.0.6
 - @0xproject/monorepo-scripts@0.1.20
 - @0xproject/order-utils@0.0.5
 - @0xproject/order-watcher@0.0.2
 - @0xproject/react-docs-example@0.0.12
 - @0xproject/react-docs@0.0.12
 - @0xproject/react-shared@0.1.7
 - @0xproject/sol-compiler@0.5.0
 - @0xproject/sol-cov@0.0.11
 - @0xproject/sol-resolver@0.0.5
 - @0xproject/sra-report@0.1.0
 - @0xproject/subproviders@0.10.2
 - @0xproject/testnet-faucets@1.0.30
 - @0xproject/tslint-config@0.4.18
 - @0xproject/types@0.7.0
 - @0xproject/typescript-typings@0.3.2
 - @0xproject/utils@0.6.2
 - @0xproject/web3-wrapper@0.6.4
 - @0xproject/website@0.0.33
2018-05-22 15:25:47 -07:00
Leonid Logvinov
fa4e694859 Updated CHANGELOGS 2018-05-22 15:22:38 -07:00
Leonid Logvinov
f8c628b0c7 Updated CHANGELOGS 2018-05-22 15:22:12 -07:00
Leonid Logvinov
2f35e4789c Change publish command name 2018-05-22 15:20:35 -07:00
Leonid Logvinov
253bada643 Fix import paths 2018-05-22 15:20:35 -07:00
Leonid Logvinov
e4fe497504 Refactor ContractData lookup 2018-05-22 15:20:35 -07:00
Leonid Logvinov
5c9bde203e Remove a comment 2018-05-22 15:20:35 -07:00
Leonid Logvinov
d9907f227e Use a hidden directory for temp artifacts 2018-05-22 15:20:34 -07:00
Leonid Logvinov
08b08ef1d0 Match class names with file names 2018-05-22 15:20:34 -07:00
Leonid Logvinov
334ef5c3eb Improve a CHANGELOG comment 2018-05-22 15:20:34 -07:00
Leonid Logvinov
ac925aa226 Improve a CHANGELOG comment 2018-05-22 15:20:34 -07:00
Leonid Logvinov
86f17fb466 Rename ZeroExArtifactAdapter to SolCompilerArtifactAdapter 2018-05-22 15:20:34 -07:00
Leonid Logvinov
6aafda4517 Assign then pass 2018-05-22 15:20:34 -07:00
Leonid Logvinov
8267950dbc Assign then return 2018-05-22 15:20:34 -07:00
Leonid Logvinov
56d1b0103f Introduce CONFIG_FILE 2018-05-22 15:20:34 -07:00
Leonid Logvinov
1ff34bd0f4 Remove web3Factory.create and remove dev-tools dependency on sol-cov 2018-05-22 15:20:34 -07:00
Leonid Logvinov
b86248f13f Add CHANGELOG entries 2018-05-22 15:20:34 -07:00
Leonid Logvinov
427a29145d Support all opcodes in a trace parser 2018-05-22 15:20:34 -07:00
Leonid Logvinov
974575b695 Make sol-cov work with truffle and other artifact adapters 2018-05-22 15:20:34 -07:00
Leonid Logvinov
60b1fdd367 Only look at *.sol files in NameResolver 2018-05-22 15:20:33 -07:00
Leonid Logvinov
842f2ea5cc Fix a bug in FS resolver causing it to try reading directories 2018-05-22 15:20:33 -07:00
Leonid Logvinov
ae220c37df Add solcVersion to CompilerOpts 2018-05-22 15:20:33 -07:00
Fabio Berger
6f57f52ac2 Fix dep version 2018-05-22 13:44:35 -07:00
Fabio Berger
4897513d7d Fix import 2018-05-22 13:19:35 -07:00
Fabio Berger
c8dad01137 Fix await calls 2018-05-22 13:19:29 -07:00
Fabio Berger
5a09063adb Refactor etherToken test to use contract-wrappers 2018-05-22 13:15:16 -07:00
Fabio Berger
9de9bf651b Fix ExchangeWrapper 2018-05-22 13:15:01 -07:00
Fabio Berger
09d80b1e50 Fix imports 2018-05-22 13:14:38 -07:00
Fabio Berger
2b793f372a Merge branch 'v2-prototype' into refactor/contracts/remove0xjsDep
* v2-prototype:
  Fix tslint issues
  Add `are` to boolean naming conventions
  Fix tslint
  Fix the tsutils version, fixing ts typings issue
  Rename some variables in multi_sig_with_time_lock.ts
  Remove extra awaitTransactionMinedAsync calls
  Update artifacts
  Update yarn.lock
  Fix warnings in Metacoin
  Upgrade UglifyJS to include ES6 support
  Add CancelOrder and MatchOrder types
  Add missing return types
  Ignore classnames linter rule
  Apply changes to test/exchange/match_orders.ts
  Fix some unhandled promise rejections
  Add awaitTransactionMinedAsync after every sent transaction
  Add missing blockchainLifecycle calls to contracts tests

# Conflicts:
#	packages/contracts/src/utils/exchange_wrapper.ts
#	packages/contracts/test/asset_proxy/proxies.ts
#	packages/contracts/test/exchange/dispatcher.ts
#	packages/contracts/test/multi_sig_with_time_lock.ts
2018-05-22 13:02:21 -07:00
Fabio Berger
4cfeb6b8ac Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo:
  Rename some variables in multi_sig_with_time_lock.ts
  Remove extra awaitTransactionMinedAsync calls
  Apply changes to test/exchange/match_orders.ts
  Fix some unhandled promise rejections
  Add awaitTransactionMinedAsync after every sent transaction
  Add missing blockchainLifecycle calls to contracts tests
2018-05-22 11:58:50 -07:00
Fabio Berger
9373451ca8 Fix tslint issues 2018-05-22 11:58:42 -07:00
Fabio Berger
15c199d5a2 Add are to boolean naming conventions 2018-05-22 11:58:35 -07:00
Alex Browne
cde85243d6 Merge pull request #601 from 0xProject/contracts-test-fixes
Contracts test fixes
2018-05-22 11:48:41 -07:00
Fabio Berger
c579db1a7b Merge branch 'v2-prototype' of github.com:0xProject/0x-monorepo into v2-prototype
* 'v2-prototype' of github.com:0xProject/0x-monorepo:
  Update artifacts
  Update yarn.lock
  Fix warnings in Metacoin
  Upgrade UglifyJS to include ES6 support
  Add CancelOrder and MatchOrder types
  Add missing return types
  Ignore classnames linter rule
2018-05-22 11:42:58 -07:00
Fabio Berger
61fa34e2ce Fix tslint 2018-05-22 11:42:52 -07:00
Fabio Berger
96febf6639 Merge pull request #605 from 0xProject/fix/multiple/build-errors
Fix build/lint errors and warnings
2018-05-22 11:40:27 -07:00
Fabio Berger
09e59cf677 Fix the tsutils version, fixing ts typings issue 2018-05-22 11:23:14 -07:00
Fabio Berger
9119ee14b6 Update artifact 2018-05-22 11:19:19 -07:00
Fabio Berger
2ac2ae3eee Fix tsutils version 2018-05-22 11:19:09 -07:00
Fabio Berger
a682b5d90e Remove 0x.js dep from contracts 2018-05-22 11:18:50 -07:00
Alex Browne
e26c0c58ae Rename some variables in multi_sig_with_time_lock.ts 2018-05-22 11:02:29 -07:00
Alex Browne
187fa71526 Remove extra awaitTransactionMinedAsync calls 2018-05-22 10:58:34 -07:00
Leonid Logvinov
031f97e97c Publish
- 0x.js@0.38.0
 - @0xproject/abi-gen@0.3.0
 - @0xproject/assert@0.2.10
 - @0xproject/base-contract@0.3.2
 - @0xproject/connect@0.6.13
 - @0xproject/contract-wrappers@0.0.2
 - contracts@2.1.29
 - @0xproject/dev-utils@0.4.2
 - @0xproject/fill-scenarios@0.0.2
 - @0xproject/json-schemas@0.7.24
 - @0xproject/metacoin@0.0.7
 - @0xproject/migrations@0.0.6
 - @0xproject/monorepo-scripts@0.1.20
 - @0xproject/order-utils@0.0.5
 - @0xproject/order-watcher@0.0.2
 - @0xproject/react-docs-example@0.0.12
 - @0xproject/react-docs@0.0.12
 - @0xproject/react-shared@0.1.7
 - @0xproject/sol-compiler@0.5.0
 - @0xproject/sol-cov@0.0.11
 - @0xproject/sol-resolver@0.0.5
 - @0xproject/sra-report@0.1.0
 - @0xproject/subproviders@0.10.2
 - @0xproject/testnet-faucets@1.0.30
 - @0xproject/tslint-config@0.4.18
 - @0xproject/types@0.7.0
 - @0xproject/typescript-typings@0.3.2
 - @0xproject/utils@0.6.2
 - @0xproject/web3-wrapper@0.6.4
 - @0xproject/website@0.0.33
2018-05-22 10:26:47 -07:00
Leonid Logvinov
b9e1c3c34f Updated CHANGELOGS 2018-05-22 10:26:39 -07:00
Leonid Logvinov
1a35107a1d Updated CHANGELOGS 2018-05-22 10:16:53 -07:00
Leonid Logvinov
d3e086c850 Change publish command name 2018-05-22 10:16:53 -07:00
Fabio Berger
4a0c8d72b0 merge development 2018-05-22 09:25:02 -07:00
Fabio Berger
ab9cfd293b remove generated contract_wrappers during clean 2018-05-22 09:21:20 -07:00
Fabio Berger
cc840a6911 Merge pull request #594 from 0xProject/improvement/addCustomTslintRules
Add more tslint rules
2018-05-22 18:04:50 +02:00
Remco Bloemen
5456187dd0 Update artifacts 2018-05-22 17:13:04 +02:00
Remco Bloemen
73c95c328d Update yarn.lock 2018-05-22 17:08:47 +02:00
Remco Bloemen
4a971be168 Fix warnings in Metacoin 2018-05-22 15:19:40 +02:00
Remco Bloemen
f657a3d811 Upgrade UglifyJS to include ES6 support 2018-05-22 15:19:40 +02:00
Remco Bloemen
b39f75a2e3 Add CancelOrder and MatchOrder types 2018-05-22 15:15:14 +02:00
Remco Bloemen
1dad14f8ea Add missing return types 2018-05-22 13:50:07 +02:00
Remco Bloemen
5cc2e8de7b Ignore classnames linter rule 2018-05-22 13:45:18 +02:00
Brandon Millman
d0abc60176 Add missing key 2018-05-21 21:41:03 -07:00
Brandon Millman
130e83d9b2 Use flexbox for wrapped ether item 2018-05-21 21:25:43 -07:00
Brandon Millman
ed8acdb11c Re add wrapped ether item 2018-05-21 21:25:43 -07:00
Brandon Millman
26370da13d Rewrite balance rows using flex box 2018-05-21 21:25:42 -07:00
Fabio Berger
c4a2f70017 Make lint run in parallel 2018-05-21 18:36:06 -07:00
Alex Browne
a5d315ee2a Apply changes to test/exchange/match_orders.ts 2018-05-21 16:58:29 -07:00
Alex Browne
4fa57f55e6 Fix some unhandled promise rejections 2018-05-21 16:52:49 -07:00
Alex Browne
2c496a92ad Add awaitTransactionMinedAsync after every sent transaction 2018-05-21 16:52:49 -07:00
Alex Browne
4ca8903a21 Add missing blockchainLifecycle calls to contracts tests 2018-05-21 16:52:49 -07:00
Greg Hysen
d460c0e8b9 Merge pull request #572 from 0xProject/feature/contracts/atomicMatching
Atomic Order Matching
2018-05-21 14:29:56 -07:00
Greg Hysen
11b6d290da Removed debug line from chai_setup. Its failing linter and does not appear to be used (it was from an old PR I merged in). 2018-05-21 14:25:39 -07:00
Greg Hysen
d83902834f Ran prettier 2018-05-21 13:54:11 -07:00
Fabio Berger
0fdf32cf6f merge development 2018-05-21 13:38:12 -07:00
Greg Hysen
f4ebbfabf4 Added getNullFillResults 2018-05-18 17:07:00 -07:00
Greg Hysen
b5bcfc8fe7 orderFilledAmount -> orderTakerAssetFilledAmount 2018-05-18 17:07:00 -07:00
Greg Hysen
d13c08cc0d Style improvements to order matching 2018-05-18 17:07:00 -07:00
Greg Hysen
89abd76570 Upgraded to Solidity 0.4.24 2018-05-18 17:07:00 -07:00
Greg Hysen
8c1ae35088 Rebased against v2-prototype 2018-05-18 17:05:36 -07:00
Greg Hysen
bb74789b42 Changed calculateFillResults to public visibility so that it can be used by the Forwarding Contract. 2018-05-18 17:01:06 -07:00
Greg Hysen
dbbd32d2ce Moved feeTokenAddress to MatchOrderTester constructor. Since it is constant, we dont need to pass it in on each call. 2018-05-18 17:01:06 -07:00
Greg Hysen
80285a300d Wording of calculateMatchedFillResults 2018-05-18 17:01:06 -07:00
Greg Hysen
2eb5819851 Cleaned up interface for decoding proxy data. Added a general decoder, which should be useful for the forwarding contract code. 2018-05-18 17:01:06 -07:00
Greg Hysen
e748e1891b Style improvements to the match orders typescript test class 2018-05-18 17:01:06 -07:00
Greg Hysen
28bb11217c Removed redundant log decode call 2018-05-18 17:01:06 -07:00
Greg Hysen
636dae6a79 The OrderInfo struct is now returned by the getOrderInfo function 2018-05-18 17:01:06 -07:00
Greg Hysen
c8f65a1bf9 Updated order of settleMatchedOrders to align with settleOrder 2018-05-18 17:01:06 -07:00
Greg Hysen
ce177ae6f6 IExchange inherits from all other interfaces (in the same order as Exchange inherits Mixins) 2018-05-18 17:01:06 -07:00
Greg Hysen
c79f3501cd Renamed takerAssetFilledAmount to orderFilledAmount to more easily distinguish between fill results and order state 2018-05-18 17:01:06 -07:00
Greg Hysen
80114edc71 Comments for readability in exchange core and mixin match orders 2018-05-18 17:01:06 -07:00
Greg Hysen
71483e2865 Renamed "validate" functions to "assert" in mixin match. 2018-05-18 17:01:06 -07:00
Greg Hysen
93087324d9 Throw if the left or right orders do not compute the correct fill results. I like this better than just logging an error and failing silently. 2018-05-18 17:01:06 -07:00
Greg Hysen
061facdcce Removed redundant status checks in matchOrders. Saves gas, plus follows pattern of fillOrder more closely. 2018-05-18 17:01:06 -07:00
Greg Hysen
3e6e7fb272 Token -> Asset in fillOrder spec 2018-05-18 17:01:06 -07:00
Greg Hysen
12d8c2398f Reordered functions in mixin exchange core -- getOrderInfo is at the bottom 2018-05-18 17:01:06 -07:00
Greg Hysen
bb73963421 Changes based on style guidelines put out by Amir 2018-05-18 17:01:06 -07:00
Greg Hysen
1dd7688bdd Reordered fund transfers for matched orders, plus added an extra sanity check to order matching calculations 2018-05-18 17:01:06 -07:00
Greg Hysen
5735095521 Style changes to atomic order matching 2018-05-18 17:01:06 -07:00
Greg Hysen
fa7570352c Added require reasons to MixinMatchOrders and cleaned up some comments. 2018-05-18 17:01:06 -07:00
Greg Hysen
f378406d15 Updated remaining contracts to v0.4.23 2018-05-18 17:01:05 -07:00
Greg Hysen
68fa7ae2a3 Removed isRoundingError from mixin header 2018-05-18 17:01:05 -07:00
Greg Hysen
9b1015bbce Atomic Order Matching - Tests 2018-05-18 17:01:05 -07:00
Greg Hysen
a4c821eb60 Atomic Order Matching - Smart Contracts. 2018-05-18 17:01:05 -07:00
Brandon Millman
c70540e7f4 Merge pull request #598 from 0xProject/feature/website/mobile-optimize
Mobile optimize the portal layout
2018-05-18 15:38:04 -07:00
Brandon Millman
e291146443 Prettier 2018-05-18 11:36:17 -07:00
Brandon Millman
faa2b6237f Change number of columns in relayer index for small screens 2018-05-18 11:35:13 -07:00
Brandon Millman
26661f3091 Wallet instead of balances for small screens 2018-05-18 11:35:13 -07:00
Brandon Millman
e6e8d49d72 Close drawer when new path is chosen 2018-05-18 11:35:13 -07:00
Brandon Millman
b9ca055586 Fix styling of portal menu 2018-05-18 11:35:13 -07:00
Brandon Millman
9ce7be050a Refactor portal specific colors out of react-shared 2018-05-18 11:35:13 -07:00
Brandon Millman
1d2617c826 Add custom styling for drawer 2018-05-18 11:35:13 -07:00
Brandon Millman
7c8e9ddc42 Fix key issue for portal routes 2018-05-18 11:35:13 -07:00
Brandon Millman
157764c0d9 Fix responsiveness broken in rebase 2018-05-18 11:35:13 -07:00
Brandon Millman
317ff81744 Set up scaffolding for new drawer 2018-05-18 11:35:13 -07:00
Brandon Millman
bd7fc780cb Hide wallet component for small screens 2018-05-18 11:35:13 -07:00
Brandon Millman
4b343d9dcf Fix token link key 2018-05-18 11:35:13 -07:00
Brandon Millman
7a6a5d7595 Modulate number of columns based on screenwidth 2018-05-18 11:35:13 -07:00
Brandon Millman
85020c74cf Fix prettier 2018-05-18 11:33:46 -07:00
Jacob Evans
0137c0da8c Merge pull request #583 from 0xProject/bug/contracts/erc721-encoded-pad
ERC721Proxy Pad to 32 if asset ids are small
2018-05-18 12:26:31 +10:00
fragosti
407731ab16 Change my title to clarify 2018-05-17 16:33:09 -07:00
Francesco Agosti
72503c0689 Merge pull request #596 from 0xProject/feature/website/weth-eth-conversion-errors
Show error messages in the wrapped ether item
2018-05-17 13:15:24 -07:00
fragosti
e9e570db4f Center all the things 2018-05-17 13:04:39 -07:00
fragosti
5bc83fceaa Refactor code in response to CR feedback 2018-05-17 13:04:39 -07:00
fragosti
e7fd501200 Remove duplicate function call to validate 2018-05-17 13:04:39 -07:00
fragosti
ea0067d999 Show error messages in the wrapped ether item 2018-05-17 13:04:39 -07:00
fragosti
ec49ca6480 Improve about page descriptions 2018-05-17 13:04:39 -07:00
Alex Browne
a26cc7c14d Merge pull request #597 from 0xProject/make-promises-safe
Use make-promises-safe to catch unhandled rejections in tests
2018-05-17 11:58:31 -07:00
Brandon Millman
c9d3041460 Merge pull request #586 from 0xProject/feature/website/manage-wallet-2
Manage your wallet section of portal
2018-05-17 11:05:58 -07:00
Brandon Millman
943b7d39c6 Fix tslint false positive 2018-05-17 11:02:55 -07:00
Brandon Millman
6b1a911604 Fix spread 2018-05-17 11:02:55 -07:00
Brandon Millman
3d4e03f2cd Refactor account management itmes 2018-05-17 11:02:55 -07:00
Brandon Millman
48b0b54819 Add loading component 2018-05-17 11:02:55 -07:00
Brandon Millman
00515eb6f9 Refactor a bunch of layouts into their own files 2018-05-17 11:02:55 -07:00
Brandon Millman
63e7391981 Add portal layout component 2018-05-17 11:02:55 -07:00
Brandon Millman
b6776f53ab Get rid of extra curly brackets 2018-05-17 11:02:55 -07:00
Brandon Millman
6a0cda7396 Fix lint error 2018-05-17 11:02:55 -07:00
Brandon Millman
09692dc70e Fix comments 2018-05-17 11:02:55 -07:00
Brandon Millman
e0482f5400 Wait for blockchain to display the account management routes 2018-05-17 11:02:55 -07:00
Brandon Millman
c787dc7356 Fix linter errors and relayer index reloading 2018-05-17 11:02:55 -07:00
Brandon Millman
ea948ac2c8 Trade direct route 2018-05-17 11:02:55 -07:00
Brandon Millman
d6e321e97f Add manage you wallet footer 2018-05-17 11:02:55 -07:00
Brandon Millman
807250510a Add props to back button 2018-05-17 11:02:55 -07:00
Brandon Millman
ef1e974346 Back button and title components 2018-05-17 11:02:55 -07:00
Brandon Millman
55d1228abb Implement new menu styling 2018-05-17 11:02:55 -07:00
Brandon Millman
9e76d2ca63 Add menu 2018-05-17 11:02:55 -07:00
Brandon Millman
d53915e7e3 Add routes 2018-05-17 11:02:55 -07:00
Fabio Berger
7fab782907 Improve naming 2018-05-17 14:07:55 +02:00
Fabio Berger
cf7967e629 Disable magic number rule in more places where it isn't helping code readability 2018-05-17 14:07:44 +02:00
Fabio Berger
0eacbac8f6 Merge branch 'development' into improvement/addCustomTslintRules
* development:
  Remove "Order utils" from menu for now
  Fix top tokens key
  Improve about page descriptions
  Do not remove artifacts when running `clean`
2018-05-17 13:57:51 +02:00
Fabio Berger
cec76c33b6 Remove "Order utils" from menu for now 2018-05-17 13:21:37 +02:00
Brandon Millman
18dcf98998 Fix top tokens key 2018-05-16 18:07:47 -07:00
Alex Browne
251218af8b Use make-promises-safe to catch unhandled rejections in tests 2018-05-16 17:36:37 -07:00
Fabio Berger
e2cbe42ed0 Update yarn.lock 2018-05-16 20:44:16 +02:00
fragosti
c06ed58582 Improve about page descriptions 2018-05-16 10:15:04 -07:00
Fabio Berger
78623ae3bd Merge branch 'development' into v2-prototype
* development: (29 commits)
  Do not remove artifacts when running `clean`
  fix style errors
  Fix circular dependency
  Add my profile image to images
  Add myself to about page
  Add dogfood configs to website
  Revert to lerna:run lint
  Do lint sequentially
  Exclude monorepo-scripts from tslint as test
  Fix prettier
  Add hover state to top tokens
  Change to weekly txn volume
  Change minimum Node version to 6.12
  Document Node.js version requirement and add it to package.json
  Apply prettier to some files which were not formatted correctly
  Fix TSLint issues
  Fix TSLint issues
  Update ethereeumjs-testrpc to ganache-cli
  Fix infinite loop
  Add changelog entries for packages where executable binary exporting fixed
  ...

# Conflicts:
#	packages/contracts/package.json
#	packages/contracts/util/formatters.ts
#	packages/contracts/util/signed_order_utils.ts
#	packages/migrations/package.json
#	yarn.lock
2018-05-16 16:18:47 +02:00
Fabio Berger
4de6221825 Do not remove artifacts when running clean 2018-05-16 16:08:15 +02:00
Fabio Berger
136c6d01b3 Do not remove artifacts when running clean 2018-05-16 16:01:37 +02:00
Fabio Berger
22f3f57f44 Merge branch 'development' into improvement/addCustomTslintRules
* development:
  fix style errors
  Fix circular dependency
  Add my profile image to images
  Add myself to about page
  Add dogfood configs to website
  Change minimum Node version to 6.12
  Document Node.js version requirement and add it to package.json
2018-05-16 15:15:23 +02:00
Fabio Berger
b2f362225c Fix comments 2018-05-16 15:14:31 +02:00
Fabio Berger
40ed59ce28 Improve name 2018-05-16 15:14:24 +02:00
Fabio Berger
839db68571 Fix TSLint rules 2018-05-16 14:59:10 +02:00
Fabio Berger
fec6ac3ff0 Enforce new rules, including no-switch-case-fall-through 2018-05-16 14:58:28 +02:00
Fabio Berger
45fa26dc6c Implement boolean variable naming custom TSLint rule 2018-05-16 14:58:01 +02:00
Fabio Berger
f49d432fdc Implement custom no-magic-numbers rule that doesn't include magic numbers passed into BigNumber instantiations (e.g const amount = new BigNumber(5); ) 2018-05-16 14:57:28 +02:00
Fabio Berger
1a31ceff8e Run linter sequentially 2018-05-16 14:56:11 +02:00
Francesco Agosti
cc486cb86d Merge pull request #593 from 0xProject/bug/website/fix-cirular-dependency
Fix circular dependency
2018-05-15 16:35:05 -07:00
Francesco Agosti
7a45a579c0 Merge pull request #592 from 0xProject/feature/website/add-francesco-about
Add myself to about page
2018-05-15 15:59:24 -07:00
fragosti
dc58d539c2 fix style errors 2018-05-15 15:54:17 -07:00
fragosti
2ba78eb740 Fix circular dependency 2018-05-15 15:27:27 -07:00
fragosti
f43b275f16 Add my profile image to images 2018-05-15 14:50:33 -07:00
fragosti
509a81a572 Add myself to about page 2018-05-15 14:44:57 -07:00
Brandon Millman
184232ba4f Add dogfood configs to website 2018-05-15 13:51:43 -07:00
Amir Bandeali
9e0471bfbb Merge branch 'development' into v2-prototype 2018-05-15 15:52:49 -04:00
Alex Browne
0bc338ba42 Merge pull request #578 from 0xProject/document-node-version
Document Node.js version requirement and add it to package.json
2018-05-15 10:51:49 -07:00
Fabio Berger
406e91d387 Merge pull request #588 from 0xProject/improvement/use-wsrun
Individual package building & watching!!! 💪 🌹
2018-05-15 11:41:51 +02:00
Fabio Berger
473acafd14 Revert to lerna:run lint 2018-05-15 11:21:49 +02:00
Fabio Berger
7474e6b1c9 Do lint sequentially 2018-05-15 11:05:02 +02:00
Fabio Berger
323955277c Exclude monorepo-scripts from tslint as test 2018-05-15 10:47:00 +02:00
Fabio Berger
03b5b09122 Fix prettier 2018-05-15 10:43:41 +02:00
Fabio Berger
fe00c06d4b Merge development 2018-05-15 10:22:22 +02:00
Brandon Millman
ca08dd9705 Add hover state to top tokens 2018-05-15 00:52:51 -07:00
Brandon Millman
b3e53b609b Change to weekly txn volume 2018-05-14 22:49:08 -07:00
Alex Browne
fdeab0475c Change minimum Node version to 6.12 2018-05-14 18:46:53 -07:00
Alex Browne
f86cc0dc7a Document Node.js version requirement and add it to package.json 2018-05-14 18:46:52 -07:00
Alex Browne
0457c959dd Merge pull request #590 from 0xProject/fix-prettier
Apply prettier to some files which were not formatted correctly
2018-05-14 18:41:45 -07:00
Alex Browne
c520b7f1fb Apply prettier to some files which were not formatted correctly 2018-05-14 15:44:09 -07:00
Fabio Berger
5422bf5733 Fix TSLint issues 2018-05-14 23:27:41 +02:00
Fabio Berger
a703160226 Merge branch 'development' into improvement/use-wsrun
* development:
  Update ethereeumjs-testrpc to ganache-cli

# Conflicts:
#	package.json
2018-05-14 22:31:53 +02:00
Fabio Berger
d0905eda49 Fix TSLint issues 2018-05-14 21:48:46 +02:00
Leonid Logvinov
da60008048 Update ethereeumjs-testrpc to ganache-cli 2018-05-14 20:16:13 +02:00
Fabio Berger
7c023233f2 Fix infinite loop 2018-05-14 20:02:41 +02:00
Fabio Berger
1e7003a307 Add changelog entries for packages where executable binary exporting fixed 2018-05-14 19:57:41 +02:00
Fabio Berger
8cb074657d Rename bin to server in testnet-faucets since bin is no longer gitignored 2018-05-14 19:33:45 +02:00
Fabio Berger
5f72b86ce4 Fix sra-report binary 2018-05-14 19:33:23 +02:00
Fabio Berger
09d33792f3 rename build:watch to watch and remove build from docs:stage 2018-05-14 19:32:52 +02:00
Fabio Berger
a6773b85d2 Fix sol-compiler binary so it can be called directly from packages 2018-05-14 19:32:32 +02:00
Fabio Berger
5f678acf46 Fix abi-gen binary so it can be called directly from packages 2018-05-14 19:31:56 +02:00
Fabio Berger
76f9ad0705 Remove build from docs:stage commands 2018-05-14 19:24:47 +02:00
Fabio Berger
478f6ed011 Move from using lerna multi-package commands to wsrun, update README's accordingly 2018-05-14 19:23:50 +02:00
Fabio Berger
c94d1b2275 Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo:
  Add missing type definitions
2018-05-14 11:30:51 +02:00
Fabio Berger
7d60356fac Remove tslint-config as dep to monorepo-scripts to avoid circular dependency. Since monorepo-scripts is only expected to be used from within the monorepo, we reference tslint-config w/ a relative path 2018-05-14 11:30:15 +02:00
Leonid Logvinov
58fa35641d Merge pull request #585 from 0xProject/feature/typedef
Add missing type definitions. Enable typedef linter rule
2018-05-14 10:36:13 +02:00
Leonid Logvinov
b74957acdf Add missing type definitions 2018-05-14 10:35:13 +02:00
Fabio Berger
6aed4fb1ae Merge pull request #579 from 0xProject/breakUp0xjs
Split 0x.js into: contract-wrappers & order-watcher
2018-05-11 19:11:27 +02:00
Fabio Berger
ad8e12eeae Add missing .gitkeeps 2018-05-11 18:54:33 +02:00
Fabio Berger
31763a018c Revert "Remove gitkeeps"
This reverts commit 3f6876c419.
2018-05-11 18:50:50 +02:00
Fabio Berger
bc20f8a004 improve wording 2018-05-11 18:24:07 +02:00
Fabio Berger
3f6876c419 Remove gitkeeps 2018-05-11 17:41:35 +02:00
Fabio Berger
fb9c774558 Create coverage dir if doesn't exist 2018-05-11 17:41:25 +02:00
Fabio Berger
7df9393d29 Add compilerSettings to compiler.json 2018-05-11 16:26:08 +02:00
Fabio Berger
c6439def2c Add deployedBytecode to artifacts since it is needed by sol-cov 2018-05-11 16:25:52 +02:00
Fabio Berger
273d3445e4 Revert throw conditions since it messes with the expected test timing 2018-05-11 16:04:03 +02:00
Fabio Berger
bc3dc52377 Revert back to hack, we need the configured web3Wrapper 2018-05-11 15:40:19 +02:00
Fabio Berger
ef1d484d9e Add comment to TransactionReceiptWithDecodedLogs explaining that it doesn't always return "decodedLogs" 2018-05-11 15:39:15 +02:00
Fabio Berger
63cd5a6296 Get rid of hack 2018-05-11 15:24:31 +02:00
Fabio Berger
657dc785ea Get networkId from web3Wrapper 2018-05-11 15:23:50 +02:00
Fabio Berger
461e74d8be Throw if tx reverts 2018-05-11 15:23:34 +02:00
Fabio Berger
a7daea1728 Remove unused methods and imports 2018-05-11 15:22:57 +02:00
Fabio Berger
c4416f9696 Prettier ignore artifact files 2018-05-11 14:45:50 +02:00
Fabio Berger
f9ad34170d Add compiler dep 2018-05-11 14:25:48 +02:00
Fabio Berger
45f2a8ad06 Update yarn.lock 2018-05-11 13:31:49 +02:00
Fabio Berger
3dad802c90 Fix version 2018-05-11 13:18:13 +02:00
Fabio Berger
735166f06c remove unused modules 2018-05-11 13:15:41 +02:00
Fabio Berger
042df52e5c Fix deps 2018-05-11 13:15:21 +02:00
Fabio Berger
294a65f842 Fix prettier 2018-05-11 13:11:50 +02:00
Fabio Berger
bf8550ae1e Update artifacts 2018-05-11 12:59:14 +02:00
Fabio Berger
91549ef28c Update yarn.lock 2018-05-11 12:58:45 +02:00
Fabio Berger
95956eff64 Update global_hooks 2018-05-11 12:58:34 +02:00
Fabio Berger
bcae71dfa4 Remove legacy test 2018-05-11 12:33:39 +02:00
Fabio Berger
d370296e82 Merge branch 'development' into breakUp0xjs
* development:
  Fix ganache subprovider config
  Fix a bug in compiler config precedence
  Fix linter errors
  Fix templates
  Remove unused deployer docs configs
  Add a legacy endpoint for the deployer
  Add a check for compiler output
  Add a comment
  Put ARTIFACTS_VERSION in a config
  Improve a comment
  Remove _applyDefaultsToDeployTxDataAsync
  Add a HACK comment
  Fix linter issues
  Rename deployer to sol-compiler
  Remove deployer
  Remove deployer from 0x.js and migrations
  Configure migrations with a compiler.json
  Remove deployer from metacoin and contract tests
  Update wallet footer and add remove token functionality

# Conflicts:
#	.gitignore
#	packages/0x.js/package.json
#	packages/0x.js/src/0x.ts
#	packages/contracts/package.json
#	packages/contracts/test/multi_sig_with_time_lock.ts
#	packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
#	packages/contracts/util/artifacts.ts
#	packages/deployer/test/deployer_test.ts
#	packages/migrations/package.json
2018-05-11 12:32:57 +02:00
Leonid Logvinov
f42f608f3f Merge pull request #574 from 0xProject/feature/rm-rf-deployer
Remove @0xproject/deployer.Deployer. Make contracts able to deploy themselves
2018-05-11 12:12:39 +02:00
Fabio Berger
f78b5741c3 Add missing version directory to path 2018-05-11 12:05:46 +02:00
Fabio Berger
733fe5b335 Add artifacts to clean command 2018-05-11 12:05:32 +02:00
Leonid Logvinov
c093aab350 Fix ganache subprovider config 2018-05-11 11:59:08 +02:00
Brandon Millman
44f17c1706 Merge pull request #580 from 0xProject/feature/website/remove-tokens
Update wallet footer and add remove token functionality
2018-05-10 10:55:17 -07:00
Fabio Berger
8302e1687a Remove unnecessary compile command 2018-05-10 19:03:58 +02:00
Fabio Berger
7ad4380653 Standardize gitignores and remove migrations/artifacts 2018-05-10 19:02:59 +02:00
Fabio Berger
bea185ce8b Commit v1 artifacts to migrations package and remove compile step from prebuild 2018-05-10 19:02:41 +02:00
Fabio Berger
5a73b8a8e6 Replace mkdir with mkdirp so it also created any missing intermediate directories 2018-05-10 18:56:32 +02:00
Fabio Berger
da62a0af3b Fix path to artifacts 2018-05-10 18:55:30 +02:00
Leonid Logvinov
1137abfd33 Fix a bug in compiler config precedence 2018-05-10 18:26:44 +02:00
Leonid Logvinov
e972ed8456 Fix linter errors 2018-05-10 18:12:34 +02:00
Leonid Logvinov
2e1c2d9dfe Fix templates 2018-05-10 17:56:57 +02:00
Fabio Berger
83dd333eba Fix tslint errors 2018-05-10 17:55:27 +02:00
Leonid Logvinov
f854f3ee2b Remove unused deployer docs configs 2018-05-10 17:47:38 +02:00
Leonid Logvinov
1055ca6d44 Add a legacy endpoint for the deployer 2018-05-10 17:47:38 +02:00
Leonid Logvinov
a5fea3b9c3 Add a check for compiler output 2018-05-10 17:47:38 +02:00
Leonid Logvinov
62f1430a2c Add a comment 2018-05-10 17:47:38 +02:00
Leonid Logvinov
1dec6a442e Put ARTIFACTS_VERSION in a config 2018-05-10 17:47:38 +02:00
Leonid Logvinov
97831e3702 Improve a comment 2018-05-10 17:47:38 +02:00
Leonid Logvinov
7eb9444458 Remove _applyDefaultsToDeployTxDataAsync 2018-05-10 17:47:38 +02:00
Leonid Logvinov
ebc296ea31 Add a HACK comment 2018-05-10 17:47:38 +02:00
Leonid Logvinov
75d24dea0e Fix linter issues 2018-05-10 17:47:38 +02:00
Leonid Logvinov
a6f72de09d Rename deployer to sol-compiler 2018-05-10 17:47:38 +02:00
Leonid Logvinov
96037aed52 Remove deployer 2018-05-10 17:46:57 +02:00
Leonid Logvinov
f9d80adaee Remove deployer from 0x.js and migrations 2018-05-10 17:46:57 +02:00
Leonid Logvinov
422e5a19d4 Configure migrations with a compiler.json 2018-05-10 17:46:57 +02:00
Leonid Logvinov
3d58b38e4e Remove deployer from metacoin and contract tests 2018-05-10 17:46:57 +02:00
Fabio Berger
0a044199a1 Add missing DummyToken 2018-05-10 17:29:59 +02:00
Fabio Berger
cd5f00ac4d Merge branch 'development' into breakUp0xjs
* development: (38 commits)
  Add fallback image support to relayer grid tile
  Clear relayer grid state when fetching
  Configure the compiler to generate artifacts with deployedBytecode
  Implement loading and error state for relayer grid
  Fallback image for relayer grid tile
  Change relayer grid tile to link on header
  Display top tokens from backend
  Remove overflowZ property from portal
  Suggestions and fix bad merge
  Fix typo
  Only show untracked tokens
  Make wallet scrollable
  Add token flow
  Update The Ocean logo
  Fix artifacts paths
  Create an artifacts folder
  Introduce a var
  Add removeHexPrefix util method
  CHeck if ABI exists
  Improve the readability of the check for should compile
  ...

# Conflicts:
#	.gitignore
#	packages/contracts/test/multi_sig_with_time_lock.ts
#	packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
#	packages/contracts/util/artifacts.ts
2018-05-10 17:08:07 +02:00
Fabio Berger
23c4027c83 Add missing uuid types 2018-05-10 16:53:12 +02:00
Fabio Berger
eeb08b7fae Fix type error for latched on property 2018-05-10 16:53:03 +02:00
Fabio Berger
20beb2bdb6 Add generated contracts in contract-wrappers to gitignore 2018-05-10 16:52:47 +02:00
Fabio Berger
c6882d0bd8 Rename zeroExContract... to contractWrappers... 2018-05-10 16:51:45 +02:00
Fabio Berger
ce47e83939 Update yarn.lock 2018-05-10 16:41:05 +02:00
Fabio Berger
832e1e2cf7 Add missing quote 2018-05-10 15:26:19 +02:00
Fabio Berger
6d61616492 Add PR number 2018-05-10 15:23:17 +02:00
Fabio Berger
d5304fb5bd Remove provider instance variable 2018-05-10 15:23:04 +02:00
Fabio Berger
13a61db289 Add var returns 2018-05-10 15:22:51 +02:00
Fabio Berger
93b74cc766 Remove unneeded tslint disable 2018-05-10 15:22:33 +02:00
Fabio Berger
28e83c21e2 Remove uneeded tslint config 2018-05-10 15:22:13 +02:00
Fabio Berger
33ed5cd437 Remove generated contract wrappers 2018-05-10 15:21:37 +02:00
Fabio Berger
37c8e21f25 Remove extra tslint config 2018-05-10 15:00:06 +02:00
Fabio Berger
7b726650e9 Improve createOrderWatcherAsync 2018-05-10 14:59:54 +02:00
Fabio Berger
d3adb48c2e Fix no-any-propagation 2018-05-10 14:59:37 +02:00
Fabio Berger
9838124abc Remove unnecessary tslint config 2018-05-10 14:59:10 +02:00
Fabio Berger
4df847c349 Add pr number to changelogs 2018-05-10 14:58:15 +02:00
Jacob Evans
f9d2689a12 Pad to 32 if asset ids are small 2018-05-10 15:59:44 +10:00
Brandon Millman
c64ad1af28 Add fallback image support to relayer grid tile 2018-05-09 17:29:02 -07:00
Brandon Millman
e83b056bd4 Clear relayer grid state when fetching 2018-05-09 15:59:53 -07:00
Brandon Millman
eba6dcc497 Update wallet footer and add remove token functionality 2018-05-09 15:46:18 -07:00
Fabio Berger
017b5a23d8 Fix website and 0x.js docs 2018-05-09 23:26:51 +02:00
Leonid Logvinov
c7a147f49d Configure the compiler to generate artifacts with deployedBytecode 2018-05-09 23:14:44 +02:00
Fabio Berger
f84a466d16 Remove last artifact 2018-05-09 22:15:35 +02:00
Fabio Berger
382a805c7e Remove artifacts 2018-05-09 22:14:19 +02:00
Fabio Berger
0b38e575d6 Fix package.json 2018-05-09 22:08:41 +02:00
Fabio Berger
209266dbed Split 0x.js into contract-wrappers, order-watcher but keep 0x.js as a unifying library with the same interface 2018-05-09 20:36:28 +02:00
Brandon Millman
20f6d8d3d0 Implement loading and error state for relayer grid 2018-05-09 10:57:26 -07:00
Brandon Millman
09b26645ee Fallback image for relayer grid tile 2018-05-09 10:04:28 -07:00
Brandon Millman
9f2258ebd9 Change relayer grid tile to link on header 2018-05-09 09:28:57 -07:00
Amir Bandeali
9744b1906a Merge pull request #546 from 0xProject/feature/contracts/solidity-0.4.23
Use Solidity 0.4.23
2018-05-08 17:20:23 -07:00
Brandon Millman
71e2ee62e4 Merge pull request #576 from 0xProject/feature/website/top-tokens
Display top tokens from backend
2018-05-08 14:30:26 -07:00
Brandon Millman
6c8ee4d55d Merge pull request #557 from 0xProject/feature/website/top-bar-redesign
Redesign top bar for portal v2
2018-05-08 14:29:30 -07:00
Amir Bandeali
5198c56db9 Add revert variables, change lib => libs to get around gitignore 2018-05-08 13:10:09 -07:00
Brandon Millman
f94d4b492d Display top tokens from backend 2018-05-08 11:32:44 -07:00
Brandon Millman
e01a4fcbb4 Merge branch 'development' into feature/website/top-bar-redesign
* development:
  Remove overflowZ property from portal
  Fix typo
  Only show untracked tokens
  Make wallet scrollable
  Add token flow
2018-05-08 11:17:00 -07:00
Brandon Millman
5ed9b8b1dc Remove overflowZ property from portal 2018-05-08 11:16:12 -07:00
Brandon Millman
17f3d5f6ba Suggestions and fix bad merge 2018-05-08 11:12:46 -07:00
Brandon Millman
607d738342 Merge branch 'development' into feature/website/top-bar-redesign
* development: (63 commits)
  Update The Ocean logo
  Fix artifacts paths
  Create an artifacts folder
  Introduce a var
  Add removeHexPrefix util method
  CHeck if ABI exists
  Improve the readability of the check for should compile
  Use named constants
  Add a comment
  Fix comments
  Rename args to constructor-args
  Fix a typo
  Define a separator const
  Move artifacts from src/artifacts to artifacts/v1
  Fix sol-cov to work with the new artifacts format
  Implement new artifacts format
  Publish
  Updated CHANGELOGS
  Make node types a dependency
  Fix type errors in CSS properties
  ...
2018-05-08 11:04:31 -07:00
Brandon Millman
1b102f9ed3 Merge pull request #570 from 0xProject/feature/website/wallet-add-tokens
Portal v2 add tokens flow
2018-05-08 11:01:40 -07:00
Brandon Millman
6c38481550 Fix typo 2018-05-08 10:17:04 -07:00
Brandon Millman
9cbd151658 Only show untracked tokens 2018-05-08 10:16:08 -07:00
Brandon Millman
419b670aa3 Make wallet scrollable 2018-05-08 10:16:08 -07:00
Brandon Millman
a44874d2eb Add token flow 2018-05-08 10:16:08 -07:00
Brandon Millman
e9d70b7b1e Merge pull request #556 from 0xProject/feature/website/portal-v2
Add new top-level portal component with wallet and relayer index layout
2018-05-08 10:14:33 -07:00
Fabio Berger
73c6f11c9c Update The Ocean logo 2018-05-08 10:47:35 +02:00
Amir Bandeali
7e7364fc83 Move Authorizable to AssetProxy dir, rename to MixinAuthorizable 2018-05-07 11:20:53 -07:00
Leonid Logvinov
a9c5488620 Merge pull request #537 from 0xProject/feature/artifacts-v2
Implement the new artifacts format
2018-05-07 14:46:28 +02:00
Leonid Logvinov
906af858a5 Fix artifacts paths 2018-05-07 14:32:17 +02:00
Leonid Logvinov
b699a61f56 Create an artifacts folder 2018-05-07 14:23:24 +02:00
Leonid Logvinov
8eabc49e9d Introduce a var 2018-05-07 14:06:00 +02:00
Leonid Logvinov
9e67e12732 Add removeHexPrefix util method 2018-05-07 14:04:58 +02:00
Leonid Logvinov
2d30183d65 CHeck if ABI exists 2018-05-07 13:57:03 +02:00
Leonid Logvinov
fcb0a05880 Improve the readability of the check for should compile 2018-05-07 13:49:21 +02:00
Leonid Logvinov
fad7dc9f04 Use named constants 2018-05-07 13:46:44 +02:00
Leonid Logvinov
7c1e05d33c Add a comment 2018-05-07 13:42:47 +02:00
Leonid Logvinov
02147f546e Fix comments 2018-05-07 13:41:50 +02:00
Leonid Logvinov
3d51bc1ada Rename args to constructor-args 2018-05-07 13:40:53 +02:00
Leonid Logvinov
95df4433dc Fix a typo 2018-05-07 13:40:05 +02:00
Leonid Logvinov
0f1589a43f Define a separator const 2018-05-07 13:37:21 +02:00
Leonid Logvinov
27262c4e56 Move artifacts from src/artifacts to artifacts/v1 2018-05-07 13:32:24 +02:00
Leonid Logvinov
c9b8f2a397 Fix sol-cov to work with the new artifacts format 2018-05-07 10:52:28 +02:00
Leonid Logvinov
72b2a1c66f Implement new artifacts format 2018-05-07 10:23:08 +02:00
Amir Bandeali
395d060427 Split up mixins and interfaces 2018-05-04 17:10:25 -07:00
Amir Bandeali
bbf088d903 Make LibBytes methods internal, add TestLibBytes 2018-05-04 17:00:24 -07:00
Leonid Logvinov
69a6166b6a Publish
- 0x.js@0.37.2
 - @0xproject/abi-gen@0.2.13
 - @0xproject/assert@0.2.9
 - @0xproject/base-contract@0.3.1
 - @0xproject/connect@0.6.12
 - contracts@2.1.28
 - @0xproject/deployer@0.4.3
 - @0xproject/dev-utils@0.4.1
 - @0xproject/json-schemas@0.7.23
 - @0xproject/metacoin@0.0.6
 - @0xproject/migrations@0.0.5
 - @0xproject/order-utils@0.0.4
 - @0xproject/react-docs-example@0.0.11
 - @0xproject/react-docs@0.0.11
 - @0xproject/react-shared@0.1.6
 - @0xproject/sol-cov@0.0.10
 - @0xproject/sol-resolver@0.0.4
 - @0xproject/sra-report@0.0.14
 - @0xproject/subproviders@0.10.1
 - @0xproject/testnet-faucets@1.0.29
 - @0xproject/types@0.6.3
 - @0xproject/typescript-typings@0.3.1
 - @0xproject/utils@0.6.1
 - @0xproject/web3-wrapper@0.6.3
 - @0xproject/website@0.0.32
2018-05-05 01:55:12 +02:00
Leonid Logvinov
bf87b1a6af Updated CHANGELOGS 2018-05-05 01:55:04 +02:00
Leonid Logvinov
2e8a5602b2 Make node types a dependency 2018-05-05 01:33:35 +02:00
Leonid Logvinov
0ec1c4ad6d Fix type errors in CSS properties 2018-05-05 01:26:02 +02:00
Leonid Logvinov
15a3a8c62f Use a single version of react types 2018-05-05 01:13:22 +02:00
Leonid Logvinov
f001181e39 Revert yarn.lock changes 2018-05-05 01:10:48 +02:00
Leonid Logvinov
2c659d3d82 Publish
- @0xproject/react-docs-example@0.0.10
 - @0xproject/react-docs@0.0.10
 - @0xproject/react-shared@0.1.5
 - @0xproject/website@0.0.31
2018-05-04 23:55:03 +02:00
Leonid Logvinov
5ffff7397e Updated CHANGELOGS 2018-05-04 23:54:57 +02:00
Leonid Logvinov
1a36459ab8 Fix property name 2018-05-04 22:41:39 +02:00
Leonid Logvinov
33cc79c13b Upgrade react types version 2018-05-04 21:17:07 +02:00
Leonid Logvinov
b4cb21b55e Publish
- 0x.js@0.37.1
 - contracts@2.1.27
 - @0xproject/order-utils@0.0.3
 - @0xproject/sra-report@0.0.13
 - @0xproject/testnet-faucets@1.0.28
 - @0xproject/website@0.0.30
2018-05-04 20:44:18 +02:00
Leonid Logvinov
ae68c3abe4 Updated CHANGELOGS 2018-05-04 20:44:12 +02:00
Brandon Millman
939e2c70c4 Add headers to wallet and relayer index 2018-05-04 11:04:58 -07:00
Brandon Millman
14b29172b1 Add scrolling to relayer index 2018-05-04 11:04:58 -07:00
Brandon Millman
58794fc8e9 Lay out wallet and relayers 2018-05-04 11:04:58 -07:00
Leonid Logvinov
91fdd6fc29 Make a negligible change to order-utils to publish a new version 2018-05-04 19:07:02 +02:00
Leonid Logvinov
8dd9124863 Publish
- 0x.js@0.37.0
 - @0xproject/abi-gen@0.2.12
 - @0xproject/assert@0.2.8
 - @0xproject/base-contract@0.3.0
 - @0xproject/connect@0.6.11
 - contracts@2.1.26
 - @0xproject/deployer@0.4.2
 - @0xproject/dev-utils@0.4.0
 - @0xproject/json-schemas@0.7.22
 - @0xproject/metacoin@0.0.5
 - @0xproject/migrations@0.0.4
 - @0xproject/monorepo-scripts@0.1.19
 - @0xproject/order-utils@0.0.2
 - @0xproject/react-docs-example@0.0.9
 - @0xproject/react-docs@0.0.9
 - @0xproject/react-shared@0.1.4
 - @0xproject/sol-cov@0.0.9
 - @0xproject/sol-resolver@0.0.3
 - @0xproject/sra-report@0.0.12
 - @0xproject/subproviders@0.10.0
 - @0xproject/testnet-faucets@1.0.27
 - @0xproject/tslint-config@0.4.17
 - @0xproject/types@0.6.2
 - @0xproject/typescript-typings@0.3.0
 - @0xproject/utils@0.6.0
 - @0xproject/web3-wrapper@0.6.2
 - @0xproject/website@0.0.29
2018-05-04 12:16:17 +02:00
Leonid Logvinov
3fc99dbad5 Updated CHANGELOGS 2018-05-04 12:16:11 +02:00
Leonid Logvinov
01dd84dced Add order utils docs to the menu 2018-05-04 12:09:46 +02:00
Brandon Millman
6b92ef733c Open relayer app when clicking on grid tile 2018-05-03 13:59:08 -07:00
Brandon Millman
fe0f4ae257 Add header images to relayer grid tiles 2018-05-03 13:59:00 -07:00
Fabio Berger
cf9555debc Fix logo left padding on mobile 2018-05-03 12:35:21 +02:00
Fabio Berger
528008b1a9 Add new section to homepage 2018-05-03 12:35:07 +02:00
Brandon Millman
5e3576ed69 Remove id property from WebsiteBackendRelayerInfo 2018-05-02 17:03:59 -07:00
Amir Bandeali
c84be8ddb3 Update contracts with revert reasons and constructor keyword 2018-05-02 15:23:05 -07:00
Amir Bandeali
853b5e1b72 Merge pull request #569 from 0xProject/feature/contracts/batchTransfer
Batch transfers in proxies
2018-05-02 11:32:27 -07:00
Amir Bandeali
3355a39fe0 Add MixinAssetProxy to reuse redundant code 2018-05-02 11:30:26 -07:00
Leonid Logvinov
28ee9e247e Add order-utils to monorepo-scripts 2018-05-02 20:00:06 +03:00
Leonid Logvinov
a054b485d0 Merge pull request #559 from 0xProject/feature/order-utils
Move order utils to @0xproject/order-utils
2018-05-02 19:42:59 +03:00
Leonid Logvinov
3585326d7e Fix signature utils tests 2018-05-02 19:30:32 +03:00
Leonid Logvinov
a6046af024 Stop exporting assertions from order-utils 2018-05-02 18:38:50 +03:00
Leonid Logvinov
adaff92c92 Create wrapper functions so that docs render properly 2018-05-02 16:01:01 +03:00
Leonid Logvinov
0499541e11 Move order utils to @0xproject/order-utils 2018-05-02 15:10:24 +03:00
Brandon Millman
f08738e133 Add Greg and Remco to the about page 2018-05-01 17:11:06 -07:00
Amir Bandeali
0cb357a0e9 Add tests for batchTransferFrom 2018-05-01 13:39:55 -07:00
Amir Bandeali
668dcb7cf0 Add batchTransferFrom to asset proxies 2018-05-01 13:38:41 -07:00
Brandon Millman
1fbdc14734 Merge pull request #550 from 0xProject/feature/website/crypto-compare-prices
Grab wallet price information by token symbol
2018-05-01 10:09:04 -07:00
Jacob Evans
3e683162e9 Merge pull request #568 from 0xProject/bug/0x.js/trade-simulator-trading-zrx
Execute Taker side in trade simulation
2018-05-01 21:55:49 +10:00
Jacob Evans
8e7937bdb6 Update comment to be more descriptive of null address in exchange simulator 2018-05-01 19:06:17 +10:00
Jacob Evans
b36587fac8 Execute taker side in trade simulation
Fill if the taker address is open
2018-05-01 14:43:47 +10:00
Brandon Millman
3a1f9d01e8 Remove WETH special case, website backend handles this now 2018-04-30 16:49:47 -07:00
Amir Bandeali
b5c4b81aac Merge pull request #563 from 0xProject/feature/contracts/proxyIds
Add hard coded proxyId into each AssetProxy
2018-04-30 16:44:38 -07:00
Amir Bandeali
c849c8ef08 Remove outdated comment 2018-04-30 16:40:27 -07:00
Amir Bandeali
bbb3d5bb67 Add hard coded proxyId into each AssetProxy 2018-04-30 16:40:27 -07:00
Brandon Millman
1131d66b3d Hit website backend for price information 2018-04-30 16:40:02 -07:00
Amir Bandeali
63ad2ebf0b Merge pull request #560 from 0xProject/refactor/contracts/structure
Update contracts structure
2018-04-30 09:53:03 -07:00
Brandon Millman
7104ae4752 Merge pull request #564 from 0xProject/add-code-of-conduct-1
Create CODE_OF_CONDUCT.md
2018-04-30 09:47:33 -07:00
Brandon Millman
2403323463 Style suggestions 2018-04-27 15:05:23 -07:00
Brandon Millman
feb7dfffa1 Move quote currency string into config 2018-04-27 15:05:23 -07:00
Brandon Millman
005e633e2a yarn.lock 2018-04-27 15:05:00 -07:00
Brandon Millman
127fe971e9 Prettier 2018-04-27 14:50:04 -07:00
Brandon Millman
3c4bde6ea1 Create CODE_OF_CONDUCT.md 2018-04-27 14:09:25 -07:00
Brandon Millman
dc19690863 Merge branch 'development' into feature/website/crypto-compare-prices
* development:
  Fix react type versions to avoid minor version bumps with breaking changes
  Update Web3 Provider Engine to 14.0.4
  Remove auto-assignment of everyone to PR's
  Check for Yarn instead of npm
  Add hack comment about the use of sudo
  Fix lazy load component name
  Rename Portal and PortalMenu components to LegacyPortal and LegacyPortalMenu
  Remove unnecessary additional params
  Remove outside declaration
  Capitalize yarn
  Use path for platform independence
  Consolidate github personal access token env to one place: constants.ts
  Use methods moved to utils since now shared by multiple scripts
  Add comment
  Improve comments
  Add checks for the required local setup before running the publish script
  Add descriptions for all commands in monorepo-scripts
  Add removeGitTags script that can be run after a failed Lerna publish
2018-04-26 17:11:01 -07:00
Amir Bandeali
e4f8ea2f7c Move TokenRegistry to 'previous' directory 2018-04-26 11:11:54 -07:00
Amir Bandeali
599d34f1c0 Make all lib functions internal, add contracts for testing 2018-04-26 11:11:54 -07:00
Amir Bandeali
31411dd11b Add LibFillResults 2018-04-26 11:09:53 -07:00
Amir Bandeali
b7781108ae Add ERC721 contracts from zeppelin-solidity 2018-04-26 10:59:27 -07:00
Amir Bandeali
35ca7d1826 Merge pull request #498 from 0xProject/feature/contracts/takerAbstraction
Sender abstraction
2018-04-26 10:59:03 -07:00
Amir Bandeali
9ddec32260 Add tests and comments 2018-04-26 10:56:44 -07:00
Amir Bandeali
185e7d43fb Add tests 2018-04-26 10:33:37 -07:00
Amir Bandeali
0e0a46f373 Update tests and utils 2018-04-26 10:33:37 -07:00
Amir Bandeali
732202fe8e Implement sender abstraction 2018-04-26 10:33:37 -07:00
Jacob Evans
47604384d4 Merge pull request #555 from 0xProject/feature/subproviders/upgrade-provider-engine
Update Web3 Provider Engine to 14.0.4
2018-04-26 15:44:55 +10:00
Fabio Berger
e1cab78c09 Remove remenants of MaliciousToken contract 2018-04-26 10:06:32 +09:00
Fabio Berger
9dc4ec6fb5 Fix prettier 2018-04-25 18:07:22 +09:00
Fabio Berger
c69984e309 Fix react type versions to avoid minor version bumps with breaking changes 2018-04-24 20:06:09 +09:00
Fabio Berger
0baaf1767b Fix merge conflict issues 2018-04-24 20:01:04 +09:00
Fabio Berger
eab76c5819 Fix @types/react version to avoid accidental minor version bumps with breaking changes 2018-04-24 19:54:22 +09:00
Fabio Berger
ebd6f7ace0 Merge pull request #549 from 0xProject/feature/contracts/combineAssetProxyDispatcher
Merge Exchange and AssetProxyDispatcher (depends on #548)
2018-04-24 18:38:11 +09:00
Fabio Berger
a6d5cd4b39 Fix CI failures caused by Webkit css properties not being recognized by React types. This is a hack. 2018-04-24 17:38:25 +09:00
Fabio Berger
4c5a632095 Revert "Fix CI test failure"
This reverts commit 870693b968.
2018-04-24 17:28:18 +09:00
Brandon Millman
b8c611de2b ProviderDisplay changes 2018-04-24 01:11:01 -07:00
Fabio Berger
870693b968 Fix CI test failure 2018-04-24 16:54:08 +09:00
Fabio Berger
b24b98a365 merge v2-prototype 2018-04-24 16:51:32 +09:00
Fabio Berger
fd041e2997 Merge pull request #548 from 0xProject/refactor/contracts/test-cleanup
Cleanup tests
2018-04-24 16:46:40 +09:00
Brandon Millman
9c827a0298 Top bar expanded display type 2018-04-23 23:47:37 -07:00
Brandon Millman
766aeaa9e1 Relayer grid spacing tweaks 2018-04-23 23:47:04 -07:00
Amir Bandeali
27a44f0e77 Rename variables, create private validation methods in token wrappers 2018-04-23 23:23:01 -07:00
Brandon Millman
567768c66a Add headers to wallet and relayer index 2018-04-23 22:17:26 -07:00
Brandon Millman
deaa5f3211 Add scrolling to relayer index 2018-04-23 21:45:05 -07:00
Jacob Evans
5682cd0048 Update Web3 Provider Engine to 14.0.4 2018-04-24 14:33:32 +10:00
Brandon Millman
11f1ccf3ff Lay out wallet and relayers 2018-04-23 21:17:23 -07:00
Fabio Berger
2896110d4d Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo:
  Fix lazy load component name
  Rename Portal and PortalMenu components to LegacyPortal and LegacyPortalMenu
2018-04-24 13:01:15 +09:00
Fabio Berger
d05b175e04 Remove auto-assignment of everyone to PR's 2018-04-24 12:53:54 +09:00
Brandon Millman
10a379077c Merge pull request #552 from 0xProject/refactor/website/legacy-portal
Rename Portal component to LegacyPortal
2018-04-23 22:42:07 -04:00
Fabio Berger
ffd9b79100 Check for Yarn instead of npm 2018-04-24 10:43:44 +09:00
Fabio Berger
04c07d9006 Merge pull request #541 from 0xProject/improveMonorepoScripts
Improve Monorepo-scripts
2018-04-24 10:34:40 +09:00
Fabio Berger
a3cc5c1dd7 Add hack comment about the use of sudo 2018-04-24 10:32:44 +09:00
Brandon Millman
941342cc24 Fix lazy load component name 2018-04-23 16:49:53 -07:00
Brandon Millman
cc471dd127 Rename Portal and PortalMenu components to LegacyPortal and LegacyPortalMenu 2018-04-23 14:27:11 -07:00
Amir Bandeali
432b064601 Fix tests 2018-04-23 10:50:09 -07:00
Amir Bandeali
a8a0a5cbfb Combine Exchange with AssetProxyDispatcher 2018-04-23 10:50:09 -07:00
Amir Bandeali
32e77753b5 Define numbers of dummy tokens to deploy in constants 2018-04-23 09:57:13 -07:00
Amir Bandeali
f427a736a3 Remove type assertions 2018-04-23 09:57:13 -07:00
Amir Bandeali
afb02b8bd1 Fix and cleanup tests 2018-04-23 09:57:13 -07:00
Amir Bandeali
48b44342ab Add ERC721 wrapper 2018-04-23 09:57:13 -07:00
Amir Bandeali
1f968fa4fd Add ERC20Wrapper 2018-04-23 09:57:13 -07:00
Amir Bandeali
ebf5077e1a Merge pull request #547 from 0xProject/refactor/contracts/cleanup
Cleanup contracts
2018-04-23 09:56:20 -07:00
Amir Bandeali
7d26b96d42 Rename proxyUtils => assetProxyUtils 2018-04-22 18:53:13 -07:00
Amir Bandeali
08208acf53 Rename missed variables 2018-04-22 14:44:56 -07:00
Brandon Millman
9b535e3cec Rename baseCurrency to quoteCurrency 2018-04-22 14:20:42 -04:00
Brandon Millman
9656895726 Remove some unused imports 2018-04-22 14:17:34 -04:00
Brandon Millman
121b6949a1 Rate limit crypto compare calls 2018-04-22 14:05:03 -04:00
Brandon Millman
fb31c49317 Refactor common fetch logic into fetch_utils 2018-04-22 13:28:13 -04:00
Brandon Millman
e51f9b3593 Grab price information from crypto compare api 2018-04-22 13:10:58 -04:00
Amir Bandeali
46653a0268 Reorder event args 2018-04-21 17:31:17 -07:00
Amir Bandeali
fcef1819b1 Add missing async suffix 2018-04-21 17:31:17 -07:00
Amir Bandeali
3335fc7baf Rename token => asset 2018-04-21 17:31:17 -07:00
Amir Bandeali
63abf34664 Rename Token => IERC20Token 2018-04-21 17:31:17 -07:00
Amir Bandeali
120ca5b1ec Rename DummyToken => DummyERC20Token 2018-04-21 17:31:17 -07:00
Amir Bandeali
1c94ab7cc3 export proxyUtils instead of individual functions 2018-04-21 17:31:17 -07:00
Amir Bandeali
aa3be51980 Fix names and visibilities, use address type over contract type for function args and returns 2018-04-21 17:31:11 -07:00
Amir Bandeali
fe6c77cafb Remove unused constructor arguments 2018-04-21 15:42:09 -07:00
Amir Bandeali
67117913dd Add presigned signature type 2018-04-20 13:57:18 -07:00
Amir Bandeali
e532f2c165 Fix zeppelin imports, run prettier 2018-04-20 13:57:18 -07:00
Greg Hysen
a0c7da95c2 Added tests for (most functions in) LibBytes. The write methods are not currently compatible with our generated contract wrappers. 2018-04-20 13:56:18 -07:00
Greg Hysen
95dbc0f5bc Added description for the DummyERC721Token constructor 2018-04-20 13:56:18 -07:00
Greg Hysen
ab13ce96cc Renamed addAssetProxy back to registerAssetProxy; this seemed to cause less confusion. Also updated the function description. 2018-04-20 13:56:18 -07:00
Greg Hysen
ac0c35424b Reverting earlier change: interfaces now inherit from other interfaces 2018-04-20 13:56:18 -07:00
Greg Hysen
41242a6660 Clarified that 0x0 could be passed into AssetProxyDispatcher 2018-04-20 13:56:18 -07:00
Greg Hysen
e80f203efc Inlined decodeMetadata in the proxies and removed encodeMetadata (already exists in Typescript). This simplifies the code. 2018-04-20 13:56:18 -07:00
Greg Hysen
dbd65cdb04 Added @TODO for safeTransferFrom support in ERC721 proxy 2018-04-20 13:56:18 -07:00
Greg Hysen
e4dd33a675 Removed outdated TODO comment in MixinSettlementProxy 2018-04-20 13:56:18 -07:00
Greg Hysen
0e3544e1f9 Miscellaneous style changes to the contracts package; specifically tests 2018-04-20 13:56:18 -07:00
Greg Hysen
f4589b5bd4 Ran prettier 2018-04-20 13:56:18 -07:00
Greg Hysen
3b7068e8d0 renaming after tokenTransferProxy was removed 2018-04-20 13:56:18 -07:00
Greg Hysen
2a8fc705c7 Commented out 0x.js tests until migration package is ready. 2018-04-20 13:56:18 -07:00
Greg Hysen
c19fb1dffc Removed ERC20 V1 Proxy + TokenTransferProxy 2018-04-20 13:56:18 -07:00
Greg Hysen
436a6605fb Updated commenting. Noted that transferFrom succeeds or throws on all transferFrom implementations. 2018-04-20 13:56:18 -07:00
Greg Hysen
84eddc3d94 switched to constants in default order params. 2018-04-20 13:56:18 -07:00
Greg Hysen
dfe6b2844b Reverted change that allowed ERC721 transfer proxy to be called with amount 0. This now throws. 2018-04-20 13:56:18 -07:00
Greg Hysen
6be5fe928e Removed takerTokenAddress and makerTokenAddress from Order struct. 2018-04-20 13:56:18 -07:00
Greg Hysen
167654c9a0 Added clarity to not-authorized test case in dispatcher 2018-04-20 13:56:18 -07:00
Greg Hysen
6d6179fb2c toUnsigned -> toBuffer in assetProxyUtils 2018-04-20 13:56:18 -07:00
Greg Hysen
80d06d358a Unrolled the loop that copies the Order struct in FillOrderNoThrow. Saves 900 gas 2018-04-20 13:56:18 -07:00
Greg Hysen
1cace49b74 address -> IAssetProxy where possible for clarity 2018-04-20 13:56:18 -07:00
Greg Hysen
7ab5442163 Reverted to calling read/write uint256 2018-04-20 13:56:18 -07:00
Greg Hysen
4d42f64fa3 More testing of common functionality across proxies 2018-04-20 13:56:17 -07:00
Greg Hysen
8d83243378 Updates to proxy tests. 2018-04-20 13:56:17 -07:00
Greg Hysen
e1a74b6bdd More authorized -> owner in test comments 2018-04-20 13:56:17 -07:00
Greg Hysen
44919c353e Removed unnecessary deployments in test 2018-04-20 13:56:17 -07:00
Greg Hysen
cf8523da5f Moved ERC721 FillOrderNoThrow tests into wrapper 2018-04-20 13:56:17 -07:00
Greg Hysen
10707ebc3a Style improvements to the Asset Proxy tests 2018-04-20 13:56:17 -07:00
Greg Hysen
8374a51e6a Replaced instances of accounts[0] with owner in contracts test cases 2018-04-20 13:56:17 -07:00
Greg Hysen
4e48de1116 Minor changes to typescript tests 2018-04-20 13:56:17 -07:00
Greg Hysen
b3b29f527e Minor fixes to the contracts 2018-04-20 13:56:17 -07:00
Greg Hysen
37cfeed0f5 Rearranged preconditions in ERC721 proxy 2018-04-20 13:56:17 -07:00
Greg Hysen
cb27fe17cd Changed order of encode/decode functions in token proxies 2018-04-20 13:56:17 -07:00
Greg Hysen
682ab76ba1 Updated name of AssetProxyChanged -> AssetProxySet 2018-04-20 13:56:17 -07:00
Greg Hysen
c811b710eb Explicity declare memory for complex types, where possible 2018-04-20 13:56:17 -07:00
Greg Hysen
d0930b9048 Improved readability of FillOrderNoThrow II 2018-04-20 13:56:17 -07:00
Greg Hysen
591645758a Improved readability of FillOrderNoThrow 2018-04-20 13:56:17 -07:00
Greg Hysen
4e093369f6 Updated ERC20 v1 proxy names in tests 2018-04-20 13:56:17 -07:00
Greg Hysen
be8e8791b7 Ran prettier/linter on new contract tests 2018-04-20 13:56:17 -07:00
Greg Hysen
b13a2e71ad Added comments around deploying contracts to helper/wrapper tests 2018-04-20 13:56:17 -07:00
Greg Hysen
28678214d2 TS styles in core contract tests 2018-04-20 13:56:17 -07:00
Greg Hysen
f75d03c9ae Added more comments to proxy tests 2018-04-20 13:56:17 -07:00
Greg Hysen
51508a732d Cleaned up TS in dispatcher tests 2018-04-20 13:56:17 -07:00
Greg Hysen
326d8d3976 Proxy Metadata -> Data 2018-04-20 13:56:17 -07:00
Greg Hysen
f559a5510b Cleaning up some wording 2018-04-20 13:56:17 -07:00
Greg Hysen
bf8b123dfc Removed some unused ERC721 tokens 2018-04-20 13:56:17 -07:00
Greg Hysen
32a7442845 Minor style improvements to asset proxy utils 2018-04-20 13:56:17 -07:00
Greg Hysen
a0dfdefd16 ethereum-js for encoding/decoding asset proxy data 2018-04-20 13:56:17 -07:00
Greg Hysen
e7b0c24d9d Added memory to bytes arrays, where possible 2018-04-20 13:56:17 -07:00
Greg Hysen
1707f1940d Replaced read/write Uint256 with generic bytes32, plus casting 2018-04-20 13:56:17 -07:00
Greg Hysen
5dd708aae8 Updated public -> external 2018-04-20 13:56:17 -07:00
Greg Hysen
2477ea2fcf Removed unused dependency 2018-04-20 13:56:17 -07:00
Greg Hysen
9b624a884b snake case to camel case 2018-04-20 13:56:17 -07:00
Greg Hysen
bc7672652e makerAssetProxyData/takerAssetProxyData -> makerAssetData/takerAssetData 2018-04-20 13:56:17 -07:00
Greg Hysen
cc77f8489e nilAddress to ZeroEx.NULL_ADDRESS 2018-04-20 13:56:17 -07:00
Greg Hysen
564ddff4c7 IAssetProxyDispatcher to IAssetProxy in MixinSettlement layer + allowing 0-condition in ERC721 transfer 2018-04-20 13:56:17 -07:00
Greg Hysen
023ea94f07 Removed Log prefix from events 2018-04-20 13:56:17 -07:00
Greg Hysen
adad76eca6 Removed unnecessary assetProxyManagerAddress 2018-04-20 13:56:17 -07:00
Greg Hysen
772bb65237 removed unnecessary import 2018-04-20 13:56:17 -07:00
Greg Hysen
d72a731865 setAssetProxy to addAssetProxy 2018-04-20 13:56:17 -07:00
Greg Hysen
f35fe56d9b Renamed TransferProxy to Proxy 2018-04-20 13:56:17 -07:00
Greg Hysen
1ab70f130d Renaming TransferProxy to Proxy 2018-04-20 13:56:17 -07:00
Greg Hysen
86f79949ea ERC20 V1 proxy compiling 2018-04-20 13:56:17 -07:00
Greg Hysen
219d6c294d Changed order of write parameters in LibBytes. Now ordered by most generalized to most specific 2018-04-20 13:56:17 -07:00
Greg Hysen
78d81f193f Asset Proxy Dispatcher 2018-04-20 13:56:17 -07:00
Fabio Berger
b9e0cd4512 Fix type issue 2018-04-20 13:56:17 -07:00
Fabio Berger
f9d4966000 Fix merge 2018-04-20 13:56:17 -07:00
Amir Bandeali
ad2289935d Use addFillResults function and add comments to all marketFill functions 2018-04-20 13:56:17 -07:00
Amir Bandeali
fd47b3fac5 Fix EtherDelta imports 2018-04-20 13:56:17 -07:00
Amir Bandeali
84d836f22b Add back require statements and tests (will move to another PR) 2018-04-20 13:56:17 -07:00
Amir Bandeali
5d05a2da74 Revert variable naming 2018-04-20 13:56:17 -07:00
Amir Bandeali
2f639b77bb Update Solidity syntax and comments 2018-04-20 13:56:17 -07:00
Amir Bandeali
8b5b371821 Return all amounts traded and fees paid 2018-04-20 13:56:17 -07:00
Amir Bandeali
0c74a3bc66 Add tests for marketBuyOrders 2018-04-20 13:56:17 -07:00
Amir Bandeali
75f77f3e86 Add marketBuyOrders, rename variables, and fx old tests 2018-04-20 13:56:17 -07:00
Amir Bandeali
7a66da5a51 Fix build errors 2018-04-20 13:56:17 -07:00
Amir Bandeali
3541f5e1da Separate filled/cancelled errors 2018-04-20 13:56:17 -07:00
Amir Bandeali
8f809e3a29 Remove partial cancels 2018-04-20 13:56:17 -07:00
Greg Hysen
3f76985435 updated test name to reflect smart contracts 2018-04-20 13:56:17 -07:00
Greg Hysen
751f9b9240 Change from cancelOrdersBefore to cancelOrdersUpTo. The effect is that orders with salt <= to maker epoch will be cancelled (previously, it was salt < maker epoch) 2018-04-20 13:56:17 -07:00
Greg Hysen
1efba5979f Renamed all instances of timestamp to salt. Clarified test case wording. 2018-04-20 13:56:17 -07:00
Greg Hysen
bf3c4f4743 Fixed spacing 2018-04-20 13:56:17 -07:00
Greg Hysen
aeb0742434 Implementation and tests in the protocol for cancelling all orders up to a specific time 2018-04-20 13:56:17 -07:00
Amir Bandeali
e98b4ea26d Fix build errors 2018-04-20 13:56:17 -07:00
Amir Bandeali
1729cfaea9 Update copyright headers 2018-04-20 13:56:17 -07:00
Amir Bandeali
56ade9c44e Add private keys for testrpc mnemonic 2018-04-20 13:56:17 -07:00
Amir Bandeali
6db0b2e398 Address feedback and lint 2018-04-20 13:56:16 -07:00
Amir Bandeali
2bd1ddd129 Add tests for fillOrderNoThrow based functions 2018-04-20 13:56:16 -07:00
Amir Bandeali
20a37bdd1d Fix fillOrderNoThrow 2018-04-20 13:56:16 -07:00
Amir Bandeali
234447cb3d Add logging to testrpc script 2018-04-20 13:56:16 -07:00
Amir Bandeali
97232145a4 Fix package.json 2018-04-20 13:56:16 -07:00
Amir Bandeali
056ec6d2b3 Bump Solidity version to 0.4.21 2018-04-20 13:56:16 -07:00
Amir Bandeali
2c44c7ea83 Add fillOrderNoThrow to exchange wrapper and add test 2018-04-20 13:56:16 -07:00
Amir Bandeali
9cc1956b4b Update formatting 2018-04-20 13:56:16 -07:00
Amir Bandeali
a35138e2b9 Update fillOrderNoThrow 2018-04-20 13:56:16 -07:00
Amir Bandeali
49f6c20b20 Update order utils 2018-04-20 13:56:16 -07:00
Amir Bandeali
6bfc02d79d Modify tests to work with new utils 2018-04-20 13:56:16 -07:00
Amir Bandeali
7b166837d3 Add script for starting testrpc with preconfigured private keys 2018-04-20 13:56:16 -07:00
Amir Bandeali
3ff8a319c5 Add utils for hashing and signing orders, update wrappers 2018-04-20 13:56:16 -07:00
Amir Bandeali
cd8f8e1e4a Modify utils to work with new signature format 2018-04-20 13:56:16 -07:00
Amir Bandeali
ed43d8d08b Change order field names 2018-04-20 13:56:16 -07:00
Amir Bandeali
ca786cdd11 Fix log decoding 2018-04-20 13:56:16 -07:00
Amir Bandeali
3e659f0de8 Revert getOrderHash to old logic 2018-04-20 13:56:16 -07:00
Amir Bandeali
795a357595 Fix compile errors 2018-04-20 13:56:16 -07:00
Remco Bloemen
5737365b2d Update fillOrderNoThrow 2018-04-20 13:56:16 -07:00
Remco Bloemen
8dff54de42 Use ABIv2 exchange core in wrapper functions 2018-04-20 13:56:16 -07:00
Remco Bloemen
c1b8a7fbb7 Implement ABIv2 in ExchangeCore 2018-04-20 13:56:16 -07:00
Remco Bloemen
6f3c6f7599 Implement EIP712 and ABIv2 in LibOrder 2018-04-20 13:56:16 -07:00
Amir Bandeali
246eca91aa Add logDecoder, remove outdated tests 2018-04-20 13:56:16 -07:00
Amir Bandeali
5fd378e4ce Merge development 2018-04-20 13:56:16 -07:00
Amir Bandeali
382f24c556 Run prettier 2018-04-20 13:56:16 -07:00
Amir Bandeali
0773fcf66f Fix utils to work with new ABI 2018-04-20 13:56:16 -07:00
Amir Bandeali
650a24ba87 Add fillOrderNoThrow and wrapper functions 2018-04-20 13:56:16 -07:00
Amir Bandeali
d2be2ee6cd Fix compile errors 2018-04-20 13:56:16 -07:00
Remco Bloemen
7d63c5d982 Fix spelling of latter 2018-04-20 13:56:16 -07:00
Remco Bloemen
a4f294c090 Add offset to signature 2018-04-20 13:56:16 -07:00
Remco Bloemen
58c5e800d0 Document noThrow wrapper and correct fixed array offset 2018-04-20 13:56:16 -07:00
Remco Bloemen
6d7097eed5 Add Trezor signatures 2018-04-20 13:56:16 -07:00
Remco Bloemen
55da59a537 Add Todos 2018-04-20 13:56:16 -07:00
Remco Bloemen
012ee310a4 Fix documentation 2018-04-20 13:56:16 -07:00
Remco Bloemen
1e07fcacac Verify length on EIP712 signatures 2018-04-20 13:56:16 -07:00
Remco Bloemen
69ab913bc6 Remove unused return value 2018-04-20 13:56:16 -07:00
Remco Bloemen
83a63f64b1 Spelling fixes 2018-04-20 13:56:16 -07:00
Remco Bloemen
8f7e67367a Add documentation 2018-04-20 13:56:16 -07:00
Remco Bloemen
0dad3fecb6 Make wrappers external again 2018-04-20 13:56:16 -07:00
Remco Bloemen
09b99bbf8b Explicit returns 2018-04-20 13:56:16 -07:00
Remco Bloemen
92e112dc63 Revert cancel order signature abstraction 2018-04-20 13:56:16 -07:00
Remco Bloemen
6f5a84703e Fix hash argument name 2018-04-20 13:56:16 -07:00
Remco Bloemen
c0de35e71c Fix batchFillOrdersNoThrow name 2018-04-20 13:56:16 -07:00
Remco Bloemen
f7dd6f7a7e Fix input length in fillOrderNoThrow 2018-04-20 13:56:16 -07:00
Remco Bloemen
655c1eb90f Add SignatureType.Invalid and documentation 2018-04-20 13:56:16 -07:00
Remco Bloemen
af6885db81 Make first value illegal 2018-04-20 13:56:16 -07:00
Remco Bloemen
78e216d157 Implement EIP712 at verify-signature call site 2018-04-20 13:56:16 -07:00
Remco Bloemen
61726d84ac Cancel signature abstraction 2018-04-20 13:56:16 -07:00
Remco Bloemen
60d3bed393 Cache order maker signature (ZEIP-15) 2018-04-20 13:56:16 -07:00
Remco Bloemen
3133ca0081 Add EIP712 signatures (implements ZEIP-17) 2018-04-20 13:56:16 -07:00
Remco Bloemen
0f720223a9 Add external contract call signatures (relates to ZEIP 1 and 7) 2018-04-20 13:56:16 -07:00
Remco Bloemen
6bb93b8170 Revert after cascade 2018-04-20 13:56:16 -07:00
Remco Bloemen
d0f32d1865 Add 'caller' signature type 2018-04-20 13:56:16 -07:00
Remco Bloemen
2fe4e380d1 Abstract signature to opaque bytearray 2018-04-20 13:56:16 -07:00
Remco Bloemen
a7f4701698 Use interfaces for contract types 2018-04-20 13:56:16 -07:00
Amir Bandeali
f12e4f8889 Use new logDecoder interface 2018-04-20 13:56:16 -07:00
Amir Bandeali
df99a360fb Rename variables 2018-04-20 13:56:16 -07:00
Amir Bandeali
4c76ad072a Move log decoding logic to exchange wrapper 2018-04-20 13:56:16 -07:00
Amir Bandeali
edf837ed62 Add logDecoder, remove outdated tests 2018-04-20 13:56:16 -07:00
Amir Bandeali
7201a74aea Move utils dir into src 2018-04-20 13:56:16 -07:00
Amir Bandeali
9e2f8bead9 Merge development 2018-04-20 13:56:16 -07:00
Amir Bandeali
942867179c Run prettier 2018-04-20 13:56:16 -07:00
Amir Bandeali
6b897f6fd2 Get tests to build 2018-04-20 13:56:16 -07:00
Amir Bandeali
389f1cde51 Fix utils to work with new ABI 2018-04-20 13:56:16 -07:00
Amir Bandeali
1ad31ab007 Add fillOrderNoThrow and wrapper functions 2018-04-20 13:56:15 -07:00
Remco Bloemen
914db52c4d Move order settlement to MSettlement 2018-04-20 13:56:15 -07:00
Remco Bloemen
fe51ec906e Exchange refactor using mixin pattern 2018-04-20 13:56:15 -07:00
Remco Bloemen
85551f4994 Fix compiler warnings 2018-04-20 13:56:15 -07:00
Remco Bloemen
fc1cfcceca Update exchange to use interfaces and current SafeMath 2018-04-20 13:56:15 -07:00
Remco Bloemen
6b4d4b9246 Copy Exchange and deps to previous as Exchange_v1 2018-04-20 13:56:15 -07:00
Remco Bloemen
b06ba55be3 Add interfaces for Exchange, TokenRegistery and TokenTransferProxy 2018-04-20 13:56:15 -07:00
Amir Bandeali
d08bfbf705 Merge pull request #545 from 0xProject/feature/deployer/solidity-0.4.23
Feature/deployer/solidity 0.4.23
2018-04-20 13:55:49 -07:00
Amir Bandeali
a10e466fed Fix getABIEncodedTransactionData in contract templates 2018-04-20 13:54:33 -07:00
Amir Bandeali
35bb010c35 Add support for solidity 0.4.23 2018-04-20 13:54:28 -07:00
Brandon Millman
0046a0762c Merge pull request #543 from 0xProject/feature/website/integrate-relayer-info
Integrate relayer index with website backend
2018-04-20 15:37:41 -04:00
Brandon Millman
c453012a8e Add specific render path for error and loading 2018-04-20 15:36:40 -04:00
Fabio Berger
1f82c7eadf Remove unnecessary additional params 2018-04-20 10:04:22 +09:00
Fabio Berger
b6fb8dbb52 Remove outside declaration 2018-04-20 10:03:53 +09:00
Fabio Berger
30256cbe51 Capitalize yarn 2018-04-20 10:01:21 +09:00
Fabio Berger
7f46e9af2c Use path for platform independence 2018-04-20 10:00:37 +09:00
Fabio Berger
417cec9e04 Consolidate github personal access token env to one place: constants.ts 2018-04-20 09:36:03 +09:00
Jacob Evans
62a55c0135 Merge pull request #540 from 0xProject/feature/abi-gen/tuple-return-types
Support Tuples returned from functions
2018-04-20 08:49:23 +10:00
Jacob Evans
72336eb393 Remove ethers-contracts types 2018-04-20 08:26:10 +10:00
Brandon Millman
12d8c0b6af Integrate relayer index with website backend 2018-04-19 16:28:35 -04:00
Jacob Evans
5c232b6a8d Update CHANGELOGs 2018-04-19 17:16:05 +10:00
Fabio Berger
f6fd4281a4 Add ImToken to landing page 2018-04-19 15:35:12 +09:00
Jacob Evans
4bee63afc6 Interface for EventDescription renamed topics 2018-04-19 16:28:46 +10:00
Jacob Evans
d186f6148b Use ethers in abi_decoder utils 2018-04-19 15:25:04 +10:00
Fabio Berger
2b15c03b9a Use methods moved to utils since now shared by multiple scripts 2018-04-19 14:19:34 +09:00
Fabio Berger
60d879e045 Add comment 2018-04-19 14:16:11 +09:00
Fabio Berger
858d1768ce Improve comments 2018-04-19 14:14:10 +09:00
Fabio Berger
fc2b7f747b Add checks for the required local setup before running the publish script 2018-04-19 14:10:48 +09:00
Jacob Evans
207019c7f3 Add ethers to web3-wrapper 2018-04-19 14:59:10 +10:00
Jacob Evans
b264bbea84 Update 0x.js package json for ethers 2018-04-19 14:57:14 +10:00
Jacob Evans
32efb3e280 Update ethers in metacoin project 2018-04-19 13:44:14 +10:00
Fabio Berger
1a0d68d49a Add descriptions for all commands in monorepo-scripts 2018-04-19 11:56:41 +09:00
Fabio Berger
7dd3b2d38b Add removeGitTags script that can be run after a failed Lerna publish 2018-04-19 11:40:22 +09:00
Fabio Berger
4bc65faf1a Merge pull request #526 from 0xProject/fix/expiration-watcher
Fix expiration watcher comparator
2018-04-19 11:28:18 +09:00
Brandon Millman
8634551f53 Merge pull request #539 from 0xProject/feature/website/backend-client
Implement backendClient object to unify calls to the portal api
2018-04-18 22:25:03 -04:00
Brandon Millman
089663ccc1 Merge pull request #534 from 0xProject/feature/website/integrate-prices
Add price information to wallet
2018-04-18 22:20:03 -04:00
Fabio Berger
d1d26f8bf6 Merge branch 'development' into fix/expiration-watcher
* development:
  Publish
  Updated CHANGELOGS
  Move @0xproject/migrations to devDependencies
  Publish
  Updated CHANGELOGS
  Make @0xproject/migrations public

# Conflicts:
#	packages/0x.js/CHANGELOG.json
#	packages/0x.js/package.json
2018-04-19 10:38:43 +09:00
Fabio Berger
1ca86730fa Remove hack above migrations package 2018-04-19 10:37:13 +09:00
Jacob Evans
12ae7c009d Support Tuples from function returns 2018-04-19 11:21:32 +10:00
Brandon Millman
51b2fce8c1 Implement backendClient object to unify calls to the portal api 2018-04-18 20:12:38 -04:00
Leonid Logvinov
62fcb51e1a Publish
- 0x.js@0.36.3
 - contracts@2.1.25
 - @0xproject/sra-report@0.0.11
 - @0xproject/testnet-faucets@1.0.26
 - @0xproject/website@0.0.28
2018-04-18 21:30:28 +02:00
Leonid Logvinov
cbc55f2ef8 Updated CHANGELOGS 2018-04-18 21:30:20 +02:00
Leonid Logvinov
679f828e4e Move @0xproject/migrations to devDependencies 2018-04-18 21:18:18 +02:00
Leonid Logvinov
4a8b4e7398 Publish
- 0x.js@0.36.2
 - contracts@2.1.24
 - @0xproject/migrations@0.0.3
 - @0xproject/sra-report@0.0.10
 - @0xproject/testnet-faucets@1.0.25
 - @0xproject/website@0.0.27
2018-04-18 19:57:42 +02:00
Leonid Logvinov
b6a11ca31e Updated CHANGELOGS 2018-04-18 19:57:36 +02:00
Leonid Logvinov
a30ccf2b25 Make @0xproject/migrations public 2018-04-18 19:32:53 +02:00
Leonid Logvinov
2574405699 Fix expiration watcher comparator 2018-04-18 13:45:04 +02:00
Fabio Berger
3ba78553f0 Publish
- 0x.js@0.36.1
 - @0xproject/abi-gen@0.2.11
 - @0xproject/assert@0.2.7
 - @0xproject/base-contract@0.2.1
 - @0xproject/connect@0.6.10
 - contracts@2.1.23
 - @0xproject/deployer@0.4.1
 - @0xproject/dev-utils@0.3.6
 - @0xproject/json-schemas@0.7.21
 - @0xproject/metacoin@0.0.4
 - @0xproject/migrations@0.0.2
 - @0xproject/monorepo-scripts@0.1.18
 - @0xproject/react-docs-example@0.0.8
 - @0xproject/react-docs@0.0.8
 - @0xproject/react-shared@0.1.3
 - @0xproject/sol-cov@0.0.8
 - @0xproject/sol-resolver@0.0.2
 - @0xproject/sra-report@0.0.9
 - @0xproject/subproviders@0.9.0
 - @0xproject/testnet-faucets@1.0.24
 - @0xproject/tslint-config@0.4.16
 - @0xproject/types@0.6.1
 - @0xproject/typescript-typings@0.2.0
 - @0xproject/utils@0.5.2
 - @0xproject/web3-wrapper@0.6.1
 - @0xproject/website@0.0.26
2018-04-18 20:16:29 +09:00
Fabio Berger
4d485fc424 Print out stderr 2018-04-18 20:03:50 +09:00
Fabio Berger
85f28ade86 Updated CHANGELOGS 2018-04-18 18:36:11 +09:00
Fabio Berger
f6f2991a44 Merge pull request #535 from 0xProject/fix/commentRendering
Docs: Fix Type Comment Rendering
2018-04-18 18:19:27 +09:00
Fabio Berger
4ea222bbff Bold property names 2018-04-18 17:55:16 +09:00
Fabio Berger
f9f5e04b41 Update PR template 2018-04-18 15:33:29 +09:00
Fabio Berger
ea6706a2af Improve rendering of type definition comments 2018-04-18 15:28:36 +09:00
Fabio Berger
64c5c5eb40 Fix comments 2018-04-18 15:22:20 +09:00
Jacob Evans
823f2db09f Merge pull request #531 from 0xProject/feature/deployer/solidity-0.4.22
Solidity 0.4.22
2018-04-18 16:21:56 +10:00
Jacob Evans
a71e511f82 Update test fixtures
allow dependency compiler test to run everywhere
2018-04-18 15:46:06 +10:00
Brandon Millman
39c0064ffb Add price information to wallet 2018-04-18 00:30:52 -04:00
Jacob Evans
12d5c35d14 Merge pull request #532 from 0xProject/bug/0x.js/fix-formatting-and-linting
Fix linter and prettier on development
2018-04-18 14:06:49 +10:00
Jacob Evans
1a161cc02e Fix linter and prettier 2018-04-18 11:24:59 +10:00
Jacob Evans
96f19ba8da Remove prettier change on package.json 2018-04-18 11:20:49 +10:00
Fabio Berger
a63dfb7995 Merge pull request #527 from avonian/redundant_order_removal_bug
Fix redundant expired order removal bug
2018-04-18 09:31:34 +09:00
Jacob Evans
97ea1e300a Update changelog with PR 2018-04-18 10:09:27 +10:00
Jacob Evans
d87d93dfac Update deployer and contracts repo to use solidity 0.4.22 2018-04-18 10:06:13 +10:00
Ara Kevonian
3ffcb03d87 Update CHANGELOG 2018-04-17 08:03:07 -07:00
Ara Kevonian
33b08b90a3 Revert removeOrder flag in favor of noop 2018-04-17 07:42:43 -07:00
Ara Kevonian
cbca2061f7 Fix redundant expired order removal bug 2018-04-17 07:25:13 -07:00
Fabio Berger
bf4873e519 Merge pull request #510 from avonian/development
Implement `zeroEx.exchange.getOrderStateAsync`
2018-04-17 23:09:05 +09:00
Ara Kevonian
8fc1b38ff2 Use this.defaultBlock in OrderFilledCancelledLazyStore 2018-04-17 06:51:26 -07:00
Ara Kevonian
7d957538b4 Add stateLayer param to getOrderState and clean up variable names 2018-04-17 06:47:36 -07:00
Fabio Berger
7a8edb5018 Reduce wiki article padding on mobile and remove commented out code 2018-04-17 22:03:16 +09:00
Jacob Evans
2193d9ae6e Merge pull request #524 from 0xProject/feature/0x.js/remove-hd-wallet-from-test
Remove truffle-hdwallet from 0x.js tests
2018-04-17 15:06:57 +10:00
Jacob Evans
79d01fe2d7 Merge branch 'development' into feature/0x.js/remove-hd-wallet-from-test 2018-04-17 13:47:57 +10:00
Jacob Evans
0d02037a12 Change changelog note as it has no public impact 2018-04-17 13:41:45 +10:00
Leonid Logvinov
d263f7783f Merge pull request #512 from 0xProject/feature/resolver
Dependencies resolver for deployer
2018-04-16 20:47:28 +02:00
Leonid Logvinov
d8ef76fd5e Rename resolver to sol-resolver 2018-04-16 17:43:59 +02:00
Jacob Evans
bc3c7a30c4 Prettier on CHANGELOG.json 2018-04-14 13:33:06 +10:00
Jacob Evans
7b318b3cc2 Update the Changelog with pr number 2018-04-14 13:15:22 +10:00
Leonid Logvinov
e5cf41b313 Uncomment tests 2018-04-13 13:27:52 +02:00
Leonid Logvinov
74012ad584 Rename getAllContracts to getAll 2018-04-13 13:20:54 +02:00
Leonid Logvinov
06b4f007f8 Introduce packagePath 2018-04-13 13:18:59 +02:00
Leonid Logvinov
a9cf425410 Remove artifacts 2018-04-13 13:17:40 +02:00
Ara Kevonian
5355da6cad Rename BalanceAndAllowanceFetchers to BalanceAndProxyAllowanceFetchers 2018-04-13 03:17:09 -07:00
Ara Kevonian
38f7c4a0d2 Implement Simple Fetchers 2018-04-13 03:04:51 -07:00
Fabio Berger
1fcf3c5dc4 Add SignedOrder type to 0x Connect docs 2018-04-13 14:10:03 +09:00
Fabio Berger
20b0afacf5 Standardize external type links 2018-04-13 14:05:57 +09:00
Fabio Berger
6dbe8dbc50 Fix calendar text color to it shows up 2018-04-13 13:38:52 +09:00
Jacob Evans
73e23996a6 Remove truffle-hdwallet from 0x.js tests 2018-04-13 13:16:30 +10:00
Fabio Berger
e40bce253c Add /jobs endpoint to website, link to it and have it re-direct to Angellist 2018-04-13 11:14:01 +09:00
Fabio Berger
74c279ea3a Remove unneeded template strings 2018-04-13 11:13:21 +09:00
Fabio Berger
6c13b792f9 Remove legacy export 2018-04-13 10:21:33 +09:00
Leonid Logvinov
6be7466c4a Fix tests 2018-04-12 14:47:03 +02:00
Leonid Logvinov
1dbdd7ee1f Merge pull request #523 from ritave/patch-1
Remove Greenkeeper from README
2018-04-12 13:20:13 +02:00
Leonid Logvinov
eb89926cee Implement the resolver 2018-04-12 12:52:48 +02:00
Leonid Logvinov
7923ff4ac6 Use solc.compileStandardWrapper 2018-04-12 12:52:21 +02:00
Leonid Logvinov
783314c037 Improve on readability 2018-04-12 12:52:21 +02:00
Leonid Logvinov
15cf64318c Update CHANGELOG's 2018-04-12 12:52:21 +02:00
Leonid Logvinov
442017f93a Use solc.compileStandardWrapper 2018-04-12 12:51:15 +02:00
Leonid Logvinov
4dd9f29769 Add ony abi-gen changes from Greg's PR 2018-04-12 12:50:52 +02:00
Leonid Logvinov
f2f9bd2e7a Revert "Merge pull request #493 from hysz/features/deployer/multipleCodebaseSupport"
This reverts commit 70d403e6f8, reversing
changes made to 073bf738dd.
2018-04-12 12:50:38 +02:00
Olaf Tomalka
d95b8ef3e1 Remove Greenkeeper from README
Greenkeeper doesn't support Monorepos as of yet
2018-04-12 10:51:58 +02:00
Jacob Evans
ed0c64fdcf Merge pull request #507 from 0xProject/feature/subproviders/mnemonic-wallet-subprovider
Mnemonic wallet subprovider and multiple accounts in ledger
2018-04-12 17:35:32 +10:00
Jacob Evans
9a91e39b3f Revert Ledger back to assigning ledgerClient to instance variable 2018-04-12 17:26:17 +10:00
Jacob Evans
ce3f25d48f Rename to parentDerivedKeyInfo to be explicity about how we walk the tree 2018-04-12 17:10:17 +10:00
Jacob Evans
b669508c34 Pluck key off of base path branch for Mnemonic
This reduces the tree walk complexity in wallet utils as it is assumed that we always walk relative. It also removes a HACK :)
2018-04-12 16:59:57 +10:00
Fabio Berger
364d8824af Fix web3-wrapper version 2018-04-12 09:29:58 +09:00
Fabio Berger
749354b1c0 Merge pull request #520 from 0xProject/fix/installation-tests
Fix the publishing/installation test issues
2018-04-12 09:26:42 +09:00
Jacob Evans
be73084e04 Merge branch 'development' into feature/subproviders/mnemonic-wallet-subprovider 2018-04-12 10:20:52 +10:00
Fabio Berger
5eb90697c8 Merge pull request #519 from 0xProject/fix/docImprovements
Doc fixes and improvements
2018-04-12 08:56:33 +09:00
Fabio Berger
faedd2fa0b Merge branch 'development' into fix/docImprovements
* development: (31 commits)
  Prettier ignore Metacoin artifacts
  Publish
  Updated CHANGELOGS
  Improve deployer error message
  Fix 0x.js tests
  Fix lint issue
  Simply export
  Move NULL_BYTES to @0xproject/utils
  Simplify the tests
  Fix lint error
  Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing
  Fix web3Wrapper build command
  Add top-level `yarn lerna:stage_docs` to upload docJsons to the staging S3 bucket for all packages with a docs page
  Refactor publish script to have it's main execution body be lean and discrete steps
  Removed unused command
  Remove 0x.js test artifacts
  Fix tslint
  Move migrations into separate monorepo subpackage and hook it up to 0x.js and contracts
  Remove unused var
  Refactor RedundantRpcSubprovider into RedundantSubprovider
  ...

# Conflicts:
#	packages/react-docs/CHANGELOG.json
2018-04-12 08:56:13 +09:00
Fabio Berger
c47fb8f9a8 Merge pull request #500 from 0xProject/removeMigrateStep
Run all tests against in-process Ganache
2018-04-12 08:53:32 +09:00
Fabio Berger
27b915789e Merge branch 'development' into removeMigrateStep
* development:
  Publish
  Updated CHANGELOGS

# Conflicts:
#	packages/0x.js/package.json
#	packages/deployer/package.json
#	packages/utils/CHANGELOG.json
2018-04-12 08:53:12 +09:00
Fabio Berger
ddc6dca98c Prettier ignore Metacoin artifacts 2018-04-12 08:42:02 +09:00
Leonid Logvinov
72aa3d3005 Fix some of the publishing/installation issues 2018-04-11 18:39:58 +02:00
Leonid Logvinov
e8d4f6d532 Publish
- 0x.js@0.36.0
 - @0xproject/abi-gen@0.2.10
 - @0xproject/assert@0.2.6
 - @0xproject/base-contract@0.2.0
 - @0xproject/connect@0.6.9
 - contracts@2.1.22
 - @0xproject/deployer@0.4.0
 - @0xproject/dev-utils@0.3.5
 - @0xproject/json-schemas@0.7.20
 - @0xproject/metacoin@0.0.3
 - @0xproject/monorepo-scripts@0.1.17
 - @0xproject/react-docs-example@0.0.7
 - @0xproject/react-docs@0.0.7
 - @0xproject/react-shared@0.1.2
 - @0xproject/sol-cov@0.0.7
 - @0xproject/sra-report@0.0.8
 - @0xproject/subproviders@0.8.5
 - @0xproject/testnet-faucets@1.0.23
 - @0xproject/tslint-config@0.4.15
 - @0xproject/types@0.6.0
 - @0xproject/typescript-typings@0.1.0
 - @0xproject/utils@0.5.1
 - @0xproject/web3-wrapper@0.6.0
 - @0xproject/website@0.0.25
2018-04-11 18:00:46 +02:00
Leonid Logvinov
631e7e9c58 Updated CHANGELOGS 2018-04-11 18:00:39 +02:00
Fabio Berger
3c84ce2050 Improve deployer error message 2018-04-11 22:37:39 +09:00
Fabio Berger
9db1ce7ceb Fix 0x.js tests 2018-04-11 22:37:23 +09:00
Fabio Berger
e472f7899f Fix lint issue 2018-04-11 22:04:26 +09:00
Fabio Berger
b053781453 Simply export 2018-04-11 22:01:00 +09:00
Fabio Berger
f892b7dbf6 Move NULL_BYTES to @0xproject/utils 2018-04-11 22:00:54 +09:00
Fabio Berger
b146acc69e Simplify the tests 2018-04-11 21:59:30 +09:00
Jacob Evans
63b941fbaf Update documentation and add to website docs 2018-04-11 20:59:17 +10:00
Fabio Berger
29dc22e208 Merge branch 'development' into removeMigrateStep
* development:
  Fix lint error
  Fix documentation links in some READMEs
  Fix relative link
  Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing
  Fix web3Wrapper build command
  Add top-level `yarn lerna:stage_docs` to upload docJsons to the staging S3 bucket for all packages with a docs page
  Added a detailed description of `renameOverloadedMethods` (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading.
  Updated deployer to accept a list of contract directories as input. Contract directories are namespaced to a void clashes. Also in this commit is a fix for overloading contract functions.
  Refactor publish script to have it's main execution body be lean and discrete steps

# Conflicts:
#	packages/contracts/package.json
#	packages/deployer/package.json
2018-04-11 19:00:30 +09:00
Fabio Berger
c44f9e56ad Merge pull request #514 from 0xProject/publishImprovements
Add Doc Page Check To Publish Flow
2018-04-11 18:55:59 +09:00
Fabio Berger
2fe209d5ff Fix lint error 2018-04-11 18:55:42 +09:00
Fabio Berger
41bd0e30d6 Add comment about Provider type 2018-04-11 18:43:58 +09:00
Fabio Berger
40f4dd91e9 Update CHANGELOG 2018-04-11 18:33:01 +09:00
Fabio Berger
5bf43a3560 Merge branch 'development' into fix/docImprovements
* development:
  Fix documentation links in some READMEs
  Fix relative link

# Conflicts:
#	packages/0x.js/README.md
#	packages/web3-wrapper/README.md
2018-04-11 18:17:35 +09:00
Fabio Berger
f0afc0ae45 Update 0x.js and web3-wrapper doc urls so that last segment is identical to package name. Keep legacy endpoints. 2018-04-11 18:14:22 +09:00
Jacob Evans
916b4d3a26 Renamed DerivedHDKey to DerivedHDKeyInfo
Added assertions on addresses for public methods
Throw a helpful error message when signer address is not instantiated address in PrivateKeyWalletSubprovider
Update changelog and rename derivationBasePath to baseDerivationPath
When returning undefined use pattern of IfExists
Added configuration object for MnemonicWallet
Put constants back into each individual wallet rather than in walletUtils
Delete accidental package-lock.json
2018-04-11 19:08:28 +10:00
Fabio Berger
6d1a587c5c Show staging docs on development and staging 2018-04-11 18:04:02 +09:00
Fabio Berger
bce97c2543 Add support for displaying default param values 2018-04-11 17:39:30 +09:00
Fabio Berger
34446cf569 Fix sol-cov, web3-wrapper, subproviders documentation pages given recent changes to the libraries 2018-04-11 17:36:41 +09:00
Fabio Berger
1e13e927d0 Add missing space in property declaration 2018-04-11 17:36:01 +09:00
Fabio Berger
3c0fa0b7e6 Fix 0x.js docs now that many types are no longer references through the Web3 typings 2018-04-11 17:05:35 +09:00
Fabio Berger
ad894fbdbb Add missing types to 0x.js docs 2018-04-11 16:53:30 +09:00
Fabio Berger
7d9c6eafbf Add support for nested methods within type declarations. Make sure they render without a callPath. 2018-04-11 16:53:13 +09:00
Fabio Berger
de6f757ec8 Introduce type JSONRpcErrorCallback 2018-04-11 16:48:56 +09:00
Fabio Berger
3eeb8f4d6d Small fix to README 2018-04-11 16:22:10 +09:00
Jacob Evans
f44ef7ce59 Update website to support latest ledger 2018-04-11 15:12:02 +10:00
Jacob Evans
b08c616713 Move type declaration for hdkey to typescript-typings 2018-04-11 14:53:58 +10:00
Jacob Evans
3ad693d334 Test valid address format but not found 2018-04-11 14:39:55 +10:00
Brandon Millman
7d8badc86e Fix documentation links in some READMEs 2018-04-10 21:24:17 -07:00
Brandon Millman
854d65b51b Merge pull request #517 from lgedeon/development
Fix relative link
2018-04-10 21:21:31 -07:00
Jacob Evans
4aa67e2925 Update JSDoc for methods in ledger and mnemonic wallet 2018-04-11 14:12:38 +10:00
Jacob Evans
260ab2d413 Update changelog and add derivationBasePath 2018-04-11 14:04:27 +10:00
Jacob Evans
a824957de7 Follow file naming pattern for mnemonic and private key subprovider 2018-04-11 13:46:01 +10:00
Jacob Evans
4017c172a2 Iterator pattern for walking derived keys 2018-04-11 13:44:08 +10:00
Jacob Evans
65b2c936ab Tests for signed transactions and multiple accounts 2018-04-11 12:56:52 +10:00
Jacob Evans
eee190826a Test signed messages with the second account 2018-04-11 12:51:57 +10:00
Jacob Evans
20a1deb187 Throw errors when the address is not specified or invalid 2018-04-11 12:47:17 +10:00
Jacob Evans
9169913a2c Add isChildKey to derived key 2018-04-11 12:22:41 +10:00
Luke Gedeon
df773d07f3 Fix relative link
0xproject.com/docs/json-schemas  -->  https://0xproject.com/docs/json-schemas
2018-04-10 21:29:16 -04:00
Ara Kevonian
bf0ef055fb Modify lazy stores to implement abstract fetcher classes 2018-04-10 03:46:43 -07:00
Jacob Evans
4e4842a62f Improve Documentation for functions and constructors 2018-04-10 16:01:34 +10:00
Jacob Evans
a34c9095c3 Rename to IS_CHILD_KEY 2018-04-10 15:51:09 +10:00
Fabio Berger
efdbc1ff6c Add step to publishing that upload staging doc jsons, deploys staging website, opens every docs page and asks the dev to confirm that each one renders properly before publishing 2018-04-10 14:49:13 +09:00
Jacob Evans
84a4b7d1c1 Refactor ledger to support multiple accounts with from address 2018-04-10 14:39:43 +10:00
Fabio Berger
a9b5faa787 Fix web3Wrapper build command 2018-04-10 12:04:51 +09:00
Fabio Berger
49a54c0ff6 Add top-level yarn lerna:stage_docs to upload docJsons to the staging S3 bucket for all packages with a docs page 2018-04-10 12:04:11 +09:00
Amir Bandeali
70d403e6f8 Merge pull request #493 from hysz/features/deployer/multipleCodebaseSupport
Deployer: Support for External Codebases + Overloaded Function Names
2018-04-09 20:02:55 -07:00
Greg Hysen
eecf09f515 Added a detailed description of renameOverloadedMethods (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading. 2018-04-09 19:25:07 -07:00
Jacob Evans
5b69cd4a22 Added walletUtils and address in signMessage 2018-04-10 11:58:12 +10:00
Greg Hysen
61fc3346c2 Updated deployer to accept a list of contract directories as input. Contract directories are namespaced to a void clashes. Also in this commit is a fix for overloading contract functions. 2018-04-09 17:22:58 -07:00
Ara Kevonian
c80b42712a Lint/Prettify 2018-04-09 07:05:46 -07:00
Ara Kevonian
8d76d74a17 Implement zeroEx.exchange.getOrderStateAsync 2018-04-09 04:49:05 -07:00
Fabio Berger
b7e98abc43 Refactor publish script to have it's main execution body be lean and discrete steps 2018-04-09 19:11:18 +09:00
Fabio Berger
6f72fed8b5 Removed unused command 2018-04-09 17:23:27 +09:00
Fabio Berger
27575e9866 Remove 0x.js test artifacts 2018-04-09 17:17:05 +09:00
Fabio Berger
986ba175ce Fix tslint 2018-04-09 17:14:32 +09:00
Fabio Berger
919b327fc5 Move migrations into separate monorepo subpackage and hook it up to 0x.js and contracts 2018-04-09 17:14:25 +09:00
Fabio Berger
e05b55d4a5 merge development 2018-04-09 14:34:36 +09:00
Fabio Berger
073bf738dd Since we moved Web3Wrapper class from index to it's own file, we need to update doc mapping 2018-04-07 10:41:43 +09:00
Fabio Berger
68e8d6f304 Update ERCDex logo 2018-04-07 10:24:47 +09:00
Fabio Berger
6f24337a53 Remove unused var 2018-04-07 10:17:53 +09:00
Jacob Evans
0e8f5004d6 Add Mnemonic wallet subprovider 2018-04-06 19:03:35 +10:00
Jacob Evans
524e4707d2 Merge pull request #506 from 0xProject/feature/subproviders/pk-wallet-subprovider
Private Key subprovider
2018-04-06 16:52:44 +10:00
Fabio Berger
22fa5a57a5 Refactor RedundantRpcSubprovider into RedundantSubprovider 2018-04-06 15:46:27 +09:00
Fabio Berger
e30c76b743 Make all handleRequest methods async, rename _engine to engine to remain compliant with web3-provider-engine 2018-04-06 15:41:42 +09:00
Jacob Evans
a0fac663f7 Update shared fixture data for network 42 2018-04-06 16:07:00 +10:00
Fabio Berger
277e58c2e5 Merge pull request #505 from 0xProject/fix/readmeContributingSection
Improve README contributing sections in all packages
2018-04-06 15:05:34 +09:00
Fabio Berger
75a51af006 Use provider over web3 in deployer, dev-utils and subprovider tests, rename subprovider to ganacheSubprovider in test util 2018-04-06 15:04:17 +09:00
Fabio Berger
24454938e5 Move away from using web3 directly in 0x.js tests 2018-04-06 15:03:14 +09:00
Jacob Evans
774ab8a8ef Feedback
remove id management from testnet faucet
spread over txParams rather than modify in place
2018-04-06 15:21:08 +10:00
Brandon Millman
21dc94b709 Merge pull request #503 from 0xProject/feature/website/relayer-grid
Implement initial relayer grid
2018-04-05 12:15:16 -07:00
Brandon Millman
d6176872f7 Merge pull request #504 from 0xProject/fix/website/wallet-key-warning
Fix missing key warnings in wallet component
2018-04-05 12:14:43 -07:00
Brandon Millman
c396be42b9 Change undefined to null 2018-04-05 12:13:55 -07:00
Fabio Berger
89a72ebf0d Merge branch 'development' into removeMigrateStep
* development:
  Fix tests
  Call static functions as static
  Address feedback
  Move our contract templates to accept Provider instead of Web3Wrapper
2018-04-05 21:06:58 +09:00
Leonid Logvinov
7f7ddee0f9 Merge pull request #501 from 0xProject/feature/provider-over-wrapper
Use Provider over web3Wrapper
2018-04-05 13:52:43 +02:00
Leonid Logvinov
b99c797945 Fix tests 2018-04-05 13:52:19 +02:00
Leonid Logvinov
59edca4166 Call static functions as static 2018-04-05 13:06:16 +02:00
Leonid Logvinov
fbba5e054a Address feedback 2018-04-05 12:37:35 +02:00
Jacob Evans
ea47613d90 Use PKWalletSubprovider in testnet faucet 2018-04-05 15:33:04 +10:00
Jacob Evans
9d18f751c8 Create a private key subprovider 2018-04-05 15:18:38 +10:00
Fabio Berger
9745dfe2f4 Use depcheck async support 2018-04-05 11:43:48 +09:00
Fabio Berger
29d38593d6 Fix contributing links 2018-04-05 10:01:41 +09:00
Fabio Berger
d76bc18bb7 Improve contributing section of all packages so they include building entire monorepo on first contribution 2018-04-05 09:57:21 +09:00
Brandon Millman
cbe61ac315 Fix missing key warnings in wallet component 2018-04-04 13:35:08 -07:00
Brandon Millman
250d97a7c4 Implement initial relayer grid 2018-04-04 12:09:03 -07:00
Leonid Logvinov
249bf0163d Move our contract templates to accept Provider instead of Web3Wrapper 2018-04-04 11:56:32 +03:00
Fabio Berger
20aaab0847 Add --exit to all mocha calls so they exit when called from top-level yarn command (https://github.com/mochajs/mocha/issues/3044) 2018-04-04 16:34:23 +09:00
Fabio Berger
3e648cfb7e Move migrations over from contracts to 0x.js 2018-04-04 16:33:18 +09:00
Fabio Berger
2106d7476d Add contract artifacts to 0x.js tests 2018-04-04 16:32:32 +09:00
Fabio Berger
43e07e7ce3 Update 0x.js to run tests against in-process ganache 2018-04-04 16:31:57 +09:00
Fabio Berger
5e4e27fed5 Update dev-utils and subproviders tests to use ganache in-process provider 2018-04-04 11:35:58 +09:00
Fabio Berger
6c02722f56 Make deployer tests run on inprocess ganache 2018-04-04 09:50:24 +09:00
Fabio Berger
5cfebd2680 Fix typos 2018-04-04 09:48:54 +09:00
Fabio Berger
bd20b1747d Add top-level test command 2018-04-04 09:48:36 +09:00
Fabio Berger
674e56cea6 Merge pull request #496 from 0xProject/removeUnusedDeps
Remove unused deps + Remove Dharma from website
2018-04-04 03:58:18 +09:00
Fabio Berger
61809130a6 Merge branch 'development' into removeUnusedDeps
* development:
  Temporarily remove installation test
  Fix package.json
  Remove `isPublished` from all CHANGELOG.json filesx
  Now that every version of a package published has a corresponding entry in it's CHANGELOG we no longer need the isPublished flag. Remove it.
  Remove temporary convert_changelog script

# Conflicts:
#	packages/monorepo-scripts/package.json
2018-04-04 03:57:42 +09:00
Fabio Berger
f5e6e0eaf7 Used generic declaration to remove need for any 2018-04-04 03:56:17 +09:00
Fabio Berger
b2c423dd84 Use Results type 2018-04-04 03:54:58 +09:00
Fabio Berger
4a9752d7cd Merge pull request #495 from 0xProject/fix/publishProcess
Improve Publish Flow
2018-04-04 03:14:36 +09:00
Leonid Logvinov
7db9a01639 Temporarily remove installation test 2018-04-03 12:50:23 +03:00
Fabio Berger
e9cb5c069a Add comment about ignored packages 2018-04-03 15:44:07 +09:00
Fabio Berger
03e4205700 Remove Dharma integration from Website 2018-04-03 15:39:43 +09:00
Fabio Berger
fd9278ac02 Add find_unused_deps monorepo script 2018-04-03 15:28:07 +09:00
Fabio Berger
1b7c7037b8 Remove remaining unused deps 2018-04-03 15:27:45 +09:00
Fabio Berger
913264c811 Update yarn.lock 2018-04-03 14:54:30 +09:00
Fabio Berger
e70b6630f9 Fix TS error 2018-04-03 14:52:31 +09:00
Fabio Berger
6d53947fd8 Add missing request types 2018-04-03 14:48:05 +09:00
Fabio Berger
1c0d982398 Fix yarn 2018-04-03 13:00:40 +09:00
Fabio Berger
a88b4040ff Stop using utils 2018-04-03 12:58:45 +09:00
Fabio Berger
e8073cd6f2 Update yarn.lock 2018-04-03 12:04:08 +09:00
Fabio Berger
8281be235c Use @0xproject/utils promisify everywhere 2018-04-03 12:03:59 +09:00
Fabio Berger
9ce03e3515 Update tslint-config. To avoid circular deps, this must always be one version back and must be manually updated. 2018-04-03 12:03:10 +09:00
Fabio Berger
667938696d Remove unused contracts deps 2018-04-03 11:43:23 +09:00
Fabio Berger
a165281dcf Remove unused 0x.js deps 2018-04-03 11:43:08 +09:00
Fabio Berger
185f70f2dd Fix package.json 2018-04-03 10:04:16 +09:00
Fabio Berger
cd3e14f45a Remove isPublished from all CHANGELOG.json filesx 2018-04-03 09:45:59 +09:00
Fabio Berger
dd87588dfe Now that every version of a package published has a corresponding entry in it's CHANGELOG we no longer need the isPublished flag. Remove it. 2018-04-03 09:45:30 +09:00
Fabio Berger
29042e1939 Remove temporary convert_changelog script 2018-04-03 09:36:43 +09:00
Leonid Logvinov
4dbf6559aa After publish 2018-04-02 16:12:37 +03:00
Leonid Logvinov
b987b5988d Publish
- 0x.js@0.35.0
 - @0xproject/abi-gen@0.2.9
 - @0xproject/assert@0.2.5
 - @0xproject/base-contract@0.1.0
 - @0xproject/connect@0.6.8
 - contracts@2.1.21
 - @0xproject/deployer@0.3.5
 - @0xproject/dev-utils@0.3.4
 - @0xproject/json-schemas@0.7.19
 - @0xproject/metacoin@0.0.2
 - @0xproject/monorepo-scripts@0.1.16
 - @0xproject/react-docs-example@0.0.6
 - @0xproject/react-docs@0.0.6
 - @0xproject/react-shared@0.1.1
 - @0xproject/sol-cov@0.0.6
 - @0xproject/sra-report@0.0.7
 - @0xproject/subproviders@0.8.4
 - @0xproject/testnet-faucets@1.0.22
 - @0xproject/tslint-config@0.4.14
 - @0xproject/types@0.5.0
 - @0xproject/typescript-typings@0.0.3
 - @0xproject/utils@0.5.0
 - @0xproject/web3-wrapper@0.5.0
 - @0xproject/website@0.0.24
2018-04-02 16:01:51 +03:00
Leonid Logvinov
6ba6bec105 Updated CHANGELOGS 2018-04-02 16:01:45 +03:00
Leonid Logvinov
d95b1e2db4 Merge pull request #485 from 0xProject/feature/metacoin
Add metacoin example project
2018-04-02 14:57:44 +03:00
Leonid Logvinov
c1d6c7ff66 Fix a typo 2018-04-02 14:45:59 +03:00
Leonid Logvinov
6e12794765 Compile only the Exchange contract in compiler tests 2018-04-02 14:20:53 +03:00
Leonid Logvinov
0f4b05e374 Fix version 2018-04-02 13:20:52 +03:00
Fabio Berger
695b697cdf small README fixes 2018-04-02 19:05:27 +09:00
Fabio Berger
3aea0e3b2f Update docs list in README 2018-04-02 19:04:02 +09:00
Leonid Logvinov
c0e92d511e Fix a typo 2018-04-02 13:01:40 +03:00
Leonid Logvinov
51f2a20b2a Merge branch 'development' into feature/metacoin 2018-04-02 12:56:46 +03:00
Leonid Logvinov
333a23f222 Update CHANGELOG.json's 2018-04-02 12:52:49 +03:00
Fabio Berger
3bf3f479f5 Add manual postpublish command to all public packages and update CHANGELOG.json 2018-04-02 18:46:53 +09:00
Fabio Berger
6241d06f27 Fix postpublish util to ignore namespace 2018-04-02 18:44:40 +09:00
Leonid Logvinov
9e81d3c87b Fix contracts and artifacts paths 2018-04-02 12:35:03 +03:00
Leonid Logvinov
a9b2838c5f Stop passing _abiDecoder 2018-04-02 12:35:03 +03:00
Leonid Logvinov
fbc39614c0 Report errors locally 2018-04-02 12:35:03 +03:00
Leonid Logvinov
b2d6ac8dba move all configs to a config file 2018-04-02 12:35:03 +03:00
Leonid Logvinov
b090b7b1f2 Remove a repo section 2018-04-02 12:35:03 +03:00
Leonid Logvinov
ba0696a0d7 Incroduce the Warning constant 2018-04-02 12:35:03 +03:00
Leonid Logvinov
b57850a225 Regroup gitignore entries 2018-04-02 12:34:29 +03:00
Leonid Logvinov
4d9029bb0e Add metacoin example project 2018-04-02 12:34:29 +03:00
Fabio Berger
bc49dde4d5 Fix release notes bug 2018-04-02 18:08:55 +09:00
Fabio Berger
afe07b2926 Should print out lerna publish stdout so we can see if anything went wrong 2018-04-02 17:59:47 +09:00
Fabio Berger
2411bfc20f Publish
- 0x.js@0.34.0
 - @0xproject/abi-gen@0.2.8
 - @0xproject/assert@0.2.4
 - @0xproject/base-contract@0.0.6
 - @0xproject/connect@0.6.7
 - contracts@2.1.20
 - @0xproject/deployer@0.3.4
 - @0xproject/dev-utils@0.3.3
 - @0xproject/json-schemas@0.7.18
 - @0xproject/monorepo-scripts@0.1.15
 - @0xproject/react-docs-example@0.0.5
 - @0xproject/react-docs@0.0.5
 - @0xproject/react-shared@0.1.0
 - @0xproject/sol-cov@0.0.5
 - @0xproject/sra-report@0.0.6
 - @0xproject/subproviders@0.8.3
 - @0xproject/testnet-faucets@1.0.21
 - @0xproject/tslint-config@0.4.13
 - @0xproject/types@0.4.2
 - @0xproject/typescript-typings@0.0.2
 - @0xproject/utils@0.4.4
 - @0xproject/web3-wrapper@0.4.0
 - @0xproject/website@0.0.23
2018-04-02 17:42:10 +09:00
Fabio Berger
4d4ea8a4d0 Updated CHANGELOGS 2018-04-02 17:42:03 +09:00
Fabio Berger
595517e68b Generate CHANGELOG.json files 2018-04-02 17:35:26 +09:00
Fabio Berger
40ab2de393 Merge pull request #489 from 0xProject/refactor/publishProcess
Automate NPM Publish Process
2018-04-02 10:33:13 +02:00
Fabio Berger
723276ae3f Fix hasty find/replace 2018-04-02 16:56:14 +09:00
Fabio Berger
76c5945017 Default to 4sp 2018-04-02 16:40:02 +09:00
Fabio Berger
01c6fd92e8 Update moment, no longer need separate moment types 2018-04-02 16:06:36 +09:00
Fabio Berger
3f230a8fdb Move prettify command to utils and also call it on CHANGELOG.md 2018-04-02 15:53:31 +09:00
Fabio Berger
2a6a71ea6c Add prettier run on generated CHANGELOG.json and fix scripts 2018-04-02 15:49:48 +09:00
Fabio Berger
cd23f220a0 Remove semi-colons from monorepo-scripts package.json 2018-04-02 08:51:10 +09:00
Fabio Berger
fab88ea2cc Get rid of ; in top-level package.json 2018-04-02 08:44:27 +09:00
Fabio Berger
688f8615ff Fix TSLint error 2018-04-02 05:12:03 +09:00
Fabio Berger
d187a31e38 Make dry-run configurable from top-level package.json 2018-04-02 05:10:27 +09:00
Fabio Berger
c6f85464ce Merge branch 'development' into refactor/publishProcess
* development:
  Run prettier, update deployer CHANGELOG
  Create solc_bin dir if does not exist before attempting to compile
  Add missing type import
2018-04-02 04:28:29 +09:00
Fabio Berger
a220b56736 Merge pull request #491 from 0xProject/fix/buildErrors
Fix build errors
2018-04-01 21:15:34 +02:00
Fabio Berger
0e33f45f3d Improve naming 2018-04-02 04:10:18 +09:00
Amir Bandeali
ff7c3012a5 Run prettier, update deployer CHANGELOG 2018-04-01 10:45:30 -07:00
Amir Bandeali
20fec2943b Create solc_bin dir if does not exist before attempting to compile 2018-04-01 10:45:25 -07:00
Fabio Berger
08b30b0706 Merge branch 'development' into refactor/publishProcess
* development:
  Add HACK comment and reorganize use other wallet button
  Fixed comment(s) for PR #488
  OrderStateWatcher fixes for PR #488
  Amended comments to clarify changes on PR #488
  Monitor different state layers with OrderWatcher
  Implement wallet locked and uninstalled states
  Style changes
  Remove props that are covered by the defaults
  Implement ETH/WETH conversion and allowance toggle styling
2018-04-02 02:41:28 +09:00
Fabio Berger
bf52ce7e72 Add temp comment, clean up code 2018-04-02 02:40:48 +09:00
Amir Bandeali
1bac5019e8 Add missing type import 2018-03-31 23:54:09 -07:00
Brandon Millman
19454a92dc Merge pull request #487 from 0xProject/feature/website/wallet-setup
Implement wallet locked and uninstalled states
2018-03-30 15:01:18 -07:00
Brandon Millman
cdbb3a015f Add HACK comment and reorganize use other wallet button 2018-03-30 15:00:02 -07:00
Leonid Logvinov
644da2b0cb Merge pull request #488 from avonian/development
Monitor different state layers with OrderWatcher
2018-03-30 19:56:16 +02:00
Ara Kevonian
57446d78f1 Fixed comment(s) for PR #488 2018-03-30 10:28:13 -07:00
Ara Kevonian
3e285c0ef1 OrderStateWatcher fixes for PR #488 2018-03-30 09:59:57 -07:00
Ara Kevonian
a322148631 Amended comments to clarify changes on PR #488 2018-03-30 08:00:05 -07:00
Fabio Berger
33ec9fdf47 Fixes for clarity 2018-03-30 15:49:09 +02:00
Fabio Berger
323826111a Remove CHANGELOG from website since it's a public package 2018-03-30 15:48:54 +02:00
Fabio Berger
ddd3d284d9 Remove CHANGELOG.json files since will be generated on development 2018-03-30 15:48:39 +02:00
Fabio Berger
f55a300f43 Set IS_DRY_RUN to false 2018-03-30 15:28:08 +02:00
Fabio Berger
08a69ebd6e Add more logging 2018-03-30 15:27:47 +02:00
Fabio Berger
ddb8e26bec Expose publish command from top-level dir 2018-03-30 15:07:24 +02:00
Ara Kevonian
57ca611e12 Monitor different state layers with OrderWatcher
Allow instantiation of stand-alone OrderWatchers
that can monitor different blockchain state
layers (e.g. pending or latest)
2018-03-30 05:59:09 -07:00
Fabio Berger
1eff120f49 Remove top-level internal dep b/c it's not clear to me what it's used for 2018-03-30 14:58:11 +02:00
Fabio Berger
4bc6096ec0 Fetch Github release notes from CHANGELOG.json and update CHANGELOG once they've been successfully published to Github 2018-03-30 14:48:20 +02:00
Fabio Berger
95eb114051 rename variable called path to includePath to avoid conflict with path package 2018-03-30 14:46:15 +02:00
Fabio Berger
9c856de49c Move monorepo root constant to constants file 2018-03-30 14:45:39 +02:00
Fabio Berger
d502f79303 Rename prepublish to publish now that it goes straight to actually publishing the packages 2018-03-30 14:29:30 +02:00
Fabio Berger
5224337323 Call lerna publish and supply it with new package versions 2018-03-30 14:29:07 +02:00
Fabio Berger
ef49192170 Add check that timestamp has been set before generating MD version 2018-03-30 12:43:03 +02:00
Fabio Berger
c9df388731 Add committing and pushing CHANGELOG changes to Github 2018-03-30 12:28:48 +02:00
Brandon Millman
870da2ab22 Implement wallet locked and uninstalled states 2018-03-29 16:57:23 -07:00
Brandon Millman
6122840241 Merge pull request #476 from 0xProject/feature/website/wallet-wrap
Implement ETH/WETH conversion and allowance toggle styling
2018-03-29 14:00:37 -07:00
Brandon Millman
03b00ef8da Style changes 2018-03-29 11:25:50 -07:00
Fabio Berger
84b820abc6 Show semver diff 2018-03-29 20:03:11 +02:00
Fabio Berger
cc4ff568a9 Improve README 2018-03-29 20:02:43 +02:00
Brandon Millman
665011174b Merge branch 'development' into feature/website/wallet-wrap
* development: (35 commits)
  Fix CHANGELOG
  Update Yarn.lock
  Standardize changelog dates and format
  Fix stubbing of a non-existent property
  Remove redundant cast
  Move common types out of web3 types
  Add monorepo_scripts to npmignore
  Add typeRoots
  Add clean-state tests
  Remove nested .gitignore files since `yarn publish` gets confused by them and ignores their contents on the top-level scope
  Remove WETH hack now that updated WETH address is in TokenRegistry
  Revert TokenRegistry address on Kovan
  Improve rounding error message
  Portal fill with mixed decimals
  Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function
  Set timeout for compiler tests
  Remove redundant types
  Add missing param comments
  Fix a comment
  Add a comment
  ...
2018-03-29 10:02:46 -07:00
Fabio Berger
37f210e9f0 Fix changelog.json 2018-03-29 17:46:43 +02:00
Fabio Berger
9c01e3a8a0 Merge branch 'development' into refactor/publishProcess
* development:
  Fix CHANGELOG
  Update Yarn.lock
2018-03-29 17:46:24 +02:00
Fabio Berger
c4dd9658e7 Fix CHANGELOG 2018-03-29 17:44:50 +02:00
Fabio Berger
29aa09e448 Generate CHANGELOG.mds 2018-03-29 17:41:39 +02:00
Fabio Berger
1337b6928a Update Yarn.lock 2018-03-29 17:17:41 +02:00
Fabio Berger
ac35d8127e remove console.logs 2018-03-29 17:02:44 +02:00
Fabio Berger
a6ae1efadb Begin global pre-publishing script. Updates changelog.json files in packages to be published 2018-03-29 15:26:47 +02:00
Fabio Berger
bd7b5c51b2 Add 0.x.x edgecase 2018-03-29 15:18:42 +02:00
Fabio Berger
397cd77ef9 Fix semver-sort version 2018-03-29 15:02:46 +02:00
Fabio Berger
743c3dbe01 Generate CHANGELOG.json files and add convert_changelog script 2018-03-29 14:06:29 +02:00
Fabio Berger
9f1c212596 Update Yarn lock and fix dep versions 2018-03-29 13:00:42 +02:00
Fabio Berger
defd249565 Standardize changelog dates and format 2018-03-29 12:49:39 +02:00
Leonid Logvinov
8926dac78c Merge pull request #482 from 0xProject/feature/web3-types
Move common types out of web3 types
2018-03-28 16:26:05 +02:00
Fabio Berger
18cac3f092 Merge pull request #483 from 0xProject/refactor/removeHardcodedWeth
Remove WETH hack now that updated WETH address is in TokenRegistry
2018-03-28 10:41:53 +01:00
Leonid Logvinov
01e27426d6 Fix stubbing of a non-existent property 2018-03-28 10:43:42 +02:00
Leonid Logvinov
0b09cc36b0 Remove redundant cast 2018-03-28 10:26:56 +02:00
Fabio Berger
f3cb484f82 Merge pull request #484 from 0xProject/fix/gitignoreIssue
Remove nested .gitignore & add monorepo_scripts to npmignore
2018-03-27 19:16:36 +01:00
Fabio Berger
0053762760 merge developmentx 2018-03-27 19:16:13 +01:00
Leonid Logvinov
d72b7299c6 Move common types out of web3 types 2018-03-27 17:56:21 +02:00
Fabio Berger
eb89ef79eb Add monorepo_scripts to npmignore 2018-03-27 16:49:19 +01:00
Leonid Logvinov
066d13f5b7 Merge pull request #480 from 0xProject/feature/clean-state-tests
Add clean-state tests
2018-03-27 17:47:45 +02:00
Leonid Logvinov
ec06d8d606 Add typeRoots 2018-03-27 17:47:05 +02:00
Leonid Logvinov
a2e4aaa9a3 Add clean-state tests 2018-03-27 17:47:04 +02:00
Leonid Logvinov
26e9696ddb Merge pull request #460 from 0xProject/feature/deployer-improvements
@0xproject/deployer improvements
2018-03-27 17:43:50 +02:00
Fabio Berger
343191e936 Remove nested .gitignore files since yarn publish gets confused by them and ignores their contents on the top-level scope 2018-03-27 16:24:44 +01:00
Fabio Berger
3e3b667366 Remove WETH hack now that updated WETH address is in TokenRegistry 2018-03-27 11:38:22 +01:00
Fabio Berger
3b45d4727b Revert TokenRegistry address on Kovan 2018-03-26 17:33:39 +01:00
Fabio Berger
b4f3450d4a Merge pull request #479 from 0xProject/bug/website/portal-fill-mixed-decimals
Portal fill with rounding error/mixed decimals
2018-03-26 13:21:26 +01:00
Fabio Berger
0a8b7cb494 Improve rounding error message 2018-03-26 13:21:02 +01:00
Jacob Evans
125ace3519 Portal fill with mixed decimals
When the token pair has different decimal precison we can end up with a remainder when multiplying by an exchange rate (as one is in 18 decimals and the other is 6 for example)
2018-03-26 16:43:12 +11:00
Fabio Berger
109fc41474 Add error popover if TokenRegistry on network user is browsing on don't include the requisite default tokens for 0x Portal to function 2018-03-25 00:22:06 +00:00
Leonid Logvinov
f30353087f Merge branch 'development' into feature/deployer-improvements 2018-03-23 19:18:31 +01:00
Brandon Millman
d106079d9b Remove props that are covered by the defaults 2018-03-22 23:39:13 -07:00
Brandon Millman
dc3be992a3 Implement ETH/WETH conversion and allowance toggle styling 2018-03-22 23:13:49 -07:00
Fabio Berger
bed7d87b7f Get LogEntry type to show up correctly as a Web3 type 2018-03-22 21:05:09 +00:00
Fabio Berger
05daab5dea Fix typos 2018-03-22 20:13:25 +00:00
Fabio Berger
170e5589f9 Fix 0x.js docs to include types from generated contract wrappers 2018-03-22 20:03:42 +00:00
Fabio Berger
538914aa52 Fix S3 bucket name 2018-03-22 16:58:20 +00:00
Fabio Berger
81deb68c8e Use past tense in FAQ 2018-03-22 16:37:23 +00:00
Fabio Berger
36986fe9c9 Replace Auctus with ERCDEX in projects section 2018-03-22 16:22:52 +00:00
Fabio Berger
5791632933 Fix Ethfinex link, looks like they have their own domain now 2018-03-22 16:19:59 +00:00
Fabio Berger
289359bf0d Merge pull request #465 from 0xProject/addExtraDocs
Add Additional Package Doc Pages
2018-03-22 16:11:23 +00:00
Fabio Berger
81f6487865 Use _.filter instead of _.reduce 2018-03-22 16:10:01 +00:00
Fabio Berger
21b797c3f9 Improve list of improvements 2018-03-22 16:00:55 +00:00
Fabio Berger
de8450d5c9 Make handleRequest public and add comment for it 2018-03-22 15:54:13 +00:00
Fabio Berger
bcb9ee4cc2 Make setEngine public 2018-03-22 15:53:54 +00:00
Fabio Berger
7c87447241 Fix lazy load so each doc page is a separate bundle 2018-03-22 15:53:39 +00:00
Fabio Berger
b39d87f357 Remove space 2018-03-22 15:53:20 +00:00
Fabio Berger
552b14b1fa npm -> yarn 2018-03-22 15:53:13 +00:00
Fabio Berger
5779ffd01b Add assertion to notify any developer trying to render a package with files containing multiple classes 2018-03-22 15:52:40 +00:00
Fabio Berger
a7c24a17f4 Fix lint rules directory 2018-03-22 14:33:40 +00:00
Fabio Berger
8743c40911 Use isEmpty 2018-03-22 13:32:14 +00:00
Leonid Logvinov
7ef6bd4b14 Set timeout for compiler tests 2018-03-22 14:26:24 +01:00
Fabio Berger
6af0f08dfc Remove no longer existent command 2018-03-22 12:54:03 +00:00
Fabio Berger
54ae94dde0 Fix benefits list 2018-03-22 12:53:51 +00:00
Fabio Berger
c570f3865f Use yarn instead of npm 2018-03-22 12:53:41 +00:00
Fabio Berger
ed9d1da297 Add default docs icon 2018-03-22 12:46:52 +00:00
Fabio Berger
beb483ea85 Merge branch 'development' into addExtraDocs
* development:
  Change blockchain prop to not optional
  Other style changes
  Updated padding and colors
  Refactor TokenState type
  Fix a bug causing fillOrdersUpTo validation to fail because of some extra orders being passed
  Implement initial wallet interface

# Conflicts:
#	packages/react-shared/CHANGELOG.md
#	packages/website/ts/types.ts
2018-03-22 12:00:41 +00:00
Fabio Berger
46b7fecafe Create helper function for converting dashes names for display 2018-03-22 11:56:12 +00:00
Leonid Logvinov
e476682922 Remove redundant types 2018-03-22 12:37:44 +01:00
Brandon Millman
8478dc8d6d Merge pull request #468 from 0xProject/feature/website/wallet-interface
Implement initial wallet interface
2018-03-21 15:48:13 -07:00
Brandon Millman
9f8e41cbfa Change blockchain prop to not optional 2018-03-21 15:45:11 -07:00
Brandon Millman
3916383dd0 Other style changes 2018-03-21 14:21:19 -07:00
Brandon Millman
a60c8f7d8c Updated padding and colors 2018-03-21 14:17:08 -07:00
Brandon Millman
4e5cd472c2 Refactor TokenState type 2018-03-21 13:02:44 -07:00
Fabio Berger
e1341bc6d9 Move docs to page and add link to docs to README 2018-03-21 18:55:59 +00:00
Fabio Berger
d437a66019 Add comments to JSON-schemas public methods 2018-03-21 18:51:17 +00:00
Fabio Berger
542b46a22f Move usage out of README and replace with link to Docs 2018-03-21 18:40:59 +00:00
Fabio Berger
6fef533fff Improve comments 2018-03-21 18:38:45 +00:00
Fabio Berger
ec219fc395 Add comments to sol-cov 2018-03-21 18:24:54 +00:00
Fabio Berger
a555a8a374 Improve subproviders comment 2018-03-21 18:24:45 +00:00
Fabio Berger
78e9c48803 Move docs from README into docs page and add a link to it. 2018-03-21 18:04:48 +00:00
Fabio Berger
18d3e5458a Fix sectionName and menuItemName to display with spaces rather then dashes 2018-03-21 18:04:27 +00:00
Fabio Berger
ac25764d12 Add changelog entry for making handleRequest private 2018-03-21 17:38:23 +00:00
Fabio Berger
c55e7fa91a Improve all the comments for the subproviders public methods 2018-03-21 17:38:02 +00:00
Leonid Logvinov
e31ba2e12e Add missing param comments 2018-03-21 18:06:50 +01:00
Leonid Logvinov
73f8ae9a47 Fix a comment 2018-03-21 18:01:26 +01:00
Leonid Logvinov
32b85625c1 Add a comment 2018-03-21 17:23:07 +01:00
Leonid Logvinov
629edd3108 Move npm-run-all to devDependencies 2018-03-21 17:20:30 +01:00
Leonid Logvinov
ee77b81551 Revert optimizer config 2018-03-21 17:19:46 +01:00
Leonid Logvinov
2c7fdac5cd Remove .only 2018-03-21 16:39:37 +01:00
Leonid Logvinov
d118116548 Revert version range changes 2018-03-21 16:34:57 +01:00
Leonid Logvinov
8d01956c3e Merge pull request #470 from 0xProject/fix/fillOrdersUpToValidation
Fix a bug causing fillOrdersUpTo validation to fail because of some e…
2018-03-21 15:30:26 +01:00
Leonid Logvinov
1dda8c1468 Fix a bug causing fillOrdersUpTo validation to fail because of some extra orders being passed 2018-03-21 15:30:04 +01:00
Leonid Logvinov
111f7e917e Add function docs 2018-03-21 15:24:41 +01:00
Leonid Logvinov
477daf4168 Add function docs 2018-03-21 15:12:18 +01:00
Leonid Logvinov
8b52793f2f Add tests for compiler utils 2018-03-21 15:12:18 +01:00
Leonid Logvinov
18b9fe5256 Enable strictNullChecks 2018-03-21 15:11:41 +01:00
Leonid Logvinov
439e864085 Change the type of optimizerEnabled to boolean and convert it to number only before passing to a compiler 2018-03-21 15:11:41 +01:00
Leonid Logvinov
f45191d0e8 Support proper semver version ranges 2018-03-21 15:11:41 +01:00
Leonid Logvinov
32feadee42 Change version ranges to only support patch version increments 2018-03-21 15:07:51 +01:00
Leonid Logvinov
c4b4bb9e8e Compile contracts sequentially 2018-03-21 15:07:51 +01:00
Leonid Logvinov
8fd705d2af Throw an error if contract file doesn't contain the contract with the same name 2018-03-21 15:07:51 +01:00
Leonid Logvinov
3c36135d6c Stop printing help on error 2018-03-21 15:07:51 +01:00
Leonid Logvinov
02ede26893 Rename onDeployCommand to onDeployCommandAsync and onCompileCommand to onCompileCommandAsync 2018-03-21 15:07:51 +01:00
Fabio Berger
af21ad1615 Add missing DocComments to Deployer package 2018-03-21 12:33:07 +00:00
Fabio Berger
07fa01528b Move usage out of README and add add link to docs 2018-03-21 12:32:53 +00:00
Fabio Berger
38f716bd77 Make docs link more discoverable in README, move docs out of README 2018-03-20 22:24:26 +00:00
Fabio Berger
6a410b03ff Improve comments 2018-03-20 22:17:39 +00:00
Fabio Berger
3cd7bce0a3 Add DocComments to Web3Wrapper 2018-03-20 21:41:59 +00:00
Fabio Berger
6693540f43 Add changelog entry 2018-03-20 21:41:36 +00:00
Fabio Berger
647bc5a63e Rename method for clarity 2018-03-20 21:41:21 +00:00
Fabio Berger
4f76bb2a12 Remove duplicate method 2018-03-20 21:39:41 +00:00
Fabio Berger
9991ddecc2 Fix var name typo 2018-03-20 21:39:08 +00:00
Brandon Millman
3cf2cb89bb Implement initial wallet interface 2018-03-20 13:42:50 -07:00
Fabio Berger
2875cfa8c7 Move doc related types closer to one another 2018-03-20 15:41:31 +00:00
Fabio Berger
87cbbdad72 Update yarn.lock 2018-03-20 15:39:39 +00:00
Fabio Berger
07de3a1d94 Pass actual iconUrl and add default icon image 2018-03-20 15:39:32 +00:00
Fabio Berger
27880a6059 Remove s3 mapping since s3 folder names are now identical to sub-package names 2018-03-20 15:35:48 +00:00
Fabio Berger
0367e4117a Remove duplicate switch case 2018-03-20 15:34:02 +00:00
Fabio Berger
ec582d6e46 Small doc fixes: remove duplicate types and add function array 2018-03-20 15:28:25 +00:00
Fabio Berger
4ca706d4e6 Remove duplicate ECSignature type def 2018-03-20 13:06:59 +00:00
Fabio Berger
72671c1014 Refactor titleToIcon mapping to idToIcon and move to docPage 2018-03-20 12:26:04 +00:00
Fabio Berger
a3c31f4f4a Fix changelog files and add PR number 2018-03-20 12:05:31 +00:00
Fabio Berger
db8be4a66e Rename stagedocs.ts file to stage_docs.ts in keeping with our file naming conventions. postpublish.ts is the only exception and this is because it is dictated by Lerna 2018-03-20 12:00:22 +00:00
Fabio Berger
2f7c19e80d Merge branch 'development' into addExtraDocs
* development: (29 commits)
  Set Lodash dep to an exact version since newer versions introduced breaking changes
  Update Kovan Ethertoken Address
  Update deployer version since manual re-publish
  Add new entry into CHANGELOG
  Fix bad merge
  Update yarn.lock
  Change title
  Add Blake and Zach to About page
  Re-size Jacob and Tom's images
  Manually publish 0x.js back to a working state
  Publish
  Publish
  Fix 0x.js assets
  Remove assets from connect and _bundles from packages that don't generate the folder
  Publish
  Fix packages that aren't working as expected
  Make new packages default to public on publish
  Add new public packages to top-level README
  Update top-level package.json
  Fix incorrect new versions
  ...

# Conflicts:
#	packages/0x.js/package.json
#	packages/connect/package.json
#	packages/json-schemas/package.json
#	packages/sol-cov/package.json
2018-03-20 11:52:22 +00:00
Fabio Berger
7d9c357409 Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo:
  Update Kovan Ethertoken Address
2018-03-20 11:40:48 +00:00
Fabio Berger
abf41b073c Set Lodash dep to an exact version since newer versions introduced breaking changes 2018-03-20 11:40:29 +00:00
Jacob Evans
c9b07107f3 Merge pull request #464 from 0xProject/bug/0x.js/kovan-ethertoken-address
Update Kovan Ethertoken Address
2018-03-20 22:24:22 +11:00
Jacob Evans
773be348a3 Update Kovan Ethertoken Address 2018-03-20 22:23:30 +11:00
Fabio Berger
b7bb8d9b2a Update deployer version since manual re-publish 2018-03-20 11:00:52 +00:00
Brandon Millman
c7c12371ef Merge pull request #451 from 0xProject/feature/sra-report/collection-tests
Add scaffolding for sra-report collection unit tests
2018-03-19 10:28:02 -07:00
Brandon Millman
fb40b10501 Add new entry into CHANGELOG 2018-03-19 10:10:17 -07:00
Brandon Millman
d4dce41d3a Fix bad merge 2018-03-19 10:06:54 -07:00
Brandon Millman
293b55e51f Update yarn.lock 2018-03-19 10:03:21 -07:00
Brandon Millman
11bac66046 Merge branch 'development' into feature/sra-report/collection-tests
* development: (26 commits)
  Change title
  Add Blake and Zach to About page
  Re-size Jacob and Tom's images
  Manually publish 0x.js back to a working state
  Publish
  Publish
  Fix 0x.js assets
  Remove assets from connect and _bundles from packages that don't generate the folder
  Publish
  Fix packages that aren't working as expected
  Make new packages default to public on publish
  Add new public packages to top-level README
  Update top-level package.json
  Fix incorrect new versions
  Fix path to assets
  Publish
  Updated CHANGELOGS
  Fix quotation marks
  Add a complex test for ast visitor
  Move opcodes to constants
  ...
2018-03-19 09:56:46 -07:00
Fabio Berger
2a438419ab Merge pull request #461 from 0xProject/updateTeam
Add Zach & Blake to team
2018-03-19 15:28:38 +01:00
Fabio Berger
0f0aca7de5 Change title 2018-03-19 14:51:58 +01:00
Fabio Berger
f699b9a73f Add Blake and Zach to About page 2018-03-19 14:50:50 +01:00
Fabio Berger
214096de9e Re-size Jacob and Tom's images 2018-03-19 14:50:36 +01:00
Fabio Berger
a0ccb609cd Manually publish 0x.js back to a working state 2018-03-19 00:55:10 +01:00
Fabio Berger
4e05554b3e Publish
- 0x.js@0.33.5
 - contracts@2.1.19
 - @0xproject/sra-report@0.0.5
 - @0xproject/testnet-faucets@1.0.20
 - @0xproject/website@0.0.22
2018-03-19 00:48:26 +01:00
Fabio Berger
04c08b9fc8 Publish
- 0x.js@0.33.4
 - @0xproject/assert@0.2.3
 - @0xproject/connect@0.6.6
 - contracts@2.1.18
 - @0xproject/deployer@0.3.2
 - @0xproject/dev-utils@0.3.2
 - @0xproject/json-schemas@0.7.17
 - @0xproject/react-docs-example@0.0.4
 - @0xproject/react-docs@0.0.4
 - @0xproject/react-shared@0.0.4
 - @0xproject/sol-cov@0.0.4
 - @0xproject/sra-report@0.0.4
 - @0xproject/subproviders@0.8.2
 - @0xproject/testnet-faucets@1.0.19
 - @0xproject/website@0.0.21
2018-03-19 00:39:25 +01:00
Fabio Berger
86c1c8082d Fix 0x.js assets 2018-03-19 00:36:44 +01:00
Fabio Berger
c5afc5feb5 Remove assets from connect and _bundles from packages that don't generate the folder 2018-03-19 00:30:33 +01:00
Fabio Berger
8392ee4625 Publish
- 0x.js@0.33.3
 - @0xproject/abi-gen@0.2.7
 - @0xproject/assert@0.2.2
 - @0xproject/base-contract@0.0.5
 - chai-as-promised-typescript-typings@0.0.12
 - chai-typescript-typings@0.0.6
 - @0xproject/connect@0.6.5
 - contracts@2.1.17
 - @0xproject/deployer@0.3.1
 - @0xproject/dev-utils@0.3.1
 - ethers-typescript-typings@0.0.4
 - @0xproject/json-schemas@0.7.16
 - @0xproject/monorepo-scripts@0.1.14
 - @0xproject/react-docs-example@0.0.3
 - @0xproject/react-docs@0.0.3
 - @0xproject/react-shared@0.0.3
 - @0xproject/sol-cov@0.0.3
 - @0xproject/sra-report@0.0.3
 - @0xproject/subproviders@0.8.1
 - @0xproject/testnet-faucets@1.0.18
 - @0xproject/tslint-config@0.4.12
 - @0xproject/types@0.4.1
 - @0xproject/utils@0.4.3
 - web3-typescript-typings@0.10.2
 - @0xproject/web3-wrapper@0.3.1
 - @0xproject/website@0.0.20
2018-03-19 00:24:28 +01:00
Fabio Berger
5468358f21 Add Subprovider docs to website 2018-03-18 19:04:16 +01:00
Fabio Berger
87044313c2 Capitalize rather then upper-case section headers 2018-03-18 18:45:06 +01:00
Fabio Berger
794b155827 Add support for displaying exported functions 2018-03-18 18:44:52 +01:00
Fabio Berger
4941ffd354 Add functions to submenu in sidebar 2018-03-18 18:43:38 +01:00
Fabio Berger
aa8a3ee055 Re-order developers dropdown 2018-03-18 16:12:24 +01:00
Fabio Berger
c1d17c83f8 Add sol-cov docs to website 2018-03-18 16:10:02 +01:00
Fabio Berger
db030016fa Refactor CoverageSubprovider to use subproviders types 2018-03-18 16:09:37 +01:00
Fabio Berger
ae04f55882 Export ErrorCallback type from Subproviders package 2018-03-18 16:09:08 +01:00
Fabio Berger
b40fab35f6 Add doc setup to sol-cov 2018-03-18 15:08:52 +01:00
Fabio Berger
644deee8b5 Standardize all doc commands and add docs:stage shortcut 2018-03-18 15:08:37 +01:00
Fabio Berger
c7302c46e5 Add JSON Schemas docs to website 2018-03-18 14:54:12 +01:00
Fabio Berger
4948551703 merge development 2018-03-18 14:01:18 +01:00
Fabio Berger
d7bf003d51 Refactor all docJSON's to reside within the same S3 bucket under different folders 2018-03-16 16:56:53 +01:00
Fabio Berger
5a827eb3d4 Fix deployer external type link to point to specific commit 2018-03-16 14:05:05 +01:00
Fabio Berger
b37076136b Add missing type 2018-03-16 14:04:38 +01:00
Fabio Berger
3574ab253f Add missing type to subproviders exports 2018-03-16 14:04:27 +01:00
Fabio Berger
312a30578b Improve deployer docs 2018-03-16 14:04:08 +01:00
Fabio Berger
8243e73413 Use named types and introduce JSONRPCRequestPayloadWithMethod type 2018-03-16 14:03:50 +01:00
Fabio Berger
5175fe8107 Handle reflection type in type rendering 2018-03-16 14:02:55 +01:00
Fabio Berger
8d1e27a1a5 Merge branch 'development' into addExtraDocs
* development:
  Add changelog entry about pragma addition
  Add pragma above command-line script
  Keep console.log in monorepo-scripts
  Enable coverage for all other packages with tests
  Fix parallel coverage results reporting
  Fix linter issuesx
  Update CHANGELOGs
  Consolidate all console.log into the @0xproject/utils package

# Conflicts:
#	packages/deployer/package.json
2018-03-15 19:44:10 +01:00
Brandon Millman
e4ea6e1ec3 WIP 2018-03-15 11:33:08 -07:00
Fabio Berger
f9ad97b978 Add Deployer docs to website 2018-03-15 19:23:21 +01:00
Fabio Berger
b145a17d11 Add pragma above command-line script 2018-03-15 19:22:57 +01:00
Brandon Millman
3430e2bdac Fix bad merge 2018-03-15 10:14:51 -07:00
Brandon Millman
cdcf925378 Fix yarn.lock 2018-03-15 09:58:20 -07:00
Brandon Millman
76029cbf09 Merge branch 'development' into feature/sra-report/collection-tests
* development: (97 commits)
  Keep console.log in monorepo-scripts
  Enable coverage for all other packages with tests
  Fix parallel coverage results reporting
  Fix linter issuesx
  Remove outdated comment
  Add script copying to build command
  Add postpublish script to sol-cov
  Move configuration into package.json configs section
  Transform input data before encoding for callAsync and getABIEncodedTransactionData
  Update CHANGELOGs
  Consolidate all console.log into the @0xproject/utils package
  Update coverage badge to show development coverage
  Configure post build hook
  Notify coveralls after all tasks have finished
  Address feedback
  Revert "Report all coverage reports together"
  Separate published packages and typescript typings on README
  Consolidate docs generation and uploading logic
  Use async/await instead of promise syntax
  Move changelog entry
  ...
2018-03-15 09:57:27 -07:00
Brandon Millman
b9c1653c1c Fix quotation marks 2018-03-15 09:48:45 -07:00
Fabio Berger
9593739938 Ignore ganache-core from subproviders in a browser setting & remove previous hack 2018-03-14 17:29:57 +01:00
Fabio Berger
28d63ad8e1 Add Web3Wrapper docs to website 2018-03-14 16:37:24 +01:00
Fabio Berger
56eeea1e63 Add fix to webpack for issue: https://github.com/trufflesuite/ganache-core/issues/84 and prettier the configs 2018-03-14 16:37:09 +01:00
Fabio Berger
642a2cf165 Added doc json generation and uploading to Web3Wrapper package 2018-03-14 16:36:00 +01:00
Fabio Berger
a86f8a81a2 Fix linter issuesx 2018-03-14 14:49:09 +01:00
Brandon Millman
ba9a734ba7 Update README and CHANGELOG 2018-03-13 16:17:02 -07:00
Brandon Millman
b08374f0ba Add scaffolding for sra-report collection unit tests 2018-03-13 15:54:33 -07:00
1336 changed files with 259930 additions and 28131 deletions

View File

@@ -3,7 +3,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/node:6.12
- image: circleci/node:9
environment:
CONTRACTS_COMMIT_HASH: '9ed05f5'
working_directory: ~/repo
@@ -11,94 +11,99 @@ jobs:
- checkout
- run: echo 'export PATH=$HOME/CIRCLE_PROJECT_REPONAME/node_modules/.bin:$PATH' >> $BASH_ENV
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-packages-{{ .Branch }}
- yarn-packages-master
- yarn-packages-
- run:
name: yarn
command: yarn --frozen-lockfile
command: yarn --frozen-lockfile install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
name: Save Yarn Package Cache
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- run: wget https://s3.amazonaws.com/testrpc-shapshots/${CONTRACTS_COMMIT_HASH}.zip
- run: unzip ${CONTRACTS_COMMIT_HASH}.zip -d testrpc_snapshot
- run: node ./node_modules/lerna/bin/lerna.js bootstrap
- run: yarn lerna:run build
- node_modules/
- run: >
if [ -z "$(git diff --name-only v2-prototype packages/website)" ]; then
yarn build --exclude website
else
yarn build
fi
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo
test-0xjs:
test-contracts-ganache:
docker:
- image: circleci/node:6.12
- image: circleci/node:9
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: testrpc
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope 0x.js test:circleci
- run: yarn wsrun test:circleci contracts
test-contracts-geth:
docker:
- image: circleci/node:9
- image: albrow/0x-devnet
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
# initialized
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
test-rest:
docker:
- image: circleci/node:9
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci 0x.js
- run: yarn wsrun test:circleci @0xproject/abi-gen
- run: yarn wsrun test:circleci @0xproject/assert
- run: yarn wsrun test:circleci @0xproject/base-contract
- run: yarn wsrun test:circleci @0xproject/connect
- run: yarn wsrun test:circleci @0xproject/contract-wrappers
- run: yarn wsrun test:circleci @0xproject/dev-utils
- run: yarn wsrun test:circleci @0xproject/json-schemas
- run: yarn wsrun test:circleci @0xproject/metacoin
- run: yarn wsrun test:circleci @0xproject/order-utils
- run: yarn wsrun test:circleci @0xproject/order-watcher
- run: yarn wsrun test:circleci @0xproject/sol-compiler
- run: yarn wsrun test:circleci @0xproject/sol-cov
- run: yarn wsrun test:circleci @0xproject/sra-report
- run: yarn wsrun test:circleci @0xproject/subproviders
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
- save_cache:
key: coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/0x.js/coverage/lcov.info
test-contracts:
docker:
- image: circleci/node:6.12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: testrpc
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope contracts test:circleci
- save_cache:
key: coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/contracts/coverage/lcov.info
test-deployer:
docker:
- image: circleci/node:6.12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: testrpc
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --scope @0xproject/deployer test:circleci
- save_cache:
key: coverage-deployer-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/deployer/coverage/lcov.info
test-rest:
docker:
- image: circleci/node:6.12
working_directory: ~/repo
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: testrpc
command: npm run testrpc -- --db testrpc_snapshot
background: true
- run: yarn lerna:run --ignore contracts --ignore 0x.js --ignore @0xproject/deployer test:circleci
- ~/repo/packages/abi-gen/coverage/lcov.info
- save_cache:
key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/assert/coverage/lcov.info
- save_cache:
key: coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/base-contract/coverage/lcov.info
- save_cache:
key: coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/connect/coverage/lcov.info
- save_cache:
key: coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/contract-wrappers/coverage/lcov.info
- save_cache:
key: coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -108,34 +113,50 @@ jobs:
paths:
- ~/repo/packages/json-schemas/coverage/lcov.info
- save_cache:
key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
key: coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/subproviders/coverage/lcov.info
- ~/repo/packages/metacoin/coverage/lcov.info
- save_cache:
key: coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/order-utils/coverage/lcov.info
- save_cache:
key: coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/order-watcher/coverage/lcov.info
- save_cache:
key: coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-compiler/coverage/lcov.info
- save_cache:
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sol-cov/coverage/lcov.info
lint:
- save_cache:
key: coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/sra-report/coverage/lcov.info
- save_cache:
key: coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/subproviders/coverage/lcov.info
- save_cache:
key: coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/packages/web3-wrapper/coverage/lcov.info
static-tests:
working_directory: ~/repo
docker:
- image: circleci/node:6.12
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn lerna:run lint
prettier:
working_directory: ~/repo
docker:
- image: circleci/node:6.12
- image: circleci/node:9
steps:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn prettier:ci
- run: yarn lerna:run lint
submit-coverage:
docker:
- image: circleci/node:6.12
- image: circleci/node:9
working_directory: ~/repo
steps:
- restore_cache:
@@ -143,13 +164,22 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-base-contract-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-connect-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-contract-wrappers-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-dev-utils-{{ .Environment.CIRCLE_SHA1 }}
@@ -158,43 +188,49 @@ jobs:
- coverage-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
- coverage-metacoin-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-order-utils-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-order-watcher-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-deployer-{{ .Environment.CIRCLE_SHA1 }}
- coverage-sra-report-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
- coverage-subproviders-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-web3-wrapper-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn report_coverage
workflows:
version: 2
main:
jobs:
- build
- test-0xjs:
- test-contracts-ganache:
requires:
- build
- test-contracts:
requires:
- build
- test-deployer:
- test-contracts-geth:
requires:
- build
- test-rest:
requires:
- build
- prettier:
requires:
- build
- lint:
- static-tests:
requires:
- build
- submit-coverage:
requires:
- test-0xjs
- test-deployer
- test-rest
- test-contracts

32
.gitignore vendored
View File

@@ -41,6 +41,7 @@ typings/
# Optional npm cache directory
.npm
.npmrc
# Optional eslint cache
.eslintcache
@@ -67,14 +68,37 @@ generated_docs/
TODO.md
# VSCode file
.vscode
packages/website/public/bundle*
packages/react-docs/example/public/bundle*
# generated binaries
bin/
# server cli
packages/testnet-faucets/server/
# generated contract artifacts
packages/contracts/src/artifacts
# generated contract artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
packages/order-watcher/test/artifacts/
packages/contract-wrappers/test/artifacts/
packages/contract-wrappers/src/artifacts/
packages/order-watcher/src/artifacts/
# generated contract watcher
packages/0x.js/src/generated_contract_wrappers/
packages/contracts/generated_contract_wrappers/
packages/contract-wrappers/src/contract_wrappers/generated/
packages/metacoin/src/contract_wrappers
packages/fill-scenarios/src/generated_contract_wrappers/
packages/order-watcher/src/generated_contract_wrappers/
packages/order-utils/src/generated_contract_wrappers/
packages/migrations/src/1.0.0/contract_wrappers
packages/migrations/src/2.0.0/contract_wrappers
packages/migrations/src/2.0.0-beta-testnet/contract_wrappers
# solc-bin in sol-compiler
packages/sol-compiler/solc_bin/
# Monorepo scripts
packages/*/scripts/

View File

@@ -1,5 +1,24 @@
lib
.nyc_output
/packages/contract-wrappers/src/contract_wrappers/generated/
/packages/metacoin/src/contract_wrappers
/packages/0x.js/src/generated_contract_wrappers/
/packages/contracts/generated_contract_wrappers/
/packages/fill-scenarios/src/generated_contract_wrappers/
/packages/order-watcher/src/generated_contract_wrappers/
/packages/order-utils/src/generated_contract_wrappers/
/packages/migrations/src/1.0.0/contract_wrappers
/packages/migrations/src/2.0.0/contract_wrappers
/packages/migrations/src/2.0.0-beta-testnet/contract_wrappers
/packages/0x.js/src/artifacts
/packages/contracts/src/artifacts
/packages/contract-wrappers/src/artifacts
/packages/order-watcher/src/artifacts
/packages/metacoin/artifacts
/packages/contract-wrappers/test/artifacts
/packages/order-watcher/test/artifacts
/packages/migrations/artifacts/1.0.0
/packages/migrations/artifacts/2.0.0
/packages/migrations/artifacts/2.0.0-beta-testnet
package.json
scripts/postpublish_utils.js

View File

@@ -1 +0,0 @@
* @abandeali1 @BMillman19 @dekz @fabioberger @LogvinovLeon @Recmo

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at team@0xproject.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -21,6 +21,18 @@ If you're adding a new public function/member, make sure you document it with Ja
If the sub-package you are modifying has a `CHANGELOG.md` file, make sure to add an entry in it for the change made to the package. For published packages, only changes that modify the public interface or behavior of the package need a CHANGELOG entry.
#### Enabling code coverage checks on your fork
If you simply fork the repo and then create a PR sourced from it, your PR will fail its test coverage check. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for 0xProject/0x-monorepo, but when running the check against your fork the token needs to match the repo that is your fork, rather than the 0x repo.
To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following:
1. Log in to [coveralls.io](https://coveralls.io/), go to Add Repos, and enable your fork. Then go to the settings for that repo, and copy the Repo Token identifier.
2. Log in to [CircleCI](https://circleci.com/login), go to Add Projects, click the Set Up Project button corresponding to your fork, and then click Start Building. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-monorepo, so you can ignore all of the instruction/explanation given on the page with the Start Building button.)
3. In CircleCI, configure your project to add an Environment Variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the Repo Token you copied in step 1.
Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper Repo Token, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance.
### Styleguide
We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) to keep our code style consistent.

View File

@@ -1,42 +1,27 @@
<!--- Thank you for taking the time to submit a Pull Request -->
<!--- Provide a general summary of the issue in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Motivation and Context
## Testing instructions
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
<!--- Please describe how reviewers can test your changes -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
<!--- What types of changes does your code introduce? Uncomment all the bullets that apply: -->
* [ ] Bug fix (non-breaking change which fixes an issue)
* [ ] New feature (non-breaking change which adds functionality)
* [ ] Breaking change (fix or feature that would cause existing functionality to change)
<!-- * Bug fix (non-breaking change which fixes an issue) -->
<!-- * New feature (non-breaking change which adds functionality) -->
<!-- * Breaking change (fix or feature that would cause existing functionality to change) -->
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- The following points should be used to indicate the progress of your PR. Put an `x` in all the boxes that apply right now, and come back over time and check them off as you make progress. If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
* [ ] Change requires a change to the documentation.
* [ ] Added tests to cover my changes.
* [ ] Added new entries to the relevant CHANGELOGs.
* [ ] Updated the new versions of the changed packages in the relevant CHANGELOGs.
* [ ] Labeled this PR with the 'WIP' label if it is a work in progress.
* [ ] Labeled this PR with the labels corresponding to the changed package.
* [ ] Prefixed the title of this PR with `[WIP]` if it is a work in progress.
* [ ] Prefixed the title of this PR with bracketed package name(s) corresponding to the changed package(s). For example: `[sol-cov] Fixed bug`.
* [ ] Added tests to cover my changes, or decided that tests would be too impractical.
* [ ] Updated documentation, or decided that no doc change is needed.
* [ ] Added new entries to the relevant CHANGELOG.jsons.

151
README.md
View File

@@ -6,47 +6,41 @@
This repository is a monorepo including the 0x protocol smart contracts and numerous developer tools. Each public sub-package is independently published to NPM.
If you're developing on 0x now or are interested in using 0x infrastructure in the future, please join our [developer mailing list][dev-mailing-list-url] for updates.
[website-url]: https://0xproject.com/
[whitepaper-url]: https://0xproject.com/pdfs/0x_white_paper.pdf
[dev-mailing-list-url]: http://eepurl.com/dx4cPf
[![CircleCI](https://circleci.com/gh/0xProject/0x-monorepo.svg?style=svg&circle-token=61bf7cd8c9b4e11b132089dfcffdd1be277d1e0c)](https://circleci.com/gh/0xProject/0x-monorepo)
[![Coverage Status](https://coveralls.io/repos/github/0xProject/0x-monorepo/badge.svg?branch=development)](https://coveralls.io/github/0xProject/0x-monorepo?branch=development)
[![Discord](https://img.shields.io/badge/chat-rocket.chat-yellow.svg?style=flat)](https://chat.0xproject.com)
[![Join the chat at https://gitter.im/0xProject/Lobby](https://badges.gitter.im/0xProject/Lobby.svg)](https://gitter.im/0xProject/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Greenkeeper badge](https://badges.greenkeeper.io/0xProject/0x-monorepo.svg?token=7c22e5c72acf39d3ead8d29c5d9bb38f9096df3e643024dcedd53ab732847be1&ts=1496426342666)](https://greenkeeper.io/)
### Published Packages
| Package | Version | Description |
| ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0xproject/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0xproject/abi-gen.svg)](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0xproject/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0xproject/assert.svg)](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages |
| [`@0xproject/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0xproject/base-contract.svg)](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0xproject/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0xproject/connect.svg)](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0xproject/deployer`](/packages/deployer) | [![npm](https://img.shields.io/npm/v/@0xproject/deployer.svg)](https://www.npmjs.com/package/@0xproject/deployer) | Solidity project compiler and deployer framework |
| [`@0xproject/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0xproject/dev-utils.svg)](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0xproject/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0xproject/json-schemas.svg)](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas |
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0xproject/monorepo-scripts.svg)](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts |
| [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
| [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool tool |
| [`@0xproject/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0xproject/subproviders.svg)](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0xproject/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0xproject/tslint-config.svg)](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
| [`@0xproject/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0xproject/types.svg)](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
| [`@0xproject/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0xproject/utils.svg)](https://www.npmjs.com/package/@0xproject/utils) | Shared utilities |
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0xproject/web3-wrapper.svg)](https://www.npmjs.com/package/@0xproject/web3-wrapper) | Web3 wrapper |
### TypeScript Typings
| Package | Version | Description |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [`chai-as-promised-typescript-typings`](/packages/chai-as-promised-typescript-typings) | [![npm](https://img.shields.io/npm/v/chai-as-promised-typescript-typings.svg)](https://www.npmjs.com/package/chai-as-promised-typescript-typings) | Chai as promised typescript typings |
| [`chai-typescript-typings`](/packages/chai-typescript-typings) | [![npm](https://img.shields.io/npm/v/chai-typescript-typings.svg)](https://www.npmjs.com/package/chai-typescript-typings) | Chai typescript typings |
| [`ethers-typescript-typings`](/packages/ethers-typescript-typings) | [![npm](https://img.shields.io/npm/v/@0xproject/deployer.svg)](https://www.npmjs.com/package/ethers-typescript-typings) | [Ethers.js](https://github.com/ethers-io/ethers.js/) typescript typings |
| [`web3-typescript-typings`](/packages/web3-typescript-typings) | [![npm](https://img.shields.io/npm/v/web3-typescript-typings.svg)](https://www.npmjs.com/package/web3-typescript-typings) | Web3 typescript typings |
| Package | Version | Description |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0xproject/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0xproject/abi-gen.svg)](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0xproject/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0xproject/assert.svg)](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages |
| [`@0xproject/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0xproject/base-contract.svg)](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0xproject/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0xproject/connect.svg)](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0xproject/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-compiler.svg)](https://www.npmjs.com/package/@0xproject/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties. |
| [`@0xproject/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0xproject/dev-utils.svg)](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0xproject/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0xproject/json-schemas.svg)](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas |
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0xproject/monorepo-scripts.svg)](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts |
| [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
| [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool |
| [`@0xproject/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0xproject/subproviders.svg)](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0xproject/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0xproject/tslint-config.svg)](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
| [`@0xproject/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0xproject/types.svg)](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
| [`@0xproject/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0xproject/typescript-typings.svg)](https://www.npmjs.com/package/@0xproject/typescript-typings) | Repository of types for external packages |
| [`@0xproject/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0xproject/utils.svg)](https://www.npmjs.com/package/@0xproject/utils) | Shared utilities |
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0xproject/web3-wrapper.svg)](https://www.npmjs.com/package/@0xproject/web3-wrapper) | Web3 wrapper |
### Private Packages
@@ -64,13 +58,27 @@ Dedicated documentation pages:
* [0x.js Library](https://0xproject.com/docs/0xjs)
* [0x Connect](https://0xproject.com/docs/connect)
* [Smart contracts](https://0xproject.com/docs/contracts)
* [Subproviders](https://0xproject.com/docs/subproviders)
* [Sol Compiler](https://0xproject.com/docs/sol-compiler)
* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
* [JSON-schemas](https://0xproject.com/docs/json-schemas)
* [Sol-cov](https://0xproject.com/docs/sol-cov)
* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
Node version >= 6.12 is required.
Most of the packages require additional typings for external dependencies.
You can include those by prepending @0xproject/typescript-typings package to your [`typeRoots`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) config.
```json
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
```
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](./CONTRIBUTING.md) before getting started.
#### Read our [contribution guidelines](./CONTRIBUTING.md).
### Install dependencies
@@ -88,46 +96,87 @@ yarn install
### Build
Build all packages
To build all packages:
```bash
yarn lerna:run build
yarn build
```
Continuously rebuild on exchange
To build a specific package:
```bash
yarn dev
PKG=@0xproject/web3-wrapper yarn build
```
### Watch
To re-build all packages on change:
```bash
yarn watch
```
To watch a specific package and all it's dependent packages:
```bash
PKG=[NPM_PACKAGE_NAME] yarn watch
e.g
PKG=@0xproject/web3-wrapper yarn watch
```
### Clean
Clean all packages:
```bash
yarn clean
```
Clean a specific package
```bash
PKG=0x.js yarn clean
```
### Rebuild
To re-build (clean & build) all packages:
```bash
yarn rebuild
```
To re-build (clean & build) a specific package & it's deps:
```bash
PKG=0x.js yarn rebuild
```
### Lint
Lint all packages
Lint all packages:
```bash
yarn lerna:run lint
yarn lint
```
Lint a specific package:
```bash
PKG=0x.js yarn lint
```
### Run Tests
Before running the tests, you will need to spin up a [TestRPC](https://www.npmjs.com/package/ethereumjs-testrpc) instance and deploy all the 0x smart contracts.
In a separate terminal, start TestRPC (a convenience command is provided as part of this repo)
Run all tests:
```bash
yarn testrpc
yarn test
```
Then in your main terminal run
```
cd packages/contracts
yarn migrate
cd ..
```
And finally from the root project directory run
Run a specific package's test:
```bash
yarn lerna:run test
PKG=@0xproject/web3-wrapper yarn test
```

View File

@@ -1,15 +1,10 @@
{
"lerna": "2.5.1",
"lerna": "3.0.0-beta.23",
"packages": ["packages/*"],
"commands": {
"publish": {
"allowBranch": "development"
}
},
"version": "independent",
"commands": {
"command": {
"publish": {
"ignore": ["test/**/*", "*.md", "scripts", "lib", "tslint.json", "tsconfig.json"]
"ignoreChanges": ["test/**/*", "*.md", "scripts", "lib", "tslint.json", "tsconfig.json"]
}
},
"npmClient": "yarn",

View File

@@ -1,28 +1,53 @@
{
"private": true,
"name": "0x-monorepo",
"workspaces": ["packages/*"],
"engines": {
"node": ">=6.12"
},
"workspaces": [
"packages/*"
],
"scripts": {
"dev": "lerna run --parallel build:watch",
"testrpc": "testrpc -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"ganache": "ganache-cli -p 8545 --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",
"report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
"script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js",
"script:publish": "node ./packages/monorepo-scripts/lib/publish.js",
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna:run": "lerna run",
"lerna:rebuild": "lerna run clean; lerna run build;",
"lerna:publish":
"yarn install; lerna run clean; lerna run build; lerna publish --registry=https://registry.npmjs.org/"
"watch": "wsrun watch_without_deps $PKG --fast-exit -r --stages --done-criteria='complete|successfully'",
"build": "wsrun build $PKG --fast-exit -r --stages",
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0xproject/website",
"build:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build",
"clean": "wsrun clean $PKG --fast-exit -r --parallel",
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
"rebuild": "run-s clean build",
"rebuild:no_website": "run-s clean build:no_website",
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
"stage_docs": "wsrun docs:stage $PKG --fast-exit --parallel --exclude-missing",
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
"comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete."
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic"
},
"devDependencies": {
"@0xproject/utils": "^0.4.2",
"async-child-process": "^1.1.1",
"coveralls": "^3.0.0",
"ethereumjs-testrpc": "^6.0.3",
"lcov-result-merger": "^2.0.0",
"lerna": "^2.5.1",
"prettier": "^1.11.1"
"ganache-cli": "6.1.3",
"lcov-result-merger": "^3.0.0",
"@0x-lerna-fork/lerna": "3.0.0-beta.23",
"npm-run-all": "^4.1.2",
"prettier": "^1.11.1",
"source-map-support": "^0.5.6",
"wsrun": "^2.2.0"
},
"resolutions": {
"ethers": "0xproject/ethers.js#eip-838-reasons"
}
}

View File

@@ -8,3 +8,4 @@ test/
/contract_templates/
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,116 @@
# CHANGELOG
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
## v0.33.2 - _March 18, 2018_
CHANGELOG
## v1.0.1-rc.1 - _July 26, 2018_
* Dependencies updated
## v1.0.0 - _July 23, 2018_
* Dependencies updated
## v1.0.0-rc.2 - _July 20, 2018_
* Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx`
## v1.0.0-rc.1 - _July 20, 2018_
* Remove tokenRegistry wrapper (#863)
* Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token` (#863)
* Rename `zeroEx.proxy` to `zeroEx.erc20Proxy` and add `zeroEx.erc721Proxy` (#863)
* Refactored `ZeroEx.isValidSignature` to `zeroEx.isValidSignatureAsync`. It is now async so that it can verify contract-dependent signature types (#863)
* Refactored `signOrderHashAsync` to `ecSignOrderHashAsync`. There are now many non-ECSignature ways to sign orders too. (#863)
* Removed `createOrderWatcherAsync` method. Will be added back once OrderWatcher is refactored for V2 (#863)
* 0x.js exports renamed contract events and event arg types (#863)
* Export `ZeroEx.assetData` with methods to decode/encode assetData fields found in 0x orders (#884)
## v0.38.6 - _July 18, 2018_
* Dependencies updated
## v0.38.5 - _July 9, 2018_
* Dependencies updated
## v0.38.4 - _June 19, 2018_
* Dependencies updated
## v0.38.3 - _May 29, 2018_
* Dependencies updated
## v0.38.2 - _May 29, 2018_
* Dependencies updated
## v0.38.1 - _May 29, 2018_
* Dependencies updated
## v0.38.0 - _May 22, 2018_
* Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async (#579)
* Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage (#579)
## v0.37.2 - _May 5, 2018_
* Dependencies updated
## v0.37.1 - _May 4, 2018_
* Dependencies updated
## v0.37.0 - _May 4, 2018_
* Fixed expiration watcher comparator to handle orders with equal expiration times (#526)
* Update Web3 Provider Engine to 14.0.4 (#555)
* Add `zeroEx.getProvider()` (#559)
* Move `ZeroExError.InvalidSignature` to `@0xproject/order-utils` `OrderError.InvalidSignature` (#559)
## v0.36.3 - _April 18, 2018_
* Move @0xproject/migrations to devDependencies
## v0.36.2 - _April 18, 2018_
* Dependencies updated
## v0.36.1 - _April 18, 2018_
* Internal changes and refactoring
* Fix redundant expired order removal bug (#527)
## v0.36.0 - _April 11, 2018_
* Moved Web3.Provider to `@0xproject/types:Provider` (#501)
* Add `zeroEx.exchange.getOrderStateAsync` to allow obtaining current OrderState for a signedOrder (#510)
## v0.35.0 - _April 2, 2018_
* Removed `ZeroExError.TransactionMiningTimeout` and moved it to '@0xproject/web3-wrapper' `Web3WrapperErrors.TransactionMiningTimeout` (#485)
## v0.34.0 - _April 2, 2018_
* Fix the bug causing `zeroEx.exchange.fillOrdersUpToAsync` validation to fail if there were some extra orders passed (#470)
* Remove automatic instantiation of `zeroEx.orderStateWatcher` (#488)
* Add `zeroEx.createOrderStateWatcher` to allow creating arbitrary number of OrderStateWatchers (#488)
* Added `stateLayer` setting to `OrderStateWatcherConfig` so OrderStateWatcher can be set to monitor different blockchain state layers (#488)
## v0.33.2 - _March 17, 2018_
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
* Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456)
## v0.33.1 - _March 8, 2018_
## v0.33.1 - _March 7, 2018_
* Add missing EthersJs typescript typings as dependency
## v0.33.0 - _March 4, 2018_
## v0.33.0 - _March 3, 2018_
* Validate and lowercase all addresses in public methods (#373)
* Improve validation to force passing contract addresses on private networks (#385)
@@ -17,57 +118,54 @@
* Rename all public `_unsubscribeAll` methods to `unsubscribeAll` (#415)
* Move web3 typings from devDep to dep since cannot use this package without it (#429)
## v0.32.2 - _February 9, 2018_
## v0.32.2 - _February 8, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.32.1 - _February 7, 2018_
## v0.32.1 - _February 6, 2018_
* Reorganized `BlockParamLiteral` export into `@0xproject/types` package (#355)
* Now using `abi-gen` package to generate ContractEventArgs types (#371)
## v0.32.0 - _February 5, 2018_
## v0.32.0 - _February 4, 2018_
* Add `zeroEx.etherToken.getContractAddressIfExists` (#350)
* Fixed the bug causing order watcher to throw if there is an event with the same signature but different indexed fields (#366)
## v0.31.1 - _February 1, 2018_
## v0.31.1 - _January 31, 2018_
* Fix the bug causing order watcher to throw if makerToken === zrx (#357)
## v0.31.0 - _January 30, 2018_
## v0.31.0 - _January 29, 2018_
* Add the `shouldAddPersonalMessagePrefix` parameter to `signOrderHashAsync` so that the
caller can decide on whether to add the personalMessage prefix before relaying the request
to the signer. Parity Signer, Ledger and TestRPC add the prefix themselves, Metamask expects
it to have already been added. (#349)
* Add the `shouldAddPersonalMessagePrefix` parameter to `signOrderHashAsync` so that the caller can decide on whether to add the personalMessage prefix before relaying the request to the signer. Parity Signer, Ledger and TestRPC add the prefix themselves, Metamask expects it to have already been added. (#349)
## v0.30.2 - _January 29, 2018_
## v0.30.2 - _January 28, 2018_
* Add Rinkeby testnet addresses to artifacts (#337)
* Move @0xproject/types to dependencies from devDependencies fixing missing type errors
## v0.30.1 - _January 24, 2018_
## v0.30.1 - _January 23, 2018_
* Fix a bug allowing negative fill values (#212)
* Fix a bug that made it impossible to pass a custom ZRX address (#341)
## v0.30.0 - _January 17, 2018_
## v0.30.0 - _January 16, 2018_
* Add an error parameter to the order watcher callback (#312)
* Fix a bug making it impossible to catch some errors from awaitTransactionMinedAsync (#312)
* Fix a bug in fillOrdersUpTo validation making it impossible to fill up to if user doesn't have enough balance to fully fill all the orders (#321)
## v0.29.1 - _January 11, 2018_
## v0.29.1 - _January 10, 2018_
* Fixed bignumber config issue #301 (#305)
## v0.29.0 - _December 28, 2017_
## v0.29.0 - _December 27, 2017_
* Assert baseUnit amount supplied to `toUnitAmount` is integer amount. (#287)
* `toBaseUnitAmount` throws if amount supplied has too many decimals (#287)
## v0.28.0 - _December 20, 2017_
## v0.28.0 - _December 19, 2017_
* Add `etherTokenAddress` arg to `depositAsync` and `withdrawAsync` methods on `zeroEx.etherToken` (#267)
* Removed accidentally included `unsubscribeAll` method from `zeroEx.proxy`, `zeroEx.etherToken` and `zeroEx.tokenRegistry` (#267)
@@ -79,11 +177,11 @@
* Support `Deposit` and `Withdraw` events on etherToken (#277)
* Improve the error message when taker is not a string (#278)
## v0.27.1 - _November 28, 2017_
## v0.27.1 - _November 27, 2017_
* Export `TransactionOpts` type
## v0.27.0 - _November 28, 2017_
## v0.27.0 - _November 27, 2017_
* Make `ZeroExConfig` required parameter of `ZeroEx` constructor (#233)
* Add a required property `networkId` to `ZeroExConfig` (#233)
@@ -95,149 +193,149 @@
* All transaction sending methods now call `estimateGas` if no gas amount was supplied (#235)
* Modify order validation methods to validate against the `latest` block, not against the `pending` block (#236)
## v0.26.0 - _November 21, 2017_
## v0.26.0 - _November 20, 2017_
* Add post-formatter for logs converting `blockNumber`, `logIndex`, `transactionIndex` from hexes to numbers (#231)
* Remove support for Async callback types when used in Subscribe functions (#222)
* In OrderWatcher subscribe to ZRX Token Transfer and Approval events when maker token is different (#225)
## v0.25.1 - _November 13, 2017_
## v0.25.1 - _November 12, 2017_
* Standardise on Cancelled over Canceled (#217)
* Add missing `DecodedLogEvent` type to exported types (#205)
* Normalized the transactionReceipt status to be `null|0|1`, 1 meaning transaction execution successful, 0 unsuccessful and `null` if it is a pre-byzantinium transaction. (#200)
## v0.23.0 - _November 12, 2017_
## v0.23.0 - _November 11, 2017_
* Fixed unhandled promise rejection error in subscribe methods (#209)
* Subscribe callbacks now receive an error object as their first argument
## v0.22.6 - _November 10, 2017_
## v0.22.6 - _November 9, 2017_
* Add a timeout parameter to transaction awaiting (#206)
## v0.22.5 - _November 7, 2017_
## v0.22.5 - _November 6, 2017_
* Re-publish v0.22.4 to fix publishing issue
## v0.22.4 - _October 25, 2017_
## v0.22.4 - _October 24, 2017_
* Upgraded bignumber.js to a new version that ships with native typings
## v0.22.3 - _October 25, 2017_
## v0.22.3 - _October 24, 2017_
* Fixed an issue with new version of testrpc and unlimited proxy allowance (#199)
## v0.22.2 - _October 24, 2017_
## v0.22.2 - _October 23, 2017_
* Fixed rounding of maker fill amount and incorrect validation of partial fees (#197)
## v0.22.0 - _October 16, 2017_
## v0.22.0 - _October 15, 2017_
* Started using `OrderFillRequest` interface instead of `OrderFillOrKillRequest` interface for `zeroEx.exchange.batchFillOrKill` (#187)
* Removed `OrderFillOrKillRequest` (#187)
## v0.21.4 - _October 13, 2017_
## v0.21.4 - _October 12, 2017_
* Made 0x.js more type-safe by making `getLogsAsync` and `subscribe/subscribeAsync` generics parametrized with arg type (#194)
## v0.21.3 - _October 12, 2017_
## v0.21.3 - _October 11, 2017_
* Fixed a bug causing order fills to throw `INSUFFICIENT_TAKER_ALLOWANCE` (#193)
## v0.21.2 - _October 11, 2017_
## v0.21.2 - _October 10, 2017_
* Exported `ContractEventArg` as a public type (#190)
## v0.21.1 - _October 11, 2017_
## v0.21.1 - _October 10, 2017_
* Fixed a bug in subscriptions (#189)
## v0.21.0 - _October 10, 2017_
## v0.21.0 - _October 9, 2017_
* Complete rewrite of subscription logic (#182)
* Subscriptions no longer return historical logs. If you want them - use `getLogsAsync`
* Subscriptions now use [ethereumjs-blockstream](https://github.com/ethereumjs/ethereumjs-blockstream) under the hood
* Subscriptions correctly handle block re-orgs (forks)
* Subscriptions correctly backfill logs (connection problems)
* They no longer setup filters on the underlying nodes, so you can use them with infura without a filter Subprovider
* Removed `ContractEventEmitter` and added `LogEvent`
* Renamed `zeroEx.token.subscribeAsync` to `zeroEx.token.subscribe`
* Added `zeroEx.token.unsubscribe` and `zeroEx.exchange.unsubscribe`
* Renamed `zeroEx.exchange.stopWatchingAllEventsAsync` to `zeroEx.exhange.unsubscribeAll`
* Renamed `zeroEx.token.stopWatchingAllEventsAsync` to `zeroEx.token.unsubscribeAll`
* Subscriptions no longer return historical logs. If you want them - use `getLogsAsync`
* Subscriptions now use [ethereumjs-blockstream](https://github.com/ethereumjs/ethereumjs-blockstream) under the hood
* Subscriptions correctly handle block re-orgs (forks)
* Subscriptions correctly backfill logs (connection problems)
* They no longer setup filters on the underlying nodes, so you can use them with infura without a filter Subprovider
* Removed `ContractEventEmitter` and added `LogEvent`
* Renamed `zeroEx.token.subscribeAsync` to `zeroEx.token.subscribe`
* Added `zeroEx.token.unsubscribe` and `zeroEx.exchange.unsubscribe`
* Renamed `zeroEx.exchange.stopWatchingAllEventsAsync` to `zeroEx.exhange.unsubscribeAll`
* Renamed `zeroEx.token.stopWatchingAllEventsAsync` to `zeroEx.token.unsubscribeAll`
* Fixed the batch fills validation by emulating all balance & proxy allowance changes (#185)
## v0.20.0 - _October 5, 2017_
## v0.20.0 - _October 4, 2017_
* Add `zeroEx.token.getLogsAsync` (#178)
* Add `zeroEx.exchange.getLogsAsync` (#178)
* Fixed fees validation when one of the tokens transferred is ZRX (#181)
## v0.19.0 - _September 29, 2017_
## v0.19.0 - _September 28, 2017_
* Made order validation optional (#172)
* Added Ropsten testnet support (#173)
* Fixed a bug causing awaitTransactionMinedAsync to DDos backend nodes (#175)
## v0.18.0 - _September 26, 2017_
## v0.18.0 - _September 25, 2017_
* Added `zeroEx.exchange.validateOrderFillableOrThrowAsync` to simplify orderbook pruning (#170)
## v0.17.0 - _September 26, 2017_
## v0.17.0 - _September 25, 2017_
* Made `zeroEx.exchange.getZRXTokenAddressAsync` public (#171)
## v0.16.0 - _September 20, 2017_
## v0.16.0 - _September 19, 2017_
* Added the ability to specify custom contract addresses to be used with 0x.js (#165)
* ZeroExConfig.exchangeContractAddress
* ZeroExConfig.tokenRegistryContractAddress
* ZeroExConfig.etherTokenContractAddress
* ZeroExConfig.exchangeContractAddress
* ZeroExConfig.tokenRegistryContractAddress
* ZeroExConfig.etherTokenContractAddress
* Added `zeroEx.tokenRegistry.getContractAddressAsync` (#165)
## v0.15.0 - _September 8, 2017_
## v0.15.0 - _September 7, 2017_
* Added the ability to specify a historical `blockNumber` at which to query the blockchain's state when calling a token or exchange method (#161)
## v0.14.2 - _September 7, 2017_
## v0.14.2 - _September 6, 2017_
* Fixed an issue with bignumber.js types not found (#160)
## v0.14.1 - _September 7, 2017_
## v0.14.1 - _September 6, 2017_
* Fixed an issue with Artifact type not found (#159)
## v0.14.0 - _September 6, 2017_
## v0.14.0 - _September 5, 2017_
* Added `zeroEx.exchange.throwLogErrorsAsErrors` method to public interface (#157)
* Fixed an issue with overlapping async intervals in `zeroEx.awaitTransactionMinedAsync` (#157)
* Fixed an issue with log decoder returning `BigNumber`s as `strings` (#157)
## v0.13.0 - _September 6, 2017_
## v0.13.0 - _September 5, 2017_
* Made all the functions submitting transactions to the network to immediately return transaction hash (#151)
* Added `zeroEx.awaitTransactionMinedAsync` (#151)
* Added `TransactionReceiptWithDecodedLogs`, `LogWithDecodedArgs`, `DecodedLogArgs` to public types (#151)
* Added signature validation to `validateFillOrderThrowIfInvalidAsync` (#152)
## v0.12.1 - _September 2, 2017_
## v0.12.1 - _September 1, 2017_
* Added the support for web3@1.x.x provider (#142)
* Added the optional `zeroExConfig` parameter to the constructor of `ZeroEx` (#139)
* Added the ability to specify `gasPrice` when instantiating `ZeroEx` (#139)
## v0.11.0 - _August 24, 2017_
## v0.11.0 - _August 23, 2017_
* Added `zeroEx.token.setUnlimitedProxyAllowanceAsync` (#137)
* Added `zeroEx.token.setUnlimitedAllowanceAsync` (#137)
* Added `zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS` (#137)
## v0.10.4 - _Aug 24, 2017_
## v0.10.4 - _August 23, 2017_
* Fixed a bug where checksummed addresses were being pulled from artifacts and not lower-cased. (#135)
## v0.10.1 - _Aug 24, 2017_
## v0.10.1 - _August 23, 2017_
* Added `zeroEx.exchange.validateFillOrderThrowIfInvalidAsync` (#128)
* Added `zeroEx.exchange.validateFillOrKillOrderThrowIfInvalidAsync` (#128)
@@ -252,20 +350,20 @@
* Added clear error message when checksummed address is passed to a public method (#124)
* Fixes the description of `shouldThrowOnInsufficientBalanceOrAllowance` in docs (#127)
## v0.9.3 - _Aug 22, 2017_
## v0.9.3 - _August 21, 2017_
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
## v0.9.2 - _Aug 21, 2017_
## v0.9.2 - _August 20, 2017_
* *This version was unpublished because of a publishing issue.*
* Update contract artifacts to include latest Kovan and Mainnet deploys (#118)
## v0.9.1 - _Aug. 16, 2017_
## v0.9.1 - _August 15, 2017_
* Fixed the bug causing `zeroEx.token.getBalanceAsync()` to fail if no addresses available (#120)
## v0.9.0 - _Jul. 26, 2017_
## v0.9.0 - _July 25, 2017_
* Migrated to the new version of smart contracts (#101)
* Removed the ability to call methods on multiple authorized Exchange smart contracts (#106)
@@ -276,48 +374,48 @@
* Updated to typescript v2.4 (#104)
* Fixed an issue with incorrect balance/allowance validation when ZRX is one of the tokens traded (#109)
## v0.8.0 - _Jul. 4, 2017_
## v0.8.0 - _July 3, 2017_
* Added the ability to call methods on different authorized versions of the Exchange smart contract (#82)
* Updated contract artifacts to reflect latest changes to the smart contracts (0xproject/contracts#59)
* Added `zeroEx.proxy.isAuthorizedAsync` and `zeroEx.proxy.getAuthorizedAddressesAsync` (#89)
* Added `zeroEx.token.subscribeAsync` (#90)
* Made contract invalidation functions private (#90)
* `zeroEx.token.invalidateContractInstancesAsync`
* `zeroEx.exchange.invalidateContractInstancesAsync`
* `zeroEx.proxy.invalidateContractInstance`
* `zeroEx.tokenRegistry.invalidateContractInstance`
* `zeroEx.token.invalidateContractInstancesAsync`
* `zeroEx.exchange.invalidateContractInstancesAsync`
* `zeroEx.proxy.invalidateContractInstance`
* `zeroEx.tokenRegistry.invalidateContractInstance`
* Fixed the bug where `zeroEx.setProviderAsync` didn't invalidate etherToken contract's instance
## v0.7.1 - _Jun. 26, 2017_
## v0.7.1 - _June 25, 2017_
* Added the ability to convert Ether to wrapped Ether tokens and back via `zeroEx.etherToken.depostAsync` and `zeroEx.etherToken.withdrawAsync` (#81)
## v0.7.0 - _Jun. 22, 2017_
## v0.7.0 - _June 21, 2017_
* Added Kovan smart contract artifacts (#78)
* Started returning fillAmount from `fillOrderAsync` and `fillUpToAsync` (#72)
* Started returning cancelledAmount from `cancelOrderAsync` (#72)
* Renamed type `LogCancelArgs` to `LogCancelContractEventArgs` and `LogFillArgs` to `LogFillContractEventArgs`
## v0.6.2 - _Jun. 21, 2017_
## v0.6.2 - _June 20, 2017_
* Reduced bundle size
* Improved documentation
## v0.6.1 - _Jun. 19, 2017_
## v0.6.1 - _June 18, 2017_
* Improved documentation
## v0.6.0 - _Jun. 19, 2017_
## v0.6.0 - _June 18, 2017_
* Made `ZeroEx` class accept `Web3Provider` instance instead of `Web3` instance
* Added types for contract event arguments
## v0.5.2 - _Jun. 15, 2017_
## v0.5.2 - _June 14, 2017_
* Fixed the bug in `postpublish` script that caused that only unminified UMD bundle was uploaded to release page
## v0.5.1 - _Jun. 15, 2017_
## v0.5.1 - _June 14, 2017_
* Added `postpublish` script to publish to Github Releases with assets.

View File

@@ -1,5 +1,9 @@
## 0x.js
A TypeScript/Javascript library for interacting with the 0x protocol.
### Read the [Documentation](https://0xproject.com/docs/0x.js).
## Installation
0x.js ships as both a [UMD](https://github.com/umdjs/umd) module and a [CommonJS](https://en.wikipedia.org/wiki/CommonJS) package.
@@ -20,11 +24,10 @@ import { ZeroEx } from '0x.js';
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```
"include": [
"./node_modules/web3-typescript-typings/index.d.ts",
"./node_modules/ethers-typescript-typings/index.d.ts"
]
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
}
```
#### UMD:
@@ -39,10 +42,54 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
<script type="text/javascript" src="0x.js"></script>
```
## Documentation
## Contributing
Extensive documentation of 0x.js can be found on [our website][docs-url].
We strongly recommend that the community help us make improvements and determine the future direction of 0x protocol. To report bugs within this package, please create an issue in this repository.
[website-url]: https://0xproject.com/
[whitepaper-url]: https://0xproject.com/pdfs/0x_white_paper.pdf
[docs-url]: https://0xproject.com/docs/0xjs
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=0x.js yarn build
```
Or continuously rebuild on change:
```bash
PKG=0x.js yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -1,6 +1,9 @@
{
"name": "0x.js",
"version": "0.33.2",
"version": "1.0.1-rc.1",
"engines": {
"node": ">=6.12"
},
"description": "A javascript library for interacting with the 0x protocol",
"keywords": [
"0x.js",
@@ -12,37 +15,50 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"prebuild": "run-s clean generate_contract_wrappers",
"build": "run-p build:umd:prod build:commonjs; exit 0;",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"watch_without_deps": "yarn pre_build && tsc -w",
"build": "yarn pre_build && yarn build:all && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"build:all": "run-p build:umd:prod build:commonjs; exit 0;",
"pre_build": "run-s update_artifacts generate_contract_wrappers",
"copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
"update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;",
"generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(ZRXToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers",
"lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*",
"test:circleci": "run-s test:coverage",
"test": "run-s clean test:commonjs",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"update_contracts": "for i in ${npm_package_config_artifacts}; do copyfiles -u 4 ../contracts/build/contracts/$i.json ../0x.js/src/artifacts; done;",
"clean": "shx rm -rf _bundles lib test_temp scripts",
"clean": "shx rm -rf _bundles lib test_temp scripts src/generated_contract_wrappers",
"build:umd:prod": "NODE_ENV=production webpack",
"build:commonjs": "tsc && copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"test:commonjs": "run-s build:commonjs run_mocha",
"run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit"
"build:commonjs": "tsc && yarn copy_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
"docs:stage": "node scripts/stage_docs.js",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
},
"config": {
"artifacts": "TokenTransferProxy Exchange TokenRegistry Token EtherToken",
"contracts": "ZRXToken",
"postpublish": {
"assets": [
"packages/0x.js/_bundles/index.js",
"packages/0x.js/_bundles/index.min.js"
"_bundles/index.js",
"_bundles/index.min.js"
],
"docPublishConfigs": {
"extraFileIncludes": [
"../types/src/index.ts"
"../types/src/index.ts",
"../ethereum-types/src/index.ts",
"../contract-wrappers/src/types.ts",
"../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/exchange_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts",
"../order-watcher/src/order_watcher/order_watcher.ts"
],
"s3BucketPath": "s3://0xjs-docs-jsons/",
"s3StagingBucketPath": "s3://staging-0xjs-docs-jsons/"
"s3BucketPath": "s3://doc-jsons/0x.js/",
"s3StagingBucketPath": "s3://staging-doc-jsons/0x.js/"
}
}
},
@@ -51,67 +67,50 @@
"url": "https://github.com/0xProject/0x-monorepo"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/abi-gen": "^0.2.6",
"@0xproject/dev-utils": "^0.3.0",
"@0xproject/monorepo-scripts": "^0.1.13",
"@0xproject/tslint-config": "^0.4.11",
"@types/bintrees": "^1.0.2",
"@types/jsonschema": "^1.1.1",
"@types/lodash": "^4.14.86",
"@0xproject/abi-gen": "^1.0.2",
"@0xproject/dev-utils": "^1.0.2",
"@0xproject/migrations": "^1.0.2",
"@0xproject/monorepo-scripts": "^1.0.3",
"@0xproject/tslint-config": "^1.0.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
"@types/sinon": "^2.2.2",
"@types/uuid": "^3.4.2",
"awesome-typescript-loader": "^3.1.3",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-as-promised-typescript-typings": "^0.0.11",
"chai-bignumber": "^2.0.1",
"chai-typescript-typings": "^0.0.5",
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"json-loader": "^0.5.4",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"opn-cli": "^3.1.0",
"prettier": "^1.11.1",
"request": "^2.81.0",
"request-promise-native": "^1.0.5",
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"truffle-hdwallet-provider": "^0.0.3",
"tslint": "5.8.0",
"tslint": "5.11.0",
"typedoc": "0xProject/typedoc",
"types-bn": "^0.0.1",
"typescript": "2.7.1",
"web3-provider-engine": "^13.0.1",
"webpack": "^3.1.0"
},
"dependencies": {
"@0xproject/assert": "^0.2.1",
"@0xproject/base-contract": "^0.0.4",
"@0xproject/json-schemas": "^0.7.15",
"@0xproject/types": "^0.4.0",
"@0xproject/utils": "^0.4.2",
"@0xproject/web3-wrapper": "^0.3.0",
"bintrees": "^1.0.2",
"bn.js": "^4.11.8",
"ethereumjs-abi": "^0.6.4",
"ethereumjs-blockstream": "^2.0.6",
"ethereumjs-util": "^5.1.1",
"ethers-contracts": "^2.2.1",
"ethers-typescript-typings": "^0.0.3",
"js-sha3": "^0.7.0",
"lodash": "^4.17.4",
"uuid": "^3.1.0",
"web3": "^0.20.0",
"web3-typescript-typings": "^0.10.1"
"@0xproject/assert": "^1.0.2",
"@0xproject/base-contract": "^1.0.2",
"@0xproject/contract-wrappers": "^1.0.1-rc.1",
"@0xproject/order-utils": "^1.0.1-rc.1",
"@0xproject/sol-compiler": "^1.0.2",
"@0xproject/subproviders": "^1.0.2",
"@0xproject/types": "^1.0.1-rc.1",
"@0xproject/typescript-typings": "^1.0.2",
"@0xproject/utils": "^1.0.2",
"@0xproject/web3-wrapper": "^1.1.0",
"ethereum-types": "^1.0.2",
"ethers": "3.0.22",
"lodash": "^4.17.4"
},
"publishConfig": {
"access": "public"

View File

@@ -1,26 +1,31 @@
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
import { ECSignature, Order, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils';
import { assert } from '@0xproject/assert';
import {
ContractWrappers,
ContractWrappersConfig,
ERC20ProxyWrapper,
ERC20TokenWrapper,
ERC721ProxyWrapper,
ERC721TokenWrapper,
EtherTokenWrapper,
ExchangeWrapper,
} from '@0xproject/contract-wrappers';
import {
assetDataUtils,
ecSignOrderHashAsync,
generatePseudoRandomSalt,
isValidSignatureAsync,
MessagePrefixOpts,
orderHashUtils,
} from '@0xproject/order-utils';
// HACK: Since we export assetDataUtils from ZeroEx and it has AssetProxyId, ERC20AssetData and ERC721AssetData
// in it's public interface, we need to import these types here.
// tslint:disable-next-line:no-unused-variable
import { AssetProxyId, ECSignature, ERC20AssetData, ERC721AssetData, Order, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { artifacts } from './artifacts';
import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper';
import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper';
import { TokenWrapper } from './contract_wrappers/token_wrapper';
import { OrderStateWatcher } from './order_watcher/order_state_watcher';
import { zeroExConfigSchema } from './schemas/zero_ex_config_schema';
import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema';
import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema';
import { Web3Provider, ZeroExConfig, ZeroExError } from './types';
import { assert } from './utils/assert';
import { constants } from './utils/constants';
import { decorators } from './utils/decorators';
import { signatureUtils } from './utils/signature_utils';
import { utils } from './utils/utils';
/**
* The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality
@@ -33,67 +38,50 @@ export class ZeroEx {
* this constant for your convenience.
*/
public static NULL_ADDRESS = constants.NULL_ADDRESS;
/**
* An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
*/
public exchange: ExchangeWrapper;
/**
* An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x
* TokenRegistry smart contract.
* An instance of the ERC20TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
*/
public tokenRegistry: TokenRegistryWrapper;
public erc20Token: ERC20TokenWrapper;
/**
* An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
* An instance of the ERC721TokenWrapper class containing methods for interacting with any ERC721 token smart contract.
*/
public token: TokenWrapper;
public erc721Token: ERC721TokenWrapper;
/**
* An instance of the EtherTokenWrapper class containing methods for interacting with the
* wrapped ETH ERC20 token smart contract.
*/
public etherToken: EtherTokenWrapper;
/**
* An instance of the TokenTransferProxyWrapper class containing methods for interacting with the
* tokenTransferProxy smart contract.
* An instance of the ERC20ProxyWrapper class containing methods for interacting with the
* ERC20 proxy smart contract.
*/
public proxy: TokenTransferProxyWrapper;
public erc20Proxy: ERC20ProxyWrapper;
/**
* An instance of the OrderStateWatcher class containing methods for watching a set of orders for relevant
* blockchain state changes.
* An instance of the ERC721ProxyWrapper class containing methods for interacting with the
* ERC721 proxy smart contract.
*/
public orderStateWatcher: OrderStateWatcher;
private _web3Wrapper: Web3Wrapper;
private _abiDecoder: AbiDecoder;
/**
* Verifies that the elliptic curve signature `signature` was generated
* by signing `data` with the private key corresponding to the `signerAddress` address.
* @param data The hex encoded data signed by the supplied signature.
* @param signature An object containing the elliptic curve signature parameters.
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
* @return Whether the signature is valid for the supplied signerAddress and data.
*/
public static isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
assert.isHexString('data', data);
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddress', signerAddress);
const normalizedSignerAddress = signerAddress.toLowerCase();
const isValidSignature = signatureUtils.isValidSignature(data, signature, normalizedSignerAddress);
return isValidSignature;
}
public erc721Proxy: ERC721ProxyWrapper;
private readonly _contractWrappers: ContractWrappers;
/**
* Generates a pseudo-random 256-bit salt.
* The salt can be included in an 0x order, ensuring that the order generates a unique orderHash
* The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
* and will not collide with other outstanding orders that are identical in all other parameters.
* @return A pseudo-random 256-bit number that can be used as a salt.
*/
public static generatePseudoRandomSalt(): BigNumber {
// BigNumber.random returns a pseudo-random number between 0 & 1 with a passed in number of decimal places.
// Source: https://mikemcl.github.io/bignumber.js/#random
const randomNumber = BigNumber.random(constants.MAX_DIGITS_IN_UNSIGNED_256_INT);
const factor = new BigNumber(10).pow(constants.MAX_DIGITS_IN_UNSIGNED_256_INT - 1);
const salt = randomNumber.times(factor).round();
return salt;
return generatePseudoRandomSalt();
}
/**
* Computes the orderHash for a supplied order.
* @param order An object that conforms to the Order or SignedOrder interface definitions.
* @return The resulting orderHash from hashing the supplied order.
*/
public static getOrderHashHex(order: Order | SignedOrder): string {
return orderHashUtils.getOrderHashHex(order);
}
/**
* Checks if the supplied hex encoded order hash is valid.
@@ -103,12 +91,7 @@ export class ZeroEx {
* @return Whether the supplied orderHash has the expected format.
*/
public static isValidOrderHash(orderHash: string): boolean {
// Since this method can be called to check if any arbitrary string conforms to an orderHash's
// format, we only assert that we were indeed passed a string.
assert.isString('orderHash', orderHash);
const schemaValidator = new SchemaValidator();
const isValidOrderHash = schemaValidator.validate(orderHash, schemas.orderHashSchema).valid;
return isValidOrderHash;
return orderHashUtils.isValidOrderHash(orderHash);
}
/**
* A unit amount is defined as the amount of a token above the specified decimal places (integer part).
@@ -121,10 +104,8 @@ export class ZeroEx {
public static toUnitAmount(amount: BigNumber, decimals: number): BigNumber {
assert.isValidBaseUnitAmount('amount', amount);
assert.isNumber('decimals', decimals);
const aUnit = new BigNumber(10).pow(decimals);
const unit = amount.div(aUnit);
return unit;
const unitAmount = Web3Wrapper.toUnitAmount(amount, decimals);
return unitAmount;
}
/**
* A baseUnit is defined as the smallest denomination of a token. An amount expressed in baseUnits
@@ -137,73 +118,93 @@ export class ZeroEx {
public static toBaseUnitAmount(amount: BigNumber, decimals: number): BigNumber {
assert.isBigNumber('amount', amount);
assert.isNumber('decimals', decimals);
const unit = new BigNumber(10).pow(decimals);
const baseUnitAmount = amount.times(unit);
const hasDecimals = baseUnitAmount.decimalPlaces() !== 0;
if (hasDecimals) {
throw new Error(`Invalid unit amount: ${amount.toString()} - Too many decimal places`);
}
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, decimals);
return baseUnitAmount;
}
/**
* Computes the orderHash for a supplied order.
* @param order An object that conforms to the Order or SignedOrder interface definitions.
* @return The resulting orderHash from hashing the supplied order.
* Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or
* takerAssetData fields in a 0x order.
* @param tokenAddress The ERC20 token address to encode
* @return The hex encoded assetData string
*/
@decorators.syncZeroExErrorHandler
public static getOrderHashHex(order: Order | SignedOrder): string {
assert.doesConformToSchema('order', order, schemas.orderSchema);
const orderHashHex = utils.getOrderHashHex(order);
return orderHashHex;
public static encodeERC20AssetData(tokenAddress: string): string {
return assetDataUtils.encodeERC20AssetData(tokenAddress);
}
/**
* Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId
* @param assetData Hex encoded assetData string to decode
* @return An object containing the decoded tokenAddress & assetProxyId
*/
public static decodeERC20AssetData(assetData: string): ERC20AssetData {
return assetDataUtils.decodeERC20AssetData(assetData);
}
/**
* Encodes an ERC721 token address into a hex encoded assetData string, usable in the makerAssetData or
* takerAssetData fields in a 0x order.
* @param tokenAddress The ERC721 token address to encode
* @param tokenId The ERC721 tokenId to encode
* @return The hex encoded assetData string
*/
public static encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
return assetDataUtils.encodeERC721AssetData(tokenAddress, tokenId);
}
/**
* Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId
* @param assetData Hex encoded assetData string to decode
* @return An object containing the decoded tokenAddress, tokenId & assetProxyId
*/
public static decodeERC721AssetData(assetData: string): ERC721AssetData {
return assetDataUtils.decodeERC721AssetData(assetData);
}
/**
* Decode and return the assetProxyId from the assetData
* @param assetData Hex encoded assetData string to decode
* @return The assetProxyId
*/
public static decodeAssetProxyId(assetData: string): AssetProxyId {
return assetDataUtils.decodeAssetProxyId(assetData);
}
/**
* Decode any assetData into it's corresponding assetData object
* @param assetData Hex encoded assetData string to decode
* @return Either a ERC20 or ERC721 assetData object
*/
public static decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData {
return assetDataUtils.decodeAssetDataOrThrow(assetData);
}
/**
* Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library.
* @param provider The Web3.js Provider instance you would like the 0x.js library to use for interacting with
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
* the Ethereum network.
* @param config The configuration object. Look up the type for the description.
* @return An instance of the 0x.js ZeroEx class.
*/
constructor(provider: Web3Provider, config: ZeroExConfig) {
constructor(provider: Provider, config: ContractWrappersConfig) {
assert.isWeb3Provider('provider', provider);
assert.doesConformToSchema('config', config, zeroExConfigSchema, [
zeroExPrivateNetworkConfigSchema,
zeroExPublicNetworkConfigSchema,
]);
const artifactJSONs = _.values(artifacts);
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
this._abiDecoder = new AbiDecoder(abiArrays);
const defaults = {
gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(provider, defaults);
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
config.networkId,
config.tokenTransferProxyContractAddress,
);
this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this._abiDecoder, this.proxy);
this.exchange = new ExchangeWrapper(
this._web3Wrapper,
config.networkId,
this._abiDecoder,
this.token,
config.exchangeContractAddress,
config.zrxContractAddress,
);
this.tokenRegistry = new TokenRegistryWrapper(
this._web3Wrapper,
config.networkId,
config.tokenRegistryContractAddress,
);
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this._abiDecoder, this.token);
this.orderStateWatcher = new OrderStateWatcher(
this._web3Wrapper,
this._abiDecoder,
this.token,
this.exchange,
config.orderWatcherConfig,
this._contractWrappers = new ContractWrappers(provider, config);
this.erc20Proxy = this._contractWrappers.erc20Proxy;
this.erc721Proxy = this._contractWrappers.erc721Proxy;
this.erc20Token = this._contractWrappers.erc20Token;
this.erc721Token = this._contractWrappers.erc721Token;
this.exchange = this._contractWrappers.exchange;
this.etherToken = this._contractWrappers.etherToken;
}
/**
* Verifies that the provided signature is valid according to the 0x Protocol smart contracts
* @param data The hex encoded data signed by the supplied signature.
* @param signature The hex encoded signature.
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
* @return Whether the signature is valid for the supplied signerAddress and data.
*/
public async isValidSignatureAsync(data: string, signature: string, signerAddress: string): Promise<boolean> {
const isValid = await isValidSignatureAsync(
this._contractWrappers.getProvider(),
data,
signature,
signerAddress,
);
return isValid;
}
/**
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
@@ -211,25 +212,24 @@ export class ZeroEx {
* @param provider The Web3Provider you would like the 0x.js library to use from now on.
* @param networkId The id of the network your provider is connected to
*/
public setProvider(provider: Web3Provider, networkId: number): void {
this._web3Wrapper.setProvider(provider);
(this.exchange as any)._invalidateContractInstances();
(this.exchange as any)._setNetworkId(networkId);
(this.tokenRegistry as any)._invalidateContractInstance();
(this.tokenRegistry as any)._setNetworkId(networkId);
(this.token as any)._invalidateContractInstances();
(this.token as any)._setNetworkId(networkId);
(this.proxy as any)._invalidateContractInstance();
(this.proxy as any)._setNetworkId(networkId);
(this.etherToken as any)._invalidateContractInstance();
(this.etherToken as any)._setNetworkId(networkId);
public setProvider(provider: Provider, networkId: number): void {
this._contractWrappers.setProvider(provider, networkId);
}
/**
* Get the provider instance currently used by 0x.js
* @return Web3 provider instance
*/
public getProvider(): Provider {
return this._contractWrappers.getProvider();
}
/**
* Get user Ethereum addresses available through the supplied web3 provider available for sending transactions.
* @return An array of available user Ethereum addresses.
*/
public async getAvailableAddressesAsync(): Promise<string[]> {
const availableAddresses = await this._web3Wrapper.getAvailableAddressesAsync();
// Hack: Get Web3Wrapper from ContractWrappers
const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper;
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
return availableAddresses;
}
/**
@@ -237,53 +237,22 @@ export class ZeroEx {
* This method currently supports TestRPC, Geth and Parity above and below V1.6.6
* @param orderHash Hex encoded orderHash to sign.
* @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address
* must be available via the Web3.Provider supplied to 0x.js.
* @param shouldAddPersonalMessagePrefix Some signers add the personal message prefix `\x19Ethereum Signed Message`
* themselves (e.g Parity Signer, Ledger, TestRPC) and others expect it to already be done by the client
* (e.g Metamask). Depending on which signer this request is going to, decide on whether to add the prefix
* before sending the request.
* must be available via the Provider supplied to 0x.js.
* @param MessagePrefixOpts Options regarding the desired prefix and whether to add it before calling `eth_sign`
* @return An object containing the Elliptic curve signature parameters generated by signing the orderHash.
*/
public async signOrderHashAsync(
public async ecSignOrderHashAsync(
orderHash: string,
signerAddress: string,
shouldAddPersonalMessagePrefix: boolean,
messagePrefixOpts: MessagePrefixOpts,
): Promise<ECSignature> {
assert.isHexString('orderHash', orderHash);
await assert.isSenderAddressAsync('signerAddress', signerAddress, this._web3Wrapper);
const normalizedSignerAddress = signerAddress.toLowerCase();
let msgHashHex = orderHash;
if (shouldAddPersonalMessagePrefix) {
const orderHashBuff = ethUtil.toBuffer(orderHash);
const msgHashBuff = ethUtil.hashPersonalMessage(orderHashBuff);
msgHashHex = ethUtil.bufferToHex(msgHashBuff);
}
const signature = await this._web3Wrapper.signTransactionAsync(normalizedSignerAddress, msgHashHex);
// HACK: There is no consensus on whether the signatureHex string should be formatted as
// v + r + s OR r + s + v, and different clients (even different versions of the same client)
// return the signature params in different orders. In order to support all client implementations,
// we parse the signature in both ways, and evaluate if either one is a valid signature.
const validVParamValues = [27, 28];
const ecSignatureVRS = signatureUtils.parseSignatureHexAsVRS(signature);
if (_.includes(validVParamValues, ecSignatureVRS.v)) {
const isValidVRSSignature = ZeroEx.isValidSignature(orderHash, ecSignatureVRS, normalizedSignerAddress);
if (isValidVRSSignature) {
return ecSignatureVRS;
}
}
const ecSignatureRSV = signatureUtils.parseSignatureHexAsRSV(signature);
if (_.includes(validVParamValues, ecSignatureRSV.v)) {
const isValidRSVSignature = ZeroEx.isValidSignature(orderHash, ecSignatureRSV, normalizedSignerAddress);
if (isValidRSVSignature) {
return ecSignatureRSV;
}
}
throw new Error(ZeroExError.InvalidSignature);
const signature = await ecSignOrderHashAsync(
this._contractWrappers.getProvider(),
orderHash,
signerAddress,
messagePrefixOpts,
);
return signature;
}
/**
* Waits for a transaction to be mined and returns the transaction receipt.
@@ -294,56 +263,16 @@ export class ZeroEx {
*/
public async awaitTransactionMinedAsync(
txHash: string,
pollingIntervalMs = 1000,
pollingIntervalMs: number = 1000,
timeoutMs?: number,
): Promise<TransactionReceiptWithDecodedLogs> {
let timeoutExceeded = false;
if (timeoutMs) {
setTimeout(() => (timeoutExceeded = true), timeoutMs);
}
const txReceiptPromise = new Promise(
(resolve: (receipt: TransactionReceiptWithDecodedLogs) => void, reject) => {
const intervalId = intervalUtils.setAsyncExcludingInterval(
async () => {
if (timeoutExceeded) {
intervalUtils.clearAsyncExcludingInterval(intervalId);
return reject(ZeroExError.TransactionMiningTimeout);
}
const transactionReceipt = await this._web3Wrapper.getTransactionReceiptAsync(txHash);
if (!_.isNull(transactionReceipt)) {
intervalUtils.clearAsyncExcludingInterval(intervalId);
const logsWithDecodedArgs = _.map(
transactionReceipt.logs,
this._abiDecoder.tryToDecodeLogOrNoop.bind(this._abiDecoder),
);
const transactionReceiptWithDecodedLogArgs: TransactionReceiptWithDecodedLogs = {
...transactionReceipt,
logs: logsWithDecodedArgs,
};
resolve(transactionReceiptWithDecodedLogArgs);
}
},
pollingIntervalMs,
(err: Error) => {
intervalUtils.clearAsyncExcludingInterval(intervalId);
reject(err);
},
);
},
// Hack: Get Web3Wrapper from ContractWrappers
const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper;
const transactionReceiptWithDecodedLogs = await web3Wrapper.awaitTransactionMinedAsync(
txHash,
pollingIntervalMs,
timeoutMs,
);
const txReceipt = await txReceiptPromise;
return txReceipt;
}
/*
* HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from
* an `ExchangeWrapper`. `ExchangeWrapper` needs `TokenWrapper` to validate orders, creating a dependency cycle.
* In order to break this - we create this function here and pass it as a parameter to the `TokenWrapper`
* and `ProxyWrapper`.
*/
private async _getTokenTransferProxyAddressAsync(): Promise<string> {
const tokenTransferProxyAddress = await (this.exchange as any)._getTokenTransferProxyAddressAsync();
return tokenTransferProxyAddress;
return transactionReceiptWithDecodedLogs;
}
}

View File

@@ -1,18 +1,7 @@
import * as DummyTokenArtifact from './artifacts/DummyToken.json';
import * as EtherTokenArtifact from './artifacts/EtherToken.json';
import * as ExchangeArtifact from './artifacts/Exchange.json';
import * as TokenArtifact from './artifacts/Token.json';
import * as TokenRegistryArtifact from './artifacts/TokenRegistry.json';
import * as TokenTransferProxyArtifact from './artifacts/TokenTransferProxy.json';
import * as ZRXArtifact from './artifacts/ZRX.json';
import { Artifact } from './types';
import { ContractArtifact } from '@0xproject/sol-compiler';
import * as ZRXToken from './artifacts/ZRXToken.json';
export const artifacts = {
ZRXArtifact: (ZRXArtifact as any) as Artifact,
DummyTokenArtifact: (DummyTokenArtifact as any) as Artifact,
TokenArtifact: (TokenArtifact as any) as Artifact,
ExchangeArtifact: (ExchangeArtifact as any) as Artifact,
EtherTokenArtifact: (EtherTokenArtifact as any) as Artifact,
TokenRegistryArtifact: (TokenRegistryArtifact as any) as Artifact,
TokenTransferProxyArtifact: (TokenTransferProxyArtifact as any) as Artifact,
ZRXToken: (ZRXToken as any) as ContractArtifact,
};

View File

@@ -1,22 +0,0 @@
{
"contract_name": "DummyToken",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_target",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "setBalance",
"outputs": [],
"payable": false,
"type": "function"
}
]
}

View File

@@ -1,287 +0,0 @@
{
"contract_name": "EtherToken",
"abi": [
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "amount",
"type": "uint256"
}
],
"name": "withdraw",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "deposit",
"outputs": [],
"payable": true,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"payable": true,
"type": "fallback"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Deposit",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Withdrawal",
"type": "event"
}
],
"networks": {
"1": {
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
},
"3": {
"address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a"
},
"4": {
"address": "0xc778417e063141139fce010982780140aa0cd5ab"
},
"42": {
"address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1"
},
"50": {
"address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c"
}
}
}

View File

@@ -1,172 +0,0 @@
{
"contract_name": "Token",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "supply",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "balance",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "success",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "remaining",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_owner",
"type": "address"
},
{
"indexed": true,
"name": "_spender",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
}
]
}

View File

@@ -1,547 +0,0 @@
{
"contract_name": "TokenRegistry",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_index",
"type": "uint256"
}
],
"name": "removeToken",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_name",
"type": "string"
}
],
"name": "getTokenAddressByName",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_symbol",
"type": "string"
}
],
"name": "getTokenAddressBySymbol",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_swarmHash",
"type": "bytes"
}
],
"name": "setTokenSwarmHash",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_token",
"type": "address"
}
],
"name": "getTokenMetaData",
"outputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint8"
},
{
"name": "",
"type": "bytes"
},
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_name",
"type": "string"
},
{
"name": "_symbol",
"type": "string"
},
{
"name": "_decimals",
"type": "uint8"
},
{
"name": "_ipfsHash",
"type": "bytes"
},
{
"name": "_swarmHash",
"type": "bytes"
}
],
"name": "addToken",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_name",
"type": "string"
}
],
"name": "setTokenName",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "tokens",
"outputs": [
{
"name": "token",
"type": "address"
},
{
"name": "name",
"type": "string"
},
{
"name": "symbol",
"type": "string"
},
{
"name": "decimals",
"type": "uint8"
},
{
"name": "ipfsHash",
"type": "bytes"
},
{
"name": "swarmHash",
"type": "bytes"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "uint256"
}
],
"name": "tokenAddresses",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_name",
"type": "string"
}
],
"name": "getTokenByName",
"outputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint8"
},
{
"name": "",
"type": "bytes"
},
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getTokenAddresses",
"outputs": [
{
"name": "",
"type": "address[]"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_ipfsHash",
"type": "bytes"
}
],
"name": "setTokenIpfsHash",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_symbol",
"type": "string"
}
],
"name": "getTokenBySymbol",
"outputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint8"
},
{
"name": "",
"type": "bytes"
},
{
"name": "",
"type": "bytes"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_token",
"type": "address"
},
{
"name": "_symbol",
"type": "string"
}
],
"name": "setTokenSymbol",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "name",
"type": "string"
},
{
"indexed": false,
"name": "symbol",
"type": "string"
},
{
"indexed": false,
"name": "decimals",
"type": "uint8"
},
{
"indexed": false,
"name": "ipfsHash",
"type": "bytes"
},
{
"indexed": false,
"name": "swarmHash",
"type": "bytes"
}
],
"name": "LogAddToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "name",
"type": "string"
},
{
"indexed": false,
"name": "symbol",
"type": "string"
},
{
"indexed": false,
"name": "decimals",
"type": "uint8"
},
{
"indexed": false,
"name": "ipfsHash",
"type": "bytes"
},
{
"indexed": false,
"name": "swarmHash",
"type": "bytes"
}
],
"name": "LogRemoveToken",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "oldName",
"type": "string"
},
{
"indexed": false,
"name": "newName",
"type": "string"
}
],
"name": "LogTokenNameChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "oldSymbol",
"type": "string"
},
{
"indexed": false,
"name": "newSymbol",
"type": "string"
}
],
"name": "LogTokenSymbolChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "oldIpfsHash",
"type": "bytes"
},
{
"indexed": false,
"name": "newIpfsHash",
"type": "bytes"
}
],
"name": "LogTokenIpfsHashChange",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "token",
"type": "address"
},
{
"indexed": false,
"name": "oldSwarmHash",
"type": "bytes"
},
{
"indexed": false,
"name": "newSwarmHash",
"type": "bytes"
}
],
"name": "LogTokenSwarmHashChange",
"type": "event"
}
],
"networks": {
"1": {
"address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c"
},
"3": {
"address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed"
},
"4": {
"address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6"
},
"42": {
"address": "0xf18e504561f4347bea557f3d4558f559dddbae7f"
},
"50": {
"address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082"
}
}
}

View File

@@ -1,187 +0,0 @@
{
"contract_name": "TokenTransferProxy",
"abi": [
{
"constant": false,
"inputs": [
{
"name": "token",
"type": "address"
},
{
"name": "from",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "target",
"type": "address"
}
],
"name": "addAuthorizedAddress",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "uint256"
}
],
"name": "authorities",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "target",
"type": "address"
}
],
"name": "removeAuthorizedAddress",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "authorized",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getAuthorizedAddresses",
"outputs": [
{
"name": "",
"type": "address[]"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "target",
"type": "address"
},
{
"indexed": true,
"name": "caller",
"type": "address"
}
],
"name": "LogAuthorizedAddressAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "target",
"type": "address"
},
{
"indexed": true,
"name": "caller",
"type": "address"
}
],
"name": "LogAuthorizedAddressRemoved",
"type": "event"
}
],
"networks": {
"1": {
"address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4"
},
"3": {
"address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6"
},
"4": {
"address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d"
},
"42": {
"address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4"
},
"50": {
"address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48"
}
}
}

View File

@@ -1,20 +0,0 @@
{
"contract_name": "ZRX",
"networks": {
"1": {
"address": "0xe41d2489571d322189246dafa5ebde1f4699f498"
},
"3": {
"address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d"
},
"4": {
"address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8"
},
"42": {
"address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570"
},
"50": {
"address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401"
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,931 +0,0 @@
import { schemas } from '@0xproject/json-schemas';
import {
BlockParamLiteral,
DecodedLogArgs,
ECSignature,
LogWithDecodedArgs,
Order,
SignedOrder,
} from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import { artifacts } from '../artifacts';
import {
BlockRange,
EventCallback,
ExchangeContractErrCodes,
ExchangeContractErrs,
IndexedFilterValues,
MethodOpts,
OrderAddresses,
OrderCancellationRequest,
OrderFillRequest,
OrderTransactionOpts,
OrderValues,
ValidateOrderFillableOpts,
} from '../types';
import { assert } from '../utils/assert';
import { decorators } from '../utils/decorators';
import { ExchangeTransferSimulator } from '../utils/exchange_transfer_simulator';
import { OrderValidationUtils } from '../utils/order_validation_utils';
import { utils } from '../utils/utils';
import { ContractWrapper } from './contract_wrapper';
import {
ExchangeContract,
ExchangeContractEventArgs,
ExchangeEvents,
LogErrorContractEventArgs,
} from './generated/exchange';
import { TokenWrapper } from './token_wrapper';
const SHOULD_VALIDATE_BY_DEFAULT = true;
interface ExchangeContractErrCodesToMsgs {
[exchangeContractErrCodes: number]: string;
}
/**
* This class includes all the functionality related to calling methods and subscribing to
* events of the 0x Exchange smart contract.
*/
export class ExchangeWrapper extends ContractWrapper {
private _exchangeContractIfExists?: ExchangeContract;
private _orderValidationUtils: OrderValidationUtils;
private _tokenWrapper: TokenWrapper;
private _exchangeContractErrCodesToMsg: ExchangeContractErrCodesToMsgs = {
[ExchangeContractErrCodes.ERROR_FILL_EXPIRED]: ExchangeContractErrs.OrderFillExpired,
[ExchangeContractErrCodes.ERROR_CANCEL_EXPIRED]: ExchangeContractErrs.OrderFillExpired,
[ExchangeContractErrCodes.ERROR_FILL_NO_VALUE]: ExchangeContractErrs.OrderRemainingFillAmountZero,
[ExchangeContractErrCodes.ERROR_CANCEL_NO_VALUE]: ExchangeContractErrs.OrderRemainingFillAmountZero,
[ExchangeContractErrCodes.ERROR_FILL_TRUNCATION]: ExchangeContractErrs.OrderFillRoundingError,
[ExchangeContractErrCodes.ERROR_FILL_BALANCE_ALLOWANCE]: ExchangeContractErrs.FillBalanceAllowanceError,
};
private _contractAddressIfExists?: string;
private _zrxContractAddressIfExists?: string;
private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] {
const orderAddresses: OrderAddresses = [
order.maker,
order.taker,
order.makerTokenAddress,
order.takerTokenAddress,
order.feeRecipient,
];
const orderValues: OrderValues = [
order.makerTokenAmount,
order.takerTokenAmount,
order.makerFee,
order.takerFee,
order.expirationUnixTimestampSec,
order.salt,
];
return [orderAddresses, orderValues];
}
constructor(
web3Wrapper: Web3Wrapper,
networkId: number,
abiDecoder: AbiDecoder,
tokenWrapper: TokenWrapper,
contractAddressIfExists?: string,
zrxContractAddressIfExists?: string,
) {
super(web3Wrapper, networkId, abiDecoder);
this._tokenWrapper = tokenWrapper;
this._orderValidationUtils = new OrderValidationUtils(this);
this._contractAddressIfExists = contractAddressIfExists;
this._zrxContractAddressIfExists = zrxContractAddressIfExists;
}
/**
* Returns the unavailable takerAmount of an order. Unavailable amount is defined as the total
* amount that has been filled or cancelled. The remaining takerAmount can be calculated by
* subtracting the unavailable amount from the total order takerAmount.
* @param orderHash The hex encoded orderHash for which you would like to retrieve the
* unavailable takerAmount.
* @param methodOpts Optional arguments this method accepts.
* @return The amount of the order (in taker tokens) that has either been filled or cancelled.
*/
public async getUnavailableTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber> {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const exchangeContract = await this._getExchangeContractAsync();
const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock;
const txData = {};
let unavailableTakerTokenAmount = await exchangeContract.getUnavailableTakerTokenAmount.callAsync(
orderHash,
txData,
defaultBlock,
);
// Wrap BigNumbers returned from web3 with our own (later) version of BigNumber
unavailableTakerTokenAmount = new BigNumber(unavailableTakerTokenAmount);
return unavailableTakerTokenAmount;
}
/**
* Retrieve the takerAmount of an order that has already been filled.
* @param orderHash The hex encoded orderHash for which you would like to retrieve the filled takerAmount.
* @param methodOpts Optional arguments this method accepts.
* @return The amount of the order (in taker tokens) that has already been filled.
*/
public async getFilledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber> {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const exchangeContract = await this._getExchangeContractAsync();
const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock;
const txData = {};
let fillAmountInBaseUnits = await exchangeContract.filled.callAsync(orderHash, txData, defaultBlock);
// Wrap BigNumbers returned from web3 with our own (later) version of BigNumber
fillAmountInBaseUnits = new BigNumber(fillAmountInBaseUnits);
return fillAmountInBaseUnits;
}
/**
* Retrieve the takerAmount of an order that has been cancelled.
* @param orderHash The hex encoded orderHash for which you would like to retrieve the
* cancelled takerAmount.
* @param methodOpts Optional arguments this method accepts.
* @return The amount of the order (in taker tokens) that has been cancelled.
*/
public async getCancelledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber> {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const exchangeContract = await this._getExchangeContractAsync();
const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock;
const txData = {};
let cancelledAmountInBaseUnits = await exchangeContract.cancelled.callAsync(orderHash, txData, defaultBlock);
// Wrap BigNumbers returned from web3 with our own (later) version of BigNumber
cancelledAmountInBaseUnits = new BigNumber(cancelledAmountInBaseUnits);
return cancelledAmountInBaseUnits;
}
/**
* Fills a signed order with an amount denominated in baseUnits of the taker token.
* Since the order in which transactions are included in the next block is indeterminate, race-conditions
* could arise where a users balance or allowance changes before the fillOrder executes. Because of this,
* we allow you to specify `shouldThrowOnInsufficientBalanceOrAllowance`.
* If false, the smart contract will not throw if the parties
* do not have sufficient balances/allowances, preserving gas costs. Setting it to true forgoes this check
* and causes the smart contract to throw (using all the gas supplied) instead.
* @param signedOrder An object that conforms to the SignedOrder interface.
* @param fillTakerTokenAmount The amount of the order (in taker tokens baseUnits) that
* you wish to fill.
* @param shouldThrowOnInsufficientBalanceOrAllowance Whether or not you wish for the contract call to throw
* if upon execution the tokens cannot be transferred.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider
* passed to 0x.js.
* @param orderTransactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async fillOrderAsync(
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
shouldThrowOnInsufficientBalanceOrAllowance: boolean,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
assert.isBoolean('shouldThrowOnInsufficientBalanceOrAllowance', shouldThrowOnInsufficientBalanceOrAllowance);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const exchangeInstance = await this._getExchangeContractAsync();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder);
const txHash: string = await exchangeInstance.fillOrder.sendTransactionAsync(
orderAddresses,
orderValues,
fillTakerTokenAmount,
shouldThrowOnInsufficientBalanceOrAllowance,
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Sequentially and atomically fills signedOrders up to the specified takerTokenFillAmount.
* If the fill amount is reached - it succeeds and does not fill the rest of the orders.
* If fill amount is not reached - it fills as much of the fill amount as possible and succeeds.
* @param signedOrders The array of signedOrders that you would like to fill until
* takerTokenFillAmount is reached.
* @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill.
* @param shouldThrowOnInsufficientBalanceOrAllowance Whether or not you wish for the contract call to throw if
* upon execution any of the tokens cannot be transferred.
* If set to false, the call will continue to fill subsequent
* signedOrders even when some cannot be filled.
* @param takerAddress The user Ethereum address who would like to fill these
* orders. Must be available via the supplied Web3.Provider
* passed to 0x.js.
* @param orderTransactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async fillOrdersUpToAsync(
signedOrders: SignedOrder[],
fillTakerTokenAmount: BigNumber,
shouldThrowOnInsufficientBalanceOrAllowance: boolean,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema);
const takerTokenAddresses = _.map(signedOrders, signedOrder => signedOrder.takerTokenAddress);
assert.hasAtMostOneUniqueValue(
takerTokenAddresses,
ExchangeContractErrs.MultipleTakerTokensInFillUpToDisallowed,
);
const exchangeContractAddresses = _.map(signedOrders, signedOrder => signedOrder.exchangeContractAddress);
assert.hasAtMostOneUniqueValue(
exchangeContractAddresses,
ExchangeContractErrs.BatchOrdersMustHaveSameExchangeAddress,
);
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
assert.isBoolean('shouldThrowOnInsufficientBalanceOrAllowance', shouldThrowOnInsufficientBalanceOrAllowance);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
let filledTakerTokenAmount = new BigNumber(0);
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
for (const signedOrder of signedOrders) {
const singleFilledTakerTokenAmount = await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount.minus(filledTakerTokenAmount),
normalizedTakerAddress,
zrxTokenAddress,
);
filledTakerTokenAmount = filledTakerTokenAmount.plus(singleFilledTakerTokenAmount);
}
}
if (_.isEmpty(signedOrders)) {
throw new Error(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem);
}
const orderAddressesValuesAndSignatureArray = _.map(signedOrders, signedOrder => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(signedOrder),
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,
];
});
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
const [orderAddressesArray, orderValuesArray, vArray, rArray, sArray] = _.unzip<any>(
orderAddressesValuesAndSignatureArray,
);
const exchangeInstance = await this._getExchangeContractAsync();
const txHash = await exchangeInstance.fillOrdersUpTo.sendTransactionAsync(
orderAddressesArray,
orderValuesArray,
fillTakerTokenAmount,
shouldThrowOnInsufficientBalanceOrAllowance,
vArray,
rArray,
sArray,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Batch version of fillOrderAsync.
* Executes multiple fills atomically in a single transaction.
* If shouldThrowOnInsufficientBalanceOrAllowance is set to false, it will continue filling subsequent orders even
* when earlier ones fail.
* When shouldThrowOnInsufficientBalanceOrAllowance is set to true, if any fill fails, the entire batch fails.
* @param orderFillRequests An array of objects that conform to the
* OrderFillRequest interface.
* @param shouldThrowOnInsufficientBalanceOrAllowance Whether or not you wish for the contract call to throw
* if upon execution any of the tokens cannot be
* transferred. If set to false, the call will continue to
* fill subsequent signedOrders even when some
* cannot be filled.
* @param takerAddress The user Ethereum address who would like to fill
* these orders. Must be available via the supplied
* Web3.Provider passed to 0x.js.
* @param orderTransactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async batchFillOrdersAsync(
orderFillRequests: OrderFillRequest[],
shouldThrowOnInsufficientBalanceOrAllowance: boolean,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('orderFillRequests', orderFillRequests, schemas.orderFillRequestsSchema);
const exchangeContractAddresses = _.map(
orderFillRequests,
orderFillRequest => orderFillRequest.signedOrder.exchangeContractAddress,
);
assert.hasAtMostOneUniqueValue(
exchangeContractAddresses,
ExchangeContractErrs.BatchOrdersMustHaveSameExchangeAddress,
);
assert.isBoolean('shouldThrowOnInsufficientBalanceOrAllowance', shouldThrowOnInsufficientBalanceOrAllowance);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
for (const orderFillRequest of orderFillRequests) {
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
orderFillRequest.signedOrder,
orderFillRequest.takerTokenFillAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
}
if (_.isEmpty(orderFillRequests)) {
throw new Error(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem);
}
const orderAddressesValuesAmountsAndSignatureArray = _.map(orderFillRequests, orderFillRequest => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(orderFillRequest.signedOrder),
orderFillRequest.takerTokenFillAmount,
orderFillRequest.signedOrder.ecSignature.v,
orderFillRequest.signedOrder.ecSignature.r,
orderFillRequest.signedOrder.ecSignature.s,
];
});
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
const [orderAddressesArray, orderValuesArray, fillTakerTokenAmounts, vArray, rArray, sArray] = _.unzip<any>(
orderAddressesValuesAmountsAndSignatureArray,
);
const exchangeInstance = await this._getExchangeContractAsync();
const txHash = await exchangeInstance.batchFillOrders.sendTransactionAsync(
orderAddressesArray,
orderValuesArray,
fillTakerTokenAmounts,
shouldThrowOnInsufficientBalanceOrAllowance,
vArray,
rArray,
sArray,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Attempts to fill a specific amount of an order. If the entire amount specified cannot be filled,
* the fill order is abandoned.
* @param signedOrder An object that conforms to the SignedOrder interface. The
* signedOrder you wish to fill.
* @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider passed to 0x.js.
* @param orderTransactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async fillOrKillOrderAsync(
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const exchangeInstance = await this._getExchangeContractAsync();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder);
const txHash = await exchangeInstance.fillOrKillOrder.sendTransactionAsync(
orderAddresses,
orderValues,
fillTakerTokenAmount,
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Batch version of fillOrKill. Allows a taker to specify a batch of orders that will either be atomically
* filled (each to the specified fillAmount) or aborted.
* @param orderFillRequests An array of objects that conform to the OrderFillRequest interface.
* @param takerAddress The user Ethereum address who would like to fill there orders.
* Must be available via the supplied Web3.Provider passed to 0x.js.
* @param orderTransactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async batchFillOrKillAsync(
orderFillRequests: OrderFillRequest[],
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('orderFillRequests', orderFillRequests, schemas.orderFillRequestsSchema);
const exchangeContractAddresses = _.map(
orderFillRequests,
orderFillRequest => orderFillRequest.signedOrder.exchangeContractAddress,
);
assert.hasAtMostOneUniqueValue(
exchangeContractAddresses,
ExchangeContractErrs.BatchOrdersMustHaveSameExchangeAddress,
);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
if (_.isEmpty(orderFillRequests)) {
throw new Error(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem);
}
const exchangeInstance = await this._getExchangeContractAsync();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
for (const orderFillRequest of orderFillRequests) {
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
orderFillRequest.signedOrder,
orderFillRequest.takerTokenFillAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
}
const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillRequests, request => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(request.signedOrder),
request.takerTokenFillAmount,
request.signedOrder.ecSignature.v,
request.signedOrder.ecSignature.r,
request.signedOrder.ecSignature.s,
];
});
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
const [orderAddresses, orderValues, fillTakerTokenAmounts, vParams, rParams, sParams] = _.unzip<any>(
orderAddressesValuesAndTakerTokenFillAmounts,
);
const txHash = await exchangeInstance.batchFillOrKillOrders.sendTransactionAsync(
orderAddresses,
orderValues,
fillTakerTokenAmounts,
vParams,
rParams,
sParams,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Cancel a given fill amount of an order. Cancellations are cumulative.
* @param order An object that conforms to the Order or SignedOrder interface.
* The order you would like to cancel.
* @param cancelTakerTokenAmount The amount (specified in taker tokens) that you would like to cancel.
* @param transactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async cancelOrderAsync(
order: Order | SignedOrder,
cancelTakerTokenAmount: BigNumber,
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema('order', order, schemas.orderSchema);
assert.isValidBaseUnitAmount('takerTokenCancelAmount', cancelTakerTokenAmount);
await assert.isSenderAddressAsync('order.maker', order.maker, this._web3Wrapper);
const normalizedMakerAddress = order.maker.toLowerCase();
const exchangeInstance = await this._getExchangeContractAsync();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const orderHash = utils.getOrderHashHex(order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
order,
cancelTakerTokenAmount,
unavailableTakerTokenAmount,
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order);
const txHash = await exchangeInstance.cancelOrder.sendTransactionAsync(
orderAddresses,
orderValues,
cancelTakerTokenAmount,
{
from: normalizedMakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Batch version of cancelOrderAsync. Atomically cancels multiple orders in a single transaction.
* All orders must be from the same maker.
* @param orderCancellationRequests An array of objects that conform to the OrderCancellationRequest
* interface.
* @param transactionOpts Optional arguments this method accepts.
* @return Transaction hash.
*/
@decorators.asyncZeroExErrorHandler
public async batchCancelOrdersAsync(
orderCancellationRequests: OrderCancellationRequest[],
orderTransactionOpts: OrderTransactionOpts = {},
): Promise<string> {
assert.doesConformToSchema(
'orderCancellationRequests',
orderCancellationRequests,
schemas.orderCancellationRequestsSchema,
);
const exchangeContractAddresses = _.map(
orderCancellationRequests,
orderCancellationRequest => orderCancellationRequest.order.exchangeContractAddress,
);
assert.hasAtMostOneUniqueValue(
exchangeContractAddresses,
ExchangeContractErrs.BatchOrdersMustHaveSameExchangeAddress,
);
const makers = _.map(orderCancellationRequests, cancellationRequest => cancellationRequest.order.maker);
assert.hasAtMostOneUniqueValue(makers, ExchangeContractErrs.MultipleMakersInSingleCancelBatchDisallowed);
const maker = makers[0];
await assert.isSenderAddressAsync('maker', maker, this._web3Wrapper);
const normalizedMakerAddress = maker.toLowerCase();
const shouldValidate = _.isUndefined(orderTransactionOpts.shouldValidate)
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
for (const orderCancellationRequest of orderCancellationRequests) {
const orderHash = utils.getOrderHashHex(orderCancellationRequest.order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
orderCancellationRequest.order,
orderCancellationRequest.takerTokenCancelAmount,
unavailableTakerTokenAmount,
);
}
}
if (_.isEmpty(orderCancellationRequests)) {
throw new Error(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem);
}
const exchangeInstance = await this._getExchangeContractAsync();
const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(cancellationRequest.order),
cancellationRequest.takerTokenCancelAmount,
];
});
// We use _.unzip<any> because _.unzip doesn't type check if values have different types :'(
const [orderAddresses, orderValues, cancelTakerTokenAmounts] = _.unzip<any>(
orderAddressesValuesAndTakerTokenCancelAmounts,
);
const txHash = await exchangeInstance.batchCancelOrders.sendTransactionAsync(
orderAddresses,
orderValues,
cancelTakerTokenAmounts,
{
from: normalizedMakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
},
);
return txHash;
}
/**
* Subscribe to an event type emitted by the Exchange contract.
* @param eventName The exchange contract event you would like to subscribe to.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
* @param callback Callback that gets called when a log is added/removed
* @return Subscription token used later to unsubscribe
*/
public subscribe<ArgsType extends ExchangeContractEventArgs>(
eventName: ExchangeEvents,
indexFilterValues: IndexedFilterValues,
callback: EventCallback<ArgsType>,
): string {
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
assert.isFunction('callback', callback);
const exchangeContractAddress = this.getContractAddress();
const subscriptionToken = this._subscribe<ArgsType>(
exchangeContractAddress,
eventName,
indexFilterValues,
artifacts.ExchangeArtifact.abi,
callback,
);
return subscriptionToken;
}
/**
* Cancel a subscription
* @param subscriptionToken Subscription token returned by `subscribe()`
*/
public unsubscribe(subscriptionToken: string): void {
this._unsubscribe(subscriptionToken);
}
/**
* Cancels all existing subscriptions
*/
public unsubscribeAll(): void {
super._unsubscribeAll();
}
/**
* Gets historical logs without creating a subscription
* @param eventName The exchange contract event you would like to subscribe to.
* @param blockRange Block range to get logs from.
* @param indexFilterValues An object where the keys are indexed args returned by the event and
* the value is the value you are interested in. E.g `{_from: aUserAddressHex}`
* @return Array of logs that match the parameters
*/
public async getLogsAsync<ArgsType extends ExchangeContractEventArgs>(
eventName: ExchangeEvents,
blockRange: BlockRange,
indexFilterValues: IndexedFilterValues,
): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
assert.doesConformToSchema('blockRange', blockRange, schemas.blockRangeSchema);
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
const exchangeContractAddress = this.getContractAddress();
const logs = await this._getLogsAsync<ArgsType>(
exchangeContractAddress,
eventName,
blockRange,
indexFilterValues,
artifacts.ExchangeArtifact.abi,
);
return logs;
}
/**
* Retrieves the Ethereum address of the Exchange contract deployed on the network
* that the user-passed web3 provider is connected to.
* @returns The Ethereum address of the Exchange contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(artifacts.ExchangeArtifact, this._contractAddressIfExists);
return contractAddress;
}
/**
* Checks if order is still fillable and throws an error otherwise. Useful for orderbook
* pruning where you want to remove stale orders without knowing who the taker will be.
* @param signedOrder An object that conforms to the SignedOrder interface. The
* signedOrder you wish to validate.
* @param opts An object that conforms to the ValidateOrderFillableOpts
* interface. Allows specifying a specific fillTakerTokenAmount
* to validate for.
*/
public async validateOrderFillableOrThrowAsync(
signedOrder: SignedOrder,
opts?: ValidateOrderFillableOpts,
): Promise<void> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
const zrxTokenAddress = this.getZRXTokenAddress();
const expectedFillTakerTokenAmount = !_.isUndefined(opts) ? opts.expectedFillTakerTokenAmount : undefined;
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateOrderFillableOrThrowAsync(
exchangeTradeEmulator,
signedOrder,
zrxTokenAddress,
expectedFillTakerTokenAmount,
);
}
/**
* Checks if order fill will succeed and throws an error otherwise.
* @param signedOrder An object that conforms to the SignedOrder interface. The
* signedOrder you wish to fill.
* @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider passed to 0x.js.
*/
public async validateFillOrderThrowIfInvalidAsync(
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
takerAddress: string,
): Promise<void> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
/**
* Checks if cancelling a given order will succeed and throws an informative error if it won't.
* @param order An object that conforms to the Order or SignedOrder interface.
* The order you would like to cancel.
* @param cancelTakerTokenAmount The amount (specified in taker tokens) that you would like to cancel.
*/
public async validateCancelOrderThrowIfInvalidAsync(
order: Order,
cancelTakerTokenAmount: BigNumber,
): Promise<void> {
assert.doesConformToSchema('order', order, schemas.orderSchema);
assert.isValidBaseUnitAmount('cancelTakerTokenAmount', cancelTakerTokenAmount);
const orderHash = utils.getOrderHashHex(order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
order,
cancelTakerTokenAmount,
unavailableTakerTokenAmount,
);
}
/**
* Checks if calling fillOrKill on a given order will succeed and throws an informative error if it won't.
* @param signedOrder An object that conforms to the SignedOrder interface. The
* signedOrder you wish to fill.
* @param fillTakerTokenAmount The total amount of the takerTokens you would like to fill.
* @param takerAddress The user Ethereum address who would like to fill this order.
* Must be available via the supplied Web3.Provider passed to 0x.js.
*/
public async validateFillOrKillOrderThrowIfInvalidAsync(
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
takerAddress: string,
): Promise<void> {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
normalizedTakerAddress,
zrxTokenAddress,
);
}
/**
* Checks if rounding error will be > 0.1% when computing makerTokenAmount by doing:
* `(fillTakerTokenAmount * makerTokenAmount) / takerTokenAmount`.
* 0x Protocol does not accept any trades that result in large rounding errors. This means that tokens with few or
* no decimals can only be filled in quantities and ratios that avoid large rounding errors.
* @param fillTakerTokenAmount The amount of the order (in taker tokens baseUnits) that you wish to fill.
* @param takerTokenAmount The order size on the taker side
* @param makerTokenAmount The order size on the maker side
*/
public async isRoundingErrorAsync(
fillTakerTokenAmount: BigNumber,
takerTokenAmount: BigNumber,
makerTokenAmount: BigNumber,
): Promise<boolean> {
assert.isValidBaseUnitAmount('fillTakerTokenAmount', fillTakerTokenAmount);
assert.isValidBaseUnitAmount('takerTokenAmount', takerTokenAmount);
assert.isValidBaseUnitAmount('makerTokenAmount', makerTokenAmount);
const exchangeInstance = await this._getExchangeContractAsync();
const isRoundingError = await exchangeInstance.isRoundingError.callAsync(
fillTakerTokenAmount,
takerTokenAmount,
makerTokenAmount,
);
return isRoundingError;
}
/**
* Checks if logs contain LogError, which is emmited by Exchange contract on transaction failure.
* @param logs Transaction logs as returned by `zeroEx.awaitTransactionMinedAsync`
*/
public throwLogErrorsAsErrors(logs: Array<LogWithDecodedArgs<DecodedLogArgs> | Web3.LogEntry>): void {
const errLog = _.find(logs, {
event: ExchangeEvents.LogError,
});
if (!_.isUndefined(errLog)) {
const logArgs = (errLog as LogWithDecodedArgs<LogErrorContractEventArgs>).args;
const errCode = logArgs.errorId;
const errMessage = this._exchangeContractErrCodesToMsg[errCode];
throw new Error(errMessage);
}
}
/**
* Returns the ZRX token address used by the exchange contract.
* @return Address of ZRX token
*/
public getZRXTokenAddress(): string {
const contractAddress = this._getContractAddress(artifacts.ZRXArtifact, this._zrxContractAddressIfExists);
return contractAddress;
}
private _invalidateContractInstances(): void {
this.unsubscribeAll();
delete this._exchangeContractIfExists;
}
private async _isValidSignatureUsingContractCallAsync(
dataHex: string,
ecSignature: ECSignature,
signerAddressHex: string,
): Promise<boolean> {
assert.isHexString('dataHex', dataHex);
assert.doesConformToSchema('ecSignature', ecSignature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddressHex', signerAddressHex);
const normalizedSignerAddress = signerAddressHex.toLowerCase();
const exchangeInstance = await this._getExchangeContractAsync();
const isValidSignature = await exchangeInstance.isValidSignature.callAsync(
normalizedSignerAddress,
dataHex,
ecSignature.v,
ecSignature.r,
ecSignature.s,
);
return isValidSignature;
}
private async _getOrderHashHexUsingContractCallAsync(order: Order | SignedOrder): Promise<string> {
const exchangeInstance = await this._getExchangeContractAsync();
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order);
const orderHashHex = await exchangeInstance.getOrderHash.callAsync(orderAddresses, orderValues);
return orderHashHex;
}
private async _getExchangeContractAsync(): Promise<ExchangeContract> {
if (!_.isUndefined(this._exchangeContractIfExists)) {
return this._exchangeContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.ExchangeArtifact,
this._contractAddressIfExists,
);
const contractInstance = new ExchangeContract(this._web3Wrapper, abi, address);
this._exchangeContractIfExists = contractInstance;
return this._exchangeContractIfExists;
}
private async _getTokenTransferProxyAddressAsync(): Promise<string> {
const exchangeInstance = await this._getExchangeContractAsync();
const tokenTransferProxyAddress = await exchangeInstance.TOKEN_TRANSFER_PROXY_CONTRACT.callAsync();
const tokenTransferProxyAddressLowerCase = tokenTransferProxyAddress.toLowerCase();
return tokenTransferProxyAddressLowerCase;
}
} // tslint:disable:max-file-line-count

View File

@@ -1 +0,0 @@
*

View File

@@ -1,128 +0,0 @@
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { Token, TokenMetadata } from '../types';
import { assert } from '../utils/assert';
import { constants } from '../utils/constants';
import { ContractWrapper } from './contract_wrapper';
import { TokenRegistryContract } from './generated/token_registry';
/**
* This class includes all the functionality related to interacting with the 0x Token Registry smart contract.
*/
export class TokenRegistryWrapper extends ContractWrapper {
private _tokenRegistryContractIfExists?: TokenRegistryContract;
private _contractAddressIfExists?: string;
private static _createTokenFromMetadata(metadata: TokenMetadata): Token | undefined {
if (metadata[0] === constants.NULL_ADDRESS) {
return undefined;
}
const token = {
address: metadata[0],
name: metadata[1],
symbol: metadata[2],
decimals: metadata[3],
};
return token;
}
constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) {
super(web3Wrapper, networkId);
this._contractAddressIfExists = contractAddressIfExists;
}
/**
* Retrieves all the tokens currently listed in the Token Registry smart contract
* @return An array of objects that conform to the Token interface.
*/
public async getTokensAsync(): Promise<Token[]> {
const addresses = await this.getTokenAddressesAsync();
const tokenPromises: Array<Promise<Token | undefined>> = _.map(addresses, async (address: string) =>
this.getTokenIfExistsAsync(address),
);
const tokens = await Promise.all(tokenPromises);
return tokens as Token[];
}
/**
* Retrieves all the addresses of the tokens currently listed in the Token Registry smart contract
* @return An array of token addresses.
*/
public async getTokenAddressesAsync(): Promise<string[]> {
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const addresses = await tokenRegistryContract.getTokenAddresses.callAsync();
const lowerCaseAddresses = _.map(addresses, address => address.toLowerCase());
return lowerCaseAddresses;
}
/**
* Retrieves a token by address currently listed in the Token Registry smart contract
* @return An object that conforms to the Token interface or undefined if token not found.
*/
public async getTokenIfExistsAsync(address: string): Promise<Token | undefined> {
assert.isETHAddressHex('address', address);
const normalizedAddress = address.toLowerCase();
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const metadata = await tokenRegistryContract.getTokenMetaData.callAsync(normalizedAddress);
const token = TokenRegistryWrapper._createTokenFromMetadata(metadata);
return token;
}
public async getTokenAddressBySymbolIfExistsAsync(symbol: string): Promise<string | undefined> {
assert.isString('symbol', symbol);
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const addressIfExists = await tokenRegistryContract.getTokenAddressBySymbol.callAsync(symbol);
if (addressIfExists === constants.NULL_ADDRESS) {
return undefined;
}
return addressIfExists;
}
public async getTokenAddressByNameIfExistsAsync(name: string): Promise<string | undefined> {
assert.isString('name', name);
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const addressIfExists = await tokenRegistryContract.getTokenAddressByName.callAsync(name);
if (addressIfExists === constants.NULL_ADDRESS) {
return undefined;
}
return addressIfExists;
}
public async getTokenBySymbolIfExistsAsync(symbol: string): Promise<Token | undefined> {
assert.isString('symbol', symbol);
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const metadata = await tokenRegistryContract.getTokenBySymbol.callAsync(symbol);
const token = TokenRegistryWrapper._createTokenFromMetadata(metadata);
return token;
}
public async getTokenByNameIfExistsAsync(name: string): Promise<Token | undefined> {
assert.isString('name', name);
const tokenRegistryContract = await this._getTokenRegistryContractAsync();
const metadata = await tokenRegistryContract.getTokenByName.callAsync(name);
const token = TokenRegistryWrapper._createTokenFromMetadata(metadata);
return token;
}
/**
* Retrieves the Ethereum address of the TokenRegistry contract deployed on the network
* that the user-passed web3 provider is connected to.
* @returns The Ethereum address of the TokenRegistry contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(
artifacts.TokenRegistryArtifact,
this._contractAddressIfExists,
);
return contractAddress;
}
private _invalidateContractInstance(): void {
delete this._tokenRegistryContractIfExists;
}
private async _getTokenRegistryContractAsync(): Promise<TokenRegistryContract> {
if (!_.isUndefined(this._tokenRegistryContractIfExists)) {
return this._tokenRegistryContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenRegistryArtifact,
this._contractAddressIfExists,
);
const contractInstance = new TokenRegistryContract(this._web3Wrapper, abi, address);
this._tokenRegistryContractIfExists = contractInstance;
return this._tokenRegistryContractIfExists;
}
}

View File

@@ -1,70 +0,0 @@
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { assert } from '../utils/assert';
import { ContractWrapper } from './contract_wrapper';
import { TokenTransferProxyContract } from './generated/token_transfer_proxy';
/**
* This class includes the functionality related to interacting with the TokenTransferProxy contract.
*/
export class TokenTransferProxyWrapper extends ContractWrapper {
private _tokenTransferProxyContractIfExists?: TokenTransferProxyContract;
private _contractAddressIfExists?: string;
constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) {
super(web3Wrapper, networkId);
this._contractAddressIfExists = contractAddressIfExists;
}
/**
* Check if the Exchange contract address is authorized by the TokenTransferProxy contract.
* @param exchangeContractAddress The hex encoded address of the Exchange contract to call.
* @return Whether the exchangeContractAddress is authorized.
*/
public async isAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> {
assert.isETHAddressHex('exchangeContractAddress', exchangeContractAddress);
const normalizedExchangeContractAddress = exchangeContractAddress.toLowerCase();
const tokenTransferProxyContractInstance = await this._getTokenTransferProxyContractAsync();
const isAuthorized = await tokenTransferProxyContractInstance.authorized.callAsync(
normalizedExchangeContractAddress,
);
return isAuthorized;
}
/**
* Get the list of all Exchange contract addresses authorized by the TokenTransferProxy contract.
* @return The list of authorized addresses.
*/
public async getAuthorizedAddressesAsync(): Promise<string[]> {
const tokenTransferProxyContractInstance = await this._getTokenTransferProxyContractAsync();
const authorizedAddresses = await tokenTransferProxyContractInstance.getAuthorizedAddresses.callAsync();
return authorizedAddresses;
}
/**
* Retrieves the Ethereum address of the TokenTransferProxy contract deployed on the network
* that the user-passed web3 provider is connected to.
* @returns The Ethereum address of the TokenTransferProxy contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(
artifacts.TokenTransferProxyArtifact,
this._contractAddressIfExists,
);
return contractAddress;
}
private _invalidateContractInstance(): void {
delete this._tokenTransferProxyContractIfExists;
}
private async _getTokenTransferProxyContractAsync(): Promise<TokenTransferProxyContract> {
if (!_.isUndefined(this._tokenTransferProxyContractIfExists)) {
return this._tokenTransferProxyContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenTransferProxyArtifact,
this._contractAddressIfExists,
);
const contractInstance = new TokenTransferProxyContract(this._web3Wrapper, abi, address);
this._tokenTransferProxyContractIfExists = contractInstance;
return this._tokenTransferProxyContractIfExists;
}
}

View File

@@ -1,49 +1,6 @@
declare module 'web3_beta';
declare module 'chai-bignumber';
declare module 'dirty-chai';
declare module 'request-promise-native';
declare module 'web3-provider-engine';
declare module 'web3-provider-engine/subproviders/rpc';
declare module 'publish-release';
// semver-sort declarations
declare module 'semver-sort' {
const desc: (versions: string[]) => string[];
}
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
// disallow `namespace`, we disable tslint for the following.
/* tslint:disable */
declare namespace Chai {
interface Assertion {
bignumber: Assertion;
// HACK: In order to comply with chai-as-promised we make eventually a `PromisedAssertion` not an `Assertion`
eventually: PromisedAssertion;
}
}
/* tslint:enable */
declare module '*.json' {
const json: any;
/* tslint:disable */
export default json;
/* tslint:enable */
}
declare module 'ethereumjs-abi' {
const soliditySHA3: (argTypes: string[], args: any[]) => Buffer;
}
// truffle-hdwallet-provider declarations
declare module 'truffle-hdwallet-provider' {
import * as Web3 from 'web3';
class HDWalletProvider implements Web3.Provider {
constructor(mnemonic: string, rpcUrl: string);
public sendAsync(
payload: Web3.JSONRPCRequestPayload,
callback: (err: Error, result: Web3.JSONRPCResponsePayload) => void,
): void;
}
export = HDWalletProvider;
}

View File

@@ -1,23 +0,0 @@
import { BigNumber } from '@0xproject/utils';
// HACK: This module overrides the Chai namespace so that we can use BigNumber types inside.
// Source: https://github.com/Microsoft/TypeScript/issues/7352#issuecomment-191547232
declare global {
// HACK: In order to merge the bignumber declaration added by chai-bignumber to the chai Assertion
// interface we must use `namespace` as the Chai definitelyTyped definition does. Since we otherwise
// disallow `namespace`, we disable tslint for the following.
/* tslint:disable */
namespace Chai {
interface NumberComparer {
(value: number | BigNumber, message?: string): Assertion;
}
interface NumericComparison {
greaterThan: NumberComparer;
}
}
/* tslint:enable */
interface DecodedLogArg {
name: string;
value: string | BigNumber;
}
}

View File

@@ -1,61 +1,66 @@
export { ZeroEx } from './0x';
export {
ZeroExError,
EventCallback,
ExchangeContractErrs,
ContractEvent,
Token,
IndexedFilterValues,
BlockRange,
OrderCancellationRequest,
OrderFillRequest,
ContractEventArgs,
Web3Provider,
ZeroExConfig,
MethodOpts,
OrderTransactionOpts,
TransactionOpts,
FilterObject,
LogEvent,
DecodedLogEvent,
EventWatcherCallback,
OnOrderStateChangeCallback,
OrderStateValid,
OrderStateInvalid,
OrderState,
} from './types';
export { MessagePrefixType, MessagePrefixOpts } from '@0xproject/order-utils';
export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders';
export {
BlockParamLiteral,
BlockParam,
ContractEventArg,
LogWithDecodedArgs,
ExchangeContractErrs,
Order,
SignedOrder,
ECSignature,
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
OrderStateValid,
OrderStateInvalid,
OrderState,
Token,
ERC20AssetData,
ERC721AssetData,
AssetProxyId,
} from '@0xproject/types';
export {
EtherTokenContractEventArgs,
WithdrawalContractEventArgs,
DepositContractEventArgs,
EtherTokenEvents,
} from './contract_wrappers/generated/ether_token';
BlockParamLiteral,
FilterObject,
BlockParam,
LogWithDecodedArgs,
ContractEventArg,
Provider,
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
} from 'ethereum-types';
export {
TransferContractEventArgs,
ApprovalContractEventArgs,
TokenContractEventArgs,
TokenEvents,
} from './contract_wrappers/generated/token';
export {
LogErrorContractEventArgs,
LogCancelContractEventArgs,
LogFillContractEventArgs,
ExchangeContractEventArgs,
ExchangeEvents,
} from './contract_wrappers/generated/exchange';
EventCallback,
ContractEvent,
IndexedFilterValues,
BlockRange,
OrderFillRequest,
ContractEventArgs,
MethodOpts,
OrderTransactionOpts,
TransactionOpts,
LogEvent,
DecodedLogEvent,
OnOrderStateChangeCallback,
ContractWrappersError,
WETH9Events,
WETH9WithdrawalEventArgs,
WETH9ApprovalEventArgs,
WETH9EventArgs,
WETH9DepositEventArgs,
WETH9TransferEventArgs,
ERC20TokenTransferEventArgs,
ERC20TokenApprovalEventArgs,
ERC20TokenEvents,
ERC20TokenEventArgs,
ERC721TokenApprovalEventArgs,
ERC721TokenApprovalForAllEventArgs,
ERC721TokenTransferEventArgs,
ERC721TokenEvents,
ExchangeCancelUpToEventArgs,
ExchangeAssetProxyRegisteredEventArgs,
ExchangeFillEventArgs,
ExchangeCancelEventArgs,
ExchangeEventArgs,
ContractWrappersConfig,
OrderInfo,
} from '@0xproject/contract-wrappers';

View File

@@ -1,95 +0,0 @@
import { intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import { BlockParamLiteral } from '@0xproject/types';
import { EventWatcherCallback, ZeroExError } from '../types';
import { assert } from '../utils/assert';
const DEFAULT_EVENT_POLLING_INTERVAL_MS = 200;
enum LogEventState {
Removed,
Added,
}
/*
* The EventWatcher watches for blockchain events at the specified block confirmation
* depth.
*/
export class EventWatcher {
private _web3Wrapper: Web3Wrapper;
private _pollingIntervalMs: number;
private _intervalIdIfExists?: NodeJS.Timer;
private _lastEvents: Web3.LogEntry[] = [];
constructor(web3Wrapper: Web3Wrapper, pollingIntervalIfExistsMs: undefined | number) {
this._web3Wrapper = web3Wrapper;
this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs)
? DEFAULT_EVENT_POLLING_INTERVAL_MS
: pollingIntervalIfExistsMs;
}
public subscribe(callback: EventWatcherCallback): void {
assert.isFunction('callback', callback);
if (!_.isUndefined(this._intervalIdIfExists)) {
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
}
this._intervalIdIfExists = intervalUtils.setAsyncExcludingInterval(
this._pollForBlockchainEventsAsync.bind(this, callback),
this._pollingIntervalMs,
(err: Error) => {
this.unsubscribe();
callback(err);
},
);
}
public unsubscribe(): void {
this._lastEvents = [];
if (!_.isUndefined(this._intervalIdIfExists)) {
intervalUtils.clearAsyncExcludingInterval(this._intervalIdIfExists);
delete this._intervalIdIfExists;
}
}
private async _pollForBlockchainEventsAsync(callback: EventWatcherCallback): Promise<void> {
const pendingEvents = await this._getEventsAsync();
if (_.isUndefined(pendingEvents)) {
// HACK: This should never happen, but happens frequently on CI due to a ganache bug
return;
}
if (pendingEvents.length === 0) {
// HACK: Sometimes when node rebuilds the pending block we get back the empty result.
// We don't want to emit a lot of removal events and bring them back after a couple of miliseconds,
// that's why we just ignore those cases.
return;
}
const removedEvents = _.differenceBy(this._lastEvents, pendingEvents, JSON.stringify);
const newEvents = _.differenceBy(pendingEvents, this._lastEvents, JSON.stringify);
await this._emitDifferencesAsync(removedEvents, LogEventState.Removed, callback);
await this._emitDifferencesAsync(newEvents, LogEventState.Added, callback);
this._lastEvents = pendingEvents;
}
private async _getEventsAsync(): Promise<Web3.LogEntry[]> {
const eventFilter = {
fromBlock: BlockParamLiteral.Pending,
toBlock: BlockParamLiteral.Pending,
};
const events = await this._web3Wrapper.getLogsAsync(eventFilter);
return events;
}
private async _emitDifferencesAsync(
logs: Web3.LogEntry[],
logEventState: LogEventState,
callback: EventWatcherCallback,
): Promise<void> {
for (const log of logs) {
const logEvent = {
removed: logEventState === LogEventState.Removed,
...log,
};
if (!_.isUndefined(this._intervalIdIfExists)) {
callback(null, logEvent);
}
}
}
}

View File

@@ -1,385 +0,0 @@
import { schemas } from '@0xproject/json-schemas';
import { BlockParamLiteral, LogWithDecodedArgs, SignedOrder } from '@0xproject/types';
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { ZeroEx } from '../0x';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import {
DepositContractEventArgs,
EtherTokenEvents,
WithdrawalContractEventArgs,
} from '../contract_wrappers/generated/ether_token';
import {
ExchangeEvents,
LogCancelContractEventArgs,
LogFillContractEventArgs,
} from '../contract_wrappers/generated/exchange';
import {
ApprovalContractEventArgs,
TokenEvents,
TransferContractEventArgs,
} from '../contract_wrappers/generated/token';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store';
import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store';
import {
ContractEventArgs,
ExchangeContractErrs,
LogEvent,
OnOrderStateChangeCallback,
OrderState,
OrderStateWatcherConfig,
ZeroExError,
} from '../types';
import { assert } from '../utils/assert';
import { OrderStateUtils } from '../utils/order_state_utils';
import { utils } from '../utils/utils';
import { EventWatcher } from './event_watcher';
import { ExpirationWatcher } from './expiration_watcher';
interface DependentOrderHashes {
[makerAddress: string]: {
[makerToken: string]: Set<string>;
};
}
interface OrderByOrderHash {
[orderHash: string]: SignedOrder;
}
interface OrderStateByOrderHash {
[orderHash: string]: OrderState;
}
const DEFAULT_CLEANUP_JOB_INTERVAL_MS = 1000 * 60 * 60; // 1h
/**
* This class includes all the functionality related to watching a set of orders
* for potential changes in order validity/fillability. The orderWatcher notifies
* the subscriber of these changes so that a final decison can be made on whether
* the order should be deemed invalid.
*/
export class OrderStateWatcher {
private _orderStateByOrderHashCache: OrderStateByOrderHash = {};
private _orderByOrderHash: OrderByOrderHash = {};
private _dependentOrderHashes: DependentOrderHashes = {};
private _callbackIfExists?: OnOrderStateChangeCallback;
private _eventWatcher: EventWatcher;
private _web3Wrapper: Web3Wrapper;
private _abiDecoder: AbiDecoder;
private _expirationWatcher: ExpirationWatcher;
private _orderStateUtils: OrderStateUtils;
private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore;
private _cleanupJobInterval: number;
private _cleanupJobIntervalIdIfExists?: NodeJS.Timer;
constructor(
web3Wrapper: Web3Wrapper,
abiDecoder: AbiDecoder,
token: TokenWrapper,
exchange: ExchangeWrapper,
config?: OrderStateWatcherConfig,
) {
this._abiDecoder = abiDecoder;
this._web3Wrapper = web3Wrapper;
const pollingIntervalIfExistsMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs;
this._eventWatcher = new EventWatcher(web3Wrapper, pollingIntervalIfExistsMs);
this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
token,
BlockParamLiteral.Pending,
);
this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(exchange);
this._orderStateUtils = new OrderStateUtils(
this._balanceAndProxyAllowanceLazyStore,
this._orderFilledCancelledLazyStore,
);
const orderExpirationCheckingIntervalMsIfExists = _.isUndefined(config)
? undefined
: config.orderExpirationCheckingIntervalMs;
const expirationMarginIfExistsMs = _.isUndefined(config) ? undefined : config.expirationMarginMs;
this._expirationWatcher = new ExpirationWatcher(
expirationMarginIfExistsMs,
orderExpirationCheckingIntervalMsIfExists,
);
this._cleanupJobInterval =
_.isUndefined(config) || _.isUndefined(config.cleanupJobIntervalMs)
? DEFAULT_CLEANUP_JOB_INTERVAL_MS
: config.cleanupJobIntervalMs;
}
/**
* Add an order to the orderStateWatcher. Before the order is added, it's
* signature is verified.
* @param signedOrder The order you wish to start watching.
*/
public addOrder(signedOrder: SignedOrder): void {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
assert.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker);
this._orderByOrderHash[orderHash] = signedOrder;
this._addToDependentOrderHashes(signedOrder, orderHash);
const expirationUnixTimestampMs = signedOrder.expirationUnixTimestampSec.times(1000);
this._expirationWatcher.addOrder(orderHash, expirationUnixTimestampMs);
}
/**
* Removes an order from the orderStateWatcher
* @param orderHash The orderHash of the order you wish to stop watching.
*/
public removeOrder(orderHash: string): void {
assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema);
const signedOrder = this._orderByOrderHash[orderHash];
if (_.isUndefined(signedOrder)) {
return; // noop
}
delete this._orderByOrderHash[orderHash];
delete this._orderStateByOrderHashCache[orderHash];
const exchange = (this._orderFilledCancelledLazyStore as any)._exchange as ExchangeWrapper;
const zrxTokenAddress = exchange.getZRXTokenAddress();
this._removeFromDependentOrderHashes(signedOrder.maker, zrxTokenAddress, orderHash);
if (zrxTokenAddress !== signedOrder.makerTokenAddress) {
this._removeFromDependentOrderHashes(signedOrder.maker, signedOrder.makerTokenAddress, orderHash);
}
this._expirationWatcher.removeOrder(orderHash);
}
/**
* Starts an orderStateWatcher subscription. The callback will be called every time a watched order's
* backing blockchain state has changed. This is a call-to-action for the caller to re-validate the order.
* @param callback Receives the orderHash of the order that should be re-validated, together
* with all the order-relevant blockchain state needed to re-validate the order.
*/
public subscribe(callback: OnOrderStateChangeCallback): void {
assert.isFunction('callback', callback);
if (!_.isUndefined(this._callbackIfExists)) {
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
}
this._callbackIfExists = callback;
this._eventWatcher.subscribe(this._onEventWatcherCallbackAsync.bind(this));
this._expirationWatcher.subscribe(this._onOrderExpired.bind(this));
this._cleanupJobIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(
this._cleanupAsync.bind(this),
this._cleanupJobInterval,
(err: Error) => {
this.unsubscribe();
callback(err);
},
);
}
/**
* Ends an orderStateWatcher subscription.
*/
public unsubscribe(): void {
if (_.isUndefined(this._callbackIfExists) || _.isUndefined(this._cleanupJobIntervalIdIfExists)) {
throw new Error(ZeroExError.SubscriptionNotFound);
}
this._balanceAndProxyAllowanceLazyStore.deleteAll();
this._orderFilledCancelledLazyStore.deleteAll();
delete this._callbackIfExists;
this._eventWatcher.unsubscribe();
this._expirationWatcher.unsubscribe();
intervalUtils.clearAsyncExcludingInterval(this._cleanupJobIntervalIdIfExists);
}
private async _cleanupAsync(): Promise<void> {
for (const orderHash of _.keys(this._orderByOrderHash)) {
this._cleanupOrderRelatedState(orderHash);
await this._emitRevalidateOrdersAsync([orderHash]);
}
}
private _cleanupOrderRelatedState(orderHash: string): void {
const signedOrder = this._orderByOrderHash[orderHash];
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(orderHash);
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(orderHash);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(signedOrder.makerTokenAddress, signedOrder.maker);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(signedOrder.makerTokenAddress, signedOrder.maker);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(signedOrder.takerTokenAddress, signedOrder.taker);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(signedOrder.takerTokenAddress, signedOrder.taker);
const zrxTokenAddress = this._getZRXTokenAddress();
if (!signedOrder.makerFee.isZero()) {
this._balanceAndProxyAllowanceLazyStore.deleteBalance(zrxTokenAddress, signedOrder.maker);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(zrxTokenAddress, signedOrder.maker);
}
if (!signedOrder.takerFee.isZero()) {
this._balanceAndProxyAllowanceLazyStore.deleteBalance(zrxTokenAddress, signedOrder.taker);
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(zrxTokenAddress, signedOrder.taker);
}
}
private _onOrderExpired(orderHash: string): void {
const orderState: OrderState = {
isValid: false,
orderHash,
error: ExchangeContractErrs.OrderFillExpired,
};
if (!_.isUndefined(this._orderByOrderHash[orderHash])) {
this.removeOrder(orderHash);
if (!_.isUndefined(this._callbackIfExists)) {
this._callbackIfExists(null, orderState);
}
}
}
private async _onEventWatcherCallbackAsync(err: Error | null, logIfExists?: LogEvent): Promise<void> {
if (!_.isNull(err)) {
if (!_.isUndefined(this._callbackIfExists)) {
this._callbackIfExists(err);
this.unsubscribe();
}
return;
}
const log = logIfExists as LogEvent; // At this moment we are sure that no error occured and log is defined.
const maybeDecodedLog = this._abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log);
const isLogDecoded = !_.isUndefined(((maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>).event);
if (!isLogDecoded) {
return; // noop
}
const decodedLog = (maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>;
let makerToken: string;
let makerAddress: string;
switch (decodedLog.event) {
case TokenEvents.Approval: {
// Invalidate cache
const args = decodedLog.args as ApprovalContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
makerAddress = args._owner;
if (
!_.isUndefined(this._dependentOrderHashes[makerAddress]) &&
!_.isUndefined(this._dependentOrderHashes[makerAddress][makerToken])
) {
const orderHashes = Array.from(this._dependentOrderHashes[makerAddress][makerToken]);
await this._emitRevalidateOrdersAsync(orderHashes);
}
break;
}
case TokenEvents.Transfer: {
// Invalidate cache
const args = decodedLog.args as TransferContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._from);
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._to);
// Revalidate orders
makerToken = decodedLog.address;
makerAddress = args._from;
if (
!_.isUndefined(this._dependentOrderHashes[makerAddress]) &&
!_.isUndefined(this._dependentOrderHashes[makerAddress][makerToken])
) {
const orderHashes = Array.from(this._dependentOrderHashes[makerAddress][makerToken]);
await this._emitRevalidateOrdersAsync(orderHashes);
}
break;
}
case EtherTokenEvents.Deposit: {
// Invalidate cache
const args = decodedLog.args as DepositContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
makerAddress = args._owner;
if (
!_.isUndefined(this._dependentOrderHashes[makerAddress]) &&
!_.isUndefined(this._dependentOrderHashes[makerAddress][makerToken])
) {
const orderHashes = Array.from(this._dependentOrderHashes[makerAddress][makerToken]);
await this._emitRevalidateOrdersAsync(orderHashes);
}
break;
}
case EtherTokenEvents.Withdrawal: {
// Invalidate cache
const args = decodedLog.args as WithdrawalContractEventArgs;
this._balanceAndProxyAllowanceLazyStore.deleteBalance(decodedLog.address, args._owner);
// Revalidate orders
makerToken = decodedLog.address;
makerAddress = args._owner;
if (
!_.isUndefined(this._dependentOrderHashes[makerAddress]) &&
!_.isUndefined(this._dependentOrderHashes[makerAddress][makerToken])
) {
const orderHashes = Array.from(this._dependentOrderHashes[makerAddress][makerToken]);
await this._emitRevalidateOrdersAsync(orderHashes);
}
break;
}
case ExchangeEvents.LogFill: {
// Invalidate cache
const args = decodedLog.args as LogFillContractEventArgs;
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]);
if (isOrderWatched) {
await this._emitRevalidateOrdersAsync([orderHash]);
}
break;
}
case ExchangeEvents.LogCancel: {
// Invalidate cache
const args = decodedLog.args as LogCancelContractEventArgs;
this._orderFilledCancelledLazyStore.deleteCancelledTakerAmount(args.orderHash);
// Revalidate orders
const orderHash = args.orderHash;
const isOrderWatched = !_.isUndefined(this._orderByOrderHash[orderHash]);
if (isOrderWatched) {
await this._emitRevalidateOrdersAsync([orderHash]);
}
break;
}
case ExchangeEvents.LogError:
return; // noop
default:
throw utils.spawnSwitchErr('decodedLog.event', decodedLog.event);
}
}
private async _emitRevalidateOrdersAsync(orderHashes: string[]): Promise<void> {
for (const orderHash of orderHashes) {
const signedOrder = this._orderByOrderHash[orderHash];
// Most of these calls will never reach the network because the data is fetched from stores
// and only updated when cache is invalidated
const orderState = await this._orderStateUtils.getOrderStateAsync(signedOrder);
if (_.isUndefined(this._callbackIfExists)) {
break; // Unsubscribe was called
}
if (_.isEqual(orderState, this._orderStateByOrderHashCache[orderHash])) {
// Actual order state didn't change
continue;
} else {
this._orderStateByOrderHashCache[orderHash] = orderState;
}
this._callbackIfExists(null, orderState);
}
}
private _addToDependentOrderHashes(signedOrder: SignedOrder, orderHash: string): void {
if (_.isUndefined(this._dependentOrderHashes[signedOrder.maker])) {
this._dependentOrderHashes[signedOrder.maker] = {};
}
if (_.isUndefined(this._dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress])) {
this._dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress] = new Set();
}
this._dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress].add(orderHash);
const zrxTokenAddress = this._getZRXTokenAddress();
if (_.isUndefined(this._dependentOrderHashes[signedOrder.maker][zrxTokenAddress])) {
this._dependentOrderHashes[signedOrder.maker][zrxTokenAddress] = new Set();
}
this._dependentOrderHashes[signedOrder.maker][zrxTokenAddress].add(orderHash);
}
private _removeFromDependentOrderHashes(makerAddress: string, tokenAddress: string, orderHash: string) {
this._dependentOrderHashes[makerAddress][tokenAddress].delete(orderHash);
if (this._dependentOrderHashes[makerAddress][tokenAddress].size === 0) {
delete this._dependentOrderHashes[makerAddress][tokenAddress];
}
if (_.isEmpty(this._dependentOrderHashes[makerAddress])) {
delete this._dependentOrderHashes[makerAddress];
}
}
private _getZRXTokenAddress(): string {
const exchange = (this._orderFilledCancelledLazyStore as any)._exchange as ExchangeWrapper;
const zrxTokenAddress = exchange.getZRXTokenAddress();
return zrxTokenAddress;
}
}

View File

@@ -1,95 +0,0 @@
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export class RemainingFillableCalculator {
private _signedOrder: SignedOrder;
private _isMakerTokenZRX: boolean;
// Transferrable Amount is the minimum of Approval and Balance
private _transferrableMakerTokenAmount: BigNumber;
private _transferrableMakerFeeTokenAmount: BigNumber;
private _remainingMakerTokenAmount: BigNumber;
private _remainingMakerFeeAmount: BigNumber;
constructor(
signedOrder: SignedOrder,
isMakerTokenZRX: boolean,
transferrableMakerTokenAmount: BigNumber,
transferrableMakerFeeTokenAmount: BigNumber,
remainingMakerTokenAmount: BigNumber,
) {
this._signedOrder = signedOrder;
this._isMakerTokenZRX = isMakerTokenZRX;
this._transferrableMakerTokenAmount = transferrableMakerTokenAmount;
this._transferrableMakerFeeTokenAmount = transferrableMakerFeeTokenAmount;
this._remainingMakerTokenAmount = remainingMakerTokenAmount;
this._remainingMakerFeeAmount = remainingMakerTokenAmount
.times(signedOrder.makerFee)
.dividedToIntegerBy(signedOrder.makerTokenAmount);
}
public computeRemainingMakerFillable(): BigNumber {
if (this._hasSufficientFundsForFeeAndTransferAmount()) {
return this._remainingMakerTokenAmount;
}
if (this._signedOrder.makerFee.isZero()) {
return BigNumber.min(this._remainingMakerTokenAmount, this._transferrableMakerTokenAmount);
}
return this._calculatePartiallyFillableMakerTokenAmount();
}
public computeRemainingTakerFillable(): BigNumber {
return this.computeRemainingMakerFillable()
.times(this._signedOrder.takerTokenAmount)
.dividedToIntegerBy(this._signedOrder.makerTokenAmount);
}
private _hasSufficientFundsForFeeAndTransferAmount(): boolean {
if (this._isMakerTokenZRX) {
const totalZRXTransferAmountRequired = this._remainingMakerTokenAmount.plus(this._remainingMakerFeeAmount);
const hasSufficientFunds = this._transferrableMakerTokenAmount.greaterThanOrEqualTo(
totalZRXTransferAmountRequired,
);
return hasSufficientFunds;
} else {
const hasSufficientFundsForTransferAmount = this._transferrableMakerTokenAmount.greaterThanOrEqualTo(
this._remainingMakerTokenAmount,
);
const hasSufficientFundsForFeeAmount = this._transferrableMakerFeeTokenAmount.greaterThanOrEqualTo(
this._remainingMakerFeeAmount,
);
const hasSufficientFunds = hasSufficientFundsForTransferAmount && hasSufficientFundsForFeeAmount;
return hasSufficientFunds;
}
}
private _calculatePartiallyFillableMakerTokenAmount(): BigNumber {
// Given an order for 200 wei for 2 ZRXwei fee, find 100 wei for 1 ZRXwei. Order ratio is then 100:1
const orderToFeeRatio = this._signedOrder.makerTokenAmount.dividedBy(this._signedOrder.makerFee);
// The number of times the maker can fill the order, if each fill only required the transfer of a single
// baseUnit of fee tokens.
// Given 2 ZRXwei, the maximum amount of times Maker can fill this order, in terms of fees, is 2
const fillableTimesInFeeTokenBaseUnits = BigNumber.min(
this._transferrableMakerFeeTokenAmount,
this._remainingMakerFeeAmount,
);
// The number of times the Maker can fill the order, given the Maker Token Balance
// Assuming a balance of 150 wei, and an orderToFeeRatio of 100:1, maker can fill this order 1 time.
let fillableTimesInMakerTokenUnits = this._transferrableMakerTokenAmount.dividedBy(orderToFeeRatio);
if (this._isMakerTokenZRX) {
// If ZRX is the maker token, the Fee and the Maker amount need to be removed from the same pool;
// 200 ZRXwei for 2ZRXwei fee can only be filled once (need 202 ZRXwei)
const totalZRXTokenPooled = this._transferrableMakerTokenAmount;
// The purchasing power here is less as the tokens are taken from the same Pool
// For every one number of fills, we have to take an extra ZRX out of the pool
fillableTimesInMakerTokenUnits = totalZRXTokenPooled.dividedBy(orderToFeeRatio.plus(new BigNumber(1)));
}
// When Ratio is not fully divisible there can be remainders which cannot be represented, so they are floored.
// This can result in a RoundingError being thrown by the Exchange Contract.
const partiallyFillableMakerTokenAmount = fillableTimesInMakerTokenUnits
.times(this._signedOrder.makerTokenAmount)
.dividedToIntegerBy(this._signedOrder.makerFee);
const partiallyFillableFeeTokenAmount = fillableTimesInFeeTokenBaseUnits
.times(this._signedOrder.makerTokenAmount)
.dividedToIntegerBy(this._signedOrder.makerFee);
const partiallyFillableAmount = BigNumber.min(
partiallyFillableMakerTokenAmount,
partiallyFillableFeeTokenAmount,
);
return partiallyFillableAmount;
}
}

View File

@@ -8,8 +8,8 @@ export const zeroExPrivateNetworkConfigSchema = {
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },
exchangeContractAddress: { $ref: '/Address' },
tokenRegistryContractAddress: { $ref: '/Address' },
tokenTransferProxyContractAddress: { $ref: '/Address' },
erc20ProxyContractAddress: { $ref: '/Address' },
erc721ProxyContractAddress: { $ref: '/Address' },
orderWatcherConfig: {
type: 'object',
properties: {
@@ -29,7 +29,7 @@ export const zeroExPrivateNetworkConfigSchema = {
'networkId',
'zrxContractAddress',
'exchangeContractAddress',
'tokenRegistryContractAddress',
'tokenTransferProxyContractAddress',
'erc20ProxyContractAddress',
'erc721ProxyContractAddress',
],
};

View File

@@ -1,15 +1,29 @@
const networkNameToId: { [networkName: string]: number } = {
mainnet: 1,
ropsten: 3,
rinkeby: 4,
kovan: 42,
ganache: 50,
};
export const zeroExPublicNetworkConfigSchema = {
id: '/ZeroExPublicNetworkConfig',
properties: {
networkId: {
type: 'number',
enum: [1, 3, 4, 42, 50],
enum: [
networkNameToId.mainnet,
networkNameToId.ropsten,
networkNameToId.rinkeby,
networkNameToId.kovan,
networkNameToId.ganache,
],
},
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },
exchangeContractAddress: { $ref: '/Address' },
tokenRegistryContractAddress: { $ref: '/Address' },
tokenTransferProxyContractAddress: { $ref: '/Address' },
erc20ProxyContractAddress: { $ref: '/Address' },
erc721ProxyContractAddress: { $ref: '/Address' },
orderWatcherConfig: {
type: 'object',
properties: {

View File

@@ -1,86 +0,0 @@
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
*/
export class BalanceAndProxyAllowanceLazyStore {
private _token: TokenWrapper;
private _defaultBlock: BlockParamLiteral;
private _balance: {
[tokenAddress: string]: {
[userAddress: string]: BigNumber;
};
};
private _proxyAllowance: {
[tokenAddress: string]: {
[userAddress: string]: BigNumber;
};
};
constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) {
this._token = token;
this._defaultBlock = defaultBlock;
this._balance = {};
this._proxyAllowance = {};
}
public async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> {
if (_.isUndefined(this._balance[tokenAddress]) || _.isUndefined(this._balance[tokenAddress][userAddress])) {
const methodOpts = {
defaultBlock: this._defaultBlock,
};
const balance = await this._token.getBalanceAsync(tokenAddress, userAddress, methodOpts);
this.setBalance(tokenAddress, userAddress, balance);
}
const cachedBalance = this._balance[tokenAddress][userAddress];
return cachedBalance;
}
public setBalance(tokenAddress: string, userAddress: string, balance: BigNumber): void {
if (_.isUndefined(this._balance[tokenAddress])) {
this._balance[tokenAddress] = {};
}
this._balance[tokenAddress][userAddress] = balance;
}
public deleteBalance(tokenAddress: string, userAddress: string): void {
if (!_.isUndefined(this._balance[tokenAddress])) {
delete this._balance[tokenAddress][userAddress];
if (_.isEmpty(this._balance[tokenAddress])) {
delete this._balance[tokenAddress];
}
}
}
public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber> {
if (
_.isUndefined(this._proxyAllowance[tokenAddress]) ||
_.isUndefined(this._proxyAllowance[tokenAddress][userAddress])
) {
const methodOpts = {
defaultBlock: this._defaultBlock,
};
const proxyAllowance = await this._token.getProxyAllowanceAsync(tokenAddress, userAddress, methodOpts);
this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance);
}
const cachedProxyAllowance = this._proxyAllowance[tokenAddress][userAddress];
return cachedProxyAllowance;
}
public setProxyAllowance(tokenAddress: string, userAddress: string, proxyAllowance: BigNumber): void {
if (_.isUndefined(this._proxyAllowance[tokenAddress])) {
this._proxyAllowance[tokenAddress] = {};
}
this._proxyAllowance[tokenAddress][userAddress] = proxyAllowance;
}
public deleteProxyAllowance(tokenAddress: string, userAddress: string): void {
if (!_.isUndefined(this._proxyAllowance[tokenAddress])) {
delete this._proxyAllowance[tokenAddress][userAddress];
if (_.isEmpty(this._proxyAllowance[tokenAddress])) {
delete this._proxyAllowance[tokenAddress];
}
}
}
public deleteAll(): void {
this._balance = {};
this._proxyAllowance = {};
}
}

View File

@@ -1,61 +0,0 @@
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
/**
* Copy on read store for filled/cancelled taker amounts
*/
export class OrderFilledCancelledLazyStore {
private _exchange: ExchangeWrapper;
private _filledTakerAmount: {
[orderHash: string]: BigNumber;
};
private _cancelledTakerAmount: {
[orderHash: string]: BigNumber;
};
constructor(exchange: ExchangeWrapper) {
this._exchange = exchange;
this._filledTakerAmount = {};
this._cancelledTakerAmount = {};
}
public async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
if (_.isUndefined(this._filledTakerAmount[orderHash])) {
const methodOpts = {
defaultBlock: BlockParamLiteral.Pending,
};
const filledTakerAmount = await this._exchange.getFilledTakerAmountAsync(orderHash, methodOpts);
this.setFilledTakerAmount(orderHash, filledTakerAmount);
}
const cachedFilled = this._filledTakerAmount[orderHash];
return cachedFilled;
}
public setFilledTakerAmount(orderHash: string, filledTakerAmount: BigNumber): void {
this._filledTakerAmount[orderHash] = filledTakerAmount;
}
public deleteFilledTakerAmount(orderHash: string): void {
delete this._filledTakerAmount[orderHash];
}
public async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber> {
if (_.isUndefined(this._cancelledTakerAmount[orderHash])) {
const methodOpts = {
defaultBlock: BlockParamLiteral.Pending,
};
const cancelledTakerAmount = await this._exchange.getCancelledTakerAmountAsync(orderHash, methodOpts);
this.setCancelledTakerAmount(orderHash, cancelledTakerAmount);
}
const cachedCancelled = this._cancelledTakerAmount[orderHash];
return cachedCancelled;
}
public setCancelledTakerAmount(orderHash: string, cancelledTakerAmount: BigNumber): void {
this._cancelledTakerAmount[orderHash] = cancelledTakerAmount;
}
public deleteCancelledTakerAmount(orderHash: string): void {
delete this._cancelledTakerAmount[orderHash];
}
public deleteAll(): void {
this._filledTakerAmount = {};
this._cancelledTakerAmount = {};
}
}

View File

@@ -1,283 +1,7 @@
import { BigNumber } from '@0xproject/utils';
import {
BlockParam,
BlockParamLiteral,
ContractEventArg,
LogWithDecodedArgs,
Order,
SignedOrder,
} from '@0xproject/types';
import * as Web3 from 'web3';
import { EtherTokenContractEventArgs, EtherTokenEvents } from './contract_wrappers/generated/ether_token';
import { ExchangeContractEventArgs, ExchangeEvents } from './contract_wrappers/generated/exchange';
import { TokenContractEventArgs, TokenEvents } from './contract_wrappers/generated/token';
export enum ZeroExError {
ExchangeContractDoesNotExist = 'EXCHANGE_CONTRACT_DOES_NOT_EXIST',
ZRXContractDoesNotExist = 'ZRX_CONTRACT_DOES_NOT_EXIST',
EtherTokenContractDoesNotExist = 'ETHER_TOKEN_CONTRACT_DOES_NOT_EXIST',
TokenTransferProxyContractDoesNotExist = 'TOKEN_TRANSFER_PROXY_CONTRACT_DOES_NOT_EXIST',
TokenRegistryContractDoesNotExist = 'TOKEN_REGISTRY_CONTRACT_DOES_NOT_EXIST',
TokenContractDoesNotExist = 'TOKEN_CONTRACT_DOES_NOT_EXIST',
UnhandledError = 'UNHANDLED_ERROR',
UserHasNoAssociatedAddress = 'USER_HAS_NO_ASSOCIATED_ADDRESSES',
InvalidSignature = 'INVALID_SIGNATURE',
ContractNotDeployedOnNetwork = 'CONTRACT_NOT_DEPLOYED_ON_NETWORK',
InsufficientAllowanceForTransfer = 'INSUFFICIENT_ALLOWANCE_FOR_TRANSFER',
InsufficientBalanceForTransfer = 'INSUFFICIENT_BALANCE_FOR_TRANSFER',
InsufficientEthBalanceForDeposit = 'INSUFFICIENT_ETH_BALANCE_FOR_DEPOSIT',
InsufficientWEthBalanceForWithdrawal = 'INSUFFICIENT_WETH_BALANCE_FOR_WITHDRAWAL',
InvalidJump = 'INVALID_JUMP',
OutOfGas = 'OUT_OF_GAS',
NoNetworkId = 'NO_NETWORK_ID',
SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND',
SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT',
TransactionMiningTimeout = 'TRANSACTION_MINING_TIMEOUT',
}
export enum InternalZeroExError {
NoAbiDecoder = 'NO_ABI_DECODER',
ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY',
WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY',
}
export type OrderAddresses = [string, string, string, string, string];
export type OrderValues = [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber];
export type LogEvent = Web3.LogEntryEvent;
export interface DecodedLogEvent<ArgsType> {
isRemoved: boolean;
log: LogWithDecodedArgs<ArgsType>;
}
export type EventCallback<ArgsType> = (err: null | Error, log?: DecodedLogEvent<ArgsType>) => void;
export type EventWatcherCallback = (err: null | Error, log?: LogEvent) => void;
export enum ExchangeContractErrCodes {
ERROR_FILL_EXPIRED, // Order has already expired
ERROR_FILL_NO_VALUE, // Order has already been fully filled or cancelled
ERROR_FILL_TRUNCATION, // Rounding error too large
ERROR_FILL_BALANCE_ALLOWANCE, // Insufficient balance or allowance for token transfer
ERROR_CANCEL_EXPIRED, // Order has already expired
ERROR_CANCEL_NO_VALUE, // Order has already been fully filled or cancelled
}
export enum ExchangeContractErrs {
OrderFillExpired = 'ORDER_FILL_EXPIRED',
OrderCancelExpired = 'ORDER_CANCEL_EXPIRED',
OrderCancelAmountZero = 'ORDER_CANCEL_AMOUNT_ZERO',
OrderAlreadyCancelledOrFilled = 'ORDER_ALREADY_CANCELLED_OR_FILLED',
OrderFillAmountZero = 'ORDER_FILL_AMOUNT_ZERO',
OrderRemainingFillAmountZero = 'ORDER_REMAINING_FILL_AMOUNT_ZERO',
OrderFillRoundingError = 'ORDER_FILL_ROUNDING_ERROR',
FillBalanceAllowanceError = 'FILL_BALANCE_ALLOWANCE_ERROR',
InsufficientTakerBalance = 'INSUFFICIENT_TAKER_BALANCE',
InsufficientTakerAllowance = 'INSUFFICIENT_TAKER_ALLOWANCE',
InsufficientMakerBalance = 'INSUFFICIENT_MAKER_BALANCE',
InsufficientMakerAllowance = 'INSUFFICIENT_MAKER_ALLOWANCE',
InsufficientTakerFeeBalance = 'INSUFFICIENT_TAKER_FEE_BALANCE',
InsufficientTakerFeeAllowance = 'INSUFFICIENT_TAKER_FEE_ALLOWANCE',
InsufficientMakerFeeBalance = 'INSUFFICIENT_MAKER_FEE_BALANCE',
InsufficientMakerFeeAllowance = 'INSUFFICIENT_MAKER_FEE_ALLOWANCE',
TransactionSenderIsNotFillOrderTaker = 'TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER',
MultipleMakersInSingleCancelBatchDisallowed = 'MULTIPLE_MAKERS_IN_SINGLE_CANCEL_BATCH_DISALLOWED',
InsufficientRemainingFillAmount = 'INSUFFICIENT_REMAINING_FILL_AMOUNT',
MultipleTakerTokensInFillUpToDisallowed = 'MULTIPLE_TAKER_TOKENS_IN_FILL_UP_TO_DISALLOWED',
BatchOrdersMustHaveSameExchangeAddress = 'BATCH_ORDERS_MUST_HAVE_SAME_EXCHANGE_ADDRESS',
BatchOrdersMustHaveAtLeastOneItem = 'BATCH_ORDERS_MUST_HAVE_AT_LEAST_ONE_ITEM',
}
export interface ContractEvent {
logIndex: number;
transactionIndex: number;
transactionHash: string;
blockHash: string;
blockNumber: number;
address: string;
type: string;
event: string;
args: ContractEventArgs;
}
export type ContractEventArgs = ExchangeContractEventArgs | TokenContractEventArgs | EtherTokenContractEventArgs;
// [address, name, symbol, decimals, ipfsHash, swarmHash]
export type TokenMetadata = [string, string, string, number, string, string];
export interface Token {
name: string;
address: string;
symbol: string;
decimals: number;
}
export interface TxOpts {
from: string;
gas?: number;
value?: BigNumber;
gasPrice?: BigNumber;
}
export interface TokenAddressBySymbol {
[symbol: string]: string;
}
export type ContractEvents = TokenEvents | ExchangeEvents | EtherTokenEvents;
export interface IndexedFilterValues {
[index: string]: ContractEventArg;
}
export interface BlockRange {
fromBlock: BlockParam;
toBlock: BlockParam;
}
export type DoneCallback = (err?: Error) => void;
export interface OrderCancellationRequest {
order: Order | SignedOrder;
takerTokenCancelAmount: BigNumber;
}
export interface OrderFillRequest {
signedOrder: SignedOrder;
takerTokenFillAmount: BigNumber;
}
export type AsyncMethod = (...args: any[]) => Promise<any>;
export type SyncMethod = (...args: any[]) => any;
/**
* We re-export the `Web3.Provider` type specified in the Web3 Typescript typings
* since it is the type of the `provider` argument to the `ZeroEx` constructor.
* It is however a `Web3` library type, not a native `0x.js` type. To learn more
* about providers, visit https://0xproject.com/wiki#Web3-Provider-Explained
*/
export type Web3Provider = Web3.Provider;
/*
* orderExpirationCheckingIntervalMs: How often to check for expired orders. Default: 50
* eventPollingIntervalMs: How often to poll the Ethereum node for new events. Defaults: 200
* expirationMarginMs: Amount of time before order expiry that you'd like to be notified
* of an orders expiration. Defaults: 0
* cleanupJobIntervalMs: How often to run a cleanup job which revalidates all the orders. Defaults: 1h
*/
export interface OrderStateWatcherConfig {
orderExpirationCheckingIntervalMs?: number;
eventPollingIntervalMs?: number;
expirationMarginMs?: number;
cleanupJobIntervalMs?: number;
}
/*
* networkId: The id of the underlying ethereum network your provider is connected to. (1-mainnet, 3-ropsten, 4-rinkeby, 42-kovan, 50-testrpc)
* gasPrice: Gas price to use with every transaction
* exchangeContractAddress: The address of an exchange contract to use
* zrxContractAddress: The address of the ZRX contract to use
* tokenRegistryContractAddress: The address of a token registry contract to use
* tokenTransferProxyContractAddress: The address of the token transfer proxy contract to use
* orderWatcherConfig: All the configs related to the orderWatcher
*/
export interface ZeroExConfig {
networkId: number;
gasPrice?: BigNumber;
exchangeContractAddress?: string;
zrxContractAddress?: string;
tokenRegistryContractAddress?: string;
tokenTransferProxyContractAddress?: string;
orderWatcherConfig?: OrderStateWatcherConfig;
}
export type ArtifactContractName = 'ZRX' | 'TokenTransferProxy' | 'TokenRegistry' | 'Token' | 'Exchange' | 'EtherToken';
export interface Artifact {
contract_name: ArtifactContractName;
abi: Web3.ContractAbi;
networks: {
[networkId: number]: {
address: string;
};
};
}
/*
* expectedFillTakerTokenAmount: If specified, the validation method will ensure that the
* supplied order maker has a sufficient allowance/balance to fill this amount of the order's
* takerTokenAmount. If not specified, the validation method ensures that the maker has a sufficient
* allowance/balance to fill the entire remaining order amount.
*/
export interface ValidateOrderFillableOpts {
expectedFillTakerTokenAmount?: BigNumber;
}
/*
* defaultBlock: The block up to which to query the blockchain state. Setting this to a historical block number
* let's the user query the blockchain's state at an arbitrary point in time. In order for this to work, the
* backing Ethereum node must keep the entire historical state of the chain (e.g setting `--pruning=archive`
* flag when running Parity).
*/
export interface MethodOpts {
defaultBlock?: Web3.BlockParam;
}
/*
* gasPrice: Gas price in Wei to use for a transaction
* gasLimit: The amount of gas to send with a transaction
*/
export interface TransactionOpts {
gasPrice?: BigNumber;
gasLimit?: number;
}
/*
* shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before
* broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default: true
*/
export interface OrderTransactionOpts extends TransactionOpts {
shouldValidate?: boolean;
}
export type FilterObject = Web3.FilterObject;
export enum TradeSide {
Maker = 'maker',
Taker = 'taker',
}
export enum TransferType {
Trade = 'trade',
Fee = 'fee',
}
export interface OrderRelevantState {
makerBalance: BigNumber;
makerProxyAllowance: BigNumber;
makerFeeBalance: BigNumber;
makerFeeProxyAllowance: BigNumber;
filledTakerTokenAmount: BigNumber;
cancelledTakerTokenAmount: BigNumber;
remainingFillableMakerTokenAmount: BigNumber;
remainingFillableTakerTokenAmount: BigNumber;
}
export interface OrderStateValid {
isValid: true;
orderHash: string;
orderRelevantState: OrderRelevantState;
}
export interface OrderStateInvalid {
isValid: false;
orderHash: string;
error: ExchangeContractErrs;
}
export type OrderState = OrderStateValid | OrderStateInvalid;
export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void;
// tslint:disable:max-file-line-count

View File

@@ -1,35 +0,0 @@
import { assert as sharedAssert } from '@0xproject/assert';
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
// tslint:disable-next-line:no-unused-variable
import { Schema } from '@0xproject/json-schemas';
// tslint:disable-next-line:no-unused-variable
import { ECSignature } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { signatureUtils } from '../utils/signature_utils';
export const assert = {
...sharedAssert,
isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string) {
const isValidSignature = signatureUtils.isValidSignature(orderHash, ecSignature, signerAddress);
this.assert(isValidSignature, `Expected order with hash '${orderHash}' to have a valid signature`);
},
async isSenderAddressAsync(
variableName: string,
senderAddressHex: string,
web3Wrapper: Web3Wrapper,
): Promise<void> {
sharedAssert.isETHAddressHex(variableName, senderAddressHex);
const isSenderAddressAvailable = await web3Wrapper.isSenderAddressAvailableAsync(senderAddressHex);
sharedAssert.assert(
isSenderAddressAvailable,
`Specified ${variableName} ${senderAddressHex} isn't available through the supplied web3 provider`,
);
},
async isUserAddressAvailableAsync(web3Wrapper: Web3Wrapper): Promise<void> {
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
this.assert(!_.isEmpty(availableAddresses), 'No addresses were available on the provided web3 provider');
},
};

View File

@@ -1,12 +1,4 @@
import { BigNumber } from '@0xproject/utils';
export const constants = {
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
TESTRPC_NETWORK_ID: 50,
MAX_DIGITS_IN_UNSIGNED_256_INT: 78,
INVALID_JUMP_PATTERN: 'invalid JUMP at',
OUT_OF_GAS_PATTERN: 'out of gas',
INVALID_TAKER_FORMAT: 'instance.taker is not of a type(s) string',
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
DEFAULT_BLOCK_POLLING_INTERVAL: 1000,
};

View File

@@ -1,138 +0,0 @@
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ZeroEx } from '../0x';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import { RemainingFillableCalculator } from '../order_watcher/remaining_fillable_calculator';
import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store';
import { OrderFilledCancelledLazyStore } from '../stores/order_filled_cancelled_lazy_store';
import { ExchangeContractErrs, OrderRelevantState, OrderState, OrderStateInvalid, OrderStateValid } from '../types';
const ACCEPTABLE_RELATIVE_ROUNDING_ERROR = 0.0001;
export class OrderStateUtils {
private _balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore;
private _orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore;
private static _validateIfOrderIsValid(signedOrder: SignedOrder, orderRelevantState: OrderRelevantState): void {
const unavailableTakerTokenAmount = orderRelevantState.cancelledTakerTokenAmount.add(
orderRelevantState.filledTakerTokenAmount,
);
const availableTakerTokenAmount = signedOrder.takerTokenAmount.minus(unavailableTakerTokenAmount);
if (availableTakerTokenAmount.eq(0)) {
throw new Error(ExchangeContractErrs.OrderRemainingFillAmountZero);
}
if (orderRelevantState.makerBalance.eq(0)) {
throw new Error(ExchangeContractErrs.InsufficientMakerBalance);
}
if (orderRelevantState.makerProxyAllowance.eq(0)) {
throw new Error(ExchangeContractErrs.InsufficientMakerAllowance);
}
if (!signedOrder.makerFee.eq(0)) {
if (orderRelevantState.makerFeeBalance.eq(0)) {
throw new Error(ExchangeContractErrs.InsufficientMakerFeeBalance);
}
if (orderRelevantState.makerFeeProxyAllowance.eq(0)) {
throw new Error(ExchangeContractErrs.InsufficientMakerFeeAllowance);
}
}
const minFillableTakerTokenAmountWithinNoRoundingErrorRange = signedOrder.takerTokenAmount
.dividedBy(ACCEPTABLE_RELATIVE_ROUNDING_ERROR)
.dividedBy(signedOrder.makerTokenAmount);
if (
orderRelevantState.remainingFillableTakerTokenAmount.lessThan(
minFillableTakerTokenAmountWithinNoRoundingErrorRange,
)
) {
throw new Error(ExchangeContractErrs.OrderFillRoundingError);
}
}
constructor(
balanceAndProxyAllowanceLazyStore: BalanceAndProxyAllowanceLazyStore,
orderFilledCancelledLazyStore: OrderFilledCancelledLazyStore,
) {
this._balanceAndProxyAllowanceLazyStore = balanceAndProxyAllowanceLazyStore;
this._orderFilledCancelledLazyStore = orderFilledCancelledLazyStore;
}
public async getOrderStateAsync(signedOrder: SignedOrder): Promise<OrderState> {
const orderRelevantState = await this.getOrderRelevantStateAsync(signedOrder);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
try {
OrderStateUtils._validateIfOrderIsValid(signedOrder, orderRelevantState);
const orderState: OrderStateValid = {
isValid: true,
orderHash,
orderRelevantState,
};
return orderState;
} catch (err) {
const orderState: OrderStateInvalid = {
isValid: false,
orderHash,
error: err.message,
};
return orderState;
}
}
public async getOrderRelevantStateAsync(signedOrder: SignedOrder): Promise<OrderRelevantState> {
// HACK: We access the private property here but otherwise the interface will be less nice.
// If we pass it from the instantiator - there is no opportunity to get it there
// because JS doesn't support async constructors.
// Moreover - it's cached under the hood so it's equivalent to an async constructor.
const exchange = (this._orderFilledCancelledLazyStore as any)._exchange as ExchangeWrapper;
const zrxTokenAddress = exchange.getZRXTokenAddress();
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
const makerBalance = await this._balanceAndProxyAllowanceLazyStore.getBalanceAsync(
signedOrder.makerTokenAddress,
signedOrder.maker,
);
const makerProxyAllowance = await this._balanceAndProxyAllowanceLazyStore.getProxyAllowanceAsync(
signedOrder.makerTokenAddress,
signedOrder.maker,
);
const makerFeeBalance = await this._balanceAndProxyAllowanceLazyStore.getBalanceAsync(
zrxTokenAddress,
signedOrder.maker,
);
const makerFeeProxyAllowance = await this._balanceAndProxyAllowanceLazyStore.getProxyAllowanceAsync(
zrxTokenAddress,
signedOrder.maker,
);
const filledTakerTokenAmount = await this._orderFilledCancelledLazyStore.getFilledTakerAmountAsync(orderHash);
const cancelledTakerTokenAmount = await this._orderFilledCancelledLazyStore.getCancelledTakerAmountAsync(
orderHash,
);
const unavailableTakerTokenAmount = await exchange.getUnavailableTakerAmountAsync(orderHash);
const totalMakerTokenAmount = signedOrder.makerTokenAmount;
const totalTakerTokenAmount = signedOrder.takerTokenAmount;
const remainingTakerTokenAmount = totalTakerTokenAmount.minus(unavailableTakerTokenAmount);
const remainingMakerTokenAmount = remainingTakerTokenAmount
.times(totalMakerTokenAmount)
.dividedToIntegerBy(totalTakerTokenAmount);
const transferrableMakerTokenAmount = BigNumber.min([makerProxyAllowance, makerBalance]);
const transferrableFeeTokenAmount = BigNumber.min([makerFeeProxyAllowance, makerFeeBalance]);
const isMakerTokenZRX = signedOrder.makerTokenAddress === zrxTokenAddress;
const remainingFillableCalculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableFeeTokenAmount,
remainingMakerTokenAmount,
);
const remainingFillableMakerTokenAmount = remainingFillableCalculator.computeRemainingMakerFillable();
const remainingFillableTakerTokenAmount = remainingFillableCalculator.computeRemainingTakerFillable();
const orderRelevantState = {
makerBalance,
makerProxyAllowance,
makerFeeBalance,
makerFeeProxyAllowance,
filledTakerTokenAmount,
cancelledTakerTokenAmount,
remainingFillableMakerTokenAmount,
remainingFillableTakerTokenAmount,
};
return orderRelevantState;
}
}

View File

@@ -1,217 +0,0 @@
import { Order, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { ZeroEx } from '../0x';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
import { ExchangeContractErrs, TradeSide, TransferType, ZeroExError } from '../types';
import { constants } from '../utils/constants';
import { utils } from '../utils/utils';
import { ExchangeTransferSimulator } from './exchange_transfer_simulator';
export class OrderValidationUtils {
private _exchangeWrapper: ExchangeWrapper;
public static validateCancelOrderThrowIfInvalid(
order: Order,
cancelTakerTokenAmount: BigNumber,
unavailableTakerTokenAmount: BigNumber,
): void {
if (cancelTakerTokenAmount.eq(0)) {
throw new Error(ExchangeContractErrs.OrderCancelAmountZero);
}
if (order.takerTokenAmount.eq(unavailableTakerTokenAmount)) {
throw new Error(ExchangeContractErrs.OrderAlreadyCancelledOrFilled);
}
const currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
if (order.expirationUnixTimestampSec.lessThan(currentUnixTimestampSec)) {
throw new Error(ExchangeContractErrs.OrderCancelExpired);
}
}
public static async validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTradeEmulator: ExchangeTransferSimulator,
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
senderAddress: string,
zrxTokenAddress: string,
): Promise<void> {
const fillMakerTokenAmount = OrderValidationUtils._getPartialAmount(
fillTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.makerTokenAmount,
);
await exchangeTradeEmulator.transferFromAsync(
signedOrder.makerTokenAddress,
signedOrder.maker,
senderAddress,
fillMakerTokenAmount,
TradeSide.Maker,
TransferType.Trade,
);
await exchangeTradeEmulator.transferFromAsync(
signedOrder.takerTokenAddress,
senderAddress,
signedOrder.maker,
fillTakerTokenAmount,
TradeSide.Taker,
TransferType.Trade,
);
const makerFeeAmount = OrderValidationUtils._getPartialAmount(
fillTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.makerFee,
);
await exchangeTradeEmulator.transferFromAsync(
zrxTokenAddress,
signedOrder.maker,
signedOrder.feeRecipient,
makerFeeAmount,
TradeSide.Maker,
TransferType.Fee,
);
const takerFeeAmount = OrderValidationUtils._getPartialAmount(
fillTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.takerFee,
);
await exchangeTradeEmulator.transferFromAsync(
zrxTokenAddress,
senderAddress,
signedOrder.feeRecipient,
takerFeeAmount,
TradeSide.Taker,
TransferType.Fee,
);
}
private static _validateRemainingFillAmountNotZeroOrThrow(
takerTokenAmount: BigNumber,
unavailableTakerTokenAmount: BigNumber,
) {
if (takerTokenAmount.eq(unavailableTakerTokenAmount)) {
throw new Error(ExchangeContractErrs.OrderRemainingFillAmountZero);
}
}
private static _validateOrderNotExpiredOrThrow(expirationUnixTimestampSec: BigNumber) {
const currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
if (expirationUnixTimestampSec.lessThan(currentUnixTimestampSec)) {
throw new Error(ExchangeContractErrs.OrderFillExpired);
}
}
private static _getPartialAmount(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
const fillMakerTokenAmount = numerator
.mul(target)
.div(denominator)
.round(0);
return fillMakerTokenAmount;
}
constructor(exchangeWrapper: ExchangeWrapper) {
this._exchangeWrapper = exchangeWrapper;
}
public async validateOrderFillableOrThrowAsync(
exchangeTradeEmulator: ExchangeTransferSimulator,
signedOrder: SignedOrder,
zrxTokenAddress: string,
expectedFillTakerTokenAmount?: BigNumber,
): Promise<void> {
const orderHash = utils.getOrderHashHex(signedOrder);
const unavailableTakerTokenAmount = await this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow(
signedOrder.takerTokenAmount,
unavailableTakerTokenAmount,
);
OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationUnixTimestampSec);
let fillTakerTokenAmount = signedOrder.takerTokenAmount.minus(unavailableTakerTokenAmount);
if (!_.isUndefined(expectedFillTakerTokenAmount)) {
fillTakerTokenAmount = expectedFillTakerTokenAmount;
}
const fillMakerTokenAmount = OrderValidationUtils._getPartialAmount(
fillTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.makerTokenAmount,
);
await exchangeTradeEmulator.transferFromAsync(
signedOrder.makerTokenAddress,
signedOrder.maker,
signedOrder.taker,
fillMakerTokenAmount,
TradeSide.Maker,
TransferType.Trade,
);
const makerFeeAmount = OrderValidationUtils._getPartialAmount(
fillTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.makerFee,
);
await exchangeTradeEmulator.transferFromAsync(
zrxTokenAddress,
signedOrder.maker,
signedOrder.feeRecipient,
makerFeeAmount,
TradeSide.Maker,
TransferType.Fee,
);
}
public async validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator: ExchangeTransferSimulator,
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
takerAddress: string,
zrxTokenAddress: string,
): Promise<BigNumber> {
if (fillTakerTokenAmount.eq(0)) {
throw new Error(ExchangeContractErrs.OrderFillAmountZero);
}
const orderHash = utils.getOrderHashHex(signedOrder);
if (!ZeroEx.isValidSignature(orderHash, signedOrder.ecSignature, signedOrder.maker)) {
throw new Error(ZeroExError.InvalidSignature);
}
const unavailableTakerTokenAmount = await this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils._validateRemainingFillAmountNotZeroOrThrow(
signedOrder.takerTokenAmount,
unavailableTakerTokenAmount,
);
if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== takerAddress) {
throw new Error(ExchangeContractErrs.TransactionSenderIsNotFillOrderTaker);
}
OrderValidationUtils._validateOrderNotExpiredOrThrow(signedOrder.expirationUnixTimestampSec);
const remainingTakerTokenAmount = signedOrder.takerTokenAmount.minus(unavailableTakerTokenAmount);
const filledTakerTokenAmount = remainingTakerTokenAmount.lessThan(fillTakerTokenAmount)
? remainingTakerTokenAmount
: fillTakerTokenAmount;
await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
filledTakerTokenAmount,
takerAddress,
zrxTokenAddress,
);
const wouldRoundingErrorOccur = await this._exchangeWrapper.isRoundingErrorAsync(
filledTakerTokenAmount,
signedOrder.takerTokenAmount,
signedOrder.makerTokenAmount,
);
if (wouldRoundingErrorOccur) {
throw new Error(ExchangeContractErrs.OrderFillRoundingError);
}
return filledTakerTokenAmount;
}
public async validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator: ExchangeTransferSimulator,
signedOrder: SignedOrder,
fillTakerTokenAmount: BigNumber,
takerAddress: string,
zrxTokenAddress: string,
): Promise<void> {
const filledTakerTokenAmount = await this.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
takerAddress,
zrxTokenAddress,
);
if (filledTakerTokenAmount !== fillTakerTokenAmount) {
throw new Error(ExchangeContractErrs.InsufficientRemainingFillAmount);
}
}
}

View File

@@ -1,45 +0,0 @@
import { ECSignature } from '@0xproject/types';
import * as ethUtil from 'ethereumjs-util';
export const signatureUtils = {
isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
const dataBuff = ethUtil.toBuffer(data);
const msgHashBuff = ethUtil.hashPersonalMessage(dataBuff);
try {
const pubKey = ethUtil.ecrecover(
msgHashBuff,
signature.v,
ethUtil.toBuffer(signature.r),
ethUtil.toBuffer(signature.s),
);
const retrievedAddress = ethUtil.bufferToHex(ethUtil.pubToAddress(pubKey));
return retrievedAddress === signerAddress;
} catch (err) {
return false;
}
},
parseSignatureHexAsVRS(signatureHex: string): ECSignature {
const signatureBuffer = ethUtil.toBuffer(signatureHex);
let v = signatureBuffer[0];
if (v < 27) {
v += 27;
}
const r = signatureBuffer.slice(1, 33);
const s = signatureBuffer.slice(33, 65);
const ecSignature: ECSignature = {
v,
r: ethUtil.bufferToHex(r),
s: ethUtil.bufferToHex(s),
};
return ecSignature;
},
parseSignatureHexAsRSV(signatureHex: string): ECSignature {
const { v, r, s } = ethUtil.fromRpcSig(signatureHex);
const ecSignature: ECSignature = {
v,
r: ethUtil.bufferToHex(r),
s: ethUtil.bufferToHex(s),
};
return ecSignature;
},
};

View File

@@ -1,63 +0,0 @@
import { Order, SignedOrder, SolidityTypes } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import BN = require('bn.js');
import * as ethABI from 'ethereumjs-abi';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
export const utils = {
/**
* Converts BigNumber instance to BN
* The only reason we convert to BN is to remain compatible with `ethABI. soliditySHA3` that
* expects values of Solidity type `uint` to be passed as type `BN`.
* We do not use BN anywhere else in the codebase.
*/
bigNumberToBN(value: BigNumber) {
return new BN(value.toString(), 10);
},
spawnSwitchErr(name: string, value: any): Error {
return new Error(`Unexpected switch value: ${value} encountered for ${name}`);
},
getOrderHashHex(order: Order | SignedOrder): string {
const orderParts = [
{ value: order.exchangeContractAddress, type: SolidityTypes.Address },
{ value: order.maker, type: SolidityTypes.Address },
{ value: order.taker, type: SolidityTypes.Address },
{ value: order.makerTokenAddress, type: SolidityTypes.Address },
{ value: order.takerTokenAddress, type: SolidityTypes.Address },
{ value: order.feeRecipient, type: SolidityTypes.Address },
{
value: utils.bigNumberToBN(order.makerTokenAmount),
type: SolidityTypes.Uint256,
},
{
value: utils.bigNumberToBN(order.takerTokenAmount),
type: SolidityTypes.Uint256,
},
{
value: utils.bigNumberToBN(order.makerFee),
type: SolidityTypes.Uint256,
},
{
value: utils.bigNumberToBN(order.takerFee),
type: SolidityTypes.Uint256,
},
{
value: utils.bigNumberToBN(order.expirationUnixTimestampSec),
type: SolidityTypes.Uint256,
},
{ value: utils.bigNumberToBN(order.salt), type: SolidityTypes.Uint256 },
];
const types = _.map(orderParts, o => o.type);
const values = _.map(orderParts, o => o.value);
const hashBuff = ethABI.soliditySHA3(types, values);
const hashHex = ethUtil.bufferToHex(hashBuff);
return hashHex;
},
getCurrentUnixTimestampSec(): BigNumber {
return new BigNumber(Date.now() / 1000).round();
},
getCurrentUnixTimestampMs(): BigNumber {
return new BigNumber(Date.now());
},
};

View File

@@ -1,120 +1,77 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { ContractWrappers } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
import { ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, ZeroEx } from '../src';
import { ERC20TokenApprovalEventArgs, ERC20TokenEvents, LogWithDecodedArgs, ZeroEx } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { TokenUtils } from './utils/token_utils';
import { web3, web3Wrapper } from './utils/web3_wrapper';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
chaiSetup.configure();
const expect = chai.expect;
const SHOULD_ADD_PERSONAL_MESSAGE_PREFIX = false;
describe('ZeroEx library', () => {
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3.currentProvider, config);
let zeroEx: ZeroEx;
before(async () => {
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
zeroEx = new ZeroEx(provider, config);
});
describe('#setProvider', () => {
it('overrides provider in nested web3s and invalidates contractInstances', async () => {
// Instantiate the contract instances with the current provider
await (zeroEx.exchange as any)._getExchangeContractAsync();
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined();
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.not.be.undefined();
const newProvider = web3Factory.getRpcProvider();
// Add property to newProvider so that we can differentiate it from old provider
(newProvider as any).zeroExTestId = 1;
zeroEx.setProvider(newProvider, constants.TESTRPC_NETWORK_ID);
(provider as any).zeroExTestId = 1;
zeroEx.setProvider(provider, constants.TESTRPC_NETWORK_ID);
// Check that contractInstances with old provider are removed after provider update
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined();
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined();
// Check that all nested web3 wrapper instances return the updated provider
const nestedWeb3WrapperProvider = (zeroEx as any)._web3Wrapper.getCurrentProvider();
expect(nestedWeb3WrapperProvider.zeroExTestId).to.be.a('number');
const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getCurrentProvider();
// Check that all nested zeroExContract/web3Wrapper instances return the updated provider
const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider();
expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number');
const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider();
expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number');
const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getCurrentProvider();
expect(tokenRegistryWeb3WrapperProvider.zeroExTestId).to.be.a('number');
});
});
describe('#isValidSignature', () => {
// The Exchange smart contract `isValidSignature` method only validates orderHashes and assumes
// the length of the data is exactly 32 bytes. Thus for these tests, we use data of this size.
const dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
const signature = {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
};
const ethSignSignature =
'0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403';
const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
it("should return false if the data doesn't pertain to the signature & address", async () => {
expect(ZeroEx.isValidSignature('0x0', signature, address)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync('0x0', signature, address),
).to.become(false);
return expect((zeroEx.exchange as any).isValidSignatureAsync('0x0', address, ethSignSignature)).to.become(
false,
);
});
it("should return false if the address doesn't pertain to the signature & data", async () => {
const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42';
expect(ZeroEx.isValidSignature(dataHex, signature, validUnrelatedAddress)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(
dataHex,
signature,
validUnrelatedAddress,
),
(zeroEx.exchange as any).isValidSignatureAsync(dataHex, validUnrelatedAddress, ethSignSignature),
).to.become(false);
});
it("should return false if the signature doesn't pertain to the dataHex & address", async () => {
const wrongSignature = _.assign({}, signature, { v: 28 });
expect(ZeroEx.isValidSignature(dataHex, wrongSignature, address)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, wrongSignature, address),
).to.become(false);
const signatureArray = ethSignSignature.split('');
// tslint:disable-next-line:custom-no-magic-numbers
signatureArray[5] = 'C'; // V = 28, instead of 27
const wrongSignature = signatureArray.join('');
return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, wrongSignature)).to.become(
false,
);
});
it('should return true if the signature does pertain to the dataHex & address', async () => {
const isValidSignatureLocal = ZeroEx.isValidSignature(dataHex, signature, address);
expect(isValidSignatureLocal).to.be.true();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, signature, address),
).to.become(true);
});
});
describe('#generateSalt', () => {
it('generates different salts', () => {
const equal = ZeroEx.generatePseudoRandomSalt().eq(ZeroEx.generatePseudoRandomSalt());
expect(equal).to.be.false();
});
it('generates salt in range [0..2^256)', () => {
const salt = ZeroEx.generatePseudoRandomSalt();
expect(salt.greaterThanOrEqualTo(0)).to.be.true();
const twoPow256 = new BigNumber(2).pow(256);
expect(salt.lessThan(twoPow256)).to.be.true();
});
});
describe('#isValidOrderHash', () => {
it('returns false if the value is not a hex string', () => {
const isValid = ZeroEx.isValidOrderHash('not a hex');
expect(isValid).to.be.false();
});
it('returns false if the length is wrong', () => {
const isValid = ZeroEx.isValidOrderHash('0xdeadbeef');
expect(isValid).to.be.false();
});
it('returns true if order hash is correct', () => {
const isValid = ZeroEx.isValidOrderHash('0x' + Array(65).join('0'));
expect(isValid).to.be.true();
return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, ethSignSignature)).to.become(
true,
);
});
});
describe('#toUnitAmount', () => {
@@ -149,106 +106,6 @@ describe('ZeroEx library', () => {
);
});
});
describe('#getOrderHashHex', () => {
const expectedOrderHash = '0x39da987067a3c9e5f1617694f1301326ba8c8b0498ebef5df4863bed394e3c83';
const fakeExchangeContractAddress = '0xb69e673309512a9d726f87304c6984054f87a93b';
const order: Order = {
maker: constants.NULL_ADDRESS,
taker: constants.NULL_ADDRESS,
feeRecipient: constants.NULL_ADDRESS,
makerTokenAddress: constants.NULL_ADDRESS,
takerTokenAddress: constants.NULL_ADDRESS,
exchangeContractAddress: fakeExchangeContractAddress,
salt: new BigNumber(0),
makerFee: new BigNumber(0),
takerFee: new BigNumber(0),
makerTokenAmount: new BigNumber(0),
takerTokenAmount: new BigNumber(0),
expirationUnixTimestampSec: new BigNumber(0),
};
it('calculates the order hash', async () => {
const orderHash = ZeroEx.getOrderHashHex(order);
expect(orderHash).to.be.equal(expectedOrderHash);
});
it('throws a readable error message if taker format is invalid', async () => {
const orderWithInvalidtakerFormat = {
...order,
taker: (null as any) as string,
};
const expectedErrorMessage =
'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
expect(() => ZeroEx.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
});
});
describe('#signOrderHashAsync', () => {
let stubs: Sinon.SinonStub[] = [];
let makerAddress: string;
before(async () => {
const availableAddreses = await zeroEx.getAvailableAddressesAsync();
makerAddress = availableAddreses[0];
});
afterEach(() => {
// clean up any stubs after the test has completed
_.each(stubs, s => s.restore());
stubs = [];
});
it('Should return the correct ECSignature', async () => {
const orderHash = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
const expectedECSignature = {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
};
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
it('should return the correct ECSignature for signatureHex concatenated as R + S + V', async () => {
const orderHash = '0x34decbedc118904df65f379a175bb39ca18209d6ce41d5ed549d54e6e0a95004';
const signature =
'0x22109d11d79cb8bf96ed88625e1cd9558800c4073332a9a02857499883ee5ce3050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb021b';
const expectedECSignature = {
v: 27,
r: '0x22109d11d79cb8bf96ed88625e1cd9558800c4073332a9a02857499883ee5ce3',
s: '0x050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb02',
};
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'signTransactionAsync').returns(Promise.resolve(signature)),
Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
];
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
it('should return the correct ECSignature for signatureHex concatenated as V + R + S', async () => {
const orderHash = '0xc793e33ffded933b76f2f48d9aa3339fc090399d5e7f5dec8d3660f5480793f7';
const signature =
'0x1bc80bedc6756722672753413efdd749b5adbd4fd552595f59c13427407ee9aee02dea66f25a608bbae457e020fb6decb763deb8b7192abab624997242da248960';
const expectedECSignature = {
v: 27,
r: '0xc80bedc6756722672753413efdd749b5adbd4fd552595f59c13427407ee9aee0',
s: '0x2dea66f25a608bbae457e020fb6decb763deb8b7192abab624997242da248960',
};
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'signTransactionAsync').returns(Promise.resolve(signature)),
Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
];
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
});
describe('#awaitTransactionMinedAsync', () => {
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -259,17 +116,16 @@ describe('ZeroEx library', () => {
it('returns transaction receipt with decoded logs', async () => {
const availableAddresses = await zeroEx.getAvailableAddressesAsync();
const coinbase = availableAddresses[0];
const tokens = await zeroEx.tokenRegistry.getTokensAsync();
const tokenUtils = new TokenUtils(tokens);
const zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address;
const proxyAddress = zeroEx.proxy.getContractAddress();
const txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase);
const zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
const erc20ProxyAddress = zeroEx.erc20Proxy.getContractAddress();
const txHash = await zeroEx.erc20Token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase);
const txReceiptWithDecodedLogs = await zeroEx.awaitTransactionMinedAsync(txHash);
const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs<ApprovalContractEventArgs>;
expect(log.event).to.be.equal(TokenEvents.Approval);
// tslint:disable-next-line:no-unnecessary-type-assertion
const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs<ERC20TokenApprovalEventArgs>;
expect(log.event).to.be.equal(ERC20TokenEvents.Approval);
expect(log.args._owner).to.be.equal(coinbase);
expect(log.args._spender).to.be.equal(proxyAddress);
expect(log.args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
expect(log.args._spender).to.be.equal(erc20ProxyAddress);
expect(log.args._value).to.be.bignumber.equal(zeroEx.erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
});
describe('#config', () => {
@@ -278,18 +134,16 @@ describe('ZeroEx library', () => {
exchangeContractAddress: ZeroEx.NULL_ADDRESS,
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroExWithWrongExchangeAddress = new ZeroEx(web3.currentProvider, zeroExConfig);
const zeroExWithWrongExchangeAddress = new ZeroEx(provider, zeroExConfig);
expect(zeroExWithWrongExchangeAddress.exchange.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS);
});
it('allows to specify token registry token contract address', async () => {
it('allows to specify erc20Proxy contract address', async () => {
const zeroExConfig = {
tokenRegistryContractAddress: ZeroEx.NULL_ADDRESS,
erc20ProxyContractAddress: ZeroEx.NULL_ADDRESS,
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroExWithWrongTokenRegistryAddress = new ZeroEx(web3.currentProvider, zeroExConfig);
expect(zeroExWithWrongTokenRegistryAddress.tokenRegistry.getContractAddress()).to.be.equal(
ZeroEx.NULL_ADDRESS,
);
const zeroExWithWrongERC20ProxyAddress = new ZeroEx(provider, zeroExConfig);
expect(zeroExWithWrongERC20ProxyAddress.erc20Proxy.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS);
});
});
});

View File

@@ -1,55 +0,0 @@
import * as fs from 'fs';
import HDWalletProvider = require('truffle-hdwallet-provider');
import { ZeroEx } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
chaiSetup.configure();
// Those tests are slower cause they're talking to a remote node
const TIMEOUT = 10000;
describe('Artifacts', () => {
describe('contracts are deployed on kovan', () => {
const kovanRpcUrl = constants.KOVAN_RPC_URL;
const packageJSONContent = fs.readFileSync('package.json', 'utf-8');
const packageJSON = JSON.parse(packageJSONContent);
const mnemonic = packageJSON.config.mnemonic;
const web3Provider = new HDWalletProvider(mnemonic, kovanRpcUrl);
const config = {
networkId: constants.KOVAN_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3Provider, config);
it('token registry contract is deployed', async () => {
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
}).timeout(TIMEOUT);
it('proxy contract is deployed', async () => {
await (zeroEx.proxy as any)._getTokenTransferProxyContractAsync();
}).timeout(TIMEOUT);
it('exchange contract is deployed', async () => {
await (zeroEx.exchange as any)._getExchangeContractAsync();
}).timeout(TIMEOUT);
});
describe('contracts are deployed on ropsten', () => {
const ropstenRpcUrl = constants.ROPSTEN_RPC_URL;
const packageJSONContent = fs.readFileSync('package.json', 'utf-8');
const packageJSON = JSON.parse(packageJSONContent);
const mnemonic = packageJSON.config.mnemonic;
const web3Provider = new HDWalletProvider(mnemonic, ropstenRpcUrl);
const config = {
networkId: constants.ROPSTEN_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3Provider, config);
it('token registry contract is deployed', async () => {
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
}).timeout(TIMEOUT);
it('proxy contract is deployed', async () => {
await (zeroEx.proxy as any)._getTokenTransferProxyContractAsync();
}).timeout(TIMEOUT);
it('exchange contract is deployed', async () => {
await (zeroEx.exchange as any)._getExchangeContractAsync();
}).timeout(TIMEOUT);
});
});

View File

@@ -1,43 +0,0 @@
import { web3Factory } from '@0xproject/dev-utils';
import * as chai from 'chai';
import 'mocha';
import { ZeroEx } from '../src';
import { assert } from '../src/utils/assert';
import { constants } from './utils/constants';
const expect = chai.expect;
describe('Assertion library', () => {
const web3 = web3Factory.create();
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3.currentProvider, config);
describe('#isSenderAddressHexAsync', () => {
it('throws when address is invalid', async () => {
const address = '0xdeadbeef';
const varName = 'address';
return expect(
assert.isSenderAddressAsync(varName, address, (zeroEx as any)._web3Wrapper),
).to.be.rejectedWith(`Expected ${varName} to be of type ETHAddressHex, encountered: ${address}`);
});
it('throws when address is unavailable', async () => {
const validUnrelatedAddress = '0x8b0292b11a196601eddce54b665cafeca0347d42';
const varName = 'address';
return expect(
assert.isSenderAddressAsync(varName, validUnrelatedAddress, (zeroEx as any)._web3Wrapper),
).to.be.rejectedWith(
`Specified ${varName} ${validUnrelatedAddress} isn't available through the supplied web3 provider`,
);
});
it("doesn't throw if address is available", async () => {
const availableAddress = (await zeroEx.getAvailableAddressesAsync())[0];
const varName = 'address';
return expect(
assert.isSenderAddressAsync(varName, availableAddress, (zeroEx as any)._web3Wrapper),
).to.become(undefined);
});
});
});

View File

@@ -1,126 +0,0 @@
import { web3Factory } from '@0xproject/dev-utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import { LogEvent } from '../src';
import { EventWatcher } from '../src/order_watcher/event_watcher';
import { DoneCallback } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
chaiSetup.configure();
const expect = chai.expect;
describe('EventWatcher', () => {
let web3: Web3;
let stubs: Sinon.SinonStub[] = [];
let eventWatcher: EventWatcher;
let web3Wrapper: Web3Wrapper;
const logA: Web3.LogEntry = {
address: '0x71d271f8b14adef568f8f28f1587ce7271ac4ca5',
blockHash: null,
blockNumber: null,
data: '',
logIndex: null,
topics: [],
transactionHash: '0x004881d38cd4a8f72f1a0d68c8b9b8124504706041ff37019c1d1ed6bfda8e17',
transactionIndex: 0,
};
const logB: Web3.LogEntry = {
address: '0x8d12a197cb00d4747a1fe03395095ce2a5cc6819',
blockHash: null,
blockNumber: null,
data: '',
logIndex: null,
topics: ['0xf341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567'],
transactionHash: '0x01ef3c048b18d9b09ea195b4ed94cf8dd5f3d857a1905ff886b152cfb1166f25',
transactionIndex: 0,
};
const logC: Web3.LogEntry = {
address: '0x1d271f8b174adef58f1587ce68f8f27271ac4ca5',
blockHash: null,
blockNumber: null,
data: '',
logIndex: null,
topics: ['0xf341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567'],
transactionHash: '0x01ef3c048b18d9b09ea195b4ed94cf8dd5f3d857a1905ff886b152cfb1166f25',
transactionIndex: 0,
};
before(async () => {
web3 = web3Factory.create();
const pollingIntervalMs = 10;
web3Wrapper = new Web3Wrapper(web3.currentProvider);
eventWatcher = new EventWatcher(web3Wrapper, pollingIntervalMs);
});
afterEach(() => {
// clean up any stubs after the test has completed
_.each(stubs, s => s.restore());
stubs = [];
eventWatcher.unsubscribe();
});
it('correctly emits initial log events', (done: DoneCallback) => {
const logs: Web3.LogEntry[] = [logA, logB];
const expectedLogEvents = [
{
removed: false,
...logA,
},
{
removed: false,
...logB,
},
];
const getLogsStub = Sinon.stub(web3Wrapper, 'getLogsAsync');
getLogsStub.onCall(0).returns(logs);
stubs.push(getLogsStub);
const expectedToBeCalledOnce = false;
const callback = reportNodeCallbackErrors(done, expectedToBeCalledOnce)((event: LogEvent) => {
const expectedLogEvent = expectedLogEvents.shift();
expect(event).to.be.deep.equal(expectedLogEvent);
if (_.isEmpty(expectedLogEvents)) {
done();
}
});
eventWatcher.subscribe(callback);
});
it('correctly computes the difference and emits only changes', (done: DoneCallback) => {
const initialLogs: Web3.LogEntry[] = [logA, logB];
const changedLogs: Web3.LogEntry[] = [logA, logC];
const expectedLogEvents = [
{
removed: false,
...logA,
},
{
removed: false,
...logB,
},
{
removed: true,
...logB,
},
{
removed: false,
...logC,
},
];
const getLogsStub = Sinon.stub(web3Wrapper, 'getLogsAsync');
getLogsStub.onCall(0).returns(initialLogs);
getLogsStub.onCall(1).returns(changedLogs);
stubs.push(getLogsStub);
const expectedToBeCalledOnce = false;
const callback = reportNodeCallbackErrors(done, expectedToBeCalledOnce)((event: LogEvent) => {
const expectedLogEvent = expectedLogEvents.shift();
expect(event).to.be.deep.equal(expectedLogEvent);
if (_.isEmpty(expectedLogEvents)) {
done();
}
});
eventWatcher.subscribe(callback);
});
});

View File

@@ -1,117 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import { ExchangeContractErrs, Token, ZeroEx } from '../src';
import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('ExchangeTransferSimulator', () => {
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
const zeroEx = new ZeroEx(web3.currentProvider, config);
const transferAmount = new BigNumber(5);
let userAddresses: string[];
let tokens: Token[];
let coinbase: string;
let sender: string;
let recipient: string;
let exampleTokenAddress: string;
let exchangeTransferSimulator: ExchangeTransferSimulator;
let txHash: string;
before(async () => {
userAddresses = await zeroEx.getAvailableAddressesAsync();
[coinbase, sender, recipient] = userAddresses;
tokens = await zeroEx.tokenRegistry.getTokensAsync();
exampleTokenAddress = tokens[0].address;
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#transferFromAsync', () => {
beforeEach(() => {
exchangeTransferSimulator = new ExchangeTransferSimulator(zeroEx.token, BlockParamLiteral.Latest);
});
it("throws if the user doesn't have enough allowance", async () => {
return expect(
exchangeTransferSimulator.transferFromAsync(
exampleTokenAddress,
sender,
recipient,
transferAmount,
TradeSide.Taker,
TransferType.Trade,
),
).to.be.rejectedWith(ExchangeContractErrs.InsufficientTakerAllowance);
});
it("throws if the user doesn't have enough balance", async () => {
txHash = await zeroEx.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount);
await zeroEx.awaitTransactionMinedAsync(txHash);
return expect(
exchangeTransferSimulator.transferFromAsync(
exampleTokenAddress,
sender,
recipient,
transferAmount,
TradeSide.Maker,
TransferType.Trade,
),
).to.be.rejectedWith(ExchangeContractErrs.InsufficientMakerBalance);
});
it('updates balances and proxyAllowance after transfer', async () => {
txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount);
await zeroEx.awaitTransactionMinedAsync(txHash);
txHash = await zeroEx.token.setProxyAllowanceAsync(exampleTokenAddress, sender, transferAmount);
await zeroEx.awaitTransactionMinedAsync(txHash);
await exchangeTransferSimulator.transferFromAsync(
exampleTokenAddress,
sender,
recipient,
transferAmount,
TradeSide.Taker,
TransferType.Trade,
);
const store = (exchangeTransferSimulator as any)._store;
const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender);
const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient);
const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender);
expect(senderBalance).to.be.bignumber.equal(0);
expect(recipientBalance).to.be.bignumber.equal(transferAmount);
expect(senderProxyAllowance).to.be.bignumber.equal(0);
});
it("doesn't update proxyAllowance after transfer if unlimited", async () => {
txHash = await zeroEx.token.transferAsync(exampleTokenAddress, coinbase, sender, transferAmount);
await zeroEx.awaitTransactionMinedAsync(txHash);
txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(exampleTokenAddress, sender);
await zeroEx.awaitTransactionMinedAsync(txHash);
await exchangeTransferSimulator.transferFromAsync(
exampleTokenAddress,
sender,
recipient,
transferAmount,
TradeSide.Taker,
TransferType.Trade,
);
const store = (exchangeTransferSimulator as any)._store;
const senderBalance = await store.getBalanceAsync(exampleTokenAddress, sender);
const recipientBalance = await store.getBalanceAsync(exampleTokenAddress, recipient);
const senderProxyAllowance = await store.getProxyAllowanceAsync(exampleTokenAddress, sender);
expect(senderBalance).to.be.bignumber.equal(0);
expect(recipientBalance).to.be.bignumber.equal(transferAmount);
expect(senderProxyAllowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,157 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import { ZeroEx } from '../src/0x';
import { ExpirationWatcher } from '../src/order_watcher/expiration_watcher';
import { DoneCallback, Token } from '../src/types';
import { utils } from '../src/utils/utils';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { FillScenarios } from './utils/fill_scenarios';
import { reportNoErrorCallbackErrors } from './utils/report_callback_errors';
import { TokenUtils } from './utils/token_utils';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('ExpirationWatcher', () => {
let zeroEx: ZeroEx;
let tokenUtils: TokenUtils;
let tokens: Token[];
let userAddresses: string[];
let zrxTokenAddress: string;
let fillScenarios: FillScenarios;
let exchangeContractAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
let coinbase: string;
let makerAddress: string;
let takerAddress: string;
let feeRecipient: string;
const fillableAmount = new BigNumber(5);
let currentUnixTimestampSec: BigNumber;
let timer: Sinon.SinonFakeTimers;
let expirationWatcher: ExpirationWatcher;
before(async () => {
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
zeroEx = new ZeroEx(web3.currentProvider, config);
exchangeContractAddress = zeroEx.exchange.getContractAddress();
userAddresses = await zeroEx.getAvailableAddressesAsync();
tokens = await zeroEx.tokenRegistry.getTokensAsync();
tokenUtils = new TokenUtils(tokens);
zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address;
fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress);
[coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses;
tokens = await zeroEx.tokenRegistry.getTokensAsync();
const [makerToken, takerToken] = tokenUtils.getDummyTokens();
makerTokenAddress = makerToken.address;
takerTokenAddress = takerToken.address;
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
const sinonTimerConfig = { shouldAdvanceTime: true } as any;
// This constructor has incorrect types
timer = Sinon.useFakeTimers(sinonTimerConfig);
currentUnixTimestampSec = utils.getCurrentUnixTimestampSec();
expirationWatcher = new ExpirationWatcher();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
timer.restore();
expirationWatcher.unsubscribe();
});
it('correctly emits events when order expires', (done: DoneCallback) => {
(async () => {
const orderLifetimeSec = 60;
const expirationUnixTimestampSec = currentUnixTimestampSec.plus(orderLifetimeSec);
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
expirationUnixTimestampSec,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000));
const callbackAsync = reportNoErrorCallbackErrors(done)((hash: string) => {
expect(hash).to.be.equal(orderHash);
expect(utils.getCurrentUnixTimestampSec()).to.be.bignumber.gte(expirationUnixTimestampSec);
});
expirationWatcher.subscribe(callbackAsync);
timer.tick(orderLifetimeSec * 1000);
})().catch(done);
});
it("doesn't emit events before order expires", (done: DoneCallback) => {
(async () => {
const orderLifetimeSec = 60;
const expirationUnixTimestampSec = currentUnixTimestampSec.plus(orderLifetimeSec);
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
expirationUnixTimestampSec,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
expirationWatcher.addOrder(orderHash, signedOrder.expirationUnixTimestampSec.times(1000));
const callbackAsync = reportNoErrorCallbackErrors(done)(async (hash: string) => {
done(new Error('Emitted expiration went before the order actually expired'));
});
expirationWatcher.subscribe(callbackAsync);
const notEnoughTime = orderLifetimeSec - 1;
timer.tick(notEnoughTime * 1000);
done();
})().catch(done);
});
it('emits events in correct order', (done: DoneCallback) => {
(async () => {
const order1Lifetime = 60;
const order2Lifetime = 120;
const order1ExpirationUnixTimestampSec = currentUnixTimestampSec.plus(order1Lifetime);
const order2ExpirationUnixTimestampSec = currentUnixTimestampSec.plus(order2Lifetime);
const signedOrder1 = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
order1ExpirationUnixTimestampSec,
);
const signedOrder2 = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
order2ExpirationUnixTimestampSec,
);
const orderHash1 = ZeroEx.getOrderHashHex(signedOrder1);
const orderHash2 = ZeroEx.getOrderHashHex(signedOrder2);
expirationWatcher.addOrder(orderHash2, signedOrder2.expirationUnixTimestampSec.times(1000));
expirationWatcher.addOrder(orderHash1, signedOrder1.expirationUnixTimestampSec.times(1000));
const expirationOrder = [orderHash1, orderHash2];
const expectToBeCalledOnce = false;
const callbackAsync = reportNoErrorCallbackErrors(done, expectToBeCalledOnce)((hash: string) => {
const orderHash = expirationOrder.shift();
expect(hash).to.be.equal(orderHash);
if (_.isEmpty(expirationOrder)) {
done();
}
});
expirationWatcher.subscribe(callbackAsync);
timer.tick(order2Lifetime * 1000);
})().catch(done);
});
});

View File

@@ -0,0 +1,17 @@
import { devConstants } from '@0xproject/dev-utils';
import { runV2MigrationsAsync } from '@0xproject/migrations';
import { provider } from './utils/web3_wrapper';
before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
const mochaTestTimeoutMs = 20000;
this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
const txDefaults = {
gas: devConstants.GAS_LIMIT,
from: devConstants.TESTRPC_FIRST_ADDRESS,
};
const artifactsDir = `../migrations/artifacts/2.0.0`;
await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
});

View File

@@ -1,556 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import * as Web3 from 'web3';
import {
ExchangeContractErrs,
OrderState,
OrderStateInvalid,
OrderStateValid,
SignedOrder,
Token,
ZeroEx,
ZeroExError,
} from '../src';
import { DoneCallback } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { FillScenarios } from './utils/fill_scenarios';
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
import { TokenUtils } from './utils/token_utils';
import { web3, web3Wrapper } from './utils/web3_wrapper';
const TIMEOUT_MS = 150;
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('OrderStateWatcher', () => {
let zeroEx: ZeroEx;
let tokens: Token[];
let tokenUtils: TokenUtils;
let fillScenarios: FillScenarios;
let userAddresses: string[];
let zrxTokenAddress: string;
let exchangeContractAddress: string;
let makerToken: Token;
let takerToken: Token;
let maker: string;
let taker: string;
let signedOrder: SignedOrder;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
const decimals = constants.ZRX_DECIMALS;
const fillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals);
before(async () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
exchangeContractAddress = zeroEx.exchange.getContractAddress();
userAddresses = await zeroEx.getAvailableAddressesAsync();
[, maker, taker] = userAddresses;
tokens = await zeroEx.tokenRegistry.getTokensAsync();
tokenUtils = new TokenUtils(tokens);
zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address;
fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress);
await fillScenarios.initTokenBalancesAsync();
[makerToken, takerToken] = tokenUtils.getDummyTokens();
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#removeOrder', async () => {
it('should successfully remove existing order', async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
expect((zeroEx.orderStateWatcher as any)._orderByOrderHash).to.include({
[orderHash]: signedOrder,
});
let dependentOrderHashes = (zeroEx.orderStateWatcher as any)._dependentOrderHashes;
expect(dependentOrderHashes[signedOrder.maker][signedOrder.makerTokenAddress]).to.have.keys(orderHash);
zeroEx.orderStateWatcher.removeOrder(orderHash);
expect((zeroEx.orderStateWatcher as any)._orderByOrderHash).to.not.include({
[orderHash]: signedOrder,
});
dependentOrderHashes = (zeroEx.orderStateWatcher as any)._dependentOrderHashes;
expect(dependentOrderHashes[signedOrder.maker]).to.be.undefined();
});
it('should no-op when removing a non-existing order', async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
const nonExistentOrderHash = `0x${orderHash
.substr(2)
.split('')
.reverse()
.join('')}`;
zeroEx.orderStateWatcher.removeOrder(nonExistentOrderHash);
});
});
describe('#subscribe', async () => {
afterEach(async () => {
zeroEx.orderStateWatcher.unsubscribe();
});
it('should fail when trying to subscribe twice', async () => {
zeroEx.orderStateWatcher.subscribe(_.noop);
expect(() => zeroEx.orderStateWatcher.subscribe(_.noop)).to.throw(ZeroExError.SubscriptionAlreadyPresent);
});
});
describe('tests with cleanup', async () => {
afterEach(async () => {
zeroEx.orderStateWatcher.unsubscribe();
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.removeOrder(orderHash);
});
it('should emit orderStateInvalid when maker allowance set to 0 for watched order', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.setProxyAllowanceAsync(makerToken.address, maker, new BigNumber(0));
})().catch(done);
});
it('should not emit an orderState event when irrelevant Transfer event received', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
throw new Error('OrderState callback fired for irrelevant order');
});
zeroEx.orderStateWatcher.subscribe(callback);
const notTheMaker = userAddresses[0];
const anyRecipient = taker;
const transferAmount = new BigNumber(2);
await zeroEx.token.transferAsync(makerToken.address, notTheMaker, anyRecipient, transferAmount);
setTimeout(() => {
done();
}, TIMEOUT_MS);
})().catch(done);
});
it('should emit orderStateInvalid when maker moves balance backing watched order', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance);
});
zeroEx.orderStateWatcher.subscribe(callback);
const anyRecipient = taker;
const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
await zeroEx.token.transferAsync(makerToken.address, maker, anyRecipient, makerBalance);
})().catch(done);
});
it('should emit orderStateInvalid when watched order fully filled', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
zeroEx.orderStateWatcher.subscribe(callback);
const shouldThrowOnInsufficientBalanceOrAllowance = true;
await zeroEx.exchange.fillOrderAsync(
signedOrder,
fillableAmount,
shouldThrowOnInsufficientBalanceOrAllowance,
taker,
);
})().catch(done);
});
it('should emit orderStateValid when watched order partially filled', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
const fillAmountInBaseUnits = new BigNumber(2);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
const remainingMakerBalance = makerBalance.sub(fillAmountInBaseUnits);
const remainingFillable = fillableAmount.minus(fillAmountInBaseUnits);
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingFillable,
);
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
remainingFillable,
);
expect(orderRelevantState.makerBalance).to.be.bignumber.equal(remainingMakerBalance);
});
zeroEx.orderStateWatcher.subscribe(callback);
const shouldThrowOnInsufficientBalanceOrAllowance = true;
await zeroEx.exchange.fillOrderAsync(
signedOrder,
fillAmountInBaseUnits,
shouldThrowOnInsufficientBalanceOrAllowance,
taker,
);
})().catch(done);
});
it('should trigger the callback when orders backing ZRX allowance changes', (done: DoneCallback) => {
(async () => {
const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), 18);
signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerToken.address,
takerToken.address,
makerFee,
takerFee,
maker,
taker,
fillableAmount,
taker,
);
const callback = reportNodeCallbackErrors(done)();
zeroEx.orderStateWatcher.addOrder(signedOrder);
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.setProxyAllowanceAsync(zrxTokenAddress, maker, new BigNumber(0));
})().catch(done);
});
describe('remainingFillable(M|T)akerTokenAmount', () => {
it('should calculate correct remaining fillable', (done: DoneCallback) => {
(async () => {
const takerFillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(10), decimals);
const makerFillableAmount = ZeroEx.toBaseUnitAmount(new BigNumber(20), decimals);
signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
makerFillableAmount,
takerFillableAmount,
);
const fillAmountInBaseUnits = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
ZeroEx.toBaseUnitAmount(new BigNumber(16), decimals),
);
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
ZeroEx.toBaseUnitAmount(new BigNumber(8), decimals),
);
});
zeroEx.orderStateWatcher.subscribe(callback);
const shouldThrowOnInsufficientBalanceOrAllowance = true;
await zeroEx.exchange.fillOrderAsync(
signedOrder,
fillAmountInBaseUnits,
shouldThrowOnInsufficientBalanceOrAllowance,
taker,
);
})().catch(done);
});
it('should equal approved amount when approved amount is lowest', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const changedMakerApprovalAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
changedMakerApprovalAmount,
);
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
changedMakerApprovalAmount,
);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.setProxyAllowanceAsync(makerToken.address, maker, changedMakerApprovalAmount);
})().catch(done);
});
it('should equal balance amount when balance amount is lowest', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker);
const remainingAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals);
const transferAmount = makerBalance.sub(remainingAmount);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingAmount,
);
expect(orderRelevantState.remainingFillableTakerTokenAmount).to.be.bignumber.equal(
remainingAmount,
);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.transferAsync(makerToken.address, maker, ZeroEx.NULL_ADDRESS, transferAmount);
})().catch(done);
});
it('should equal remaining amount when partially cancelled and order has fees', (done: DoneCallback) => {
(async () => {
const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals);
const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals);
const feeRecipient = taker;
signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerToken.address,
takerToken.address,
makerFee,
takerFee,
maker,
taker,
fillableAmount,
feeRecipient,
);
const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals);
const transferTokenAmount = makerFee.sub(remainingTokenAmount);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingTokenAmount,
);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.exchange.cancelOrderAsync(signedOrder, transferTokenAmount);
})().catch(done);
});
it('should equal ratio amount when fee balance is lowered', (done: DoneCallback) => {
(async () => {
const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals);
const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals);
const feeRecipient = taker;
signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerToken.address,
takerToken.address,
makerFee,
takerFee,
maker,
taker,
fillableAmount,
feeRecipient,
);
const remainingFeeAmount = ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals);
const remainingTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(4), decimals);
const transferTokenAmount = makerFee.sub(remainingTokenAmount);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
remainingFeeAmount,
);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.setProxyAllowanceAsync(zrxTokenAddress, maker, remainingFeeAmount);
await zeroEx.token.transferAsync(
makerToken.address,
maker,
ZeroEx.NULL_ADDRESS,
transferTokenAmount,
);
})().catch(done);
});
it('should calculate full amount when all available and non-divisible', (done: DoneCallback) => {
(async () => {
const takerFee = ZeroEx.toBaseUnitAmount(new BigNumber(0), decimals);
const makerFee = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
const feeRecipient = taker;
signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerToken.address,
takerToken.address,
makerFee,
takerFee,
maker,
taker,
fillableAmount,
feeRecipient,
);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
const validOrderState = orderState as OrderStateValid;
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal(
fillableAmount,
);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.token.setProxyAllowanceAsync(
makerToken.address,
maker,
ZeroEx.toBaseUnitAmount(new BigNumber(100), decimals),
);
})().catch(done);
});
});
it('should emit orderStateInvalid when watched order cancelled', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
})().catch(done);
});
it('should emit orderStateInvalid when within rounding error range', (done: DoneCallback) => {
(async () => {
const remainingFillableAmountInBaseUnits = new BigNumber(100);
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.false();
const invalidOrderState = orderState as OrderStateInvalid;
expect(invalidOrderState.orderHash).to.be.equal(orderHash);
expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.exchange.cancelOrderAsync(
signedOrder,
fillableAmount.minus(remainingFillableAmountInBaseUnits),
);
})().catch(done);
});
it('should emit orderStateValid when watched order partially cancelled', (done: DoneCallback) => {
(async () => {
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerToken.address,
takerToken.address,
maker,
taker,
fillableAmount,
);
const cancelAmountInBaseUnits = new BigNumber(2);
const orderHash = ZeroEx.getOrderHashHex(signedOrder);
zeroEx.orderStateWatcher.addOrder(signedOrder);
const callback = reportNodeCallbackErrors(done)((orderState: OrderState) => {
expect(orderState.isValid).to.be.true();
const validOrderState = orderState as OrderStateValid;
expect(validOrderState.orderHash).to.be.equal(orderHash);
const orderRelevantState = validOrderState.orderRelevantState;
expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits);
});
zeroEx.orderStateWatcher.subscribe(callback);
await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmountInBaseUnits);
})().catch(done);
});
});
}); // tslint:disable:max-file-line-count

View File

@@ -1,473 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import { ExchangeContractErrs, SignedOrder, Token, ZeroEx, ZeroExError } from '../src';
import { TradeSide, TransferType } from '../src/types';
import { ExchangeTransferSimulator } from '../src/utils/exchange_transfer_simulator';
import { OrderValidationUtils } from '../src/utils/order_validation_utils';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { FillScenarios } from './utils/fill_scenarios';
import { TokenUtils } from './utils/token_utils';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('OrderValidation', () => {
let zeroEx: ZeroEx;
let userAddresses: string[];
let tokens: Token[];
let tokenUtils: TokenUtils;
let exchangeContractAddress: string;
let zrxTokenAddress: string;
let fillScenarios: FillScenarios;
let makerTokenAddress: string;
let takerTokenAddress: string;
let coinbase: string;
let makerAddress: string;
let takerAddress: string;
let feeRecipient: string;
const fillableAmount = new BigNumber(5);
const fillTakerAmount = new BigNumber(5);
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
before(async () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
exchangeContractAddress = zeroEx.exchange.getContractAddress();
userAddresses = await zeroEx.getAvailableAddressesAsync();
[coinbase, makerAddress, takerAddress, feeRecipient] = userAddresses;
tokens = await zeroEx.tokenRegistry.getTokensAsync();
tokenUtils = new TokenUtils(tokens);
zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address;
fillScenarios = new FillScenarios(zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress);
const [makerToken, takerToken] = tokenUtils.getDummyTokens();
makerTokenAddress = makerToken.address;
takerTokenAddress = takerToken.address;
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('validateOrderFillableOrThrowAsync', () => {
it('should succeed if the order is fillable', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder);
});
it('should succeed if the order is asymmetric and fillable', async () => {
const makerFillableAmount = fillableAmount;
const takerFillableAmount = fillableAmount.minus(4);
const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
makerFillableAmount,
takerFillableAmount,
);
await zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder);
});
it('should throw when the order is fully filled or cancelled', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith(
ExchangeContractErrs.OrderRemainingFillAmountZero,
);
});
it('should throw when order is expired', async () => {
const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
expirationInPast,
);
return expect(zeroEx.exchange.validateOrderFillableOrThrowAsync(signedOrder)).to.be.rejectedWith(
ExchangeContractErrs.OrderFillExpired,
);
});
});
describe('validateFillOrderAndThrowIfInvalidAsync', () => {
it('should throw when the fill amount is zero', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
const zeroFillAmount = new BigNumber(0);
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, zeroFillAmount, takerAddress),
).to.be.rejectedWith(ExchangeContractErrs.OrderFillAmountZero);
});
it('should throw when the signature is invalid', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
// 27 <--> 28
signedOrder.ecSignature.v = 28 - signedOrder.ecSignature.v + 27;
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillableAmount, takerAddress),
).to.be.rejectedWith(ZeroExError.InvalidSignature);
});
it('should throw when the order is fully filled or cancelled', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillableAmount, takerAddress),
).to.be.rejectedWith(ExchangeContractErrs.OrderRemainingFillAmountZero);
});
it('should throw when sender is not a taker', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
const nonTakerAddress = userAddresses[6];
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillTakerAmount, nonTakerAddress),
).to.be.rejectedWith(ExchangeContractErrs.TransactionSenderIsNotFillOrderTaker);
});
it('should throw when order is expired', async () => {
const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
expirationInPast,
);
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(signedOrder, fillTakerAmount, takerAddress),
).to.be.rejectedWith(ExchangeContractErrs.OrderFillExpired);
});
it('should throw when there a rounding error would have occurred', async () => {
const makerAmount = new BigNumber(3);
const takerAmount = new BigNumber(5);
const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
makerAmount,
takerAmount,
);
const fillTakerAmountThatCausesRoundingError = new BigNumber(3);
return expect(
zeroEx.exchange.validateFillOrderThrowIfInvalidAsync(
signedOrder,
fillTakerAmountThatCausesRoundingError,
takerAddress,
),
).to.be.rejectedWith(ExchangeContractErrs.OrderFillRoundingError);
});
});
describe('#validateFillOrKillOrderAndThrowIfInvalidAsync', () => {
it('should throw if remaining fillAmount is less then the desired fillAmount', async () => {
const signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
const tooLargeFillAmount = new BigNumber(7);
const fillAmountDifference = tooLargeFillAmount.minus(fillableAmount);
await zeroEx.token.transferAsync(takerTokenAddress, coinbase, takerAddress, fillAmountDifference);
await zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, tooLargeFillAmount);
await zeroEx.token.transferAsync(makerTokenAddress, coinbase, makerAddress, fillAmountDifference);
await zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, tooLargeFillAmount);
return expect(
zeroEx.exchange.validateFillOrKillOrderThrowIfInvalidAsync(
signedOrder,
tooLargeFillAmount,
takerAddress,
),
).to.be.rejectedWith(ExchangeContractErrs.InsufficientRemainingFillAmount);
});
});
describe('validateCancelOrderAndThrowIfInvalidAsync', () => {
let signedOrder: SignedOrder;
const cancelAmount = new BigNumber(3);
beforeEach(async () => {
[coinbase, makerAddress, takerAddress] = userAddresses;
const [makerToken, takerToken] = tokenUtils.getDummyTokens();
makerTokenAddress = makerToken.address;
takerTokenAddress = takerToken.address;
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
);
});
it('should throw when cancel amount is zero', async () => {
const zeroCancelAmount = new BigNumber(0);
return expect(
zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, zeroCancelAmount),
).to.be.rejectedWith(ExchangeContractErrs.OrderCancelAmountZero);
});
it('should throw when order is expired', async () => {
const expirationInPast = new BigNumber(1496826058); // 7th Jun 2017
const expiredSignedOrder = await fillScenarios.createFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
expirationInPast,
);
return expect(
zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(expiredSignedOrder, cancelAmount),
).to.be.rejectedWith(ExchangeContractErrs.OrderCancelExpired);
});
it('should throw when order is already cancelled or filled', async () => {
await zeroEx.exchange.cancelOrderAsync(signedOrder, fillableAmount);
return expect(
zeroEx.exchange.validateCancelOrderThrowIfInvalidAsync(signedOrder, fillableAmount),
).to.be.rejectedWith(ExchangeContractErrs.OrderAlreadyCancelledOrFilled);
});
});
describe('#validateFillOrderBalancesAllowancesThrowIfInvalidAsync', () => {
let exchangeTransferSimulator: ExchangeTransferSimulator;
let transferFromAsync: Sinon.SinonSpy;
const bigNumberMatch = (expected: BigNumber) => {
return Sinon.match((value: BigNumber) => value.eq(expected));
};
beforeEach('create exchangeTransferSimulator', async () => {
exchangeTransferSimulator = new ExchangeTransferSimulator(zeroEx.token, BlockParamLiteral.Latest);
transferFromAsync = Sinon.spy();
exchangeTransferSimulator.transferFromAsync = transferFromAsync as any;
});
it('should call exchangeTransferSimulator.transferFrom in a correct order', async () => {
const makerFee = new BigNumber(2);
const takerFee = new BigNumber(2);
const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerTokenAddress,
takerTokenAddress,
makerFee,
takerFee,
makerAddress,
takerAddress,
fillableAmount,
feeRecipient,
);
await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTransferSimulator,
signedOrder,
fillableAmount,
takerAddress,
zrxTokenAddress,
);
expect(transferFromAsync.callCount).to.be.equal(4);
expect(
transferFromAsync
.getCall(0)
.calledWith(
makerTokenAddress,
makerAddress,
takerAddress,
bigNumberMatch(fillableAmount),
TradeSide.Maker,
TransferType.Trade,
),
).to.be.true();
expect(
transferFromAsync
.getCall(1)
.calledWith(
takerTokenAddress,
takerAddress,
makerAddress,
bigNumberMatch(fillableAmount),
TradeSide.Taker,
TransferType.Trade,
),
).to.be.true();
expect(
transferFromAsync
.getCall(2)
.calledWith(
zrxTokenAddress,
makerAddress,
feeRecipient,
bigNumberMatch(makerFee),
TradeSide.Maker,
TransferType.Fee,
),
).to.be.true();
expect(
transferFromAsync
.getCall(3)
.calledWith(
zrxTokenAddress,
takerAddress,
feeRecipient,
bigNumberMatch(takerFee),
TradeSide.Taker,
TransferType.Fee,
),
).to.be.true();
});
it('should call exchangeTransferSimulator.transferFrom with correct values for an open order', async () => {
const makerFee = new BigNumber(2);
const takerFee = new BigNumber(2);
const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerTokenAddress,
takerTokenAddress,
makerFee,
takerFee,
makerAddress,
ZeroEx.NULL_ADDRESS,
fillableAmount,
feeRecipient,
);
await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTransferSimulator,
signedOrder,
fillableAmount,
takerAddress,
zrxTokenAddress,
);
expect(transferFromAsync.callCount).to.be.equal(4);
expect(
transferFromAsync
.getCall(0)
.calledWith(
makerTokenAddress,
makerAddress,
takerAddress,
bigNumberMatch(fillableAmount),
TradeSide.Maker,
TransferType.Trade,
),
).to.be.true();
expect(
transferFromAsync
.getCall(1)
.calledWith(
takerTokenAddress,
takerAddress,
makerAddress,
bigNumberMatch(fillableAmount),
TradeSide.Taker,
TransferType.Trade,
),
).to.be.true();
expect(
transferFromAsync
.getCall(2)
.calledWith(
zrxTokenAddress,
makerAddress,
feeRecipient,
bigNumberMatch(makerFee),
TradeSide.Maker,
TransferType.Fee,
),
).to.be.true();
expect(
transferFromAsync
.getCall(3)
.calledWith(
zrxTokenAddress,
takerAddress,
feeRecipient,
bigNumberMatch(takerFee),
TradeSide.Taker,
TransferType.Fee,
),
).to.be.true();
});
it('should correctly round the fillMakerTokenAmount', async () => {
const makerTokenAmount = new BigNumber(3);
const takerTokenAmount = new BigNumber(1);
const signedOrder = await fillScenarios.createAsymmetricFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
makerTokenAmount,
takerTokenAmount,
);
await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTransferSimulator,
signedOrder,
takerTokenAmount,
takerAddress,
zrxTokenAddress,
);
expect(transferFromAsync.callCount).to.be.equal(4);
const makerFillAmount = transferFromAsync.getCall(0).args[3];
expect(makerFillAmount).to.be.bignumber.equal(makerTokenAmount);
});
it('should correctly round the makerFeeAmount', async () => {
const makerFee = new BigNumber(2);
const takerFee = new BigNumber(4);
const signedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
makerTokenAddress,
takerTokenAddress,
makerFee,
takerFee,
makerAddress,
takerAddress,
fillableAmount,
ZeroEx.NULL_ADDRESS,
);
const fillTakerTokenAmount = fillableAmount.div(2).round(0);
await OrderValidationUtils.validateFillOrderBalancesAllowancesThrowIfInvalidAsync(
exchangeTransferSimulator,
signedOrder,
fillTakerTokenAmount,
takerAddress,
zrxTokenAddress,
);
const makerPartialFee = makerFee.div(2);
const takerPartialFee = takerFee.div(2);
expect(transferFromAsync.callCount).to.be.equal(4);
const partialMakerFee = transferFromAsync.getCall(2).args[3];
expect(partialMakerFee).to.be.bignumber.equal(makerPartialFee);
const partialTakerFee = transferFromAsync.getCall(3).args[3];
expect(partialTakerFee).to.be.bignumber.equal(takerPartialFee);
});
});
});

View File

@@ -1,234 +0,0 @@
import { ECSignature, SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import 'mocha';
import { ZeroEx } from '../src/0x';
import { RemainingFillableCalculator } from '../src/order_watcher/remaining_fillable_calculator';
import { chaiSetup } from './utils/chai_setup';
chaiSetup.configure();
const expect = chai.expect;
describe('RemainingFillableCalculator', () => {
let calculator: RemainingFillableCalculator;
let signedOrder: SignedOrder;
let transferrableMakerTokenAmount: BigNumber;
let transferrableMakerFeeTokenAmount: BigNumber;
let remainingMakerTokenAmount: BigNumber;
let makerAmount: BigNumber;
let takerAmount: BigNumber;
let makerFeeAmount: BigNumber;
let isMakerTokenZRX: boolean;
const makerToken: string = '0x1';
const takerToken: string = '0x2';
const decimals: number = 4;
const zero: BigNumber = new BigNumber(0);
const zeroAddress = '0x0';
const signature: ECSignature = { v: 27, r: '', s: '' };
beforeEach(async () => {
[makerAmount, takerAmount, makerFeeAmount] = [
ZeroEx.toBaseUnitAmount(new BigNumber(50), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals),
];
[transferrableMakerTokenAmount, transferrableMakerFeeTokenAmount] = [
ZeroEx.toBaseUnitAmount(new BigNumber(50), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(5), decimals),
];
});
function buildSignedOrder(): SignedOrder {
return {
ecSignature: signature,
exchangeContractAddress: zeroAddress,
feeRecipient: zeroAddress,
maker: zeroAddress,
taker: zeroAddress,
makerFee: makerFeeAmount,
takerFee: zero,
makerTokenAmount: makerAmount,
takerTokenAmount: takerAmount,
makerTokenAddress: makerToken,
takerTokenAddress: takerToken,
salt: zero,
expirationUnixTimestampSec: zero,
};
}
describe('Maker token is NOT ZRX', () => {
before(async () => {
isMakerTokenZRX = false;
});
it('calculates the correct amount when unfilled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(remainingMakerTokenAmount);
});
it('calculates the correct amount when partially filled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(remainingMakerTokenAmount);
});
it('calculates the amount to be 0 when all fee funds are transferred', () => {
signedOrder = buildSignedOrder();
transferrableMakerFeeTokenAmount = zero;
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(zero);
});
it('calculates the correct amount when balance is less than remaining fillable', () => {
signedOrder = buildSignedOrder();
const partiallyFilledAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
remainingMakerTokenAmount = signedOrder.makerTokenAmount.minus(partiallyFilledAmount);
transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(partiallyFilledAmount);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(transferrableMakerTokenAmount);
});
describe('Order to Fee Ratio is < 1', () => {
beforeEach(async () => {
[makerAmount, takerAmount, makerFeeAmount] = [
ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(6), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(6), decimals),
];
});
it('calculates the correct amount when funds unavailable', () => {
signedOrder = buildSignedOrder();
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
const transferredAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(transferredAmount);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(transferrableMakerTokenAmount);
});
});
describe('Ratio is not evenly divisble', () => {
beforeEach(async () => {
[makerAmount, takerAmount, makerFeeAmount] = [
ZeroEx.toBaseUnitAmount(new BigNumber(3), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(7), decimals),
ZeroEx.toBaseUnitAmount(new BigNumber(7), decimals),
];
});
it('calculates the correct amount when funds unavailable', () => {
signedOrder = buildSignedOrder();
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
const transferredAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(transferredAmount);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
const calculatedFillableAmount = calculator.computeRemainingMakerFillable();
expect(calculatedFillableAmount.lessThanOrEqualTo(transferrableMakerTokenAmount)).to.be.true();
expect(calculatedFillableAmount).to.be.bignumber.greaterThan(new BigNumber(0));
const orderToFeeRatio = signedOrder.makerTokenAmount.dividedBy(signedOrder.makerFee);
const calculatedFeeAmount = calculatedFillableAmount.dividedBy(orderToFeeRatio);
expect(calculatedFeeAmount).to.be.bignumber.lessThan(transferrableMakerFeeTokenAmount);
});
});
});
describe('Maker Token is ZRX', () => {
before(async () => {
isMakerTokenZRX = true;
});
it('calculates the correct amount when unfilled and funds available', () => {
signedOrder = buildSignedOrder();
transferrableMakerTokenAmount = makerAmount.plus(makerFeeAmount);
transferrableMakerFeeTokenAmount = transferrableMakerTokenAmount;
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(remainingMakerTokenAmount);
});
it('calculates the correct amount when partially filled and funds available', () => {
signedOrder = buildSignedOrder();
remainingMakerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), decimals);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(remainingMakerTokenAmount);
});
it('calculates the amount to be 0 when all fee funds are transferred', () => {
signedOrder = buildSignedOrder();
transferrableMakerTokenAmount = zero;
transferrableMakerFeeTokenAmount = zero;
remainingMakerTokenAmount = signedOrder.makerTokenAmount;
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
expect(calculator.computeRemainingMakerFillable()).to.be.bignumber.equal(zero);
});
it('calculates the correct amount when balance is less than remaining fillable', () => {
signedOrder = buildSignedOrder();
const partiallyFilledAmount = ZeroEx.toBaseUnitAmount(new BigNumber(2), decimals);
remainingMakerTokenAmount = signedOrder.makerTokenAmount.minus(partiallyFilledAmount);
transferrableMakerTokenAmount = remainingMakerTokenAmount.minus(partiallyFilledAmount);
transferrableMakerFeeTokenAmount = transferrableMakerTokenAmount;
const orderToFeeRatio = signedOrder.makerTokenAmount.dividedToIntegerBy(signedOrder.makerFee);
const expectedFillableAmount = new BigNumber(450980);
calculator = new RemainingFillableCalculator(
signedOrder,
isMakerTokenZRX,
transferrableMakerTokenAmount,
transferrableMakerFeeTokenAmount,
remainingMakerTokenAmount,
);
const calculatedFillableAmount = calculator.computeRemainingMakerFillable();
const numberOfFillsInRatio = calculatedFillableAmount.dividedToIntegerBy(orderToFeeRatio);
const calculatedFillableAmountPlusFees = calculatedFillableAmount.plus(numberOfFillsInRatio);
expect(calculatedFillableAmountPlusFees).to.be.bignumber.lessThan(transferrableMakerTokenAmount);
expect(calculatedFillableAmountPlusFees).to.be.bignumber.lessThan(remainingMakerTokenAmount);
expect(calculatedFillableAmount).to.be.bignumber.equal(expectedFillableAmount);
expect(numberOfFillsInRatio.decimalPlaces()).to.be.equal(0);
});
});
});

View File

@@ -1,83 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import 'mocha';
import * as Sinon from 'sinon';
import * as Web3 from 'web3';
import { ApprovalContractEventArgs, DecodedLogEvent, Token, TokenEvents, ZeroEx } from '../src';
import { DoneCallback } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { assertNodeCallbackError } from './utils/report_callback_errors';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('SubscriptionTest', () => {
let zeroEx: ZeroEx;
let userAddresses: string[];
let tokens: Token[];
let coinbase: string;
let addressWithoutFunds: string;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
before(async () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
userAddresses = await zeroEx.getAvailableAddressesAsync();
tokens = await zeroEx.tokenRegistry.getTokensAsync();
coinbase = userAddresses[0];
addressWithoutFunds = userAddresses[1];
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#subscribe', () => {
const indexFilterValues = {};
let tokenAddress: string;
const allowanceAmount = new BigNumber(42);
let stubs: Sinon.SinonStub[] = [];
before(() => {
const token = tokens[0];
tokenAddress = token.address;
});
afterEach(() => {
zeroEx.token.unsubscribeAll();
_.each(stubs, s => s.restore());
stubs = [];
});
it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => {
(async () => {
const errMsg = 'Error fetching block';
const callback = assertNodeCallbackError(done, errMsg);
stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync').throws(new Error(errMsg))];
zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount);
})().catch(done);
});
it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => {
(async () => {
const errMsg = 'Error fetching logs';
const callback = assertNodeCallbackError(done, errMsg);
stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getLogsAsync').throws(new Error(errMsg))];
zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount);
})().catch(done);
});
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
(async () => {
const callback = (err: Error | null, logEvent?: DecodedLogEvent<ApprovalContractEventArgs>) => _.noop;
zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
stubs = [Sinon.stub((zeroEx as any)._web3Wrapper, 'getBlockAsync').throws(new Error('JSON RPC error'))];
zeroEx.token.unsubscribeAll();
done();
})().catch(done);
});
});
});

View File

@@ -1,128 +0,0 @@
import { BlockchainLifecycle, devConstants } from '@0xproject/dev-utils';
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'mocha';
import { Token, ZeroEx } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const TOKEN_REGISTRY_SIZE_AFTER_MIGRATION = 7;
describe('TokenRegistryWrapper', () => {
let zeroEx: ZeroEx;
let tokens: Token[];
const tokenAddressBySymbol: { [symbol: string]: string } = {};
const tokenAddressByName: { [symbol: string]: string } = {};
const tokenBySymbol: { [symbol: string]: Token } = {};
const tokenByName: { [symbol: string]: Token } = {};
const registeredSymbol = 'ZRX';
const registeredName = '0x Protocol Token';
const unregisteredSymbol = 'MAL';
const unregisteredName = 'Malicious Token';
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
before(async () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
tokens = await zeroEx.tokenRegistry.getTokensAsync();
_.map(tokens, token => {
tokenAddressBySymbol[token.symbol] = token.address;
tokenAddressByName[token.name] = token.address;
tokenBySymbol[token.symbol] = token;
tokenByName[token.name] = token;
});
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#getTokensAsync', () => {
it('should return all the tokens added to the tokenRegistry during the migration', async () => {
expect(tokens).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION);
const schemaValidator = new SchemaValidator();
_.each(tokens, token => {
const validationResult = schemaValidator.validate(token, schemas.tokenSchema);
expect(validationResult.errors).to.have.lengthOf(0);
});
});
});
describe('#getTokenAddressesAsync', () => {
it('should return all the token addresses added to the tokenRegistry during the migration', async () => {
const tokenAddresses = await zeroEx.tokenRegistry.getTokenAddressesAsync();
expect(tokenAddresses).to.have.lengthOf(TOKEN_REGISTRY_SIZE_AFTER_MIGRATION);
const schemaValidator = new SchemaValidator();
_.each(tokenAddresses, tokenAddress => {
const validationResult = schemaValidator.validate(tokenAddress, schemas.addressSchema);
expect(validationResult.errors).to.have.lengthOf(0);
expect(tokenAddress).to.not.be.equal(ZeroEx.NULL_ADDRESS);
});
});
});
describe('#getTokenAddressBySymbol', () => {
it('should return correct address for a token in the registry', async () => {
const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(registeredSymbol);
expect(tokenAddress).to.be.equal(tokenAddressBySymbol[registeredSymbol]);
});
it('should return undefined for a token out of registry', async () => {
const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressBySymbolIfExistsAsync(unregisteredSymbol);
expect(tokenAddress).to.be.undefined();
});
});
describe('#getTokenAddressByName', () => {
it('should return correct address for a token in the registry', async () => {
const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressByNameIfExistsAsync(registeredName);
expect(tokenAddress).to.be.equal(tokenAddressByName[registeredName]);
});
it('should return undefined for a token out of registry', async () => {
const tokenAddress = await zeroEx.tokenRegistry.getTokenAddressByNameIfExistsAsync(unregisteredName);
expect(tokenAddress).to.be.undefined();
});
});
describe('#getTokenBySymbol', () => {
it('should return correct token for a token in the registry', async () => {
const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(registeredSymbol);
expect(token).to.be.deep.equal(tokenBySymbol[registeredSymbol]);
});
it('should return undefined for a token out of registry', async () => {
const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(unregisteredSymbol);
expect(token).to.be.undefined();
});
});
describe('#getTokenByName', () => {
it('should return correct token for a token in the registry', async () => {
const token = await zeroEx.tokenRegistry.getTokenByNameIfExistsAsync(registeredName);
expect(token).to.be.deep.equal(tokenByName[registeredName]);
});
it('should return undefined for a token out of registry', async () => {
const token = await zeroEx.tokenRegistry.getTokenByNameIfExistsAsync(unregisteredName);
expect(token).to.be.undefined();
});
});
describe('#getTokenIfExistsAsync', () => {
it('should return the token added to the tokenRegistry during the migration', async () => {
const aToken = tokens[0];
const token = await zeroEx.tokenRegistry.getTokenIfExistsAsync(aToken.address);
const schemaValidator = new SchemaValidator();
const validationResult = schemaValidator.validate(token, schemas.tokenSchema);
expect(validationResult.errors).to.have.lengthOf(0);
});
it('should return return undefined when passed a token address not in the tokenRegistry', async () => {
const unregisteredTokenAddress = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
const tokenIfExists = await zeroEx.tokenRegistry.getTokenIfExistsAsync(unregisteredTokenAddress);
expect(tokenIfExists).to.be.undefined();
});
});
});

View File

@@ -1,517 +0,0 @@
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as chai from 'chai';
import 'mocha';
import * as Web3 from 'web3';
import {
ApprovalContractEventArgs,
BlockParamLiteral,
BlockRange,
DecodedLogEvent,
Token,
TokenEvents,
TransferContractEventArgs,
ZeroEx,
ZeroExError,
} from '../src';
import { DoneCallback } from '../src/types';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { reportNodeCallbackErrors } from './utils/report_callback_errors';
import { TokenUtils } from './utils/token_utils';
import { web3, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('TokenWrapper', () => {
let zeroEx: ZeroEx;
let userAddresses: string[];
let tokens: Token[];
let tokenUtils: TokenUtils;
let coinbase: string;
let addressWithoutFunds: string;
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
before(async () => {
zeroEx = new ZeroEx(web3.currentProvider, config);
userAddresses = await zeroEx.getAvailableAddressesAsync();
tokens = await zeroEx.tokenRegistry.getTokensAsync();
tokenUtils = new TokenUtils(tokens);
coinbase = userAddresses[0];
addressWithoutFunds = userAddresses[1];
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#transferAsync', () => {
let token: Token;
let transferAmount: BigNumber;
before(() => {
token = tokens[0];
transferAmount = new BigNumber(42);
});
it('should successfully transfer tokens', async () => {
const fromAddress = coinbase;
const toAddress = addressWithoutFunds;
const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
expect(preBalance).to.be.bignumber.equal(0);
await zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount);
const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});
it('should fail to transfer tokens if fromAddress has an insufficient balance', async () => {
const fromAddress = addressWithoutFunds;
const toAddress = coinbase;
return expect(
zeroEx.token.transferAsync(token.address, fromAddress, toAddress, transferAmount),
).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer);
});
it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
const fromAddress = coinbase;
const toAddress = coinbase;
return expect(
zeroEx.token.transferAsync(nonExistentTokenAddress, fromAddress, toAddress, transferAmount),
).to.be.rejectedWith(ZeroExError.TokenContractDoesNotExist);
});
});
describe('#transferFromAsync', () => {
let token: Token;
let toAddress: string;
let senderAddress: string;
before(async () => {
token = tokens[0];
toAddress = addressWithoutFunds;
senderAddress = userAddresses[2];
});
it('should fail to transfer tokens if fromAddress has insufficient allowance set', async () => {
const fromAddress = coinbase;
const transferAmount = new BigNumber(42);
const fromAddressBalance = await zeroEx.token.getBalanceAsync(token.address, fromAddress);
expect(fromAddressBalance).to.be.bignumber.greaterThan(transferAmount);
const fromAddressAllowance = await zeroEx.token.getAllowanceAsync(token.address, fromAddress, toAddress);
expect(fromAddressAllowance).to.be.bignumber.equal(0);
return expect(
zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount),
).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer);
});
it('[regression] should fail to transfer tokens if set allowance for toAddress instead of senderAddress', async () => {
const fromAddress = coinbase;
const transferAmount = new BigNumber(42);
await zeroEx.token.setAllowanceAsync(token.address, fromAddress, toAddress, transferAmount);
return expect(
zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount),
).to.be.rejectedWith(ZeroExError.InsufficientAllowanceForTransfer);
});
it('should fail to transfer tokens if fromAddress has insufficient balance', async () => {
const fromAddress = addressWithoutFunds;
const transferAmount = new BigNumber(42);
const fromAddressBalance = await zeroEx.token.getBalanceAsync(token.address, fromAddress);
expect(fromAddressBalance).to.be.bignumber.equal(0);
await zeroEx.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount);
const fromAddressAllowance = await zeroEx.token.getAllowanceAsync(
token.address,
fromAddress,
senderAddress,
);
expect(fromAddressAllowance).to.be.bignumber.equal(transferAmount);
return expect(
zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount),
).to.be.rejectedWith(ZeroExError.InsufficientBalanceForTransfer);
});
it('should successfully transfer tokens', async () => {
const fromAddress = coinbase;
const preBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
expect(preBalance).to.be.bignumber.equal(0);
const transferAmount = new BigNumber(42);
await zeroEx.token.setAllowanceAsync(token.address, fromAddress, senderAddress, transferAmount);
await zeroEx.token.transferFromAsync(token.address, fromAddress, toAddress, senderAddress, transferAmount);
const postBalance = await zeroEx.token.getBalanceAsync(token.address, toAddress);
return expect(postBalance).to.be.bignumber.equal(transferAmount);
});
it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
const fromAddress = coinbase;
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
return expect(
zeroEx.token.transferFromAsync(
nonExistentTokenAddress,
fromAddress,
toAddress,
senderAddress,
new BigNumber(42),
),
).to.be.rejectedWith(ZeroExError.TokenContractDoesNotExist);
});
});
describe('#getBalanceAsync', () => {
describe('With web3 provider with accounts', () => {
it('should return the balance for an existing ERC20 token', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const balance = await zeroEx.token.getBalanceAsync(token.address, ownerAddress);
const expectedBalance = new BigNumber('1000000000000000000000000000');
return expect(balance).to.be.bignumber.equal(expectedBalance);
});
it('should throw a CONTRACT_DOES_NOT_EXIST error for a non-existent token contract', async () => {
const nonExistentTokenAddress = '0x9dd402f14d67e001d8efbe6583e51bf9706aa065';
const ownerAddress = coinbase;
return expect(zeroEx.token.getBalanceAsync(nonExistentTokenAddress, ownerAddress)).to.be.rejectedWith(
ZeroExError.TokenContractDoesNotExist,
);
});
it('should return a balance of 0 for a non-existent owner address', async () => {
const token = tokens[0];
const nonExistentOwner = '0x198c6ad858f213fb31b6fe809e25040e6b964593';
const balance = await zeroEx.token.getBalanceAsync(token.address, nonExistentOwner);
const expectedBalance = new BigNumber(0);
return expect(balance).to.be.bignumber.equal(expectedBalance);
});
});
describe('With web3 provider without accounts', () => {
let zeroExWithoutAccounts: ZeroEx;
before(async () => {
const hasAddresses = false;
const web3WithoutAccounts = web3Factory.create({ hasAddresses });
zeroExWithoutAccounts = new ZeroEx(web3WithoutAccounts.currentProvider, config);
});
it('should return balance even when called with Web3 provider instance without addresses', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const balance = await zeroExWithoutAccounts.token.getBalanceAsync(token.address, ownerAddress);
const expectedBalance = new BigNumber('1000000000000000000000000000');
return expect(balance).to.be.bignumber.equal(expectedBalance);
});
});
});
describe('#setAllowanceAsync', () => {
it("should set the spender's allowance", async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const spenderAddress = addressWithoutFunds;
const allowanceBeforeSet = await zeroEx.token.getAllowanceAsync(
token.address,
ownerAddress,
spenderAddress,
);
const expectedAllowanceBeforeAllowanceSet = new BigNumber(0);
expect(allowanceBeforeSet).to.be.bignumber.equal(expectedAllowanceBeforeAllowanceSet);
const amountInBaseUnits = new BigNumber(50);
await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits);
const allowanceAfterSet = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress);
const expectedAllowanceAfterAllowanceSet = amountInBaseUnits;
return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet);
});
});
describe('#setUnlimitedAllowanceAsync', () => {
it("should set the unlimited spender's allowance", async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const spenderAddress = addressWithoutFunds;
await zeroEx.token.setUnlimitedAllowanceAsync(token.address, ownerAddress, spenderAddress);
const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress);
return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
it('should reduce the gas cost for transfers including tokens with unlimited allowance support', async () => {
const transferAmount = new BigNumber(5);
const zrx = tokenUtils.getProtocolTokenOrThrow();
const [, userWithNormalAllowance, userWithUnlimitedAllowance] = userAddresses;
await zeroEx.token.setAllowanceAsync(zrx.address, coinbase, userWithNormalAllowance, transferAmount);
await zeroEx.token.setUnlimitedAllowanceAsync(zrx.address, coinbase, userWithUnlimitedAllowance);
const initBalanceWithNormalAllowance = await web3Wrapper.getBalanceInWeiAsync(userWithNormalAllowance);
const initBalanceWithUnlimitedAllowance = await web3Wrapper.getBalanceInWeiAsync(
userWithUnlimitedAllowance,
);
await zeroEx.token.transferFromAsync(
zrx.address,
coinbase,
userWithNormalAllowance,
userWithNormalAllowance,
transferAmount,
);
await zeroEx.token.transferFromAsync(
zrx.address,
coinbase,
userWithUnlimitedAllowance,
userWithUnlimitedAllowance,
transferAmount,
);
const finalBalanceWithNormalAllowance = await web3Wrapper.getBalanceInWeiAsync(userWithNormalAllowance);
const finalBalanceWithUnlimitedAllowance = await web3Wrapper.getBalanceInWeiAsync(
userWithUnlimitedAllowance,
);
const normalGasCost = initBalanceWithNormalAllowance.minus(finalBalanceWithNormalAllowance);
const unlimitedGasCost = initBalanceWithUnlimitedAllowance.minus(finalBalanceWithUnlimitedAllowance);
// In theory the gas cost with unlimited allowance should be smaller, but with testrpc it's actually bigger.
// This needs to be investigated in ethereumjs-vm. This test is essentially a repro.
// TODO: Make this test pass with inverted assertion.
expect(unlimitedGasCost.toNumber()).to.be.gt(normalGasCost.toNumber());
});
});
describe('#getAllowanceAsync', () => {
describe('With web3 provider with accounts', () => {
it('should get the proxy allowance', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const spenderAddress = addressWithoutFunds;
const amountInBaseUnits = new BigNumber(50);
await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits);
const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress);
const expectedAllowance = amountInBaseUnits;
return expect(allowance).to.be.bignumber.equal(expectedAllowance);
});
it('should return 0 if no allowance set yet', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const spenderAddress = addressWithoutFunds;
const allowance = await zeroEx.token.getAllowanceAsync(token.address, ownerAddress, spenderAddress);
const expectedAllowance = new BigNumber(0);
return expect(allowance).to.be.bignumber.equal(expectedAllowance);
});
});
describe('With web3 provider without accounts', () => {
let zeroExWithoutAccounts: ZeroEx;
before(async () => {
const hasAddresses = false;
const web3WithoutAccounts = web3Factory.create({ hasAddresses });
zeroExWithoutAccounts = new ZeroEx(web3WithoutAccounts.currentProvider, config);
});
it('should get the proxy allowance', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const spenderAddress = addressWithoutFunds;
const amountInBaseUnits = new BigNumber(50);
await zeroEx.token.setAllowanceAsync(token.address, ownerAddress, spenderAddress, amountInBaseUnits);
const allowance = await zeroExWithoutAccounts.token.getAllowanceAsync(
token.address,
ownerAddress,
spenderAddress,
);
const expectedAllowance = amountInBaseUnits;
return expect(allowance).to.be.bignumber.equal(expectedAllowance);
});
});
});
describe('#getProxyAllowanceAsync', () => {
it('should get the proxy allowance', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const amountInBaseUnits = new BigNumber(50);
await zeroEx.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits);
const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress);
const expectedAllowance = amountInBaseUnits;
return expect(allowance).to.be.bignumber.equal(expectedAllowance);
});
});
describe('#setProxyAllowanceAsync', () => {
it('should set the proxy allowance', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
const allowanceBeforeSet = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress);
const expectedAllowanceBeforeAllowanceSet = new BigNumber(0);
expect(allowanceBeforeSet).to.be.bignumber.equal(expectedAllowanceBeforeAllowanceSet);
const amountInBaseUnits = new BigNumber(50);
await zeroEx.token.setProxyAllowanceAsync(token.address, ownerAddress, amountInBaseUnits);
const allowanceAfterSet = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress);
const expectedAllowanceAfterAllowanceSet = amountInBaseUnits;
return expect(allowanceAfterSet).to.be.bignumber.equal(expectedAllowanceAfterAllowanceSet);
});
});
describe('#setUnlimitedProxyAllowanceAsync', () => {
it('should set the unlimited proxy allowance', async () => {
const token = tokens[0];
const ownerAddress = coinbase;
await zeroEx.token.setUnlimitedProxyAllowanceAsync(token.address, ownerAddress);
const allowance = await zeroEx.token.getProxyAllowanceAsync(token.address, ownerAddress);
return expect(allowance).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
});
describe('#subscribe', () => {
const indexFilterValues = {};
let tokenAddress: string;
const transferAmount = new BigNumber(42);
const allowanceAmount = new BigNumber(42);
before(() => {
const token = tokens[0];
tokenAddress = token.address;
});
afterEach(() => {
zeroEx.token.unsubscribeAll();
});
// Hack: Mocha does not allow a test to be both async and have a `done` callback
// Since we need to await the receipt of the event in the `subscribe` callback,
// we do need both. A hack is to make the top-level a sync fn w/ a done callback and then
// wrap the rest of the test in an async block
// Source: https://github.com/mochajs/mocha/issues/2407
it('Should receive the Transfer event when tokens are transfered', (done: DoneCallback) => {
(async () => {
const callback = reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<TransferContractEventArgs>) => {
expect(logEvent.isRemoved).to.be.false();
expect(logEvent.log.logIndex).to.be.equal(0);
expect(logEvent.log.transactionIndex).to.be.equal(0);
expect(logEvent.log.blockNumber).to.be.a('number');
const args = logEvent.log.args;
expect(args._from).to.be.equal(coinbase);
expect(args._to).to.be.equal(addressWithoutFunds);
expect(args._value).to.be.bignumber.equal(transferAmount);
},
);
zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callback);
await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount);
})().catch(done);
});
it('Should receive the Approval event when allowance is being set', (done: DoneCallback) => {
(async () => {
const callback = reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
expect(logEvent).to.not.be.undefined();
expect(logEvent.isRemoved).to.be.false();
const args = logEvent.log.args;
expect(args._owner).to.be.equal(coinbase);
expect(args._spender).to.be.equal(addressWithoutFunds);
expect(args._value).to.be.bignumber.equal(allowanceAmount);
},
);
zeroEx.token.subscribe(tokenAddress, TokenEvents.Approval, indexFilterValues, callback);
await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount);
})().catch(done);
});
it('Outstanding subscriptions are cancelled when zeroEx.setProvider called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callbackNeverToBeCalled);
const callbackToBeCalled = reportNodeCallbackErrors(done)();
const newProvider = web3Factory.getRpcProvider();
zeroEx.setProvider(newProvider, constants.TESTRPC_NETWORK_ID);
zeroEx.token.subscribe(tokenAddress, TokenEvents.Transfer, indexFilterValues, callbackToBeCalled);
await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount);
})().catch(done);
});
it('Should cancel subscription when unsubscribe called', (done: DoneCallback) => {
(async () => {
const callbackNeverToBeCalled = reportNodeCallbackErrors(done)(
(logEvent: DecodedLogEvent<ApprovalContractEventArgs>) => {
done(new Error('Expected this subscription to have been cancelled'));
},
);
const subscriptionToken = zeroEx.token.subscribe(
tokenAddress,
TokenEvents.Transfer,
indexFilterValues,
callbackNeverToBeCalled,
);
zeroEx.token.unsubscribe(subscriptionToken);
await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount);
done();
})().catch(done);
});
});
describe('#getLogsAsync', () => {
let tokenAddress: string;
let tokenTransferProxyAddress: string;
const blockRange: BlockRange = {
fromBlock: 0,
toBlock: BlockParamLiteral.Latest,
};
let txHash: string;
before(() => {
const token = tokens[0];
tokenAddress = token.address;
tokenTransferProxyAddress = zeroEx.proxy.getContractAddress();
});
it('should get logs with decoded args emitted by Approval', async () => {
txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
await zeroEx.awaitTransactionMinedAsync(txHash);
const eventName = TokenEvents.Approval;
const indexFilterValues = {};
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
tokenAddress,
eventName,
blockRange,
indexFilterValues,
);
expect(logs).to.have.length(1);
const args = logs[0].args;
expect(logs[0].event).to.be.equal(eventName);
expect(args._owner).to.be.equal(coinbase);
expect(args._spender).to.be.equal(tokenTransferProxyAddress);
expect(args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
});
it('should only get the logs with the correct event name', async () => {
txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
await zeroEx.awaitTransactionMinedAsync(txHash);
const differentEventName = TokenEvents.Transfer;
const indexFilterValues = {};
const logs = await zeroEx.token.getLogsAsync(
tokenAddress,
differentEventName,
blockRange,
indexFilterValues,
);
expect(logs).to.have.length(0);
});
it('should only get the logs with the correct indexed fields', async () => {
txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, coinbase);
await zeroEx.awaitTransactionMinedAsync(txHash);
txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(tokenAddress, addressWithoutFunds);
await zeroEx.awaitTransactionMinedAsync(txHash);
const eventName = TokenEvents.Approval;
const indexFilterValues = {
_owner: coinbase,
};
const logs = await zeroEx.token.getLogsAsync<ApprovalContractEventArgs>(
tokenAddress,
eventName,
blockRange,
indexFilterValues,
);
expect(logs).to.have.length(1);
const args = logs[0].args;
expect(args._owner).to.be.equal(coinbase);
});
});
});
// tslint:disable:max-file-line-count

View File

@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
import * as dirtyChai from 'dirty-chai';
export const chaiSetup = {
configure() {
configure(): void {
chai.config.includeStack = true;
chai.use(ChaiBigNumber());
chai.use(dirtyChai);

View File

@@ -1,198 +0,0 @@
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { SignedOrder, Token, ZeroEx } from '../../src';
import { artifacts } from '../../src/artifacts';
import { DummyTokenContract } from '../../src/contract_wrappers/generated/dummy_token';
import { orderFactory } from '../utils/order_factory';
import { constants } from './constants';
const INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS = new BigNumber(100);
export class FillScenarios {
private _zeroEx: ZeroEx;
private _userAddresses: string[];
private _tokens: Token[];
private _coinbase: string;
private _zrxTokenAddress: string;
private _exchangeContractAddress: string;
constructor(
zeroEx: ZeroEx,
userAddresses: string[],
tokens: Token[],
zrxTokenAddress: string,
exchangeContractAddress: string,
) {
this._zeroEx = zeroEx;
this._userAddresses = userAddresses;
this._tokens = tokens;
this._coinbase = userAddresses[0];
this._zrxTokenAddress = zrxTokenAddress;
this._exchangeContractAddress = exchangeContractAddress;
}
public async initTokenBalancesAsync() {
const web3Wrapper = (this._zeroEx as any)._web3Wrapper as Web3Wrapper;
for (const token of this._tokens) {
if (token.symbol !== 'ZRX' && token.symbol !== 'WETH') {
const defaults = {};
const dummyToken = new DummyTokenContract(web3Wrapper, artifacts.DummyTokenArtifact.abi, token.address);
const tokenSupply = ZeroEx.toBaseUnitAmount(INITIAL_COINBASE_TOKEN_SUPPLY_IN_UNITS, token.decimals);
const txHash = await dummyToken.setBalance.sendTransactionAsync(this._coinbase, tokenSupply, {
from: this._coinbase,
});
await this._zeroEx.awaitTransactionMinedAsync(txHash);
}
}
}
public async createFillableSignedOrderAsync(
makerTokenAddress: string,
takerTokenAddress: string,
makerAddress: string,
takerAddress: string,
fillableAmount: BigNumber,
expirationUnixTimestampSec?: BigNumber,
): Promise<SignedOrder> {
return this.createAsymmetricFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
fillableAmount,
expirationUnixTimestampSec,
);
}
public async createFillableSignedOrderWithFeesAsync(
makerTokenAddress: string,
takerTokenAddress: string,
makerFee: BigNumber,
takerFee: BigNumber,
makerAddress: string,
takerAddress: string,
fillableAmount: BigNumber,
feeRecepient: string,
expirationUnixTimestampSec?: BigNumber,
): Promise<SignedOrder> {
return this._createAsymmetricFillableSignedOrderWithFeesAsync(
makerTokenAddress,
takerTokenAddress,
makerFee,
takerFee,
makerAddress,
takerAddress,
fillableAmount,
fillableAmount,
feeRecepient,
expirationUnixTimestampSec,
);
}
public async createAsymmetricFillableSignedOrderAsync(
makerTokenAddress: string,
takerTokenAddress: string,
makerAddress: string,
takerAddress: string,
makerFillableAmount: BigNumber,
takerFillableAmount: BigNumber,
expirationUnixTimestampSec?: BigNumber,
): Promise<SignedOrder> {
const makerFee = new BigNumber(0);
const takerFee = new BigNumber(0);
const feeRecepient = constants.NULL_ADDRESS;
return this._createAsymmetricFillableSignedOrderWithFeesAsync(
makerTokenAddress,
takerTokenAddress,
makerFee,
takerFee,
makerAddress,
takerAddress,
makerFillableAmount,
takerFillableAmount,
feeRecepient,
expirationUnixTimestampSec,
);
}
public async createPartiallyFilledSignedOrderAsync(
makerTokenAddress: string,
takerTokenAddress: string,
takerAddress: string,
fillableAmount: BigNumber,
partialFillAmount: BigNumber,
) {
const [makerAddress] = this._userAddresses;
const signedOrder = await this.createAsymmetricFillableSignedOrderAsync(
makerTokenAddress,
takerTokenAddress,
makerAddress,
takerAddress,
fillableAmount,
fillableAmount,
);
const shouldThrowOnInsufficientBalanceOrAllowance = false;
await this._zeroEx.exchange.fillOrderAsync(
signedOrder,
partialFillAmount,
shouldThrowOnInsufficientBalanceOrAllowance,
takerAddress,
);
return signedOrder;
}
private async _createAsymmetricFillableSignedOrderWithFeesAsync(
makerTokenAddress: string,
takerTokenAddress: string,
makerFee: BigNumber,
takerFee: BigNumber,
makerAddress: string,
takerAddress: string,
makerFillableAmount: BigNumber,
takerFillableAmount: BigNumber,
feeRecepient: string,
expirationUnixTimestampSec?: BigNumber,
): Promise<SignedOrder> {
await Promise.all([
this._increaseBalanceAndAllowanceAsync(makerTokenAddress, makerAddress, makerFillableAmount),
this._increaseBalanceAndAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount),
]);
await Promise.all([
this._increaseBalanceAndAllowanceAsync(this._zrxTokenAddress, makerAddress, makerFee),
this._increaseBalanceAndAllowanceAsync(this._zrxTokenAddress, takerAddress, takerFee),
]);
const signedOrder = await orderFactory.createSignedOrderAsync(
this._zeroEx,
makerAddress,
takerAddress,
makerFee,
takerFee,
makerFillableAmount,
makerTokenAddress,
takerFillableAmount,
takerTokenAddress,
this._exchangeContractAddress,
feeRecepient,
expirationUnixTimestampSec,
);
return signedOrder;
}
private async _increaseBalanceAndAllowanceAsync(
tokenAddress: string,
address: string,
amount: BigNumber,
): Promise<void> {
if (amount.isZero() || address === ZeroEx.NULL_ADDRESS) {
return; // noop
}
await Promise.all([
this._increaseBalanceAsync(tokenAddress, address, amount),
this._increaseAllowanceAsync(tokenAddress, address, amount),
]);
}
private async _increaseBalanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> {
await this._zeroEx.token.transferAsync(tokenAddress, this._coinbase, address, amount);
}
private async _increaseAllowanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> {
const oldMakerAllowance = await this._zeroEx.token.getProxyAllowanceAsync(tokenAddress, address);
const newMakerAllowance = oldMakerAllowance.plus(amount);
await this._zeroEx.token.setProxyAllowanceAsync(tokenAddress, address, newMakerAllowance);
}
}

View File

@@ -1,46 +0,0 @@
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { SignedOrder, ZeroEx } from '../../src';
const SHOULD_ADD_PERSONAL_MESSAGE_PREFIX = false;
export const orderFactory = {
async createSignedOrderAsync(
zeroEx: ZeroEx,
maker: string,
taker: string,
makerFee: BigNumber,
takerFee: BigNumber,
makerTokenAmount: BigNumber,
makerTokenAddress: string,
takerTokenAmount: BigNumber,
takerTokenAddress: string,
exchangeContractAddress: string,
feeRecipient: string,
expirationUnixTimestampSecIfExists?: BigNumber,
): Promise<SignedOrder> {
const defaultExpirationUnixTimestampSec = new BigNumber(2524604400); // Close to infinite
const expirationUnixTimestampSec = _.isUndefined(expirationUnixTimestampSecIfExists)
? defaultExpirationUnixTimestampSec
: expirationUnixTimestampSecIfExists;
const order = {
maker,
taker,
makerFee,
takerFee,
makerTokenAmount,
takerTokenAmount,
makerTokenAddress,
takerTokenAddress,
salt: ZeroEx.generatePseudoRandomSalt(),
exchangeContractAddress,
feeRecipient,
expirationUnixTimestampSec,
};
const orderHash = ZeroEx.getOrderHashHex(order);
const ecSignature = await zeroEx.signOrderHashAsync(orderHash, maker, SHOULD_ADD_PERSONAL_MESSAGE_PREFIX);
const signedOrder: SignedOrder = _.assign(order, { ecSignature });
return signedOrder;
},
};

View File

@@ -1,66 +0,0 @@
import * as chai from 'chai';
import * as _ from 'lodash';
import { DoneCallback } from '../../src/types';
const expect = chai.expect;
export const reportNoErrorCallbackErrors = (done: DoneCallback, expectToBeCalledOnce = true) => {
return <T>(f?: (value: T) => void) => {
const wrapped = (value: T) => {
if (_.isUndefined(f)) {
done();
return;
}
try {
f(value);
if (expectToBeCalledOnce) {
done();
}
} catch (err) {
done(err);
}
};
return wrapped;
};
};
export const reportNodeCallbackErrors = (done: DoneCallback, expectToBeCalledOnce = true) => {
return <T>(f?: (value: T) => void) => {
const wrapped = (error: Error | null, value: T | undefined) => {
if (!_.isNull(error)) {
done(error);
} else {
if (_.isUndefined(f)) {
done();
return;
}
try {
f(value as T);
if (expectToBeCalledOnce) {
done();
}
} catch (err) {
done(err);
}
}
};
return wrapped;
};
};
export const assertNodeCallbackError = (done: DoneCallback, errMsg: string) => {
const wrapped = <T>(error: Error | null, value: T | undefined) => {
if (_.isNull(error)) {
done(new Error('Expected callback to receive an error'));
} else {
try {
expect(error.message).to.be.equal(errMsg);
done();
} catch (err) {
done(err);
}
}
};
return wrapped;
};

View File

@@ -1,33 +1,9 @@
import * as _ from 'lodash';
import { artifacts } from '../../src/artifacts';
import { InternalZeroExError, Token } from '../../src/types';
import { constants } from './constants';
const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
const WETH_TOKEN_SYMBOL = 'WETH';
export class TokenUtils {
private _tokens: Token[];
constructor(tokens: Token[]) {
this._tokens = tokens;
}
public getProtocolTokenOrThrow(): Token {
const zrxToken = _.find(this._tokens, { symbol: PROTOCOL_TOKEN_SYMBOL });
if (_.isUndefined(zrxToken)) {
throw new Error(InternalZeroExError.ZrxNotInTokenRegistry);
}
return zrxToken;
}
public getWethTokenOrThrow(): Token {
const wethToken = _.find(this._tokens, { symbol: WETH_TOKEN_SYMBOL });
if (_.isUndefined(wethToken)) {
throw new Error(InternalZeroExError.WethNotInTokenRegistry);
}
return wethToken;
}
public getDummyTokens(): Token[] {
const dummyTokens = _.filter(this._tokens, token => {
return !_.includes([PROTOCOL_TOKEN_SYMBOL, WETH_TOKEN_SYMBOL], token.symbol);
});
return dummyTokens;
}
}
export const tokenUtils = {
getProtocolTokenAddress(): string {
return artifacts.ZRXToken.networks[constants.TESTRPC_NETWORK_ID].address;
},
};

View File

@@ -1,6 +1,12 @@
import { web3Factory } from '@0xproject/dev-utils';
import { devConstants, web3Factory } from '@0xproject/dev-utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as Web3 from 'web3';
import { Provider } from 'ethereum-types';
export const web3 = web3Factory.create();
export const web3Wrapper = new Web3Wrapper(web3.currentProvider);
const txDefaults = {
from: devConstants.TESTRPC_FIRST_ADDRESS,
gas: devConstants.GAS_LIMIT,
};
const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
const web3Wrapper = new Web3Wrapper(provider);
export { provider, web3Wrapper, txDefaults };

View File

@@ -1,17 +1,7 @@
{
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib",
"noImplicitThis": false
"outDir": "lib"
},
"include": [
"./src/**/*",
"./test/**/*",
"../../node_modules/types-bn/index.d.ts",
"../../node_modules/types-ethereumjs-util/index.d.ts",
"../../node_modules/ethers-typescript-typings/index.d.ts",
"../../node_modules/web3-typescript-typings/index.d.ts",
"../../node_modules/chai-typescript-typings/index.d.ts",
"../../node_modules/chai-as-promised-typescript-typings/index.d.ts"
]
"include": ["./src/**/*", "./test/**/*"]
}

View File

@@ -3,3 +3,4 @@ yarn-error.log
/src/
/scripts/
tsconfig.json
/lib/monorepo_scripts/

View File

@@ -0,0 +1,212 @@
[
{
"timestamp": 1532605697,
"version": "1.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.1",
"changes": [
{
"note": "Fix the abi-gen entry point in package.json",
"pr": 901
}
],
"timestamp": 1532357734
},
{
"timestamp": 1532043000,
"version": "1.0.0",
"changes": [
{
"note": "Convert e_r_c to erc in generated file names",
"pr": 822
},
{
"note": "Remove the output directory before writing to it",
"pr": 822
},
{
"note": "skip generation of wrappers that are already up to date",
"pr": 788
}
]
},
{
"timestamp": 1531919263,
"version": "0.3.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1531149657,
"version": "0.3.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1529397769,
"version": "0.3.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.3.1",
"changes": [
{
"note": "Incorrect publish that was unpublished"
}
],
"timestamp": 1527810075
},
{
"version": "0.3.0",
"changes": [
{
"note": "Properly export the executable binary",
"pr": 588
}
],
"timestamp": 1527008270
},
{
"timestamp": 1525477860,
"version": "0.2.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525428773,
"version": "0.2.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1524044013,
"version": "0.2.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1523462196,
"version": "0.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1522673609,
"version": "0.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1522658513,
"version": "0.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.2.5",
"changes": [
{
"note": "Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package",
"pr": 452
}
],
"timestamp": 1521298800
},
{
"version": "0.2.4",
"changes": [
{
"note":
"Add a `backend` parameter that allows you to specify the Ethereum library you use in your templates (`web3` or `ethers`). Ethers auto-converts small ints to numbers whereas Web3 doesn't. Defaults to `web3`",
"pr": 413
},
{
"note":
"Add support for [tuple types](https://solidity.readthedocs.io/en/develop/abi-spec.html#handling-tuple-types)",
"pr": 413
},
{
"note": "Add `hasReturnValue` to context data",
"pr": 413
}
],
"timestamp": 1520089200
},
{
"version": "0.2.1",
"changes": [
{
"note": "Fix publishing issue where .npmignore was not properly excluding undesired content",
"pr": 389
}
],
"timestamp": 1518102000
},
{
"version": "0.2.0",
"changes": [
{
"note": "Added CLI options for explicit specifying location of partials and main template",
"pr": 346
},
{
"note":
"Added CLI option to specify networkId, adding support for the JSON artifact format found in @0xproject/contracts",
"pr": 388
}
],
"timestamp": 1517929200
},
{
"version": "0.1.0",
"changes": [
{
"note": "Fixed array typings with union types",
"pr": 295
},
{
"note": "Add event ABIs to context data passed to templates",
"pr": 302
},
{
"note": "Add constructor ABIs to context data passed to templates",
"pr": 304
}
],
"timestamp": 1515596400
}
]

View File

@@ -1,25 +1,88 @@
# CHANGELOG
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
## v0.2.5 - _March 18, 2018_
CHANGELOG
## v1.0.2 - _July 26, 2018_
* Dependencies updated
## v1.0.1 - _July 23, 2018_
* Fix the abi-gen entry point in package.json (#901)
## v1.0.0 - _July 20, 2018_
* Convert e_r_c to erc in generated file names (#822)
* Remove the output directory before writing to it (#822)
* skip generation of wrappers that are already up to date (#788)
## v0.3.4 - _July 18, 2018_
* Dependencies updated
## v0.3.3 - _July 9, 2018_
* Dependencies updated
## v0.3.2 - _June 19, 2018_
* Dependencies updated
## v0.3.1 - _June 1, 2018_
* Incorrect publish that was unpublished
## v0.3.0 - _May 22, 2018_
* Properly export the executable binary (#588)
## v0.2.13 - _May 5, 2018_
* Dependencies updated
## v0.2.12 - _May 4, 2018_
* Dependencies updated
## v0.2.11 - _April 18, 2018_
* Dependencies updated
## v0.2.10 - _April 11, 2018_
* Dependencies updated
## v0.2.9 - _April 2, 2018_
* Dependencies updated
## v0.2.8 - _April 2, 2018_
* Dependencies updated
## v0.2.5 - _March 17, 2018_
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
## v0.2.4 - _March 4, 2018_
## v0.2.4 - _March 3, 2018_
* Add a `backend` parameter that allows you to specify the Ethereum library you use in your templates (`web3` or `ethers`). Ethers auto-converts small ints to numbers whereas Web3 doesn't. Defaults to `web3` (#413)
* Add support for [tuple types](https://solidity.readthedocs.io/en/develop/abi-spec.html#handling-tuple-types) (#413)
* Add `hasReturnValue` to context data (#413)
## v0.2.1 - _February 9, 2018_
## v0.2.1 - _February 8, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.2.0 - _February 7, 2018_
## v0.2.0 - _February 6, 2018_
* Added CLI options for explicit specifying location of partials and main template (#346)
* Added CLI option to specify networkId, adding support for the JSON artifact format found in @0xproject/contracts (#388)
## v0.1.0 - _January 11, 2018_
## v0.1.0 - _January 10, 2018_
* Fixed array typings with union types (#295)
* Add event ABIs to context data passed to templates (#302)

View File

@@ -4,8 +4,7 @@ This package allows you to generate TypeScript contract wrappers from ABI files.
It's heavily inspired by [Geth abigen](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) but takes a different approach.
You can write your custom handlebars templates which will allow you to seamlessly integrate the generated code into your existing codebase with existing conventions.
For an example of the generated [wrapper files](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/src/contract_wrappers/generated) check out 0x.js.
[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate those files.
[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate the contract wrappers used by 0x.js.e
## Installation
@@ -45,7 +44,7 @@ You need to also specify the location of your main template used for every contr
## How to write custom templates?
The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) and start adjusting them for your needs.
The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates) and start adjusting them for your needs.
We use [handlebars](http://handlebarsjs.com/) template engine under the hood.
You need to have a master template called `contract.mustache`. it will be used to generate each contract wrapper. Although - you don't need and probably shouldn't write all your logic in a single template file. You can write [partial templates](http://handlebarsjs.com/partials.html) and as long as they are within a partials folder - they will be registered and available.
@@ -57,3 +56,49 @@ See the [type definition](https://github.com/0xProject/0x-monorepo/tree/developm
## Output files
Output files will be generated within an output folder with names converted to camel case and taken from abi file names. If you already have some files in that folder they will be overwritten.
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0xproject/abi-gen yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0xproject/abi-gen yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../lib/src/index.js');

View File

@@ -1,17 +1,26 @@
{
"name": "@0xproject/abi-gen",
"version": "0.2.6",
"version": "1.0.2",
"engines": {
"node": ">=6.12"
},
"description": "Generate contract wrappers from ABI and handlebars templates",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"lint": "tslint --project . 'src/**/*.ts'",
"watch_without_deps": "tsc -w",
"lint": "tslint --project .",
"clean": "shx rm -rf lib scripts",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts"
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"test": "yarn run_mocha",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
"test:circleci": "yarn test:coverage",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"bin": {
"abi-gen": "lib/index.js"
"abi-gen": "bin/abi-gen.js"
},
"repository": {
"type": "git",
@@ -23,30 +32,38 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0xproject/utils": "^0.4.2",
"@0xproject/typescript-typings": "^1.0.2",
"@0xproject/utils": "^1.0.2",
"chalk": "^2.3.0",
"ethereum-types": "^1.0.2",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"sleep": "^5.1.1",
"tmp": "^0.0.33",
"to-snake-case": "^1.0.0",
"web3": "^0.20.0",
"yargs": "^10.0.3"
},
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.13",
"@0xproject/tslint-config": "^0.4.11",
"@types/glob": "^5.0.33",
"@0xproject/monorepo-scripts": "^1.0.3",
"@0xproject/tslint-config": "^1.0.3",
"@types/glob": "5.0.35",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
"@types/node": "^8.0.53",
"@types/sleep": "^0.0.7",
"@types/tmp": "^0.0.33",
"@types/yargs": "^10.0.0",
"chai": "^4.1.2",
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
"typescript": "2.7.1",
"web3-typescript-typings": "^0.10.1"
"tslint": "5.11.0",
"typescript": "2.7.1"
},
"publishConfig": {
"access": "public"

View File

@@ -1,8 +1,3 @@
declare function toSnakeCase(str: string): string;
declare module 'to-snake-case' {
export = toSnakeCase;
}
declare module '*.json' {
const json: any;
/* tslint:disable */

View File

@@ -1,17 +1,14 @@
#!/usr/bin/env node
import { logUtils } from '@0xproject/utils';
import { abiUtils, logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import * as fs from 'fs';
import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from 'ethereum-types';
import { sync as globSync } from 'glob';
import * as Handlebars from 'handlebars';
import * as _ from 'lodash';
import * as mkdirp from 'mkdirp';
import * as yargs from 'yargs';
import toSnakeCase = require('to-snake-case');
import * as Web3 from 'web3';
import { ContextData, ContractsBackend, ParamKind } from './types';
import { utils } from './utils';
@@ -61,29 +58,17 @@ const args = yargs
'Full usage example',
).argv;
function registerPartials(partialsGlob: string) {
function registerPartials(partialsGlob: string): void {
const partialTemplateFileNames = globSync(partialsGlob);
logUtils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
for (const partialTemplateFileName of partialTemplateFileNames) {
const namedContent = utils.getNamedContent(partialTemplateFileName);
Handlebars.registerPartial(namedContent.name, namedContent.content);
}
return partialsGlob;
}
function writeOutputFile(name: string, renderedTsCode: string): void {
let fileName = toSnakeCase(name);
if (fileName === 'z_r_x_token') {
fileName = 'zrx_token';
}
const filePath = `${args.output}/${fileName}.ts`;
fs.writeFileSync(filePath, renderedTsCode);
logUtils.log(`Created: ${chalk.bold(filePath)}`);
}
Handlebars.registerHelper('parameterType', utils.solTypeToTsType.bind(utils, ParamKind.Input, args.backend));
Handlebars.registerHelper('returnType', utils.solTypeToTsType.bind(utils, ParamKind.Output, args.backend));
if (args.partials) {
registerPartials(args.partials);
}
@@ -109,28 +94,37 @@ for (const abiFileName of abiFileNames) {
ABI = parsedContent; // ABI file
} else if (!_.isUndefined(parsedContent.abi)) {
ABI = parsedContent.abi; // Truffle artifact
} else if (!_.isUndefined(parsedContent.networks) && !_.isUndefined(parsedContent.networks[args.networkId])) {
ABI = parsedContent.networks[args.networkId].abi; // 0x contracts package artifact
} else if (!_.isUndefined(parsedContent.compilerOutput.abi)) {
ABI = parsedContent.compilerOutput.abi; // 0x artifact
}
if (_.isUndefined(ABI)) {
logUtils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
logUtils.log(
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x deployer artifact`,
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x sol-compiler artifact`,
);
process.exit(1);
}
let ctor = ABI.find((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as Web3.ConstructorAbi;
const outFileName = utils.makeOutputFileName(namedContent.name);
const outFilePath = `${args.output}/${outFileName}.ts`;
if (utils.isOutputFileUpToDate(abiFileName, outFilePath)) {
logUtils.log(`Already up to date: ${chalk.bold(outFilePath)}`);
continue;
}
let ctor = ABI.find((abi: AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as ConstructorAbi;
if (_.isUndefined(ctor)) {
ctor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition
}
const methodAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_METHOD) as Web3.MethodAbi[];
const methodsData = _.map(methodAbis, methodAbi => {
_.map(methodAbi.inputs, (input, i: number) => {
const methodAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_METHOD) as MethodAbi[];
const sanitizedMethodAbis = abiUtils.renameOverloadedMethods(methodAbis) as MethodAbi[];
const methodsData = _.map(methodAbis, (methodAbi, methodAbiIndex: number) => {
_.forEach(methodAbi.inputs, (input, inputIndex: number) => {
if (_.isEmpty(input.name)) {
// Auto-generated getters don't have parameter names
input.name = `index_${i}`;
input.name = `index_${inputIndex}`;
}
});
// This will make templates simpler
@@ -138,11 +132,13 @@ for (const abiFileName of abiFileNames) {
...methodAbi,
singleReturnValue: methodAbi.outputs.length === 1,
hasReturnValue: methodAbi.outputs.length !== 0,
tsName: sanitizedMethodAbis[methodAbiIndex].name,
functionSignature: abiUtils.getFunctionSignature(methodAbi),
};
return methodData;
});
const eventAbis = ABI.filter((abi: Web3.AbiDefinition) => abi.type === ABI_TYPE_EVENT) as Web3.EventAbi[];
const eventAbis = ABI.filter((abi: AbiDefinition) => abi.type === ABI_TYPE_EVENT) as EventAbi[];
const contextData = {
contractName: namedContent.name,
@@ -151,5 +147,6 @@ for (const abiFileName of abiFileNames) {
events: eventAbis,
};
const renderedTsCode = template(contextData);
writeOutputFile(namedContent.name, renderedTsCode);
utils.writeOutputFile(outFilePath, renderedTsCode);
logUtils.log(`Created: ${chalk.bold(outFilePath)}`);
}

View File

@@ -1,29 +1,24 @@
import * as Web3 from 'web3';
import { EventAbi, MethodAbi } from 'ethereum-types';
export enum ParamKind {
Input = 'input',
Output = 'output',
}
export enum AbiType {
Function = 'function',
Constructor = 'constructor',
Event = 'event',
Fallback = 'fallback',
}
export enum ContractsBackend {
Web3 = 'web3',
Ethers = 'ethers',
}
export interface Method extends Web3.MethodAbi {
export interface Method extends MethodAbi {
singleReturnValue: boolean;
hasReturnValue: boolean;
tsName: string;
functionSignature: string;
}
export interface ContextData {
contractName: string;
methods: Method[];
events: Web3.EventAbi[];
events: EventAbi[];
}

View File

@@ -1,17 +1,13 @@
import { AbiType, ConstructorAbi, DataItem } from 'ethereum-types';
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
import * as Web3 from 'web3';
import toSnakeCase = require('to-snake-case');
import { AbiType, ContractsBackend, ParamKind } from './types';
import { ContractsBackend, ParamKind } from './types';
export const utils = {
solTypeToTsType(
paramKind: ParamKind,
backend: ContractsBackend,
solType: string,
components?: Web3.DataItem[],
): string {
solTypeToTsType(paramKind: ParamKind, backend: ContractsBackend, solType: string, components?: DataItem[]): string {
const trailingArrayRegex = /\[\d*\]$/;
if (solType.match(trailingArrayRegex)) {
const arrayItemSolType = solType.replace(trailingArrayRegex, '');
@@ -61,7 +57,7 @@ export const utils = {
const componentType = `${component.name}: ${componentValueType}`;
return componentType;
});
const tsType = `{${componentsType}}`;
const tsType = `{${componentsType.join(';')}}`;
return tsType;
}
throw new Error(`Unknown Solidity type found: ${solType}`);
@@ -89,7 +85,7 @@ export const utils = {
throw new Error(`Failed to read ${filename}: ${err}`);
}
},
getEmptyConstructor(): Web3.ConstructorAbi {
getEmptyConstructor(): ConstructorAbi {
return {
type: AbiType.Constructor,
stateMutability: 'nonpayable',
@@ -97,4 +93,27 @@ export const utils = {
inputs: [],
};
},
makeOutputFileName(name: string): string {
let fileName = toSnakeCase(name);
// HACK: Snake case doesn't make a lot of sense for abbreviated names but we can't reliably detect abbreviations
// so we special-case the abbreviations we use.
fileName = fileName.replace('z_r_x', 'zrx').replace('e_r_c', 'erc');
return fileName;
},
writeOutputFile(filePath: string, renderedTsCode: string): void {
fs.writeFileSync(filePath, renderedTsCode);
},
isOutputFileUpToDate(abiFile: string, outputFile: string): boolean {
const abiFileModTimeMs = fs.statSync(abiFile).mtimeMs;
try {
const outFileModTimeMs = fs.statSync(outputFile).mtimeMs;
return outFileModTimeMs > abiFileModTimeMs;
} catch (err) {
if (err.code === 'ENOENT') {
return false;
} else {
throw err;
}
}
},
};

View File

@@ -0,0 +1,86 @@
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
import * as fs from 'fs';
import 'mocha';
import * as tmp from 'tmp';
import { utils } from '../src/utils';
tmp.setGracefulCleanup(); // remove tmp files even if there are failures
chai.use(dirtyChai);
const expect = chai.expect;
describe('makeOutputFileName()', () => {
it('should handle Metacoin usage', () => {
expect(utils.makeOutputFileName('Metacoin')).to.equal('metacoin');
});
it('should handle special zrx_token case', () => {
expect(utils.makeOutputFileName('ZRXToken')).to.equal('zrx_token');
});
it('should handle special erc_token case', () => {
expect(utils.makeOutputFileName('ERC20Token')).to.equal('erc20_token');
});
});
describe('writeOutputFile()', () => {
let tempFilePath: string;
before(() => {
tempFilePath = tmp.fileSync(
{ discardDescriptor: true }, // close file (so we can update it)
).name;
});
it('should write content to output file', () => {
const content = 'hello world';
utils.writeOutputFile(tempFilePath, content);
expect(fs.readFileSync(tempFilePath).toString()).to.equal(content);
});
});
describe('isOutputFileUpToDate()', () => {
it('should throw ENOENT when there is no abi file', () => {
expect(utils.isOutputFileUpToDate.bind('nonexistant1', 'nonexistant2')).to.throw('ENOENT');
});
describe('when the abi input file exists', () => {
let abiFile: string;
before(() => {
abiFile = tmp.fileSync(
{ discardDescriptor: true }, // close file (set timestamp)
).name;
});
describe('without an existing output file', () => {
it('should return false', () => {
expect(utils.isOutputFileUpToDate(abiFile, 'nonexistant_file')).to.be.false();
});
});
describe('with an existing output file', () => {
let outputFile: string;
before(() => {
outputFile = tmp.fileSync(
{ discardDescriptor: true }, // close file (set timestamp)
).name;
const abiFileModTimeMs = fs.statSync(abiFile).mtimeMs;
const outfileModTimeMs = abiFileModTimeMs + 1;
fs.utimesSync(outputFile, outfileModTimeMs, outfileModTimeMs);
});
it('should return true when output file is newer than abi file', async () => {
expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.true();
});
it('should return false when output file exists but is older than abi file', () => {
const outFileModTimeMs = fs.statSync(outputFile).mtimeMs;
const abiFileModTimeMs = outFileModTimeMs + 1;
fs.utimesSync(abiFile, abiFileModTimeMs, abiFileModTimeMs);
expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.false();
});
});
});
});

View File

@@ -3,5 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
"include": ["./src/**/*", "./test/**/*", "../../node_modules/web3-typescript-typings/index.d.ts"]
"include": ["./src/**/*", "./test/**/*"]
}

View File

@@ -4,3 +4,4 @@ yarn-error.log
/scripts/
test/
tsconfig.json
/lib/src/monorepo_scripts/

View File

@@ -0,0 +1,177 @@
[
{
"timestamp": 1532605697,
"version": "1.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1532357734,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1532043000,
"version": "1.0.0",
"changes": [
{
"note":
"Fix bug in string enum assertion. We erroneously were checking against the enum keys, not values",
"pr": 821
}
]
},
{
"timestamp": 1531919263,
"version": "0.2.14",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1531149657,
"version": "0.2.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1529397769,
"version": "0.2.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.2.11",
"changes": [
{
"note": "Incorrect publish that was unpublished"
}
],
"timestamp": 1527810075
},
{
"timestamp": 1527008270,
"version": "0.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525477860,
"version": "0.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525428773,
"version": "0.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1524044013,
"version": "0.2.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1523462196,
"version": "0.2.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1522673609,
"version": "0.2.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1522658513,
"version": "0.2.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.2.0",
"changes": [
{
"note": "Rename `isHttpUrl` to `isWebUri`",
"pr": 412
}
],
"timestamp": 1520434800
},
{
"version": "0.1.0",
"changes": [
{
"note": "Remove isETHAddressHex checksum address check and assume address will be lowercased ",
"pr": 373
},
{
"note": "Add an optional parameter `subSchemas` to `doesConformToSchema` method",
"pr": 385
}
],
"timestamp": 1520089200
},
{
"version": "0.0.18",
"changes": [
{
"note": "Fix publishing issue where .npmignore was not properly excluding undesired content",
"pr": 389
}
],
"timestamp": 1486566000
},
{
"version": "0.0.4",
"changes": [
{
"note": "Re-publish Assert previously published under NPM package @0xproject/0x-assert"
},
{
"note":
"Added assertion isValidBaseUnitAmount which checks both that the value is a valid bigNumber and that it does not contain decimals."
}
],
"timestamp": 1510585200
}
]

View File

@@ -1,19 +1,80 @@
# CHANGELOG
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
## v0.2.0 - _March 8, 2018_
CHANGELOG
## v1.0.2 - _July 26, 2018_
* Dependencies updated
## v1.0.1 - _July 23, 2018_
* Dependencies updated
## v1.0.0 - _July 20, 2018_
* Fix bug in string enum assertion. We erroneously were checking against the enum keys, not values (#821)
## v0.2.14 - _July 18, 2018_
* Dependencies updated
## v0.2.13 - _July 9, 2018_
* Dependencies updated
## v0.2.12 - _June 19, 2018_
* Dependencies updated
## v0.2.11 - _June 1, 2018_
* Incorrect publish that was unpublished
## v0.2.10 - _May 22, 2018_
* Dependencies updated
## v0.2.9 - _May 5, 2018_
* Dependencies updated
## v0.2.8 - _May 4, 2018_
* Dependencies updated
## v0.2.7 - _April 18, 2018_
* Dependencies updated
## v0.2.6 - _April 11, 2018_
* Dependencies updated
## v0.2.5 - _April 2, 2018_
* Dependencies updated
## v0.2.4 - _April 2, 2018_
* Dependencies updated
## v0.2.0 - _March 7, 2018_
* Rename `isHttpUrl` to `isWebUri` (#412)
## v0.1.0 - _March 4, 2018_
## v0.1.0 - _March 3, 2018_
* Remove isETHAddressHex checksum address check and assume address will be lowercased (#373)
* Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385)
## v0.0.18 - _February 9, 2017_
## v0.0.18 - _February 8, 2017_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.0.4 - _November 14, 2017_
## v0.0.4 - _November 13, 2017_
* Re-publish Assert previously published under NPM package @0xproject/0x-assert
* Added assertion isValidBaseUnitAmount which checks both that the value is a valid bigNumber and that it does not contain decimals.

View File

@@ -8,14 +8,6 @@ Standard type and schema assertions to be used across all 0x projects and packag
yarn add @0xproject/assert
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```
"include": [
"./node_modules/web3-typescript-typings/index.d.ts",
]
```
## Usage
```typescript
@@ -24,13 +16,21 @@ import { assert } from '@0xproject/assert';
assert.isValidBaseUnitAmount('baseUnitAmount', baseUnitAmount);
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We strongly encourage that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install Dependencies
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
@@ -46,8 +46,22 @@ yarn install
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn build
PKG=@0xproject/assert yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0xproject/assert yarn watch
```
### Clean
```bash
yarn clean
```
### Lint

View File

@@ -1,20 +1,24 @@
{
"name": "@0xproject/assert",
"version": "0.2.1",
"version": "1.0.2",
"engines": {
"node": ">=6.12"
},
"description": "Provides a standard way of performing type and schema validation across 0x projects",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf _bundles lib test_temp scripts",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"run_mocha": "mocha lib/test/**/*_test.js",
"prepublishOnly": "run-p build",
"test": "run-s clean build run_mocha",
"clean": "shx rm -rf lib test_temp scripts",
"lint": "tslint --project .",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage"
"test:circleci": "yarn test:coverage",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"license": "Apache-2.0",
"repository": {
@@ -26,25 +30,26 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.13",
"@0xproject/tslint-config": "^0.4.11",
"@types/lodash": "^4.14.86",
"@0xproject/monorepo-scripts": "^1.0.3",
"@0xproject/tslint-config": "^1.0.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
"chai": "^4.0.1",
"chai-typescript-typings": "^0.0.5",
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
"tslint": "5.8.0",
"tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
"@0xproject/json-schemas": "^0.7.15",
"@0xproject/utils": "^0.4.2",
"@0xproject/json-schemas": "^1.0.1-rc.1",
"@0xproject/typescript-typings": "^1.0.2",
"@0xproject/utils": "^1.0.2",
"lodash": "^4.17.4",
"valid-url": "^1.0.9"
},

View File

@@ -1,5 +1,3 @@
declare module 'dirty-chai';
declare module '*.json' {
const json: any;
/* tslint:disable */

View File

@@ -8,41 +8,41 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
export const assert = {
isBigNumber(variableName: string, value: BigNumber): void {
const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
assert.assert(isBigNumber, assert.typeAssertionMessage(variableName, 'BigNumber', value));
},
isValidBaseUnitAmount(variableName: string, value: BigNumber) {
isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
assert.isBigNumber(variableName, value);
const isNegative = value.lessThan(0);
this.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
assert.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
const hasDecimals = value.decimalPlaces() !== 0;
this.assert(
assert.assert(
!hasDecimals,
`${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
);
},
isString(variableName: string, value: string): void {
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
},
isFunction(variableName: string, value: any): void {
this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value));
assert.assert(_.isFunction(value), assert.typeAssertionMessage(variableName, 'function', value));
},
isHexString(variableName: string, value: string): void {
this.assert(
assert.assert(
_.isString(value) && HEX_REGEX.test(value),
this.typeAssertionMessage(variableName, 'HexString', value),
assert.typeAssertionMessage(variableName, 'HexString', value),
);
},
isETHAddressHex(variableName: string, value: string): void {
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
assert.assert(addressUtils.isAddress(value), assert.typeAssertionMessage(variableName, 'ETHAddressHex', value));
},
doesBelongToStringEnum(
variableName: string,
value: string,
stringEnum: any /* There is no base type for every string enum */,
): void {
const doesBelongToStringEnum = !_.isUndefined(stringEnum[value]);
const enumValues = _.keys(stringEnum);
const enumValues = _.values(stringEnum);
const doesBelongToStringEnum = _.includes(enumValues, value);
const enumValuesAsStrings = _.map(enumValues, enumValue => `'${enumValue}'`);
const enumValuesAsString = enumValuesAsStrings.join(', ');
assert.assert(
@@ -51,19 +51,22 @@ export const assert = {
);
},
hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
this.assert(_.uniq(value).length <= 1, errMsg);
assert.assert(_.uniq(value).length <= 1, errMsg);
},
isNumber(variableName: string, value: number): void {
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
assert.assert(_.isFinite(value), assert.typeAssertionMessage(variableName, 'number', value));
},
isBoolean(variableName: string, value: boolean): void {
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
assert.assert(_.isBoolean(value), assert.typeAssertionMessage(variableName, 'boolean', value));
},
isWeb3Provider(variableName: string, value: any): void {
const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value));
assert.assert(isWeb3Provider, assert.typeAssertionMessage(variableName, 'Provider', value));
},
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
if (_.isUndefined(value)) {
throw new Error(`${variableName} can't be undefined`);
}
const schemaValidator = new SchemaValidator();
if (!_.isUndefined(subSchemas)) {
_.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator));
@@ -73,15 +76,15 @@ export const assert = {
const msg = `Expected ${variableName} to conform to schema ${schema.id}
Encountered: ${JSON.stringify(value, null, '\t')}
Validation errors: ${validationResult.errors.join(', ')}`;
this.assert(!hasValidationErrors, msg);
assert.assert(!hasValidationErrors, msg);
},
isWebUri(variableName: string, value: any): void {
const isValidUrl = !_.isUndefined(validUrl.isWebUri(value));
this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'web uri', value));
assert.assert(isValidUrl, assert.typeAssertionMessage(variableName, 'web uri', value));
},
isUri(variableName: string, value: any): void {
const isValidUri = !_.isUndefined(validUrl.isUri(value));
this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value));
assert.assert(isValidUri, assert.typeAssertionMessage(variableName, 'uri', value));
},
assert(condition: boolean, message: string): void {
if (!condition) {

View File

@@ -10,6 +10,7 @@ chai.config.includeStack = true;
chai.use(dirtyChai);
const expect = chai.expect;
// tslint:disable:custom-no-magic-numbers
describe('Assertions', () => {
const variableName = 'variable';
describe('#isBigNumber', () => {
@@ -48,7 +49,7 @@ describe('Assertions', () => {
});
describe('#isFunction', () => {
it('should not throw for valid input', () => {
const validInputs = [BigNumber, assert.isString];
const validInputs = [BigNumber, assert.isString.bind(assert)];
validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw());
});
it('should throw for invalid input', () => {
@@ -251,3 +252,4 @@ describe('Assertions', () => {
});
});
});
// tslint:enable:custom-no-magic-numbers

View File

@@ -3,10 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
"include": [
"./src/**/*",
"./test/**/*",
"../../node_modules/web3-typescript-typings/index.d.ts",
"../../node_modules/chai-typescript-typings/index.d.ts"
]
"include": ["./src/**/*", "./test/**/*"]
}

View File

@@ -3,3 +3,4 @@ yarn-error.log
/scripts/
/src/
tsconfig.json
/lib/monorepo_scripts/

View File

@@ -0,0 +1,149 @@
[
{
"timestamp": 1532605697,
"version": "1.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1532357734,
"version": "1.0.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1532043000,
"version": "1.0.0",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1531919263,
"version": "0.3.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1531149657,
"version": "0.3.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.3.4",
"changes": [
{
"note":
"Update EthersJs to fix the `value.toLowerCase()` is not a function bug caused by `ethers.js` breaking patch version https://github.com/ethers-io/ethers.js/issues/201"
}
],
"timestamp": 1529397769
},
{
"timestamp": 1527810075,
"version": "0.3.3",
"changes": [
{
"note": "Incorrect publish that was unpublished"
}
]
},
{
"timestamp": 1527008270,
"version": "0.3.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525477860,
"version": "0.3.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.3.0",
"changes": [
{
"note": "Update ethers-contracts to ethers.js",
"pr": 540
}
],
"timestamp": 1525428773
},
{
"timestamp": 1524044013,
"version": "0.2.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.2.0",
"changes": [
{
"note": "Contract wrappers now accept Provider and defaults instead of Web3Wrapper",
"pr": 501
}
],
"timestamp": 1523462196
},
{
"version": "0.1.0",
"changes": [
{
"note": "Add tests for traversing ABI tree",
"pr": 485
},
{
"note": "Fix ABI tuples traversing",
"pr": 485
},
{
"note": "Fix ABI arrays traversing",
"pr": 485
}
],
"timestamp": 1522673609
},
{
"timestamp": 1522658513,
"version": "0.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.0.2",
"changes": [
{
"note": "Initial release"
}
],
"timestamp": 1520089200
}
]

View File

@@ -1,5 +1,68 @@
# CHANGELOG
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
## v0.0.2 - _March 4, 2018_
CHANGELOG
## v1.0.2 - _July 26, 2018_
* Dependencies updated
## v1.0.1 - _July 23, 2018_
* Dependencies updated
## v1.0.0 - _July 20, 2018_
* Dependencies updated
## v0.3.6 - _July 18, 2018_
* Dependencies updated
## v0.3.5 - _July 9, 2018_
* Dependencies updated
## v0.3.4 - _June 19, 2018_
* Update EthersJs to fix the `value.toLowerCase()` is not a function bug caused by `ethers.js` breaking patch version https://github.com/ethers-io/ethers.js/issues/201
## v0.3.3 - _June 1, 2018_
* Incorrect publish that was unpublished
## v0.3.2 - _May 22, 2018_
* Dependencies updated
## v0.3.1 - _May 5, 2018_
* Dependencies updated
## v0.3.0 - _May 4, 2018_
* Update ethers-contracts to ethers.js (#540)
## v0.2.1 - _April 18, 2018_
* Dependencies updated
## v0.2.0 - _April 11, 2018_
* Contract wrappers now accept Provider and defaults instead of Web3Wrapper (#501)
## v0.1.0 - _April 2, 2018_
* Add tests for traversing ABI tree (#485)
* Fix ABI tuples traversing (#485)
* Fix ABI arrays traversing (#485)
## v0.0.6 - _April 2, 2018_
* Dependencies updated
## v0.0.2 - _March 3, 2018_
* Initial release

View File

@@ -10,11 +10,10 @@ yarn add @0xproject/base-contract
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```
"include": [
"./node_modules/web3-typescript-typings/index.d.ts",
"./node_modules/ethers-typescript-typings/index.d.ts"
]
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
}
```
## Usage
@@ -45,14 +44,16 @@ yarn install
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn build
PKG=@0xproject/base-contract yarn build
```
or
Or continuously rebuild on change:
```bash
yarn build:watch
PKG=@0xproject/base-contract yarn watch
```
### Lint

View File

@@ -1,14 +1,24 @@
{
"name": "@0xproject/base-contract",
"version": "0.0.4",
"version": "1.0.2",
"engines": {
"node": ">=6.12"
},
"description": "0x Base TS contract",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib scripts",
"lint": "tslint --project . 'src/**/*.ts'"
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"lint": "tslint --project . --exclude **/src/contract_wrappers/**/*",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"license": "Apache-2.0",
"repository": {
@@ -20,23 +30,25 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.13",
"@0xproject/tslint-config": "^0.4.11",
"@types/lodash": "^4.14.86",
"@0xproject/monorepo-scripts": "^1.0.3",
"@0xproject/tslint-config": "^1.0.3",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",
"tslint": "5.11.0",
"typescript": "2.7.1"
},
"dependencies": {
"@0xproject/types": "^0.4.0",
"@0xproject/web3-wrapper": "^0.3.0",
"ethers-contracts": "^2.2.1",
"ethers-typescript-typings": "^0.0.3",
"lodash": "^4.17.4",
"web3": "^0.20.0",
"web3-typescript-typings": "^0.10.1"
"@0xproject/typescript-typings": "^1.0.2",
"@0xproject/utils": "^1.0.2",
"@0xproject/web3-wrapper": "^1.1.0",
"ethereum-types": "^1.0.2",
"ethers": "3.0.22",
"lodash": "^4.17.4"
},
"publishConfig": {
"access": "public"

View File

@@ -1,68 +1,125 @@
import { TxData, TxDataPayable } from '@0xproject/types';
import { abiUtils, BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethersContracts from 'ethers-contracts';
import {
AbiDefinition,
AbiType,
ConstructorAbi,
ContractAbi,
DataItem,
MethodAbi,
Provider,
TxData,
TxDataPayable,
} from 'ethereum-types';
import * as ethers from 'ethers';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import { formatABIDataItem } from './utils';
export interface EthersInterfaceByFunctionSignature {
[key: string]: ethers.Interface;
}
export class BaseContract {
protected _ethersInterface: ethersContracts.Interface;
protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature;
protected _web3Wrapper: Web3Wrapper;
public abi: Web3.ContractAbi;
public abi: ContractAbi;
public address: string;
protected static _transformABIData(
abis: Web3.DataItem[],
public contractName: string;
public constructorArgs: any[] = [];
protected static _formatABIDataItemList(
abis: DataItem[],
values: any[],
transformation: (type: string, value: any) => any,
formatter: (type: string, value: any) => any,
): any {
return _.map(values, (value: any, i: number) =>
BaseContract._transformTypedData(abis[i].type, value, transformation),
);
return _.map(values, (value: any, i: number) => formatABIDataItem(abis[i], value, formatter));
}
protected static _lowercaseAddress(type: string, value: string): string {
return type === 'address' ? value.toLowerCase() : value;
}
protected static _bigNumberToString(type: string, value: string): string {
return _.isObject(value) && (value as any).isBigNumber ? value.toString() : value;
protected static _bigNumberToString(_type: string, value: any): any {
return _.isObject(value) && value.isBigNumber ? value.toString() : value;
}
private static _transformTypedData(
type: string,
values: any,
transformation: (type: string, value: any) => any,
): any {
const trailingArrayRegex = /\[\d*\]$/;
if (type.match(trailingArrayRegex)) {
const arrayItemType = type.replace(trailingArrayRegex, '');
return _.map(values, value => this._transformTypedData(arrayItemType, value, transformation));
protected static _lookupConstructorAbi(abi: ContractAbi): ConstructorAbi {
const constructorAbiIfExists = _.find(
abi,
(abiDefinition: AbiDefinition) => abiDefinition.type === AbiType.Constructor,
// tslint:disable-next-line:no-unnecessary-type-assertion
) as ConstructorAbi | undefined;
if (!_.isUndefined(constructorAbiIfExists)) {
return constructorAbiIfExists;
} else {
return transformation(type, values);
// If the constructor is not explicitly defined, it won't be included in the ABI. It is
// still callable however, so we construct what the ABI would look like were it to exist.
const defaultConstructorAbi: ConstructorAbi = {
type: AbiType.Constructor,
stateMutability: 'nonpayable',
payable: false,
inputs: [],
};
return defaultConstructorAbi;
}
}
protected async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
protected static _bnToBigNumber(_type: string, value: any): any {
return _.isObject(value) && value._bn ? new BigNumber(value.toString()) : value;
}
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
txData: T,
txDefaults: Partial<TxData>,
estimateGasAsync?: (txData: T) => Promise<number>,
): Promise<TxData> {
// Gas amount sourced with the following priorities:
// 1. Optional param passed in to public method call
// 2. Global config passed in at library instantiation
// 3. Gas estimate calculation + safety margin
const removeUndefinedProperties = _.pickBy;
const removeUndefinedProperties = _.pickBy.bind(_);
const txDataWithDefaults = {
to: this.address,
...removeUndefinedProperties(this._web3Wrapper.getContractDefaults()),
...removeUndefinedProperties(txData as any),
// HACK: TS can't prove that T is spreadable.
// Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
...removeUndefinedProperties(txDefaults),
...removeUndefinedProperties(txData),
};
if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
const estimatedGas = await estimateGasAsync(txData);
txDataWithDefaults.gas = estimatedGas;
txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults);
}
return txDataWithDefaults;
}
constructor(web3Wrapper: Web3Wrapper, abi: Web3.ContractAbi, address: string) {
this._web3Wrapper = web3Wrapper;
protected _lookupEthersInterface(functionSignature: string): ethers.Interface {
const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature];
if (_.isUndefined(ethersInterface)) {
throw new Error(`Failed to lookup method with function signature '${functionSignature}'`);
}
return ethersInterface;
}
protected _lookupAbi(functionSignature: string): MethodAbi {
const methodAbi = _.find(this.abi, (abiDefinition: AbiDefinition) => {
if (abiDefinition.type !== AbiType.Function) {
return false;
}
const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition);
if (abiFunctionSignature === functionSignature) {
return true;
}
return false;
}) as MethodAbi;
return methodAbi;
}
constructor(
contractName: string,
abi: ContractAbi,
address: string,
provider: Provider,
txDefaults?: Partial<TxData>,
) {
this.contractName = contractName;
this._web3Wrapper = new Web3Wrapper(provider, txDefaults);
this.abi = abi;
this.address = address;
this._ethersInterface = new ethersContracts.Interface(abi);
const methodAbis = this.abi.filter(
(abiDefinition: AbiDefinition) => abiDefinition.type === AbiType.Function,
) as MethodAbi[];
this._ethersInterfacesByFunctionSignature = {};
_.each(methodAbis, methodAbi => {
const functionSignature = abiUtils.getFunctionSignature(methodAbi);
this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.Interface([methodAbi]);
});
}
}

View File

@@ -0,0 +1,25 @@
import { DataItem } from 'ethereum-types';
import * as _ from 'lodash';
// tslint:disable-next-line:completed-docs
export function formatABIDataItem(abi: DataItem, value: any, formatter: (type: string, value: any) => any): any {
const trailingArrayRegex = /\[\d*\]$/;
if (abi.type.match(trailingArrayRegex)) {
const arrayItemType = abi.type.replace(trailingArrayRegex, '');
return _.map(value, val => {
const arrayItemAbi = {
...abi,
type: arrayItemType,
};
return formatABIDataItem(arrayItemAbi, val, formatter);
});
} else if (abi.type === 'tuple') {
const formattedTuple: { [componentName: string]: DataItem } = {};
_.forEach(abi.components, componentABI => {
formattedTuple[componentABI.name] = formatABIDataItem(componentABI, value[componentABI.name], formatter);
});
return formattedTuple;
} else {
return formatter(abi.type, value);
}
}

View File

@@ -0,0 +1,108 @@
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import 'mocha';
import { formatABIDataItem } from '../src/utils';
const { expect } = chai;
describe('Utils tests', () => {
describe('#formatABIDataItem', () => {
it('correctly handles arrays', () => {
const calls: Array<{ type: string; value: any }> = [];
const abi = {
name: 'values',
type: 'uint256[]',
};
const val = [1, 2, 3];
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
calls.push({ type, value });
return value; // no-op
});
expect(formatted).to.be.deep.equal(val);
expect(calls).to.be.deep.equal([
{ type: 'uint256', value: 1 },
{ type: 'uint256', value: 2 },
{ type: 'uint256', value: 3 },
]);
});
it('correctly handles tuples', () => {
const calls: Array<{ type: string; value: any }> = [];
const abi = {
components: [
{
name: 'to',
type: 'address',
},
{
name: 'amount',
type: 'uint256',
},
],
name: 'data',
type: 'tuple',
};
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const val = { to: ZERO_ADDRESS, amount: new BigNumber(1) };
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
calls.push({ type, value });
return value; // no-op
});
expect(formatted).to.be.deep.equal(val);
expect(calls).to.be.deep.equal([
{
type: 'address',
value: val.to,
},
{
type: 'uint256',
value: val.amount,
},
]);
});
it('correctly handles nested arrays of tuples', () => {
const calls: Array<{ type: string; value: any }> = [];
const abi = {
components: [
{
name: 'to',
type: 'address',
},
{
name: 'amount',
type: 'uint256',
},
],
name: 'data',
type: 'tuple[2][]',
};
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
const val = [
[{ to: ZERO_ADDRESS, amount: new BigNumber(1) }, { to: ZERO_ADDRESS, amount: new BigNumber(2) }],
];
const formatted = formatABIDataItem(abi, val, (type: string, value: any) => {
calls.push({ type, value });
return value; // no-op
});
expect(formatted).to.be.deep.equal(val);
expect(calls).to.be.deep.equal([
{
type: 'address',
value: val[0][0].to,
},
{
type: 'uint256',
value: val[0][0].amount,
},
{
type: 'address',
value: val[0][1].to,
},
{
type: 'uint256',
value: val[0][1].amount,
},
]);
});
});
});

View File

@@ -3,9 +3,5 @@
"compilerOptions": {
"outDir": "lib"
},
"include": [
"./src/**/*",
"../../node_modules/web3-typescript-typings/index.d.ts",
"../../node_modules/ethers-typescript-typings/index.d.ts"
]
"include": ["src/**/*", "test/**/*"]
}

View File

@@ -1,3 +0,0 @@
# CHANGELOG
## v0.x.x - _TBD, 2018_

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