Compare commits

...

412 Commits

Author SHA1 Message Date
Leonid Logvinov
397496aff0 Publish
- 0x.js@6.0.3
 - @0x/abi-gen@2.0.6
 - @0x/abi-gen-wrappers@4.0.2
 - @0x/assert@2.0.6
 - @0x/asset-buyer@6.0.3
 - @0x/base-contract@5.0.2
 - @0x/connect@5.0.2
 - @0x/contract-wrappers@8.0.3
 - @0x/contracts-gen@1.0.5
 - @0x/dev-tools-pages@0.0.22
 - @0x/dev-utils@2.1.3
 - @0x/fill-scenarios@3.0.2
 - @0x/instant@1.0.17
 - @0x/json-schemas@3.0.6
 - @0x/metacoin@0.0.44
 - @0x/migrations@4.0.3
 - @0x/monorepo-scripts@1.0.27
 - @0x/order-utils@7.0.2
 - @0x/order-watcher@4.0.3
 - @0x/pipeline@1.0.14
 - @0x/react-docs@2.0.7
 - @0x/react-shared@2.0.7
 - @0x/sol-compiler@3.1.3
 - @0x/sol-coverage@3.0.0
 - @0x/sol-doc@2.0.7
 - @0x/sol-profiler@3.1.2
 - @0x/sol-trace@2.0.8
 - @0x/sol-tracing-utils@6.0.7
 - @0x/sra-spec@2.0.6
 - @0x/subproviders@4.0.2
 - @0x/testnet-faucets@1.0.73
 - @0x/utils@4.2.2
 - @0x/web3-wrapper@6.0.2
 - @0x/website@0.0.76
 - @0x/contracts-asset-proxy@1.0.9
 - @0x/contracts-erc20@1.0.9
 - @0x/contracts-erc721@1.0.9
 - @0x/contracts-exchange@1.0.9
 - @0x/contracts-exchange-forwarder@1.0.9
 - @0x/contracts-exchange-libs@1.1.3
 - @0x/contracts-extensions@2.0.8
 - @0x/contracts-multisig@2.0.8
 - @0x/contracts-tec@0.0.4
 - @0x/contracts-test-utils@3.0.8
 - @0x/contracts-utils@2.0.8
2019-03-01 14:34:26 -08:00
Leonid Logvinov
7458fe0d81 Updated CHANGELOGS 2019-03-01 14:34:15 -08:00
Leonid Logvinov
453c81f634 Merge pull request #1663 from 0xProject/fix/sol-profiler
Sol profiler improvements and bug fixes
2019-03-01 14:19:41 -08:00
Leonid Logvinov
eebce4b54d Fix linter errors 2019-03-01 13:59:56 -08:00
Fabio B
f7976e18f1 Update packages/sol-profiler/src/profiler_subprovider.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-03-01 13:46:47 -08:00
Fabio B
d951fe9988 Update packages/sol-tracing-utils/CHANGELOG.json
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-03-01 13:46:42 -08:00
Fabio B
fd4da78075 Update packages/sol-profiler/src/profiler_subprovider.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-03-01 13:46:35 -08:00
Fabio B
a025ae3f54 Update packages/sol-profiler/src/profiler_subprovider.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-03-01 13:46:27 -08:00
Jacob Evans
a75ba0d903 Merge pull request #1662 from 0xProject/bug/move-contracts-test-utils
Move contracts-test-utils to dev dependencies
2019-03-01 10:35:59 -05:00
Alex Svanevik
99318ae2ba Merge pull request #1658 from 0xProject/fix/pipeline/edps-rate-limiting
Added bottleneck for EDPS to deal with rate-limiting
2019-03-01 18:11:18 +08:00
Leonid Logvinov
8369bcb605 Fix linter issues 2019-02-28 22:37:32 -08:00
askeluv
338cc69034 Removed logging 2019-03-01 14:33:19 +08:00
Leonid Logvinov
4526c52fe8 Add PR numbers 2019-02-28 20:23:24 -08:00
Leonid Logvinov
81f9bda502 Add CHANGELOG entries 2019-02-28 20:19:47 -08:00
Leonid Logvinov
46bc5463ca Change the way we access the stack in traces 2019-02-28 20:19:05 -08:00
Leonid Logvinov
bb346537ba Make sol-profiler faster 2019-02-28 20:18:44 -08:00
F. Eugene Aumson
3b5f0d5c30 Adapt to Bloxy API change (#1659)
* Adapt to Bloxy API change

We were using the `days` parameter, but that's no longer available in
the API, so our fetching of previous days (before "today") was broken.

This change gets rid of the concept of "days", and uses the API's new
`from_date` and `till_date` parameters to fetch previous days' trades.

The change to the query in `getLastSeenTimestampAsync()` was necessary
because it was returning a string (despite the `as Array<{ tx_timestamp:
number }>` cast), which was later causing problems trying to pass that
value into `new Date()`.  It worked before because we were doing some
math operations on it (multiplying it by some numbers), so coercion was
saving us.  With the change from a raw query to a `typeorm` call, the
`numberToBigIntTransformer` specified in the `DexTrade` entity is now
doing the proper type conversion for us.

The new `MAX_DAYS` constant in `pull_competing_dex_trades.ts` is
necessary in order to avoid trying to pull data all the way back to 1969
:D, which induces the API to return an HTTP 503.

* Increase trades per query to match current API doc

This is needed in order to be able to pull more than a handful of days
of data at a time (at least, with the script the way its currently
written).
2019-02-28 20:28:00 -05:00
Leonid Logvinov
808ce969d9 Fix a bug with OpCode gas costs being incorrect or NaN 2019-02-28 16:53:59 -08:00
Leonid Logvinov
16f8339f3c Add HEX_BASE to constants 2019-02-28 16:52:18 -08:00
Leonid Logvinov
25d68c3904 Add opCodeToGasCost and opCodeToParamToStackOffset to constants 2019-02-28 16:51:29 -08:00
Leonid Logvinov
77ad8e1a80 Fix a bug when TruffleArtifactAdapter wasn't correctly parsing solc config in the pre 5.0 version of trufle 2019-02-28 16:46:08 -08:00
Jacob Evans
9e8c18075a Move fill-scenarios to devDependecies 2019-02-28 17:48:40 -05:00
Jacob Evans
4278cdfd29 Add CHANGELOG 2019-02-28 17:32:08 -05:00
Jacob Evans
142c2bd0f0 Move contracts-test-utils to dev dependencies 2019-02-28 16:50:23 -05:00
Jacob Evans
13ee8686bb Merge pull request #1660 from 0xProject/bug/log-utils-process
Check for process in browser environments
2019-02-28 16:45:54 -05:00
Jacob Evans
5c06df2635 Update changelog PR 2019-02-28 15:43:07 -05:00
Jacob Evans
d69bf76341 Update CHANGELOG 2019-02-28 15:28:09 -05:00
Jacob Evans
d0d1b295b4 Check for process in browser environments 2019-02-28 15:26:07 -05:00
askeluv
e450191548 Added bottleneck to deal with rate-limiting 2019-02-28 13:08:09 +08:00
Francesco Agosti
3aee83f3d8 Merge pull request #1633 from 0xProject/feature/pipeline/concepts-schema-and-radar-depth-table
[pipeline] Add concepts schema and radar orderbook USD price concept
2019-02-27 20:40:00 -08:00
fragosti
3610a2bc8d Run linter 2019-02-27 20:23:10 -08:00
fragosti
ab559d4620 Include new test path in package.json 2019-02-27 20:11:48 -08:00
fragosti
15d308d4c5 Remove isCli method 2019-02-27 19:34:35 -08:00
Alex Svanevik
e7ea66afb5 Merge pull request #1629 from 0xProject/etherscan-exchange-transactions
Pull exchange contract transactions from Etherscan
2019-02-28 08:30:05 +08:00
David Sun
d9a1d8bde6 Merge pull request #1655 from 0xProject/feature/extensions-page-freds-jank-pr-mirror
Feature/extensions page freds jank pr mirror
2019-02-27 16:38:41 -05:00
Leonid Logvinov
9ac4486403 Merge pull request #1656 from 0xProject/fix/1635
Allow project specific coverage ignore paths by specifying `config.ignoreFilesGlobs`
2019-02-27 13:35:11 -08:00
David Sun
428afabaa3 disabling lint for prettier 2019-02-27 16:21:00 -05:00
Leonid Logvinov
9162189fa6 Add PR numbers 2019-02-27 13:09:30 -08:00
Leonid Logvinov
154ca9b760 Merge branch 'development' into fix/1635 2019-02-27 13:09:04 -08:00
Leonid Logvinov
9fcead3973 Fix the docs 2019-02-27 13:07:03 -08:00
Leonid Logvinov
2fd9d0359c Ignore node_modules, test and interfaces coverage in contracts 2019-02-27 13:06:54 -08:00
Leonid Logvinov
4cf9e030a2 Add ignoreFilesGlobs config option to sol-coverage 2019-02-27 13:06:30 -08:00
David Sun
5570d14179 fixed build issues 2019-02-27 16:05:48 -05:00
David Sun
fd3c546994 changed links 2019-02-27 15:54:09 -05:00
Leonid Logvinov
e81ae05df9 Publish
- 0x.js@6.0.2
 - @0x/asset-buyer@6.0.2
 - @0x/contract-wrappers@8.0.2
 - @0x/instant@1.0.16
 - @0x/metacoin@0.0.43
 - @0x/migrations@4.0.2
 - @0x/order-watcher@4.0.2
 - @0x/pipeline@1.0.13
 - @0x/sol-compiler@3.1.2
 - @0x/sol-coverage@2.0.6
 - @0x/sol-doc@2.0.6
 - @0x/sol-profiler@3.1.1
 - @0x/sol-trace@2.0.7
 - @0x/sol-tracing-utils@6.0.6
 - @0x/testnet-faucets@1.0.72
 - @0x/website@0.0.75
 - @0x/contracts-asset-proxy@1.0.8
 - @0x/contracts-erc20@1.0.8
 - @0x/contracts-erc721@1.0.8
 - @0x/contracts-exchange@1.0.8
 - @0x/contracts-exchange-forwarder@1.0.8
 - @0x/contracts-exchange-libs@1.1.2
 - @0x/contracts-extensions@2.0.7
 - @0x/contracts-multisig@2.0.7
 - @0x/contracts-tec@0.0.3
 - @0x/contracts-test-utils@3.0.7
 - @0x/contracts-utils@2.0.7
2019-02-27 12:45:19 -08:00
Leonid Logvinov
cb394f3a1c Updated CHANGELOGS 2019-02-27 12:45:09 -08:00
David Sun
03ed057ff6 fixed linting + prettier issues 2019-02-27 15:34:24 -05:00
Leonid Logvinov
807290ff38 Merge pull request #1654 from 0xProject/fix/truffle-config-parsing
Fix a bug when TruffleArtifactAdapter was incorrectly parsing the truffle config of the newest version
2019-02-27 12:29:05 -08:00
Leonid Logvinov
40a4b4fa7a Add an explanatory comment 2019-02-27 12:28:41 -08:00
Leonid Logvinov
b7d2ad3651 Merge pull request #1653 from 0xProject/fix/remove-redundant-log
Remove redundant logging from sol-compiler
2019-02-27 12:26:45 -08:00
David Sun
faac286f70 fixed links 2019-02-27 15:21:07 -05:00
David Sun
c6c7f6f907 added title for extensions 2019-02-27 15:01:59 -05:00
fragosti
ccd0da58cb fix build errors 2019-02-27 11:34:04 -08:00
Francesco Agosti
500e5f1b5d Merge pull request #1630 from bakkenbaeck/website-updates
[WIP] Extensions page and tweaks to website
2019-02-27 11:09:57 -08:00
Fred Carlsen
ebb6177271 Update link to whitelist filter 2019-02-27 10:49:41 +01:00
Fred Carlsen
951c256980 Remove redundant fragment 2019-02-27 10:47:59 +01:00
Fred Carlsen
a134ef03dd Update illustrations and copy 2019-02-27 10:45:39 +01:00
Leonid Logvinov
f21a9d16d0 Fix a bug when TruffleArtifactAdapter was incorrectly parsing the truffle config of the newest version 2019-02-26 16:16:44 -08:00
fragosti
42c3bb00ec move to using require.main === module 2019-02-26 16:05:20 -08:00
Leonid Logvinov
0d0fcfe49a Remove redundant logging from sol-compiler 2019-02-26 15:03:06 -08:00
Leonid Logvinov
3f0db92be6 Fix prettier 2019-02-26 14:50:34 -08:00
Leonid Logvinov
ec24c79da1 Publish
- 0x.js@6.0.1
 - @0x/abi-gen@2.0.5
 - @0x/abi-gen-wrappers@4.0.1
 - @0x/assert@2.0.5
 - @0x/asset-buyer@6.0.1
 - @0x/base-contract@5.0.1
 - @0x/connect@5.0.1
 - @0x/contract-wrappers@8.0.1
 - @0x/contracts-gen@1.0.4
 - @0x/dev-tools-pages@0.0.21
 - @0x/dev-utils@2.1.2
 - @0x/fill-scenarios@3.0.1
 - @0x/instant@1.0.15
 - @0x/json-schemas@3.0.5
 - @0x/metacoin@0.0.42
 - @0x/migrations@4.0.1
 - @0x/monorepo-scripts@1.0.26
 - @0x/order-utils@7.0.1
 - @0x/order-watcher@4.0.1
 - @0x/pipeline@1.0.12
 - @0x/react-docs@2.0.6
 - @0x/react-shared@2.0.6
 - @0x/sol-compiler@3.1.1
 - @0x/sol-coverage@2.0.5
 - @0x/sol-doc@2.0.5
 - @0x/sol-profiler@3.1.0
 - @0x/sol-resolver@2.0.4
 - @0x/sol-trace@2.0.6
 - @0x/sol-tracing-utils@6.0.5
 - @0x/sra-spec@2.0.5
 - @0x/subproviders@4.0.1
 - @0x/testnet-faucets@1.0.71
 - @0x/types@2.1.1
 - @0x/utils@4.2.1
 - @0x/web3-wrapper@6.0.1
 - @0x/website@0.0.74
 - @0x/contracts-asset-proxy@1.0.7
 - @0x/contracts-erc20@1.0.7
 - @0x/contracts-erc721@1.0.7
 - @0x/contracts-exchange@1.0.7
 - @0x/contracts-exchange-forwarder@1.0.7
 - @0x/contracts-exchange-libs@1.1.1
 - @0x/contracts-extensions@2.0.6
 - @0x/contracts-multisig@2.0.6
 - @0x/contracts-tec@0.0.2
 - @0x/contracts-test-utils@3.0.6
 - @0x/contracts-utils@2.0.6
2019-02-26 14:45:52 -08:00
Leonid Logvinov
f5fffbea04 Updated CHANGELOGS 2019-02-26 14:45:42 -08:00
Amir Bandeali
fb0a2ef248 Merge pull request #1545 from 0xProject/feat/contracts/tec
TEC MVP
2019-02-26 14:24:30 -08:00
Leonid Logvinov
240f482e8e Merge pull request #1652 from 0xProject/fix/sol-compiler-settings
Fix a bug when combining sol-compiler settings from different sources
2019-02-26 14:15:37 -08:00
Leonid Logvinov
885031d3ce Add PR number 2019-02-26 14:15:23 -08:00
fragosti
eb212de70e run linter and add doc string 2019-02-26 14:05:18 -08:00
Amir Bandeali
68323d6def Fix geth tests 2019-02-26 14:00:21 -08:00
Leonid Logvinov
7c492071f1 Merge pull request #1647 from 0xProject/feature/sol-profiler-ganache
Sol-profiler ganache
2019-02-26 13:53:55 -08:00
fragosti
8fbdef2a1d Make job look at last timestamp, fix tests 2019-02-26 13:52:18 -08:00
Leonid Logvinov
8f64784781 Fix a bug when combining sol-compiler settings from different sources 2019-02-26 13:50:45 -08:00
David Sun
1bd6095c60 Merge pull request #1651 from dave4506/fix/website/add-temporary-seo
Added temporary metadata
2019-02-26 16:38:59 -05:00
David Sun
e133a5f0f3 added temporary metadata 2019-02-26 16:38:09 -05:00
Amir Bandeali
b47886416e Unpin deps when unnecessary 2019-02-26 13:29:18 -08:00
Amir Bandeali
c522d611d1 Fix typos 2019-02-26 13:29:18 -08:00
Amir Bandeali
f6d9b6b7aa Remove unused deps 2019-02-26 13:29:18 -08:00
Amir Bandeali
1de6bca12d Add TEC integration tests 2019-02-26 13:29:18 -08:00
Amir Bandeali
2de9b862d8 Add more verification test cases 2019-02-26 13:29:18 -08:00
Amir Bandeali
3c649df3df simplify approval verification logic 2019-02-26 13:29:18 -08:00
Amir Bandeali
9bf38d9e4d Add 'contains' function to LibAddressArray 2019-02-26 13:29:18 -08:00
Amir Bandeali
dee40f038d Add more approval verification tests 2019-02-26 13:29:18 -08:00
Amir Bandeali
d0aa907418 Add TEC revert reasons 2019-02-26 13:29:18 -08:00
Amir Bandeali
8dbdffc9b4 Fix abi decoding of 0x transaction data 2019-02-26 13:29:17 -08:00
Amir Bandeali
f409780455 Add ApprovalFactory class 2019-02-26 13:29:17 -08:00
Amir Bandeali
bebcd99b3b Add signature validator tests 2019-02-26 13:29:17 -08:00
Amir Bandeali
99aeaddf42 Make internal functions public 2019-02-26 13:29:17 -08:00
Amir Bandeali
793398216f Update deps versions 2019-02-26 13:29:17 -08:00
Amir Bandeali
b353ed3157 Update deps versions 2019-02-26 13:29:17 -08:00
Amir Bandeali
8637212a17 temp 2019-02-26 13:29:17 -08:00
Amir Bandeali
c42ce38e1c Bump dep versions 2019-02-26 13:29:17 -08:00
Amir Bandeali
76d228a603 Bump solidity version 2019-02-26 13:29:17 -08:00
Amir Bandeali
5cb52faa10 Do not verify orders with a null senderAddress 2019-02-26 13:29:17 -08:00
Amir Bandeali
e67e822845 Add tests for hashing libs 2019-02-26 13:29:17 -08:00
Amir Bandeali
a52686ca3b Fix README typos 2019-02-26 13:29:17 -08:00
Amir Bandeali
7a1e6cccfd Add public wrappers for libs 2019-02-26 13:29:17 -08:00
Amir Bandeali
1166b6c2fb Do not check approvals for orders where sender == feeRecipient 2019-02-26 13:29:17 -08:00
Amir Bandeali
7a6693694c Update README 2019-02-26 13:29:17 -08:00
Amir Bandeali
6ed423d1af Make all cancels permissionless 2019-02-26 13:29:17 -08:00
Amir Bandeali
8b69444602 Add tec package to relevant files 2019-02-26 13:29:17 -08:00
Amir Bandeali
7de5e8d9c8 Update READMEs 2019-02-26 13:29:17 -08:00
Amir Bandeali
844e3d1934 Implement TEC MVP 2019-02-26 13:29:17 -08:00
Amir Bandeali
9eafbbc0ae Update solidity versions of relevant contracts 2019-02-26 13:29:17 -08:00
Amir Bandeali
74677e3d54 Rename getTransactionHex to getTransactionHashHex for clarity 2019-02-26 13:29:17 -08:00
Amir Bandeali
57f4638742 Update CHANGELOGs 2019-02-26 13:29:17 -08:00
Amir Bandeali
c7a32f2d56 Update dep versions 2019-02-26 13:29:17 -08:00
Leonid Logvinov
d2dc64aa2d Rename idx to index 2019-02-26 13:25:26 -08:00
Fabio B
edb2a34c51 Update packages/sol-tracing-utils/src/utils.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-02-26 13:13:56 -08:00
Leonid Logvinov
dbd9b1c5c4 Add CHANGELOG entry 2019-02-26 11:00:37 -08:00
Leonid Logvinov
c3b758845d Refactor structLogs normalization to handle ganache 2019-02-26 10:55:58 -08:00
Leonid Logvinov
4d770549fc Fix stack content reporting in custom JS tracer 2019-02-26 10:55:40 -08:00
Leonid Logvinov
a67674bae1 Fix memory cost computing 2019-02-26 10:54:54 -08:00
Leonid Logvinov
462a61da73 Move structLogs normalization right after we fetch the trace 2019-02-26 10:54:00 -08:00
Leonid Logvinov
ae8a7f6320 Remove ganache profiling warning 2019-02-26 10:50:14 -08:00
Leonid Logvinov
a23c6a0996 Fix linter issues 2019-02-26 10:03:42 -08:00
Fred Carlsen
e6594cecce Fix jumping part of animated hero logo 2019-02-26 12:41:09 +01:00
askeluv
85ed5d27f5 Bumped up timeout to 4 mins 2019-02-26 19:37:59 +08:00
askeluv
6ac9e11245 Linting 2019-02-26 11:46:21 +08:00
askeluv
9fbd809344 Improved testing - added fixtures 2019-02-26 11:42:53 +08:00
David Sun
63a098d757 Merge pull request #1643 from dave4506/feature/remove-website-vote
Removed announcement
2019-02-25 20:23:18 -05:00
David Sun
b68d9ed672 removed announcement 2019-02-25 20:21:49 -05:00
Leonid Logvinov
5934eb0559 Publish
- 0x.js@6.0.0
 - @0x/abi-gen@2.0.4
 - @0x/abi-gen-templates@2.0.1
 - @0x/abi-gen-wrappers@4.0.0
 - @0x/assert@2.0.4
 - @0x/asset-buyer@6.0.0
 - @0x/base-contract@5.0.0
 - @0x/connect@5.0.0
 - @0x/contract-addresses@2.2.2
 - @0x/contract-wrappers@8.0.0
 - @0x/contracts-gen@1.0.3
 - @0x/dev-tools-pages@0.0.20
 - @0x/dev-utils@2.1.1
 - ethereum-types@2.1.0
 - @0x/fill-scenarios@3.0.0
 - @0x/instant@1.0.14
 - @0x/json-schemas@3.0.4
 - @0x/metacoin@0.0.41
 - @0x/migrations@4.0.0
 - @0x/monorepo-scripts@1.0.25
 - @0x/order-utils@7.0.0
 - @0x/order-watcher@4.0.0
 - @0x/pipeline@1.0.11
 - @0x/react-docs@2.0.5
 - @0x/react-shared@2.0.5
 - @0x/sol-compiler@3.1.0
 - @0x/sol-coverage@2.0.4
 - @0x/sol-doc@2.0.4
 - @0x/sol-profiler@3.0.0
 - @0x/sol-resolver@2.0.3
 - @0x/sol-trace@2.0.5
 - @0x/sol-tracing-utils@6.0.4
 - @0x/sra-spec@2.0.4
 - @0x/subproviders@4.0.0
 - @0x/testnet-faucets@1.0.70
 - @0x/types@2.1.0
 - @0x/typescript-typings@4.1.0
 - @0x/utils@4.2.0
 - @0x/web3-wrapper@6.0.0
 - @0x/website@0.0.73
 - @0x/contracts-asset-proxy@1.0.6
 - @0x/contracts-erc20@1.0.6
 - @0x/contracts-erc721@1.0.6
 - @0x/contracts-exchange@1.0.6
 - @0x/contracts-exchange-forwarder@1.0.6
 - @0x/contracts-exchange-libs@1.1.0
 - @0x/contracts-extensions@2.0.5
 - @0x/contracts-multisig@2.0.5
 - @0x/contracts-test-utils@3.0.5
 - @0x/contracts-utils@2.0.5
2019-02-25 13:35:29 -08:00
Leonid Logvinov
b998d719a6 Updated CHANGELOGS 2019-02-25 13:35:17 -08:00
Leonid Logvinov
33832244cf Merge pull request #1638 from 0xProject/feature/sol-profiler-improvements
Sol profiler improvements
2019-02-25 13:19:51 -08:00
Fabio B
df8ea3b65c Merge pull request #1641 from 0xProject/fixAddresses
Fix OrderValidator and Forwarder addresses in Python package
2019-02-25 15:57:21 -05:00
Leonid Logvinov
7067d4a499 Fix prettier 2019-02-25 12:53:42 -08:00
Leonid Logvinov
3e764eafd9 Use contracts-test-utils in metacoin 2019-02-25 12:52:21 -08:00
Leonid Logvinov
4169a41eda Rename traceInfo.data to traceInfo.dataIfExists 2019-02-25 12:40:10 -08:00
Leonid Logvinov
379eab19ad FIx CHANGELOGs 2019-02-25 12:35:57 -08:00
Fabio B
6cba1f3b61 Update packages/sol-profiler/CHANGELOG.json
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-02-25 12:34:18 -08:00
Fabio B
5dad2404d3 Update packages/ethereum-types/src/index.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-02-25 12:33:58 -08:00
Fabio B
a1b20eea2c Update packages/ethereum-types/src/index.ts
Co-Authored-By: LogvinovLeon <logvinov.leon@gmail.com>
2019-02-25 12:33:50 -08:00
Fabio Berger
af075e7b8b Fix OrderValidator and Forwarder addresses in Python package 2019-02-25 15:05:18 -05:00
Amir Bandeali
ef0a699919 Merge pull request #1604 from 0xProject/feat/exchange-libs/solc5.0
Update exchange-libs and utils Solidity versions + bugfix
2019-02-25 10:29:52 -08:00
Amir Bandeali
8279ef0e05 Add more slice tests 2019-02-25 10:12:59 -08:00
Amir Bandeali
c1cee8e951 Run lerna link before building 2019-02-25 09:59:25 -08:00
Amir Bandeali
4c17373311 Update dep versions 2019-02-25 09:59:25 -08:00
Amir Bandeali
c20972de3f Update CHANGELOGs 2019-02-25 09:59:25 -08:00
Amir Bandeali
64401f1031 Fix bug in slice functions that disallow slicing the last byte of a byte array 2019-02-25 09:59:25 -08:00
Amir Bandeali
1f895d0f27 Make constants internal 2019-02-25 09:59:25 -08:00
Amir Bandeali
5aa8ea10c3 Upgrade solc version to 0.5.3 for exchange-libs and utils 2019-02-25 09:59:25 -08:00
Fred Carlsen
cf65d4a909 Prettier fixes 2019-02-25 15:32:57 +01:00
Fred Carlsen
079f627b34 Fix linting issues 2019-02-25 15:29:24 +01:00
Fred Carlsen
f6c6cbc343 Constrain icon size to container 2019-02-25 15:22:48 +01:00
Fred Carlsen
c6cdea77b6 Fix website errors related to props/children 2019-02-25 15:22:35 +01:00
Jacob Evans
b1fd3429ae Merge pull request #1639 from 0xProject/vote/zeip-23-pst-end-date
Change vote end date to end on PST 25/02/2019
2019-02-24 12:29:07 -08:00
Jacob Evans
dc161ef08d Change vote end date to end on PST 25/02/2019 2019-02-24 12:01:45 -08:00
Leonid Logvinov
9502e789b3 Move constants up 2019-02-22 19:47:29 -08:00
Leonid Logvinov
a71aed0233 Run prettier 2019-02-22 18:16:38 -08:00
Leonid Logvinov
eda8dc278b Remove excesive exports 2019-02-22 18:01:19 -08:00
Leonid Logvinov
23a7ffb167 Fix linter 2019-02-22 17:35:14 -08:00
Leonid Logvinov
ab11aaa694 Export ContractAbi from sol-tracing-utils 2019-02-22 16:58:57 -08:00
Leonid Logvinov
83b5a2709d Remove commented code 2019-02-22 16:57:50 -08:00
Leonid Logvinov
f67f94fd6b Rename logHeader to header 2019-02-22 16:28:04 -08:00
Leonid Logvinov
4e8ae037bb Add PR numbers 2019-02-22 16:23:04 -08:00
Leonid Logvinov
04d8f46ff3 Major sol-profiler overhaul 2019-02-22 16:16:03 -08:00
fragosti
3191de68b8 Fix typo in query 2019-02-22 16:13:48 -08:00
Leonid Logvinov
047de370d6 Add logUtils.table and logUtils.header 2019-02-22 16:12:34 -08:00
Leonid Logvinov
e21dc5f026 Add all existing opcodes to OpCode 2019-02-22 16:06:55 -08:00
fragosti
f3da56773e Run prettier 2019-02-22 12:02:58 -08:00
fragosti
5197758579 Add missing file 2019-02-22 10:36:30 -08:00
Fred Carlsen
d48af7c4c2 Add icons 2019-02-22 13:42:17 +01:00
Fred Carlsen
bbafe0fc46 Add link to extensions in footer 2019-02-22 13:27:18 +01:00
Fred Carlsen
9a91f917e0 Tweak cards + add links 2019-02-22 13:03:30 +01:00
Fred Carlsen
1f681f02ae More cleanup 2019-02-22 11:23:55 +01:00
Fred Carlsen
778a86e7eb Fix linting issues 2019-02-22 11:18:04 +01:00
Fabio B
78da033441 Merge pull request #1627 from 0xProject/supportEIP1193Providers
Support EIP1193 provider interface
2019-02-21 20:26:25 -08:00
askeluv
6eb923d22f Throw error when API key is missing + use response in parser test 2019-02-22 11:21:33 +08:00
fragosti
e602afcd5f add documentation 2019-02-21 18:24:11 -08:00
askeluv
bf1115d417 Backfills automatically + prettier 2019-02-22 09:45:25 +08:00
Fabio Berger
b51038b9e7 Merge branch 'development' into supportEIP1193Providers
* development:
  Demonstrate calling contracts with tuple arrays (#1615)
  removed default meta tags in public/index.html
  fixed linting issue
  updated documentTitle component
  added metadata for pages (incomplete)
  fixed title comment-out
  removed react-document-title in favor of using react-helmet for consistency and bug fix
2019-02-21 16:45:00 -08:00
Fabio Berger
44e0b58c66 Fix migration exported types 2019-02-21 16:44:38 -08:00
Fabio Berger
3f7d5274a2 Fix version 2019-02-21 16:29:50 -08:00
Fabio Berger
c8f5f6045e Fix CI failures 2019-02-21 16:27:38 -08:00
F. Eugene Aumson
6bcc2064a2 Demonstrate calling contracts with tuple arrays (#1615) 2019-02-21 16:24:54 -08:00
Fabio Berger
3f9872d8b3 Remove getZeroExProvider method since it can be confusing 2019-02-21 16:07:23 -08:00
Fabio Berger
5814cd5fae Export supportedProvider in interface since this package is also used by external devs 2019-02-21 16:04:11 -08:00
Fabio Berger
44f8c7c548 Add TODO about consolidating type checks 2019-02-21 16:03:51 -08:00
Fabio Berger
c2549308fe Remove superfluous standardization 2019-02-21 16:00:44 -08:00
Fabio Berger
cf1a3bf4e7 Fix node types version in monorepo-scripts since it's used in test-installation and the latest version has a bug 2019-02-21 15:58:02 -08:00
fragosti
f5d668af31 Add radar_orderbook_usd_prices concept 2019-02-21 15:45:36 -08:00
Fabio Berger
b7bd4e5c51 Try fixing publish ci failure 2019-02-21 15:26:35 -08:00
fragosti
62373f969c Add concepts migrations 2019-02-21 12:51:27 -08:00
David Sun
ceb651fdd1 Merge pull request #1631 from dave4506/fix/website/remove-deplicate-meta-tags
Removed default meta tags in public/index.html
2019-02-21 10:43:40 -05:00
David Sun
8fa0f4a232 removed default meta tags in public/index.html 2019-02-21 10:20:29 -05:00
Fred Carlsen
30f2e3b606 Remove placeholder extensions 2019-02-21 13:49:35 +01:00
Fred Carlsen
7d3d997083 Merge remote-tracking branch 'upstream/development' into website-updates 2019-02-21 13:45:40 +01:00
Fred Carlsen
3955e2c84a Tweak padding 2019-02-21 13:43:47 +01:00
Fred Carlsen
6a6c41df26 Tweak extensions width 2019-02-21 13:42:03 +01:00
Fred Carlsen
1dfd2aec50 Tweak banner 2019-02-21 13:41:33 +01:00
askeluv
8885f543ae Pull exchange contract transactions from Etherscan 2019-02-21 20:37:55 +08:00
Fred Carlsen
8804e6c2ca Tweak banner 2019-02-21 11:17:01 +01:00
Fred Carlsen
88b7c214f7 Add extensions page 2019-02-21 11:16:52 +01:00
David Sun
297f3da5db Merge pull request #1626 from dave4506/fix/website/document-title-consistency-issue
Fix bug with document titles + add rich metadata for documents
2019-02-20 23:42:41 -05:00
David Sun
ec4d634677 fixed linting issue 2019-02-20 23:24:05 -05:00
David Sun
0ddec99704 updated documentTitle component 2019-02-20 23:08:04 -05:00
Fabio Berger
64cec1de3b Major version bump packages with modified exported type definitions 2019-02-20 18:07:01 -08:00
Fabio Berger
fdaf5d1fc8 Merge branch 'development' into supportEIP1193Providers
* development:
  Add constraint name to down phase as well
  Give the constraint an explicit name of token_orderbook_snapshots_pkey
  Remove comments
  Fix inconsistently named constraint
2019-02-20 18:01:23 -08:00
Fabio Berger
6baf71dca5 Make deprecation notice a warning message if used 2019-02-20 18:00:43 -08:00
Fabio Berger
9d75a72a02 Add back test 2019-02-20 17:59:53 -08:00
Francesco Agosti
4bf66d6a63 Merge pull request #1628 from 0xProject/fix/pipeline/fix-test-db-incorrectly-named-constraint
Fix inconsistently named constraint in migration
2019-02-20 17:17:16 -08:00
fragosti
8d9a550107 Add constraint name to down phase as well 2019-02-20 17:01:02 -08:00
fragosti
a076278026 Give the constraint an explicit name of token_orderbook_snapshots_pkey 2019-02-20 16:37:44 -08:00
fragosti
998dac44ee Remove comments 2019-02-20 16:09:33 -08:00
fragosti
871e81bd71 Fix inconsistently named constraint 2019-02-20 16:03:29 -08:00
Fabio Berger
d892d16b51 Merge branch 'development' into supportEIP1193Providers
* development: (37 commits)
  Factor out redundant source param in parse order functions
  Fix marquee typo
  Throw error if cannot find error in table
  Integrate one-time dump and API for nonfungible.com (#1603)
  Change optional text props to mandatory in LedgerSignNote
  Add radar_orders parseRadarOrder test
  Add parser test for Radar orderbook parsing
  Moved calculateSlippage from parsers to transformers
  Show greater than less than when minority has a vote
  Prettier
  Recieved -> Received
  Fix style for address table
  Hide ledger sign note on error
  Revert broken formatting
  Added ledger sign notification
  Fix bug in ledger address selector where provider does not exist.
  fix null column constraint issue
  Add parsing radar order test
  Rename migration to what it is called on prod and qa
  Fix type bug around Radar response
  ...
2019-02-20 14:52:58 -08:00
Fabio Berger
4cbf2781e5 Fix types so docs render 2019-02-20 14:31:40 -08:00
Fabio Berger
69653b1c7c Fix yarn.lock 2019-02-20 14:31:31 -08:00
Francesco Agosti
39390865da Merge pull request #1612 from 0xProject/feature/pipeline/add-radar
[pipeline] Add Radar orders and maker_address column to token_orderbook_snapshots
2019-02-20 14:17:42 -08:00
fragosti
4952cd5afb Factor out redundant source param in parse order functions 2019-02-20 13:45:14 -08:00
Fabio Berger
e86df96bfe Fix doc gen 2019-02-20 13:20:32 -08:00
fragosti
ef5195db90 Fix marquee typo 2019-02-20 11:43:32 -08:00
fragosti
bc7e62db9f Throw error if cannot find error in table 2019-02-20 11:40:49 -08:00
Fred Carlsen
9a7ccc20e8 Add new 404 page 2019-02-20 16:41:42 +01:00
Alex Svanevik
154e7a6a8a Merge pull request #1601 from askeluv/feature/pipeline/edps-slippage
Slippage calculations from Ethereum DEX Prices Service (EDPS)
2019-02-20 22:51:23 +08:00
Fabio Berger
ba56019f2d Add missing exported types 2019-02-19 23:59:12 -08:00
Fabio Berger
31d289c504 Add type import 2019-02-19 23:56:28 -08:00
Fabio Berger
a42b22966a Standardize bowser deps 2019-02-19 23:41:30 -08:00
Fabio Berger
17db62d463 Standardize web3-provider-engine deps 2019-02-19 23:40:45 -08:00
Fabio Berger
d6d40ea839 Improve commenty 2019-02-19 23:38:58 -08:00
Fabio Berger
eca8410dbb Update CHANGELOGs 2019-02-19 23:38:53 -08:00
Fabio Berger
eb3a530e6c Fix website build 2019-02-19 23:20:38 -08:00
Fabio Berger
26e17074c2 Fix linter issues 2019-02-19 23:09:26 -08:00
Fabio Berger
6b775628d5 Prettier fixes 2019-02-19 22:48:09 -08:00
Fabio Berger
13eb9103a7 Add back support for Web3@1.0-beta-37 and below 2019-02-19 22:48:02 -08:00
Fabio Berger
1fa82c1077 Fix up missing Provider interfaces and refactor providerUtils.standardizeOrThrow() 2019-02-19 22:34:31 -08:00
David Sun
426190181b added metadata for pages (incomplete) 2019-02-19 23:33:48 -05:00
F. Eugene Aumson
1232a9a03d Integrate one-time dump and API for nonfungible.com (#1603)
* Add script for pulling NFT trade data from nonfungible.com

* corrections for current state of API

* change data model to match data source

* change primary key

* pull data from initial dump first, then API

* pull all supported NFT's, not just cryptokitties

* disable problematic data sources

* rename function to satisfy linter

* Rename table to nonfungible_dot_com_trades

* rename parser module to nonfungible_dot_com from non_fungible_dot_com, for consistency

* correct mistaken reference to Bloxy

* rename NonfungibleDotComTrade to ...TradeResponse

* `NftTrade` -> `NonfungibleDotComTrade`

* rename files to match prior object renaming

* use fetchAsync instead of axios

* improve fetchAsync error message: include URL

* avoid non-null contraints in API trades too, not just for trades from the one-time dump

* disable mythereum publisher
2019-02-19 19:07:42 -08:00
Jacob Evans
e643c13292 Merge pull request #1622 from 0xProject/fix/governance-ledger-provider
[Governance] Ledger address selector ZRX balance
2019-02-19 17:52:42 -08:00
Jacob Evans
522736e367 Change optional text props to mandatory in LedgerSignNote 2019-02-19 17:34:06 -08:00
fragosti
12fd9c29f0 Add radar_orders parseRadarOrder test 2019-02-19 17:19:12 -08:00
fragosti
0c871b67ca Add parser test for Radar orderbook parsing 2019-02-19 16:58:11 -08:00
askeluv
379e828fc1 Moved calculateSlippage from parsers to transformers 2019-02-20 08:55:21 +08:00
Fabio Berger
fe1e8575ea Fix comments 2019-02-19 16:35:14 -08:00
Fabio Berger
8f14099adc Put all Web3.js provider interfaces next to eachother 2019-02-19 16:17:14 -08:00
Fabio Berger
852c1396ae Fix comments 2019-02-19 16:16:56 -08:00
Fabio Berger
b0f9195b57 merge development 2019-02-19 16:02:41 -08:00
Fabio Berger
98236736e0 Fix remaining Provider to SupportedProvider type 2019-02-19 15:25:47 -08:00
Jacob Evans
8b93a2816c Show greater than less than when minority has a vote 2019-02-19 14:53:18 -08:00
Leonid Logvinov
76d8a991c0 Merge pull request #1625 from 0xProject/feature/sol-compiler-offline
Sol-compiler offline mode
2019-02-19 14:21:09 -08:00
Leonid Logvinov
9186af1433 Fix a PR number 2019-02-19 14:20:13 -08:00
Alex Browne
6a473f4c57 Merge pull request #1617 from 0xProject/fix/devnet-readme-dockerhub
Update README for devnet
2019-02-19 13:47:46 -08:00
Alex Browne
42224ab534 Update README.md 2019-02-19 13:46:48 -08:00
Fabio Berger
20bcf09459 Modify providerUtils such that it simply guarentees a common sendAsync method but does not create a new instance since website depends on other properties being available 2019-02-19 13:25:57 -08:00
David Sun
5d1dd536e9 fixed title comment-out 2019-02-19 16:13:26 -05:00
David Sun
169b8807f7 removed react-document-title in favor of using react-helmet for consistency and bug fix 2019-02-19 16:10:35 -05:00
Jacob Evans
5acdab849e Prettier 2019-02-19 13:09:05 -08:00
Fabio Berger
2417084145 Rename public interface provider to supportedProvider and our internal provider to Provider 2019-02-19 12:47:01 -08:00
Jacob Evans
c16e62b5bf Recieved -> Received 2019-02-19 11:28:09 -08:00
Leonid Logvinov
6fa7d90f1f Define offlineMode as false in all smart contracts packages 2019-02-19 10:38:24 -08:00
Leonid Logvinov
1a3fd0227d Implement sol-compiler offline mode 2019-02-19 10:35:52 -08:00
Steve Klebanoff
2259b7dfcf Merge pull request #1624 from 0xProject/fix/instant-svg
[instant] Reset svg style
2019-02-19 10:08:47 -08:00
Steve Klebanoff
33fd70d0e1 reset svg because etherscan has a global svg style 2019-02-19 09:40:25 -08:00
Jacob Evans
fc906bcaae Governance tweaks 2019-02-19 09:23:28 -08:00
Jacob Evans
184e111e39 Fix style for address table 2019-02-19 09:12:29 -08:00
Fred Carlsen
ab62f50f5c Hide ledger sign note on error 2019-02-19 15:53:07 +01:00
Fred Carlsen
3eac854356 Revert broken formatting 2019-02-19 15:20:47 +01:00
Fred Carlsen
f7892cd86b Merge remote-tracking branch 'upstream/development' into governance-tweaks 2019-02-19 13:32:43 +01:00
Fred Carlsen
6e0260385c Added ledger sign notification 2019-02-19 13:32:25 +01:00
Jacob Evans
44300dabb0 Fix bug in ledger address selector where provider does not exist.
This can happen in browsers without metamask or a injected provider
2019-02-18 20:04:55 -08:00
David Sun
580c3038c8 Merge pull request #1621 from dave4506/fix/website/announcement-spacing
Added padding fix to announcements
2019-02-18 21:45:02 -05:00
David Sun
2a9175e964 added padding fix 2019-02-18 20:55:27 -05:00
Fabio Berger
5db20bbbe8 Add support for EIP1193 providers and clean up provider standardization logic 2019-02-18 15:12:29 -08:00
David Sun
ae144dff39 Merge pull request #1619 from dave4506/feature/website/add-banner-component
Adding announcement component for hero (for vote)
2019-02-18 09:13:57 -05:00
Jacob Evans
9f533efc92 Merge pull request #1620 from 0xProject/governance-vote-updates
Governance vote updates
2019-02-18 00:53:14 -08:00
Jacob Evans
76e15c4166 Yarn lock update 2019-02-18 00:41:36 -08:00
Jacob Evans
62bb2daf16 Add og-zeip23 for social sharing 2019-02-18 00:14:05 -08:00
Jacob Evans
59e292030a Update I voted badge svg 2019-02-18 00:08:55 -08:00
Jacob Evans
533fc7e444 Remove unused input 2019-02-17 23:31:02 -08:00
Jacob Evans
e5c5338eb6 Add governance to the footer 2019-02-17 23:29:47 -08:00
Jacob Evans
9463acb131 Update copy of Risk 2019-02-17 23:12:22 -08:00
Jacob Evans
e69749350b Update the formatting of ZRX (showing whole ZRX) 2019-02-17 23:09:45 -08:00
Jacob Evans
42749187ff Update copy on the banner 2019-02-17 22:51:42 -08:00
Jacob Evans
d5c2038d58 Update copy on the governance page 2019-02-17 22:24:38 -08:00
Jacob Evans
5843a61c9f Remove rounding (up) in total balance string 2019-02-17 22:16:56 -08:00
Jacob Evans
ecde2c9d7f Add todos for cleanup on duplicated code. Fix styling and typo 2019-02-17 21:53:25 -08:00
Jacob Evans
abd597c7a6 Update ZEIP from strings to numbers 2019-02-17 18:24:48 -08:00
Jacob Evans
b35e1d350b Remove unused 2019-02-17 13:26:27 -08:00
Jacob Evans
918399458d Submit the voting comment 2019-02-17 13:24:27 -08:00
Jacob Evans
72d9b7028b Handle Coinbase wallet inconsitency 2019-02-17 13:06:29 -08:00
Jacob Evans
ed9790c840 Vote: Added instant. Updated failure modes 2019-02-17 12:22:29 -08:00
Fred Carlsen
fd04bc4820 Fix linting errors 2019-02-17 12:22:29 -08:00
Fred Carlsen
58a213b7f9 Prevent overflowing content on error modal 2019-02-17 12:22:29 -08:00
Fred Carlsen
7f8bbfb4bd Fallback from EIP712 when signing 2019-02-17 12:22:29 -08:00
Fred Carlsen
8a3e64b3cd Update tally when user votes 2019-02-17 12:22:29 -08:00
Fred Carlsen
572de86d06 Add error modal 2019-02-17 12:22:28 -08:00
Fred Carlsen
88c33fa4d4 Add default color to icons 2019-02-17 12:22:28 -08:00
Jacob Evans
ee1c6a1ce1 Update copy
Co-Authored-By: sjelfull <fred@sjelfull.no>
2019-02-17 12:22:28 -08:00
Jacob Evans
09e90bea8b Update proposal title
Co-Authored-By: sjelfull <fred@sjelfull.no>
2019-02-17 12:22:28 -08:00
Fred Carlsen
bf758412c1 Import SignatureType from @0x/types 2019-02-17 12:22:28 -08:00
Fred Carlsen
0bbbf5b431 Fix no tally to prevent rounding 2019-02-17 12:22:27 -08:00
Fred Carlsen
87b2236cfb Cleanup 2019-02-17 12:22:27 -08:00
Fred Carlsen
855d2bb87f Add suffix to const name 2019-02-17 12:22:27 -08:00
Fred Carlsen
13b54a3b4d Remove Kovan prefix 2019-02-17 12:22:27 -08:00
Fred Carlsen
5d24ef4849 Remove web3 types 2019-02-17 12:22:27 -08:00
Fred Carlsen
b2da451e8d Tweak tabel formating of addres table 2019-02-17 12:22:27 -08:00
Fred Carlsen
139b66fa76 Format more links 2019-02-17 12:22:26 -08:00
Fred Carlsen
390ed5d7f1 Fix countdown and format in locale aware date 2019-02-17 12:22:26 -08:00
Fred Carlsen
16b5fb6b56 Fix countdown 2019-02-17 12:22:26 -08:00
Fred Carlsen
6205d6c885 Fix linting errors 2019-02-17 12:22:26 -08:00
Fred Carlsen
e5ea65da82 Cleanup unused parts 2019-02-17 12:22:12 -08:00
Fred Carlsen
9caa5feff5 Add derivation path change 2019-02-17 12:22:11 -08:00
Fred Carlsen
7f616356d2 Reset to voting screen when done 2019-02-17 12:21:40 -08:00
Fred Carlsen
155b5dd42f Tweak whitespace 2019-02-17 12:21:40 -08:00
Fred Carlsen
41aaf428bf Cleanup 2019-02-17 12:21:40 -08:00
Fred Carlsen
a17cdf33ea Fire onvoted callback 2019-02-17 12:21:39 -08:00
Fred Carlsen
3d5e879d5f Fix tally 2019-02-17 12:21:39 -08:00
Fred Carlsen
1a73ad3a32 Fix React errors on modal 2019-02-17 12:21:39 -08:00
Fred Carlsen
abb5e7cd39 Fix key on links 2019-02-17 12:21:39 -08:00
Fred Carlsen
cdae6de52e Lint 2019-02-17 12:21:39 -08:00
Fred Carlsen
910fe77ca3 Fix error 2019-02-17 12:21:39 -08:00
Fred Carlsen
b9a93c82d7 Linting fixes 2019-02-17 12:21:38 -08:00
Fred Carlsen
1c040bd616 Rename variable 2019-02-17 12:21:38 -08:00
Fred Carlsen
166c537938 Show balance on confirmation step 2019-02-17 12:21:38 -08:00
Fred Carlsen
79c8de5fd0 Update tally endpoint 2019-02-17 12:21:38 -08:00
Fred Carlsen
7e6d2102a5 Remove back button 2019-02-17 12:21:37 -08:00
Fred Carlsen
4f7d6132fc Remove python code 2019-02-17 12:21:37 -08:00
Fred Carlsen
b7fcc70cd9 Prettier + close button 2019-02-17 12:21:37 -08:00
Fred Carlsen
43ad27931c Update content base 2019-02-17 12:21:37 -08:00
Fred Carlsen
68dc3f75eb Use AWS endpoint when deployed 2019-02-17 12:21:37 -08:00
Fred Carlsen
e67eb6d5b4 Set strong to bold fontweight 2019-02-17 12:21:37 -08:00
Fred Carlsen
2e060bc85f Initial governance commit 2019-02-17 12:21:36 -08:00
Fred Carlsen
22f80e4b19 Fix type 2019-02-17 12:20:09 -08:00
Fred Carlsen
1ef434f95e WIP governance page 2019-02-17 12:20:08 -08:00
Tristan King
5676702da6 Add initial v0x backend and test frontend 2019-02-17 12:19:32 -08:00
David Sun
2fe0539600 added spacing + mobile changes 2019-02-16 22:34:50 -05:00
David Sun
13df5adecd added announcement component 2019-02-15 13:24:28 -05:00
fragosti
f33f808dc7 fix null column constraint issue 2019-02-14 17:17:35 -08:00
Francesco Agosti
82ed9ef25e Merge pull request #1618 from dave4506/bug/website/credit-leads-fix
Fix for credit lead form data
2019-02-14 17:15:23 -08:00
David Sun
0aa26d791d fix for credit lead form data 2019-02-14 20:14:37 -05:00
Alex Browne
255f278f5e Update README for devnet 2019-02-14 16:57:02 -08:00
Leonid Logvinov
1c76f9a0ff Merge pull request #1616 from 0xProject/feature/devnode-ws
Add WS endpoint to devnode
2019-02-15 01:47:29 +01:00
Leonid Logvinov
9a308e25a3 Add WS endpoint to devnode 2019-02-14 16:41:24 -08:00
David Sun
4b52f8c823 Merge pull request #1610 from dave4506/feature/website/infrastructure-deals
Infrastructure deals page
2019-02-14 18:21:09 -05:00
fragosti
8f7145f80a Add parsing radar order test 2019-02-14 15:07:09 -08:00
David Sun
eb17f053f7 Merged latest development to branch 2019-02-14 16:22:18 -05:00
David Sun
304e714331 changes to spacing 2019-02-14 16:02:39 -05:00
David Sun
525685f942 fixed code styling 2019-02-14 15:51:48 -05:00
David Sun
e2477b66c6 added polish to copy and mobile bugs 2019-02-14 15:36:58 -05:00
fragosti
58d51e039c Rename migration to what it is called on prod and qa 2019-02-14 10:45:48 -08:00
fragosti
cb5b5167fc Fix type bug around Radar response 2019-02-14 10:40:10 -08:00
fragosti
7d68378c3c Fix volume calculation bug 2019-02-14 09:40:38 -08:00
fragosti
87da6a947d Have migration to maker_address column working 2019-02-14 09:22:50 -08:00
askeluv
0e644da6ac Fixed linting issues 2019-02-14 17:39:12 +08:00
askeluv
d61a7c360e Self-hosted EDPS 2019-02-14 17:12:31 +08:00
askeluv
ab286d851d Changed Maps to EdpsWrappers 2019-02-14 15:30:58 +08:00
fragosti
e8b60ab292 Use remainingFillableAmount instead of maker/takerAssetAmount for amount field for Radar orders 2019-02-13 13:41:20 -08:00
fragosti
1cb7e70b42 increment MAX_PER_PAGE to 10000 2019-02-13 13:31:45 -08:00
Francesco Agosti
25b9c22845 Merge pull request #1614 from 0xProject/feature/website/faux-vote-page
Add vote placeholder page
2019-02-13 12:26:12 -08:00
fragosti
47166104fa run linter 2019-02-13 12:01:53 -08:00
fragosti
d0e0622058 PR feedback 2019-02-13 11:38:39 -08:00
fragosti
87c75a1e43 Add vote placeholder page 2019-02-13 11:25:18 -08:00
fragosti
d1cc08f1d9 Attempt to add maker_address token_orderbook_snapshots 2019-02-13 11:03:40 -08:00
David Sun
6619626486 changed dogfood s3 bucket and fixed linting issues 2019-02-13 12:14:13 -05:00
David Sun
1681ba090c changed check box 2019-02-13 11:35:05 -05:00
askeluv
c36e1ad056 Changes made as per comments - still have two minor things to fix 2019-02-13 20:23:07 +08:00
fragosti
d79c7f70be fix linting error 2019-02-12 14:58:05 -08:00
fragosti
b7eb2e4746 Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/pipeline/add-radar 2019-02-12 14:56:02 -08:00
fragosti
4db9b8b0e3 Add script for pulling radar orderbook 2019-02-12 14:49:32 -08:00
fragosti
f3a537d5c2 Add radar parser 2019-02-12 14:35:50 -08:00
David Sun
6a704b8a77 Merge pull request #1611 from dave4506/feature/website/add-forum-link-footer
Added forum link
2019-02-12 17:32:25 -05:00
David Sun
df896877f8 added forum link 2019-02-12 17:24:57 -05:00
David Sun
3cb2d3dfff adding free credits page (incomplete) 2019-02-12 16:58:55 -05:00
fragosti
d5f5e79661 Add radar data source 2019-02-12 10:41:47 -08:00
askeluv
82dffe9d0e Added remaining tests + fixed linting issues 2019-02-12 19:34:05 +08:00
askeluv
d7825dd7db Added test for entity 2019-02-12 16:06:53 +08:00
askeluv
c0a2f429b6 Added saving to database 2019-02-12 12:30:10 +08:00
Fabio Berger
e909faa3ef Publish
- 0x.js@5.0.0
 - @0x/abi-gen@2.0.3
 - @0x/abi-gen-wrappers@3.0.3
 - @0x/assert@2.0.3
 - @0x/asset-buyer@5.0.4
 - @0x/base-contract@4.0.3
 - @0x/connect@4.0.4
 - @0x/contract-wrappers@7.1.0
 - @0x/contracts-gen@1.0.2
 - @0x/dev-tools-pages@0.0.19
 - @0x/dev-utils@2.1.0
 - @0x/fill-scenarios@2.0.4
 - @0x/instant@1.0.13
 - @0x/json-schemas@3.0.3
 - @0x/metacoin@0.0.40
 - @0x/migrations@3.0.4
 - @0x/monorepo-scripts@1.0.24
 - @0x/order-utils@6.1.0
 - @0x/order-watcher@3.0.4
 - @0x/pipeline@1.0.10
 - @0x/react-docs@2.0.4
 - @0x/react-shared@2.0.4
 - @0x/sol-compiler@3.0.3
 - @0x/sol-coverage@2.0.3
 - @0x/sol-doc@2.0.3
 - @0x/sol-profiler@2.0.4
 - @0x/sol-trace@2.0.4
 - @0x/sol-tracing-utils@6.0.3
 - @0x/sra-spec@2.0.3
 - @0x/subproviders@3.0.3
 - @0x/testnet-faucets@1.0.69
 - @0x/utils@4.1.0
 - @0x/web3-wrapper@5.0.0
 - @0x/website@0.0.72
 - @0x/contracts-asset-proxy@1.0.5
 - @0x/contracts-erc20@1.0.5
 - @0x/contracts-erc721@1.0.5
 - @0x/contracts-exchange@1.0.5
 - @0x/contracts-exchange-forwarder@1.0.5
 - @0x/contracts-exchange-libs@1.0.5
 - @0x/contracts-extensions@2.0.4
 - @0x/contracts-multisig@2.0.4
 - @0x/contracts-test-utils@3.0.4
 - @0x/contracts-utils@2.0.4
2019-02-09 18:44:40 +00:00
Fabio Berger
28d9fdf798 Updated CHANGELOGS 2019-02-09 18:44:28 +00:00
Fabio Berger
e9bfc44b90 Remove react deps from highlight 2019-02-09 17:28:52 +00:00
Fabio B
2a772b71f1 Merge pull request #1569 from 0xProject/feature/utils/decodeArbitrary0xCalldata
0x Transaction Data Decoder
2019-02-09 14:29:20 +00:00
Greg Hysen
233869ed80 updated changelog.json for 0x.js / order-utils / web3-wrapper 2019-02-08 17:12:58 -08:00
Greg Hysen
a9aaae7f97 Deduped random value generation from salt generation 2019-02-08 17:12:58 -08:00
Greg Hysen
500b4940a3 Improvements and conventions in utils package + abi decoder 2019-02-08 17:12:54 -08:00
Greg Hysen
6d0dc47157 updated changelog for contract wrappers 2019-02-08 16:25:30 -08:00
Greg Hysen
56e7e7d644 updated exports for contract wrappers 2019-02-08 16:25:30 -08:00
Greg Hysen
93c128ee21 Added exports for doc generation 2019-02-08 16:25:30 -08:00
Greg Hysen
c72e3667b8 ran prettier and linter 2019-02-08 16:25:30 -08:00
Greg Hysen
6406126ae3 Merged tx decoder into AbiDecoder in utils and merged zeroex tx decoder into ContractWrappers. 2019-02-08 16:25:30 -08:00
Greg Hysen
6bde77bb57 fix doc generation in contract-wrappers 2019-02-08 16:25:30 -08:00
Greg Hysen
831a628379 ran linter 2019-02-08 16:25:30 -08:00
Greg Hysen
3d2babd059 Tests for transaction decoder 2019-02-08 16:25:30 -08:00
Greg Hysen
d9c4c74a56 Added tests for ZeroExTransactionDecoder 2019-02-08 16:25:30 -08:00
Greg Hysen
5a231fb057 Prep for txData decoder tests 2019-02-08 16:25:30 -08:00
Greg Hysen
63f41df327 started writing tests for zeroex tx decoder 2019-02-08 16:25:30 -08:00
Greg Hysen
171618d32b Added comments for transaction decoder 2019-02-08 16:25:30 -08:00
Greg Hysen
f7b58e7f64 moved ZeroExTransactionDecoder into contract wrappers 2019-02-08 16:25:30 -08:00
Greg Hysen
436d87da98 Ran prettier and linter 2019-02-08 16:25:30 -08:00
Greg Hysen
896874fb99 separated tx decode classes and types into separate files 2019-02-08 16:25:30 -08:00
Greg Hysen
a9f8e80b1c Abstractd out ZeroExTransactionDecoder 2019-02-08 16:25:30 -08:00
Greg Hysen
f93cd1bb48 Can query decoder by contract address / network id OR contract name 2019-02-08 16:25:30 -08:00
Greg Hysen
8fc3a6b828 Expanding search parameters for transaction decoder 2019-02-08 16:25:30 -08:00
Greg Hysen
100840b743 Utility function to decode arbitrary 0x calldata 2019-02-08 16:25:30 -08:00
David Sun
8c8cab9309 added page [WIP] still 2019-02-08 18:06:58 -05:00
F. Eugene Aumson
629a8d6328 Add migration to fix exchange events primary keys (#1593)
* Add migration to fix exchange events primary key

* correct comment: "foreign key" -> "primary key"

* Refine hack to handle only the expected error

* Add tx hash to erc20 approval events primary key
2019-02-08 13:21:41 -05:00
Fabio B
ffdaec9f9f Merge pull request #1602 from 0xProject/feat/allow_using_existing_ganache_snapshot
Allow using Web3Factory in-process Ganache with existing snapshot
2019-02-08 17:49:33 +00:00
Fabio Berger
c794153221 Add CHANGELOG entry 2019-02-08 13:22:11 +00:00
Fabio Berger
d01837f42c Allow using Web3Factory in-process Ganache with existing snapshot 2019-02-08 13:19:47 +00:00
askeluv
7ad4cb0078 [WIP] Slippage calculations from Ethereum DEX Prices Service (EDPS) 2019-02-08 18:54:38 +08:00
David Sun
ffd8349889 Merge pull request #1581 from dave4506/feature/instant/bignumber-coerce-type
Big number input to Instant coercion to version utilized by 0x packages
2019-02-07 21:06:43 -05:00
David Sun
f3716fd813 fixed config orderSource assignment 2019-02-07 20:41:37 -05:00
Greg Hysen
1170cf1896 Merge pull request #1592 from 0xProject/feature/abiEncoder/simplifiedSigParsing
Simplified signature parsing + signature tests
2019-02-07 15:18:37 -08:00
Greg Hysen
b9ee9d2bd5 replaced typeof with _.isString 2019-02-07 15:01:29 -08:00
Greg Hysen
21c3f75efc Changelog for utils package 2019-02-07 15:01:29 -08:00
Greg Hysen
eb5f7e36e9 Signature parsing tests 2019-02-07 15:00:07 -08:00
Greg Hysen
4079563f5d More robust/simple signature parsing, using a parse tree 2019-02-07 15:00:07 -08:00
David Sun
6dabed5938 updated order coercion utils architecture and testing 2019-02-07 16:45:56 -05:00
Fabio B
3939d516e6 Merge pull request #1586 from 0xProject/addAnalyticsToDevToolsPages
Add Heap and Google analytics to Dev Tools Pages
2019-02-07 21:18:41 +00:00
Fabio Berger
5aba9d698b Only include analytics on production builds 2019-02-07 14:54:12 +00:00
Fabio Berger
3dd652e7cf Merge branch 'development' into addAnalyticsToDevToolsPages
* development: (51 commits)
  Publish
  Updated CHANGELOGS
  Updated CHANGELOGS
  Update packages/sol-compiler/CHANGELOG.json
  Update packages/sol-compiler/CHANGELOG.json
  Move from devDep to dep
  Fix linter
  Update CHANGELOG
  Re-run yarn since fails again on first run
  Add PR numbers
  Omit remapping in compiler settings equality checks
  Omit remapping in compiler settings equality checks
  Fix a bug when ast and legacyAST were not present in the artifacts even if requested
  Update yarn.lock
  Remove the bin_paths and fetch the solidity release list from github repo
  Remove postinstall hack
  Fix the undefined opts bug
  Fix sol-compiler bug with remappings causing smart recompilation to now work
  re-add postinstall hack
  Fix deps versions
  ...
2019-02-07 14:28:24 +00:00
David Sun
d95af455f1 added coercion util functions 2019-02-05 16:46:51 -05:00
Fabio Berger
8de955f3d8 Add Heap and Google analytics to Dev Tools Pages 2019-02-05 21:34:29 +00:00
David Sun
59f48d6d57 working on big number coercion function 2019-02-04 11:19:18 -05:00
497 changed files with 14509 additions and 1814 deletions

View File

@@ -51,6 +51,7 @@ jobs:
- run: yarn wsrun test:circleci @0x/contracts-asset-proxy
- run: yarn wsrun test:circleci @0x/contracts-exchange
- run: yarn wsrun test:circleci @0x/contracts-exchange-forwarder
- run: yarn wsrun test:circleci @0x/contracts-tec
test-contracts-geth:
docker:
- image: circleci/node:9-browsers
@@ -71,6 +72,7 @@ jobs:
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-asset-proxy
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-exchange
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-exchange-forwarder
- run: TEST_PROVIDER=geth yarn wsrun test:circleci @0x/contracts-tec
test-publish:
resource_class: medium+
docker:

2
.gitignore vendored
View File

@@ -83,6 +83,7 @@ packages/react-docs/example/public/bundle*
packages/testnet-faucets/server/
# generated contract artifacts/
contracts/tec/generated-artifacts/
contracts/exchange/generated-artifacts/
contracts/asset-proxy/generated-artifacts/
contracts/multisig/generated-artifacts/
@@ -97,6 +98,7 @@ packages/metacoin/artifacts/
# generated contract wrappers
packages/abi-gen-wrappers/wrappers
contracts/tec/generated-wrappers/
contracts/exchange/generated-wrappers/
contracts/asset-proxy/generated-wrappers/
contracts/multisig/generated-wrappers/

View File

@@ -1,5 +1,7 @@
lib
.nyc_output
/contracts/tec/generated-wrappers
/contracts/tec/generated-artifacts
/contracts/exchange/generated-wrappers
/contracts/exchange/generated-artifacts
/contracts/asset-proxy/generated-wrappers

View File

@@ -41,11 +41,12 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
| [`@0x/contracts-erc721`](/contracts/erc721) | [![npm](https://img.shields.io/npm/v/@0x/contracts-erc721.svg)](https://www.npmjs.com/package/@0x/contracts-erc721) | Implementations of various ERC721 tokens |
| [`@0x/contracts-exchange`](/contracts/exchange) | [![npm](https://img.shields.io/npm/v/@0x/contracts-exchange.svg)](https://www.npmjs.com/package/@0x/contracts-exchange) | The [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract used for settling trades within the protocol |
| [`@0x/contracts-exchange-forwarder`](/contracts/exchange-forwarder) | [![npm](https://img.shields.io/npm/v/@0x/contracts-exchange-forwarder.svg)](https://www.npmjs.com/package/@0x/contracts-exchange-forwarder) | A [`Forwarder`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract used to simplify UX for interacting with the protocol |
| [`@0x/contracts-exchange-libs`](/contracts/exchange-libs) | [![npm](https://img.shields.io/npm/v/@0x/contracts-exchange-libs.svg)](https://www.npmjs.com/package/@0x/contracts-exchange-libs) | Protocol specific Llbraries used within the [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract |
| [`@0x/contracts-exchange-libs`](/contracts/exchange-libs) | [![npm](https://img.shields.io/npm/v/@0x/contracts-exchange-libs.svg)](https://www.npmjs.com/package/@0x/contracts-exchange-libs) | Protocol specific libraries used within the [`Exchange`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#exchange) contract |
| [`@0x/contracts-extensions`](/contracts/extensions) | [![npm](https://img.shields.io/npm/v/@0x/contracts-extensions.svg)](https://www.npmjs.com/package/@0x/contracts-extensions) | Contracts that interact with and extend the functionality of the core protocol |
| [`@0x/contracts-multisig`](/contracts/multisig) | [![npm](https://img.shields.io/npm/v/@0x/contracts-multisig.svg)](https://www.npmjs.com/package/@0x/contracts-multisig) | Various implementations of multisignature wallets, including the [`AssetProxyOwner`](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxyowner) contract that has permissions to upgrade the protocol |
| [`@0x/contracts-test-utils`](/contracts/test-utils) | [![npm](https://img.shields.io/npm/v/@0x/contracts-test-utils.svg)](https://www.npmjs.com/package/@0x/contracts-test-utils) | Typescript/Javascript shared utilities used for testing contracts |
| [`@0x/contracts-utils`](/contracts/utils) | [![npm](https://img.shields.io/npm/v/@0x/contracts-utils.svg)](https://www.npmjs.com/package/@0x/contracts-utils) | Generic libraries and utilities used throughout all of the contracts |
| [`@0x/contracts-tec`](/contracts/tec) | [![npm](https://img.shields.io/npm/v/@0x/contracts-tec.svg)](https://www.npmjs.com/package/@0x/contracts-tec) | A contract that allows users to execute 0x transactions with permission from a TEC (Trade Execution Coordinator) |
### Typescript/Javascript Packages

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.9 - _March 1, 2019_
* Dependencies updated
## v1.0.8 - _February 27, 2019_
* Dependencies updated
## v1.0.7 - _February 26, 2019_
* Dependencies updated
## v1.0.6 - _February 25, 2019_
* Dependencies updated
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-asset-proxy",
"version": "1.0.4",
"version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,10 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -66,17 +67,16 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-erc20": "1.0.2",
"@0x/contracts-erc721": "1.0.2",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-erc721": "^1.0.9",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^6.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -2,7 +2,7 @@ import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-
import { assetDataUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import { ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, DummyERC20TokenContract, ERC20ProxyContract } from '../../src';
@@ -11,7 +11,7 @@ export class ERC20Wrapper {
private readonly _tokenOwnerAddresses: string[];
private readonly _contractOwnerAddress: string;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _provider: Provider;
private readonly _provider: ZeroExProvider;
private readonly _dummyTokenContracts: DummyERC20TokenContract[];
private _proxyContract?: ERC20ProxyContract;
private _proxyIdIfExists?: string;
@@ -22,7 +22,7 @@ export class ERC20Wrapper {
* @param contractOwnerAddress Desired owner of the contract
* Instance of ERC20Wrapper
*/
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
constructor(provider: ZeroExProvider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._dummyTokenContracts = [];
this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;

View File

@@ -2,7 +2,7 @@ import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import { ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, DummyERC721TokenContract, ERC721ProxyContract } from '../../src';
@@ -11,12 +11,12 @@ export class ERC721Wrapper {
private readonly _tokenOwnerAddresses: string[];
private readonly _contractOwnerAddress: string;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _provider: Provider;
private readonly _provider: ZeroExProvider;
private readonly _dummyTokenContracts: DummyERC721TokenContract[];
private _proxyContract?: ERC721ProxyContract;
private _proxyIdIfExists?: string;
private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
constructor(provider: ZeroExProvider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;
this._dummyTokenContracts = [];

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.9 - _March 1, 2019_
* Dependencies updated
## v1.0.8 - _February 27, 2019_
* Dependencies updated
## v1.0.7 - _February 26, 2019_
* Dependencies updated
## v1.0.6 - _February 25, 2019_
* Dependencies updated
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc20",
"version": "1.0.4",
"version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -67,14 +67,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-exchange-libs": "1.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.9 - _March 1, 2019_
* Dependencies updated
## v1.0.8 - _February 27, 2019_
* Dependencies updated
## v1.0.7 - _February 26, 2019_
* Dependencies updated
## v1.0.6 - _February 25, 2019_
* Dependencies updated
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-erc721",
"version": "1.0.4",
"version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -67,13 +67,13 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.9 - _March 1, 2019_
* Dependencies updated
## v1.0.8 - _February 27, 2019_
* Dependencies updated
## v1.0.7 - _February 26, 2019_
* Dependencies updated
## v1.0.6 - _February 25, 2019_
* Dependencies updated
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-forwarder",
"version": "1.0.4",
"version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contract-wrappers": "^7.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contract-wrappers": "^8.0.3",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -68,19 +68,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-asset-proxy": "1.0.2",
"@0x/contracts-erc20": "1.0.2",
"@0x/contracts-erc721": "1.0.2",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-asset-proxy": "^1.0.9",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-erc721": "^1.0.9",
"@0x/contracts-exchange": "1.0.2",
"@0x/contracts-exchange-libs": "1.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^6.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,5 +1,10 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import { ExchangeWrapper } from '@0x/contracts-exchange';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20Wrapper,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -21,15 +26,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
ExchangeContract,
ForwarderContract,
ForwarderWrapper,
WETH9Contract,
} from '../src';
import { artifacts, ForwarderContract, ForwarderWrapper, WETH9Contract } from '../src';
chaiSetup.configure();
const expect = chai.expect;

View File

@@ -1,8 +1,8 @@
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
import { constants, formatters, LogDecoder, MarketSellOrders, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
import { TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
import * as _ from 'lodash';
import { ForwarderContract } from '../../generated-wrappers/forwarder';
@@ -55,7 +55,7 @@ export class ForwarderWrapper {
const params = formatters.createMarketSellOrders(signedOrders, constants.ZERO_AMOUNT);
return params;
}
constructor(contractInstance: ForwarderContract, provider: Provider) {
constructor(contractInstance: ForwarderContract, provider: Web3ProviderEngine) {
this._forwarderContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);

View File

@@ -1,4 +1,54 @@
[
{
"timestamp": 1551479279,
"version": "1.1.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.1.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.1.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.1.0",
"changes": [
{
"note": "Upgrade contracts to Solidity 0.5.3",
"pr": 1604
},
{
"note": "Make constants internal",
"pr": 1604
}
],
"timestamp": 1551130135
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,27 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.3 - _March 1, 2019_
* Dependencies updated
## v1.1.2 - _February 27, 2019_
* Dependencies updated
## v1.1.1 - _February 26, 2019_
* Dependencies updated
## v1.1.0 - _February 25, 2019_
* Upgrade contracts to Solidity 0.5.3 (#1604)
* Make constants internal (#1604)
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
pragma experimental ABIEncoderV2;
import "./LibOrder.sol";

View File

@@ -17,7 +17,7 @@
*/
// solhint-disable
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
/// @dev This contract documents the revert reasons used in the AssetProxy contracts.
@@ -25,14 +25,14 @@ pragma solidity ^0.4.24;
contract LibAssetProxyErrors {
/// Authorizable errors ///
string constant SENDER_NOT_AUTHORIZED = "SENDER_NOT_AUTHORIZED"; // Sender not authorized to call this method.
string constant TARGET_NOT_AUTHORIZED = "TARGET_NOT_AUTHORIZED"; // Target address not authorized to call this method.
string constant TARGET_ALREADY_AUTHORIZED = "TARGET_ALREADY_AUTHORIZED"; // Target address must not already be authorized.
string constant INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; // Specified array index is out of bounds.
string constant AUTHORIZED_ADDRESS_MISMATCH = "AUTHORIZED_ADDRESS_MISMATCH"; // Address at index does not match given target address.
string constant internal SENDER_NOT_AUTHORIZED = "SENDER_NOT_AUTHORIZED"; // Sender not authorized to call this method.
string constant internal TARGET_NOT_AUTHORIZED = "TARGET_NOT_AUTHORIZED"; // Target address not authorized to call this method.
string constant internal TARGET_ALREADY_AUTHORIZED = "TARGET_ALREADY_AUTHORIZED"; // Target address must not already be authorized.
string constant internal INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; // Specified array index is out of bounds.
string constant internal AUTHORIZED_ADDRESS_MISMATCH = "AUTHORIZED_ADDRESS_MISMATCH"; // Address at index does not match given target address.
/// Transfer errors ///
string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1.
string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed.
string constant LENGTH_GREATER_THAN_131_REQUIRED = "LENGTH_GREATER_THAN_131_REQUIRED"; // Byte array must have a length greater than 0.
string constant internal INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1.
string constant internal TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed.
string constant internal LENGTH_GREATER_THAN_131_REQUIRED = "LENGTH_GREATER_THAN_131_REQUIRED"; // Byte array must have a length greater than 0.
}

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
// solhint-disable max-line-length

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
contract LibEIP712 {
@@ -50,7 +50,7 @@ contract LibEIP712 {
EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,
keccak256(bytes(EIP712_DOMAIN_NAME)),
keccak256(bytes(EIP712_DOMAIN_VERSION)),
bytes32(address(this))
uint256(address(this))
));
}

View File

@@ -17,7 +17,7 @@
*/
// solhint-disable
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
/// @dev This contract documents the revert reasons used in the Exchange contract.
@@ -25,46 +25,46 @@ pragma solidity ^0.4.24;
contract LibExchangeErrors {
/// Order validation errors ///
string constant ORDER_UNFILLABLE = "ORDER_UNFILLABLE"; // Order cannot be filled.
string constant INVALID_MAKER = "INVALID_MAKER"; // Invalid makerAddress.
string constant INVALID_TAKER = "INVALID_TAKER"; // Invalid takerAddress.
string constant INVALID_SENDER = "INVALID_SENDER"; // Invalid `msg.sender`.
string constant INVALID_ORDER_SIGNATURE = "INVALID_ORDER_SIGNATURE"; // Signature validation failed.
string constant internal ORDER_UNFILLABLE = "ORDER_UNFILLABLE"; // Order cannot be filled.
string constant internal INVALID_MAKER = "INVALID_MAKER"; // Invalid makerAddress.
string constant internal INVALID_TAKER = "INVALID_TAKER"; // Invalid takerAddress.
string constant internal INVALID_SENDER = "INVALID_SENDER"; // Invalid `msg.sender`.
string constant internal INVALID_ORDER_SIGNATURE = "INVALID_ORDER_SIGNATURE"; // Signature validation failed.
/// fillOrder validation errors ///
string constant INVALID_TAKER_AMOUNT = "INVALID_TAKER_AMOUNT"; // takerAssetFillAmount cannot equal 0.
string constant ROUNDING_ERROR = "ROUNDING_ERROR"; // Rounding error greater than 0.1% of takerAssetFillAmount.
string constant internal INVALID_TAKER_AMOUNT = "INVALID_TAKER_AMOUNT"; // takerAssetFillAmount cannot equal 0.
string constant internal ROUNDING_ERROR = "ROUNDING_ERROR"; // Rounding error greater than 0.1% of takerAssetFillAmount.
/// Signature validation errors ///
string constant INVALID_SIGNATURE = "INVALID_SIGNATURE"; // Signature validation failed.
string constant SIGNATURE_ILLEGAL = "SIGNATURE_ILLEGAL"; // Signature type is illegal.
string constant SIGNATURE_UNSUPPORTED = "SIGNATURE_UNSUPPORTED"; // Signature type unsupported.
string constant internal INVALID_SIGNATURE = "INVALID_SIGNATURE"; // Signature validation failed.
string constant internal SIGNATURE_ILLEGAL = "SIGNATURE_ILLEGAL"; // Signature type is illegal.
string constant internal SIGNATURE_UNSUPPORTED = "SIGNATURE_UNSUPPORTED"; // Signature type unsupported.
/// cancelOrdersUptTo errors ///
string constant INVALID_NEW_ORDER_EPOCH = "INVALID_NEW_ORDER_EPOCH"; // Specified salt must be greater than or equal to existing orderEpoch.
string constant internal INVALID_NEW_ORDER_EPOCH = "INVALID_NEW_ORDER_EPOCH"; // Specified salt must be greater than or equal to existing orderEpoch.
/// fillOrKillOrder errors ///
string constant COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired takerAssetFillAmount could not be completely filled.
string constant internal COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired takerAssetFillAmount could not be completely filled.
/// matchOrders errors ///
string constant NEGATIVE_SPREAD_REQUIRED = "NEGATIVE_SPREAD_REQUIRED"; // Matched orders must have a negative spread.
string constant internal NEGATIVE_SPREAD_REQUIRED = "NEGATIVE_SPREAD_REQUIRED"; // Matched orders must have a negative spread.
/// Transaction errors ///
string constant REENTRANCY_ILLEGAL = "REENTRANCY_ILLEGAL"; // Recursive reentrancy is not allowed.
string constant INVALID_TX_HASH = "INVALID_TX_HASH"; // Transaction has already been executed.
string constant INVALID_TX_SIGNATURE = "INVALID_TX_SIGNATURE"; // Signature validation failed.
string constant FAILED_EXECUTION = "FAILED_EXECUTION"; // Transaction execution failed.
string constant internal REENTRANCY_ILLEGAL = "REENTRANCY_ILLEGAL"; // Recursive reentrancy is not allowed.
string constant internal INVALID_TX_HASH = "INVALID_TX_HASH"; // Transaction has already been executed.
string constant internal INVALID_TX_SIGNATURE = "INVALID_TX_SIGNATURE"; // Signature validation failed.
string constant internal FAILED_EXECUTION = "FAILED_EXECUTION"; // Transaction execution failed.
/// registerAssetProxy errors ///
string constant ASSET_PROXY_ALREADY_EXISTS = "ASSET_PROXY_ALREADY_EXISTS"; // AssetProxy with same id already exists.
string constant internal ASSET_PROXY_ALREADY_EXISTS = "ASSET_PROXY_ALREADY_EXISTS"; // AssetProxy with same id already exists.
/// dispatchTransferFrom errors ///
string constant ASSET_PROXY_DOES_NOT_EXIST = "ASSET_PROXY_DOES_NOT_EXIST"; // No assetProxy registered at given id.
string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer unsuccesful.
string constant internal ASSET_PROXY_DOES_NOT_EXIST = "ASSET_PROXY_DOES_NOT_EXIST"; // No assetProxy registered at given id.
string constant internal TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer unsuccesful.
/// Length validation errors ///
string constant LENGTH_GREATER_THAN_0_REQUIRED = "LENGTH_GREATER_THAN_0_REQUIRED"; // Byte array must have a length greater than 0.
string constant LENGTH_GREATER_THAN_3_REQUIRED = "LENGTH_GREATER_THAN_3_REQUIRED"; // Byte array must have a length greater than 3.
string constant LENGTH_0_REQUIRED = "LENGTH_0_REQUIRED"; // Byte array must have a length of 0.
string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED"; // Byte array must have a length of 65.
string constant internal LENGTH_GREATER_THAN_0_REQUIRED = "LENGTH_GREATER_THAN_0_REQUIRED"; // Byte array must have a length greater than 0.
string constant internal LENGTH_GREATER_THAN_3_REQUIRED = "LENGTH_GREATER_THAN_3_REQUIRED"; // Byte array must have a length greater than 3.
string constant internal LENGTH_0_REQUIRED = "LENGTH_0_REQUIRED"; // Byte array must have a length of 0.
string constant internal LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED"; // Byte array must have a length of 65.
}

View File

@@ -16,137 +16,137 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
contract LibExchangeSelectors {
// solhint-disable max-line-length
// allowedValidators
bytes4 constant public ALLOWED_VALIDATORS_SELECTOR = 0x7b8e3514;
bytes4 constant public ALLOWED_VALIDATORS_SELECTOR_GENERATOR = bytes4(keccak256("allowedValidators(address,address)"));
bytes4 constant internal ALLOWED_VALIDATORS_SELECTOR = 0x7b8e3514;
bytes4 constant internal ALLOWED_VALIDATORS_SELECTOR_GENERATOR = bytes4(keccak256("allowedValidators(address,address)"));
// assetProxies
bytes4 constant public ASSET_PROXIES_SELECTOR = 0x3fd3c997;
bytes4 constant public ASSET_PROXIES_SELECTOR_GENERATOR = bytes4(keccak256("assetProxies(bytes4)"));
bytes4 constant internal ASSET_PROXIES_SELECTOR = 0x3fd3c997;
bytes4 constant internal ASSET_PROXIES_SELECTOR_GENERATOR = bytes4(keccak256("assetProxies(bytes4)"));
// batchCancelOrders
bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR = 0x4ac14782;
bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
bytes4 constant internal BATCH_CANCEL_ORDERS_SELECTOR = 0x4ac14782;
bytes4 constant internal BATCH_CANCEL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
// batchFillOrKillOrders
bytes4 constant public BATCH_FILL_OR_KILL_ORDERS_SELECTOR = 0x4d0ae546;
bytes4 constant public BATCH_FILL_OR_KILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
bytes4 constant internal BATCH_FILL_OR_KILL_ORDERS_SELECTOR = 0x4d0ae546;
bytes4 constant internal BATCH_FILL_OR_KILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
// batchFillOrders
bytes4 constant public BATCH_FILL_ORDERS_SELECTOR = 0x297bb70b;
bytes4 constant public BATCH_FILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
bytes4 constant internal BATCH_FILL_ORDERS_SELECTOR = 0x297bb70b;
bytes4 constant internal BATCH_FILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
// batchFillOrdersNoThrow
bytes4 constant public BATCH_FILL_ORDERS_NO_THROW_SELECTOR = 0x50dde190;
bytes4 constant public BATCH_FILL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
bytes4 constant internal BATCH_FILL_ORDERS_NO_THROW_SELECTOR = 0x50dde190;
bytes4 constant internal BATCH_FILL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
// cancelOrder
bytes4 constant public CANCEL_ORDER_SELECTOR = 0xd46b02c3;
bytes4 constant public CANCEL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
bytes4 constant internal CANCEL_ORDER_SELECTOR = 0xd46b02c3;
bytes4 constant internal CANCEL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
// cancelOrdersUpTo
bytes4 constant public CANCEL_ORDERS_UP_TO_SELECTOR = 0x4f9559b1;
bytes4 constant public CANCEL_ORDERS_UP_TO_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrdersUpTo(uint256)"));
bytes4 constant internal CANCEL_ORDERS_UP_TO_SELECTOR = 0x4f9559b1;
bytes4 constant internal CANCEL_ORDERS_UP_TO_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrdersUpTo(uint256)"));
// cancelled
bytes4 constant public CANCELLED_SELECTOR = 0x2ac12622;
bytes4 constant public CANCELLED_SELECTOR_GENERATOR = bytes4(keccak256("cancelled(bytes32)"));
bytes4 constant internal CANCELLED_SELECTOR = 0x2ac12622;
bytes4 constant internal CANCELLED_SELECTOR_GENERATOR = bytes4(keccak256("cancelled(bytes32)"));
// currentContextAddress
bytes4 constant public CURRENT_CONTEXT_ADDRESS_SELECTOR = 0xeea086ba;
bytes4 constant public CURRENT_CONTEXT_ADDRESS_SELECTOR_GENERATOR = bytes4(keccak256("currentContextAddress()"));
bytes4 constant internal CURRENT_CONTEXT_ADDRESS_SELECTOR = 0xeea086ba;
bytes4 constant internal CURRENT_CONTEXT_ADDRESS_SELECTOR_GENERATOR = bytes4(keccak256("currentContextAddress()"));
// executeTransaction
bytes4 constant public EXECUTE_TRANSACTION_SELECTOR = 0xbfc8bfce;
bytes4 constant public EXECUTE_TRANSACTION_SELECTOR_GENERATOR = bytes4(keccak256("executeTransaction(uint256,address,bytes,bytes)"));
bytes4 constant internal EXECUTE_TRANSACTION_SELECTOR = 0xbfc8bfce;
bytes4 constant internal EXECUTE_TRANSACTION_SELECTOR_GENERATOR = bytes4(keccak256("executeTransaction(uint256,address,bytes,bytes)"));
// fillOrKillOrder
bytes4 constant public FILL_OR_KILL_ORDER_SELECTOR = 0x64a3bc15;
bytes4 constant public FILL_OR_KILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
bytes4 constant internal FILL_OR_KILL_ORDER_SELECTOR = 0x64a3bc15;
bytes4 constant internal FILL_OR_KILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
// fillOrder
bytes4 constant public FILL_ORDER_SELECTOR = 0xb4be83d5;
bytes4 constant public FILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
bytes4 constant internal FILL_ORDER_SELECTOR = 0xb4be83d5;
bytes4 constant internal FILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
// fillOrderNoThrow
bytes4 constant public FILL_ORDER_NO_THROW_SELECTOR = 0x3e228bae;
bytes4 constant public FILL_ORDER_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
bytes4 constant internal FILL_ORDER_NO_THROW_SELECTOR = 0x3e228bae;
bytes4 constant internal FILL_ORDER_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
// filled
bytes4 constant public FILLED_SELECTOR = 0x288cdc91;
bytes4 constant public FILLED_SELECTOR_GENERATOR = bytes4(keccak256("filled(bytes32)"));
bytes4 constant internal FILLED_SELECTOR = 0x288cdc91;
bytes4 constant internal FILLED_SELECTOR_GENERATOR = bytes4(keccak256("filled(bytes32)"));
// getAssetProxy
bytes4 constant public GET_ASSET_PROXY_SELECTOR = 0x60704108;
bytes4 constant public GET_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("getAssetProxy(bytes4)"));
bytes4 constant internal GET_ASSET_PROXY_SELECTOR = 0x60704108;
bytes4 constant internal GET_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("getAssetProxy(bytes4)"));
// getOrderInfo
bytes4 constant public GET_ORDER_INFO_SELECTOR = 0xc75e0a81;
bytes4 constant public GET_ORDER_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
bytes4 constant internal GET_ORDER_INFO_SELECTOR = 0xc75e0a81;
bytes4 constant internal GET_ORDER_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
// getOrdersInfo
bytes4 constant public GET_ORDERS_INFO_SELECTOR = 0x7e9d74dc;
bytes4 constant public GET_ORDERS_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
bytes4 constant internal GET_ORDERS_INFO_SELECTOR = 0x7e9d74dc;
bytes4 constant internal GET_ORDERS_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
// isValidSignature
bytes4 constant public IS_VALID_SIGNATURE_SELECTOR = 0x93634702;
bytes4 constant public IS_VALID_SIGNATURE_SELECTOR_GENERATOR = bytes4(keccak256("isValidSignature(bytes32,address,bytes)"));
bytes4 constant internal IS_VALID_SIGNATURE_SELECTOR = 0x93634702;
bytes4 constant internal IS_VALID_SIGNATURE_SELECTOR_GENERATOR = bytes4(keccak256("isValidSignature(bytes32,address,bytes)"));
// marketBuyOrders
bytes4 constant public MARKET_BUY_ORDERS_SELECTOR = 0xe5fa431b;
bytes4 constant public MARKET_BUY_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
bytes4 constant internal MARKET_BUY_ORDERS_SELECTOR = 0xe5fa431b;
bytes4 constant internal MARKET_BUY_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
// marketBuyOrdersNoThrow
bytes4 constant public MARKET_BUY_ORDERS_NO_THROW_SELECTOR = 0xa3e20380;
bytes4 constant public MARKET_BUY_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
bytes4 constant internal MARKET_BUY_ORDERS_NO_THROW_SELECTOR = 0xa3e20380;
bytes4 constant internal MARKET_BUY_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
// marketSellOrders
bytes4 constant public MARKET_SELL_ORDERS_SELECTOR = 0x7e1d9808;
bytes4 constant public MARKET_SELL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
bytes4 constant internal MARKET_SELL_ORDERS_SELECTOR = 0x7e1d9808;
bytes4 constant internal MARKET_SELL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
// marketSellOrdersNoThrow
bytes4 constant public MARKET_SELL_ORDERS_NO_THROW_SELECTOR = 0xdd1c7d18;
bytes4 constant public MARKET_SELL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
bytes4 constant internal MARKET_SELL_ORDERS_NO_THROW_SELECTOR = 0xdd1c7d18;
bytes4 constant internal MARKET_SELL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
// matchOrders
bytes4 constant public MATCH_ORDERS_SELECTOR = 0x3c28d861;
bytes4 constant public MATCH_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)"));
bytes4 constant internal MATCH_ORDERS_SELECTOR = 0x3c28d861;
bytes4 constant internal MATCH_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)"));
// orderEpoch
bytes4 constant public ORDER_EPOCH_SELECTOR = 0xd9bfa73e;
bytes4 constant public ORDER_EPOCH_SELECTOR_GENERATOR = bytes4(keccak256("orderEpoch(address,address)"));
bytes4 constant internal ORDER_EPOCH_SELECTOR = 0xd9bfa73e;
bytes4 constant internal ORDER_EPOCH_SELECTOR_GENERATOR = bytes4(keccak256("orderEpoch(address,address)"));
// owner
bytes4 constant public OWNER_SELECTOR = 0x8da5cb5b;
bytes4 constant public OWNER_SELECTOR_GENERATOR = bytes4(keccak256("owner()"));
bytes4 constant internal OWNER_SELECTOR = 0x8da5cb5b;
bytes4 constant internal OWNER_SELECTOR_GENERATOR = bytes4(keccak256("owner()"));
// preSign
bytes4 constant public PRE_SIGN_SELECTOR = 0x3683ef8e;
bytes4 constant public PRE_SIGN_SELECTOR_GENERATOR = bytes4(keccak256("preSign(bytes32,address,bytes)"));
bytes4 constant internal PRE_SIGN_SELECTOR = 0x3683ef8e;
bytes4 constant internal PRE_SIGN_SELECTOR_GENERATOR = bytes4(keccak256("preSign(bytes32,address,bytes)"));
// preSigned
bytes4 constant public PRE_SIGNED_SELECTOR = 0x82c174d0;
bytes4 constant public PRE_SIGNED_SELECTOR_GENERATOR = bytes4(keccak256("preSigned(bytes32,address)"));
bytes4 constant internal PRE_SIGNED_SELECTOR = 0x82c174d0;
bytes4 constant internal PRE_SIGNED_SELECTOR_GENERATOR = bytes4(keccak256("preSigned(bytes32,address)"));
// registerAssetProxy
bytes4 constant public REGISTER_ASSET_PROXY_SELECTOR = 0xc585bb93;
bytes4 constant public REGISTER_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("registerAssetProxy(address)"));
bytes4 constant internal REGISTER_ASSET_PROXY_SELECTOR = 0xc585bb93;
bytes4 constant internal REGISTER_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("registerAssetProxy(address)"));
// setSignatureValidatorApproval
bytes4 constant public SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR = 0x77fcce68;
bytes4 constant public SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR_GENERATOR = bytes4(keccak256("setSignatureValidatorApproval(address,bool)"));
bytes4 constant internal SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR = 0x77fcce68;
bytes4 constant internal SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR_GENERATOR = bytes4(keccak256("setSignatureValidatorApproval(address,bool)"));
// transactions
bytes4 constant public TRANSACTIONS_SELECTOR = 0x642f2eaf;
bytes4 constant public TRANSACTIONS_SELECTOR_GENERATOR = bytes4(keccak256("transactions(bytes32)"));
bytes4 constant internal TRANSACTIONS_SELECTOR = 0x642f2eaf;
bytes4 constant internal TRANSACTIONS_SELECTOR_GENERATOR = bytes4(keccak256("transactions(bytes32)"));
// transferOwnership
bytes4 constant public TRANSFER_OWNERSHIP_SELECTOR = 0xf2fde38b;
bytes4 constant public TRANSFER_OWNERSHIP_SELECTOR_GENERATOR = bytes4(keccak256("transferOwnership(address)"));
bytes4 constant internal TRANSFER_OWNERSHIP_SELECTOR = 0xf2fde38b;
bytes4 constant internal TRANSFER_OWNERSHIP_SELECTOR_GENERATOR = bytes4(keccak256("transferOwnership(address)"));
}

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
import "@0x/contracts-utils/contracts/src/SafeMath.sol";

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
import "@0x/contracts-utils/contracts/src/SafeMath.sol";

View File

@@ -16,7 +16,7 @@
*/
pragma solidity ^0.4.24;
pragma solidity ^0.5.3;
import "./LibEIP712.sol";

View File

@@ -16,7 +16,7 @@
*/
pragma solidity 0.4.24;
pragma solidity 0.5.3;
pragma experimental ABIEncoderV2;
import "../src/LibMath.sol";

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange-libs",
"version": "1.0.4",
"version": "1.1.3",
"engines": {
"node": ">=6.12"
},
@@ -46,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -67,14 +67,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^6.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-utils": "^2.0.8",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "1.0.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "1.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "1.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "1.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.4",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.9 - _March 1, 2019_
* Dependencies updated
## v1.0.8 - _February 27, 2019_
* Dependencies updated
## v1.0.7 - _February 26, 2019_
* Dependencies updated
## v1.0.6 - _February 25, 2019_
* Dependencies updated
## v1.0.5 - _February 9, 2019_
* Dependencies updated
## v1.0.4 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-exchange",
"version": "1.0.4",
"version": "1.0.9",
"engines": {
"node": ">=6.12"
},
@@ -46,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -67,18 +67,18 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-asset-proxy": "1.0.2",
"@0x/contracts-erc20": "1.0.2",
"@0x/contracts-erc721": "1.0.2",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-asset-proxy": "^1.0.9",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-erc721": "^1.0.9",
"@0x/contracts-exchange-libs": "1.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^6.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"
},

View File

@@ -1,4 +1,14 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import {
DummyERC20TokenContract,
DummyERC20TokenTransferEventArgs,
DummyERC721TokenContract,
DummyNoReturnERC20TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
MultiAssetProxyContract,
} from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,
@@ -24,16 +34,9 @@ import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC20TokenTransferEventArgs,
DummyERC721TokenContract,
DummyNoReturnERC20TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeCancelEventArgs,
ExchangeContract,
ExchangeWrapper,
MultiAssetProxyContract,
ReentrantERC20TokenContract,
TestStaticCallReceiverContract,
} from '../src';

View File

@@ -1,4 +1,10 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import {
DummyERC20TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,
@@ -18,9 +24,6 @@ import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
TestAssetProxyDispatcherContract,
} from '../src';

View File

@@ -1,4 +1,11 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,
@@ -20,10 +27,6 @@ import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeContract,
ExchangeWrapper,
MatchOrderTester,

View File

@@ -1,5 +1,4 @@
import { ERC20ProxyContract, ERC20Wrapper } from '@0x/contracts-asset-proxy';
import { DummyERC20TokenContract } from '@0x/contracts-erc20';
import { DummyERC20TokenContract, ERC20ProxyContract, ERC20Wrapper } from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,

View File

@@ -1,8 +1,15 @@
import { FillResults, formatters, LogDecoder, OrderInfo, orderUtils } from '@0x/contracts-test-utils';
import {
FillResults,
formatters,
LogDecoder,
OrderInfo,
orderUtils,
Web3ProviderEngine,
} from '@0x/contracts-test-utils';
import { SignedOrder, SignedZeroExTransaction } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { MethodAbi, TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, ExchangeContract } from '../../src';
@@ -13,7 +20,7 @@ export class ExchangeWrapper {
private readonly _exchange: ExchangeContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(exchangeContract: ExchangeContract, provider: Provider) {
constructor(exchangeContract: ExchangeContract, provider: Web3ProviderEngine | ZeroExProvider) {
this._exchange = exchangeContract;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);

View File

@@ -15,6 +15,7 @@ import {
TakerAssetFillAmountScenario,
TakerScenario,
TraderStateScenario,
Web3ProviderEngine,
} from '@0x/contracts-test-utils';
import {
assetDataUtils,
@@ -25,10 +26,10 @@ import {
OrderValidationUtils,
} from '@0x/order-utils';
import { AssetProxyId, RevertReason, SignatureType, SignedOrder } from '@0x/types';
import { BigNumber, errorUtils, logUtils } from '@0x/utils';
import { BigNumber, errorUtils, logUtils, providerUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
import { LogWithDecodedArgs, TxData } from 'ethereum-types';
import * as _ from 'lodash';
import 'make-promises-safe';
@@ -59,7 +60,8 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
const [ownerAddress, makerAddress, takerAddress] = userAddresses;
const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)];
const provider = web3Wrapper.getProvider();
const supportedProvider = web3Wrapper.getProvider();
const provider = providerUtils.standardizeOrThrow(supportedProvider);
const erc20Wrapper = new ERC20Wrapper(provider, userAddresses, ownerAddress);
const erc721Wrapper = new ERC721Wrapper(provider, userAddresses, ownerAddress);
@@ -351,7 +353,7 @@ export class FillOrderCombinatorialUtils {
this.testLibsContract = testLibsContract;
}
public async testFillOrderScenarioAsync(
provider: Provider,
provider: Web3ProviderEngine,
fillScenario: FillScenario,
isVerbose: boolean = false,
): Promise<void> {

View File

@@ -1,4 +1,11 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import {
chaiSetup,
constants,
@@ -20,16 +27,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeContract,
ExchangeWrapper,
ReentrantERC20TokenContract,
} from '../src';
import { artifacts, ExchangeContract, ExchangeWrapper, ReentrantERC20TokenContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "2.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "2.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "2.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "2.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "2.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.0.3",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.8 - _March 1, 2019_
* Dependencies updated
## v2.0.7 - _February 27, 2019_
* Dependencies updated
## v2.0.6 - _February 26, 2019_
* Dependencies updated
## v2.0.5 - _February 25, 2019_
* Dependencies updated
## v2.0.4 - _February 9, 2019_
* Dependencies updated
## v2.0.3 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "2.0.3",
"version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -46,12 +46,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contract-wrappers": "^7.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contract-wrappers": "^8.0.3",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -68,19 +68,19 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-asset-proxy": "1.0.2",
"@0x/contracts-erc20": "1.0.2",
"@0x/contracts-erc721": "1.0.2",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-asset-proxy": "^1.0.9",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-erc721": "^1.0.9",
"@0x/contracts-exchange": "1.0.2",
"@0x/contracts-exchange-libs": "1.0.2",
"@0x/contracts-utils": "2.0.1",
"@0x/order-utils": "^6.0.1",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,4 +1,4 @@
import { ExchangeWrapper } from '@0x/contracts-exchange';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { Order, RevertReason, SignedOrder } from '@0x/types';
@@ -24,7 +24,7 @@ import {
web3Wrapper,
} from '@0x/contracts-test-utils';
import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper, ExchangeContract } from '../src';
import { artifacts, BalanceThresholdFilterContract, BalanceThresholdWrapper } from '../src';
chaiSetup.configure();
const expect = chai.expect;

View File

@@ -1,6 +1,11 @@
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import { ExchangeWrapper } from '@0x/contracts-exchange';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20Wrapper,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -21,15 +26,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
DutchAuctionContract,
DutchAuctionTestWrapper,
ExchangeContract,
WETH9Contract,
} from '../src';
import { artifacts, DutchAuctionContract, DutchAuctionTestWrapper, WETH9Contract } from '../src';
chaiSetup.configure();
const expect = chai.expect;

View File

@@ -1,5 +1,11 @@
import { ERC20Wrapper } from '@0x/contracts-asset-proxy';
import { ExchangeWrapper } from '@0x/contracts-exchange';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
} from '@0x/contracts-asset-proxy';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -22,16 +28,7 @@ import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeContract,
ExchangeFillEventArgs,
OrderMatcherContract,
} from '../src';
import { artifacts, ExchangeFillEventArgs, OrderMatcherContract } from '../src';
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
chaiSetup.configure();

View File

@@ -1,5 +1,12 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
import { ExchangeWrapper } from '@0x/contracts-exchange';
import {
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
} from '@0x/contracts-asset-proxy';
import { ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -16,15 +23,7 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import {
artifacts,
DummyERC20TokenContract,
DummyERC721TokenContract,
ERC20ProxyContract,
ERC721ProxyContract,
ExchangeContract,
OrderValidatorContract,
} from '../src';
import { artifacts, OrderValidatorContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;

View File

@@ -1,3 +1,4 @@
import { ExchangeContract } from '@0x/contracts-exchange';
import {
FillResults,
formatters,
@@ -5,14 +6,15 @@ import {
OrderInfo,
orderUtils,
TransactionFactory,
Web3ProviderEngine,
} from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { artifacts, BalanceThresholdFilterContract, ExchangeContract } from '../../src';
import { artifacts, BalanceThresholdFilterContract } from '../../src';
export class BalanceThresholdWrapper {
private readonly _balanceThresholdFilter: BalanceThresholdFilterContract;
@@ -24,7 +26,7 @@ export class BalanceThresholdWrapper {
balanceThresholdFilter: BalanceThresholdFilterContract,
exchangeContract: ExchangeContract,
signerTransactionFactory: TransactionFactory,
provider: Provider,
provider: Web3ProviderEngine,
) {
this._balanceThresholdFilter = balanceThresholdFilter;
this._exchange = exchangeContract;

View File

@@ -1,7 +1,7 @@
import { LogDecoder } from '@0x/contracts-test-utils';
import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
@@ -12,7 +12,7 @@ export class DutchAuctionTestWrapper {
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(contractInstance: DutchAuctionContract, provider: Provider) {
constructor(contractInstance: DutchAuctionContract, provider: Web3ProviderEngine) {
this._dutchAuctionContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);

View File

@@ -1,4 +1,49 @@
[
{
"timestamp": 1551479279,
"version": "2.0.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "2.0.7",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "2.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551130135,
"version": "2.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1549733923,
"version": "2.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "2.0.3",
"changes": [

View File

@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.0.8 - _March 1, 2019_
* Dependencies updated
## v2.0.7 - _February 27, 2019_
* Dependencies updated
## v2.0.6 - _February 26, 2019_
* Dependencies updated
## v2.0.5 - _February 25, 2019_
* Dependencies updated
## v2.0.4 - _February 9, 2019_
* Dependencies updated
## v2.0.3 - _February 7, 2019_
* Dependencies updated

View File

@@ -2,6 +2,7 @@
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"isOfflineMode": false,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "2.0.3",
"version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -46,11 +46,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.2",
"@0x/contracts-gen": "^1.0.1",
"@0x/contracts-test-utils": "^3.0.3",
"@0x/dev-utils": "^2.0.2",
"@0x/sol-compiler": "^3.0.2",
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
@@ -67,14 +67,15 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^4.0.2",
"@0x/contracts-asset-proxy": "1.0.2",
"@0x/contracts-erc20": "1.0.2",
"@0x/types": "^2.0.2",
"@0x/typescript-typings": "^4.0.0",
"@0x/utils": "^4.0.3",
"@0x/web3-wrapper": "^4.0.2",
"ethereum-types": "^2.0.0",
"@0x/base-contract": "^5.0.2",
"@0x/contracts-asset-proxy": "^1.0.9",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-utils": "2.0.1",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"lodash": "^4.17.11"
},
"publishConfig": {

View File

@@ -1,7 +1,7 @@
import { LogDecoder } from '@0x/contracts-test-utils';
import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
@@ -11,7 +11,7 @@ export class AssetProxyOwnerWrapper {
private readonly _assetProxyOwner: AssetProxyOwnerContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Web3ProviderEngine) {
this._assetProxyOwner = assetproxyOwnerContract;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);

View File

@@ -1,7 +1,7 @@
import { LogDecoder } from '@0x/contracts-test-utils';
import { LogDecoder, Web3ProviderEngine } from '@0x/contracts-test-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
@@ -11,7 +11,7 @@ export class MultiSigWrapper {
private readonly _multiSig: MultiSigWalletContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
constructor(multiSigContract: MultiSigWalletContract, provider: Web3ProviderEngine) {
this._multiSig = multiSigContract;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);

View File

@@ -0,0 +1,29 @@
[
{
"timestamp": 1551479279,
"version": "0.0.4",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551299797,
"version": "0.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1551220833,
"version": "0.0.2",
"changes": [
{
"note": "Dependencies updated"
}
]
}
]

View File

@@ -0,0 +1,18 @@
<!--
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
CHANGELOG
## v0.0.4 - _March 1, 2019_
* Dependencies updated
## v0.0.3 - _February 27, 2019_
* Dependencies updated
## v0.0.2 - _February 26, 2019_
* Dependencies updated

View File

@@ -0,0 +1 @@
[]

73
contracts/tec/README.md Normal file
View File

@@ -0,0 +1,73 @@
## Trade Execution Coordinator (TEC)
This package contains a contract that allows users to call arbitrary functions on the Exchange contract with permission from one or more TECs (Trade Execution Coordinators). Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [DEPLOYS](./DEPLOYS.json) file within this package.
## Installation
**Install**
```bash
npm install @0x/contracts-tec --save
```
## Bug bounty
A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install Dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0x/contracts-tec yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0x/contracts-tec yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```
#### Testing options
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).

View File

@@ -0,0 +1,20 @@
{
"artifactsDir": "./generated-artifacts",
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"compilerSettings": {
"optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap"
]
}
}
},
"contracts": ["src/TEC.sol", "test/TestLibs.sol", "test/TestMixins.sol"]
}

View File

@@ -0,0 +1,107 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "./mixins/MSignatureValidator.sol";
contract MixinSignatureValidator is
MSignatureValidator
{
using LibBytes for bytes;
/// @dev Recovers the address of a signer given a hash and signature.
/// @param hash Any 32 byte hash.
/// @param signature Proof that the hash has been signed by signer.
function getSignerAddress(bytes32 hash, bytes memory signature)
public
pure
returns (address signerAddress)
{
require(
signature.length > 0,
"LENGTH_GREATER_THAN_0_REQUIRED"
);
// Pop last byte off of signature byte array.
uint8 signatureTypeRaw = uint8(signature.popLastByte());
// Ensure signature is supported
require(
signatureTypeRaw < uint8(SignatureType.NSignatureTypes),
"SIGNATURE_UNSUPPORTED"
);
SignatureType signatureType = SignatureType(signatureTypeRaw);
// Always illegal signature.
// This is always an implicit option since a signer can create a
// signature array with invalid type or length. We may as well make
// it an explicit option. This aids testing and analysis. It is
// also the initialization value for the enum type.
if (signatureType == SignatureType.Illegal) {
revert("SIGNATURE_ILLEGAL");
// Signature using EIP712
} else if (signatureType == SignatureType.EIP712) {
require(
signature.length == 65,
"LENGTH_65_REQUIRED"
);
uint8 v = uint8(signature[0]);
bytes32 r = signature.readBytes32(1);
bytes32 s = signature.readBytes32(33);
signerAddress = ecrecover(
hash,
v,
r,
s
);
return signerAddress;
// Signed using web3.eth_sign
} else if (signatureType == SignatureType.EthSign) {
require(
signature.length == 65,
"LENGTH_65_REQUIRED"
);
uint8 v = uint8(signature[0]);
bytes32 r = signature.readBytes32(1);
bytes32 s = signature.readBytes32(33);
signerAddress = ecrecover(
keccak256(abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
hash
)),
v,
r,
s
);
return signerAddress;
}
// Anything else is illegal (We do not return false because
// the signature may actually be valid, just not in a format
// that we currently support. In this case returning false
// may lead the caller to incorrectly believe that the
// signature was invalid.)
revert("SIGNATURE_UNSUPPORTED");
}
}

View File

@@ -0,0 +1,200 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
pragma experimental "ABIEncoderV2";
import "@0x/contracts-exchange-libs/contracts/src/LibExchangeSelectors.sol";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "@0x/contracts-utils/contracts/src/LibBytes.sol";
import "@0x/contracts-utils/contracts/src/LibAddressArray.sol";
import "./libs/LibTECApproval.sol";
import "./libs/LibZeroExTransaction.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTECApprovalVerifier.sol";
// solhint-disable avoid-tx-origin
contract MixinTECApprovalVerifier is
LibExchangeSelectors,
LibTECApproval,
LibZeroExTransaction,
MSignatureValidator,
MTECApprovalVerifier
{
using LibBytes for bytes;
using LibAddressArray for address[];
/// @dev Validates that the 0x transaction has been approved by all of the feeRecipients
/// that correspond to each order in the transaction's Exchange calldata.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.
function assertValidTECApprovals(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
view
{
// Get the orders from the the Exchange calldata in the 0x transaction
LibOrder.Order[] memory orders = decodeFillDataOrders(transaction.data);
// No approval is required for non-fill methods
if (orders.length > 0) {
// Revert if approval is invalid for transaction orders
assertValidTransactionOrdersApproval(
transaction,
orders,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures
);
}
}
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param orders Array of order structs containing order specifications.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
function assertValidTransactionOrdersApproval(
LibZeroExTransaction.ZeroExTransaction memory transaction,
LibOrder.Order[] memory orders,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
view
{
// Hash 0x transaction
bytes32 transactionHash = getTransactionHash(transaction);
// Create empty list of approval signers
address[] memory approvalSignerAddresses = new address[](0);
uint256 signaturesLength = approvalSignatures.length;
for (uint256 i = 0; i < signaturesLength; i++) {
// Create approval message
uint256 currentApprovalExpirationTimeSeconds = approvalExpirationTimeSeconds[i];
TECApproval memory approval = TECApproval({
transactionHash: transactionHash,
transactionSignature: transactionSignature,
approvalExpirationTimeSeconds: currentApprovalExpirationTimeSeconds
});
// Ensure approval has not expired
require(
// solhint-disable-next-line not-rely-on-time
currentApprovalExpirationTimeSeconds > block.timestamp,
"APPROVAL_EXPIRED"
);
// Hash approval message and recover signer address
bytes32 approvalHash = getTECApprovalHash(approval);
address approvalSignerAddress = getSignerAddress(approvalHash, approvalSignatures[i]);
// Add approval signer to list of signers
approvalSignerAddresses = approvalSignerAddresses.append(approvalSignerAddress);
}
uint256 ordersLength = orders.length;
for (uint256 i = 0; i < ordersLength; i++) {
// Do not check approval if the order's senderAddress is null
if (orders[i].senderAddress == address(0)) {
continue;
}
// Ethereum transaction signer gives implicit signature of approval
address approverAddress = orders[i].feeRecipientAddress;
if (approverAddress == tx.origin) {
approvalSignerAddresses = approvalSignerAddresses.append(tx.origin);
continue;
}
// Ensure feeRecipient of order has approved this 0x transaction
bool isOrderApproved = approvalSignerAddresses.contains(approverAddress);
require(
isOrderApproved,
"INVALID_APPROVAL_SIGNATURE"
);
// The Ethereum transaction signer must be the 0x transaction signer or an approver of the 0x transaction
require(
transaction.signerAddress == tx.origin || approvalSignerAddresses.contains(tx.origin),
"INVALID_SENDER"
);
}
}
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeFillDataOrders(bytes memory data)
internal
pure
returns (LibOrder.Order[] memory orders)
{
bytes4 selector = data.readBytes4(0);
if (
selector == FILL_ORDER_SELECTOR ||
selector == FILL_ORDER_NO_THROW_SELECTOR ||
selector == FILL_OR_KILL_ORDER_SELECTOR
) {
// Decode single order
(LibOrder.Order memory order) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order)
);
orders = new LibOrder.Order[](1);
orders[0] = order;
} else if (
selector == BATCH_FILL_ORDERS_SELECTOR ||
selector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
selector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_SELECTOR ||
selector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
selector == MARKET_SELL_ORDERS_SELECTOR ||
selector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
) {
// Decode all orders
// solhint-disable indent
(orders) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order[])
);
} else if (selector == MATCH_ORDERS_SELECTOR) {
// Decode left and right orders
(LibOrder.Order memory leftOrder, LibOrder.Order memory rightOrder) = abi.decode(
data.slice(4, data.length),
(LibOrder.Order, LibOrder.Order)
);
// Create array of orders
orders = new LibOrder.Order[](2);
orders[0] = leftOrder;
orders[1] = rightOrder;
}
return orders;
}
}

View File

@@ -0,0 +1,62 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
pragma experimental "ABIEncoderV2";
import "./libs/LibZeroExTransaction.sol";
import "./libs/LibConstants.sol";
import "./mixins/MTECApprovalVerifier.sol";
import "./interfaces/ITECCore.sol";
contract MixinTECCore is
LibConstants,
MTECApprovalVerifier,
ITECCore
{
/// @dev Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.
function executeTransaction(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
{
// Validate that the 0x transaction has been approves by each feeRecipient
assertValidTECApprovals(
transaction,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures
);
// Execute the transaction
EXCHANGE.executeTransaction(
transaction.salt,
transaction.signerAddress,
transaction.data,
transactionSignature
);
}
}

View File

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

View File

@@ -0,0 +1,31 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
contract ISignatureValidator {
/// @dev Recovers the address of a signer given a hash and signature.
/// @param hash Any 32 byte hash.
/// @param signature Proof that the hash has been signed by signer.
function getSignerAddress(bytes32 hash, bytes memory signature)
public
pure
returns (address signerAddress);
}

View File

@@ -0,0 +1,58 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
pragma experimental "ABIEncoderV2";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "../libs/LibZeroExTransaction.sol";
contract ITECApprovalVerifier {
/// @dev Validates that the 0x transaction has been approved by all of the feeRecipients
/// that correspond to each order in the transaction's Exchange calldata.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.
function assertValidTECApprovals(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
view;
/// @dev Validates that the feeRecipients of a batch of order have approved a 0x transaction.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param orders Array of order structs containing order specifications.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order.
function assertValidTransactionOrdersApproval(
LibZeroExTransaction.ZeroExTransaction memory transaction,
LibOrder.Order[] memory orders,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public
view;
}

View File

@@ -0,0 +1,39 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
pragma experimental "ABIEncoderV2";
import "../libs/LibZeroExTransaction.sol";
contract ITECCore {
/// @dev Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @param transactionSignature Proof that the transaction has been signed by the signer.
/// @param approvalExpirationTimeSeconds Array of expiration times in seconds for which each corresponding approval signature expires.
/// @param approvalSignatures Array of signatures that correspond to the feeRecipients of each order in the transaction's Exchange calldata.
function executeTransaction(
LibZeroExTransaction.ZeroExTransaction memory transaction,
bytes memory transactionSignature,
uint256[] memory approvalExpirationTimeSeconds,
bytes[] memory approvalSignatures
)
public;
}

View File

@@ -0,0 +1,35 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
contract ITransactions {
/// @dev Executes an exchange method call in the context of signer.
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
/// @param signerAddress Address of transaction signer.
/// @param data AbiV2 encoded calldata.
/// @param signature Proof of signer transaction by signer.
function executeTransaction(
uint256 salt,
address signerAddress,
bytes calldata data,
bytes calldata signature
)
external;
}

View File

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

View File

@@ -0,0 +1,87 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
contract LibEIP712Domain {
// EIP191 header for EIP712 prefix
string constant internal EIP191_HEADER = "\x19\x01";
// EIP712 Domain Name value
string constant internal EIP712_DOMAIN_NAME = "0x Protocol Trade Execution Coordinator";
// EIP712 Domain Version value
string constant internal EIP712_DOMAIN_VERSION = "1.0.0";
// Hash of the EIP712 Domain Separator Schema
bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(
"EIP712Domain(",
"string name,",
"string version,",
"address verifyingContract",
")"
));
// Hash of the EIP712 Domain Separator data
// solhint-disable-next-line var-name-mixedcase
bytes32 public EIP712_DOMAIN_HASH;
constructor ()
public
{
EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(
EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,
keccak256(bytes(EIP712_DOMAIN_NAME)),
keccak256(bytes(EIP712_DOMAIN_VERSION)),
uint256(address(this))
));
}
/// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.
/// @param hashStruct The EIP712 hash struct.
/// @return EIP712 hash applied to this EIP712 Domain.
function hashEIP712Message(bytes32 hashStruct)
internal
view
returns (bytes32 result)
{
bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;
// Assembly for more efficient computing:
// keccak256(abi.encodePacked(
// EIP191_HEADER,
// EIP712_DOMAIN_HASH,
// hashStruct
// ));
assembly {
// Load free memory pointer
let memPtr := mload(64)
mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header
mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash
mstore(add(memPtr, 34), hashStruct) // Hash of struct
// Compute hash
result := keccak256(memPtr, 66)
}
return result;
}
}

View File

@@ -0,0 +1,89 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
import "./LibEIP712Domain.sol";
contract LibTECApproval is
LibEIP712Domain
{
// Hash for the EIP712 TEC approval message
bytes32 constant internal EIP712_TEC_APPROVAL_SCHEMA_HASH = keccak256(abi.encodePacked(
"TECApproval(",
"bytes32 transactionHash,",
"bytes transactionSignature,",
"uint256 approvalExpirationTimeSeconds",
")"
));
struct TECApproval {
bytes32 transactionHash; // EIP712 hash of the transaction, using the domain separator of this contract.
bytes transactionSignature; // Signature of the 0x transaction.
uint256 approvalExpirationTimeSeconds; // Timestamp in seconds for which the signature expires.
}
/// @dev Calculated the EIP712 hash of the TEC approval mesasage using the domain separator of this contract.
/// @param approval TEC approval message containing the transaction hash, transaction signature, and expiration of the approval.
/// @return EIP712 hash of the TEC approval message with the domain separator of this contract.
function getTECApprovalHash(TECApproval memory approval)
internal
view
returns (bytes32 approvalHash)
{
approvalHash = hashEIP712Message(hashTECApproval(approval));
return approvalHash;
}
/// @dev Calculated the EIP712 hash of the TEC approval mesasage with no domain separator.
/// @param approval TEC approval message containing the transaction hash, transaction signature, and expiration of the approval.
/// @return EIP712 hash of the TEC approval message with no domain separator.
function hashTECApproval(TECApproval memory approval)
internal
pure
returns (bytes32 result)
{
bytes32 schemaHash = EIP712_TEC_APPROVAL_SCHEMA_HASH;
bytes32 transactionSignatureHash = keccak256(approval.transactionSignature);
// TODO(abandeali1): optimize by loading from memory in assembly
bytes32 transactionHash = approval.transactionHash;
uint256 approvalExpirationTimeSeconds = approval.approvalExpirationTimeSeconds;
// Assembly for more efficiently computing:
// keccak256(abi.encodePacked(
// EIP712_TEC_APPROVAL_SCHEMA_HASH,
// approval.transactionHash,
// keccak256(approval.transactionSignature)
// approval.expiration,
// ));
assembly {
// Load free memory pointer
let memPtr := mload(64)
mstore(memPtr, schemaHash) // hash of schema
mstore(add(memPtr, 32), transactionHash) // transactionHash
mstore(add(memPtr, 64), transactionSignatureHash) // transactionSignatureHash
mstore(add(memPtr, 96), approvalExpirationTimeSeconds) // approvalExpirationTimeSeconds
// Compute hash
result := keccak256(memPtr, 128)
}
return result;
}
}

View File

@@ -0,0 +1,91 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
import "./LibEIP712Domain.sol";
contract LibZeroExTransaction is
LibEIP712Domain
{
// Hash for the EIP712 0x transaction schema
bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
"ZeroExTransaction(",
"uint256 salt,",
"address signerAddress,",
"bytes data",
")"
));
struct ZeroExTransaction {
uint256 salt; // Arbitrary number to ensure uniqueness of transaction hash.
address signerAddress; // Address of transaction signer.
bytes data; // AbiV2 encoded calldata.
}
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of this contract.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @return EIP712 hash of the transaction with the domain separator of this contract.
function getTransactionHash(ZeroExTransaction memory transaction)
internal
view
returns (bytes32 transactionHash)
{
// Note: this transaction hash will differ from the hash produced by the Exchange contract because it utilizes a different domain hash.
transactionHash = hashEIP712Message(hashZeroExTransaction(transaction));
return transactionHash;
}
/// @dev Calculates EIP712 hash of the 0x transaction with no domain separator.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @return EIP712 hash of the transaction with no domain separator.
function hashZeroExTransaction(ZeroExTransaction memory transaction)
internal
pure
returns (bytes32 result)
{
bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
bytes32 dataHash = keccak256(transaction.data);
// TODO(abandeali1): optimize by loading from memory in assembly
uint256 salt = transaction.salt;
address signerAddress = transaction.signerAddress;
// Assembly for more efficiently computing:
// keccak256(abi.encodePacked(
// EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
// transaction.salt,
// uint256(transaction.signerAddress),
// keccak256(transaction.data)
// ));
assembly {
// Load free memory pointer
let memPtr := mload(64)
mstore(memPtr, schemaHash) // hash of schema
mstore(add(memPtr, 32), salt) // salt
mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress
mstore(add(memPtr, 96), dataHash) // hash of data
// Compute hash
result := keccak256(memPtr, 128)
}
return result;
}
}

View File

@@ -0,0 +1,34 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
import "../interfaces/ISignatureValidator.sol";
contract MSignatureValidator is
ISignatureValidator
{
// Allowed signature types.
enum SignatureType {
Illegal, // 0x00, default value
EIP712, // 0x01
EthSign, // 0x02
NSignatureTypes // 0x03, number of signature types. Always leave at end.
}
}

View File

@@ -0,0 +1,36 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.3;
pragma experimental "ABIEncoderV2";
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
import "../interfaces/ITECApprovalVerifier.sol";
contract MTECApprovalVerifier is
ITECApprovalVerifier
{
/// @dev Decodes the orders from Exchange calldata representing any fill method.
/// @param data Exchange calldata representing a fill method.
/// @return The orders from the Exchange calldata.
function decodeFillDataOrders(bytes memory data)
internal
pure
returns (LibOrder.Order[] memory orders);
}

View File

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

View File

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

View File

@@ -0,0 +1,88 @@
{
"name": "@0x/contracts-tec",
"version": "0.0.4",
"engines": {
"node": ">=6.12"
},
"description": "Smart contract extensions of 0x protocol",
"main": "lib/src/index.js",
"directories": {
"test": "test"
},
"scripts": {
"build": "yarn pre_build && tsc -b",
"build:ci": "yarn build",
"pre_build": "run-s compile generate_contract_wrappers",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
"compile": "sol-compiler",
"watch": "sol-compiler -w",
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
"contracts:gen": "contracts-gen",
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "./generated-artifacts/@(IExchange|TEC|TestLibs|TestMixins).json",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^2.0.6",
"@0x/contracts-gen": "^1.0.5",
"@0x/contracts-test-utils": "^3.0.8",
"@0x/dev-utils": "^2.1.3",
"@0x/sol-compiler": "^3.1.3",
"@0x/tslint-config": "^3.0.0",
"@types/lodash": "4.14.104",
"@types/node": "*",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^3.0.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1"
},
"dependencies": {
"@0x/base-contract": "^5.0.2",
"@0x/contracts-asset-proxy": "^1.0.9",
"@0x/contracts-erc20": "^1.0.9",
"@0x/contracts-exchange": "1.0.2",
"@0x/contracts-exchange-libs": "^1.1.3",
"@0x/contracts-utils": "^2.0.8",
"@0x/order-utils": "^7.0.2",
"@0x/types": "^2.1.1",
"@0x/typescript-typings": "^4.1.0",
"@0x/utils": "^4.2.2",
"@0x/web3-wrapper": "^6.0.2",
"ethereum-types": "^2.1.0",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.11"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,15 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
import { ContractArtifact } from 'ethereum-types';
import * as TEC from '../generated-artifacts/TEC.json';
import * as TestLibs from '../generated-artifacts/TestLibs.json';
import * as TestMixins from '../generated-artifacts/TestMixins.json';
export const artifacts = {
TEC: TEC as ContractArtifact,
TestLibs: TestLibs as ContractArtifact,
TestMixins: TestMixins as ContractArtifact,
};

View File

@@ -0,0 +1,3 @@
export * from './artifacts';
export * from './wrappers';
export * from '../test/utils';

View File

@@ -0,0 +1,8 @@
/*
* -----------------------------------------------------------------------------
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
* -----------------------------------------------------------------------------
*/
export * from '../generated-wrappers/tec';
export * from '../generated-wrappers/test_libs';
export * from '../generated-wrappers/test_mixins';

View File

@@ -0,0 +1,17 @@
import { env, EnvVars } from '@0x/dev-utils';
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
before('start web3 provider', () => {
provider.start();
});
after('generate coverage report', async () => {
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
await coverageSubprovider.writeCoverageAsync();
}
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
await profilerSubprovider.writeProfilerOutputAsync();
}
provider.stop();
});

View File

@@ -0,0 +1,65 @@
import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { artifacts, hashUtils, TestLibsContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('Libs tests', () => {
let testLibs: TestLibsContract;
before(async () => {
await blockchainLifecycle.startAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
testLibs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('getTransactionHash', () => {
it('should return the correct transaction hash', async () => {
const tx = {
verifyingContractAddress: testLibs.address,
salt: new BigNumber(0),
signerAddress: constants.NULL_ADDRESS,
data: '0x1234',
};
const expectedTxHash = hashUtils.getTransactionHashHex(tx);
const txHash = await testLibs.publicGetTransactionHash.callAsync(tx);
expect(expectedTxHash).to.eq(txHash);
});
});
describe('getApprovalHash', () => {
it('should return the correct approval hash', async () => {
const signedTx = {
verifyingContractAddress: testLibs.address,
salt: new BigNumber(0),
signerAddress: constants.NULL_ADDRESS,
data: '0x1234',
signature: '0x5678',
};
const approvalExpirationTimeSeconds = new BigNumber(0);
const approval = {
transactionHash: hashUtils.getTransactionHashHex(signedTx),
transactionSignature: signedTx.signature,
approvalExpirationTimeSeconds,
};
const expectedApprovalHash = hashUtils.getApprovalHashHex(signedTx, approvalExpirationTimeSeconds);
const approvalHash = await testLibs.publicGetTECApprovalHash.callAsync(approval);
expect(expectedApprovalHash).to.eq(approvalHash);
});
});
});

View File

@@ -0,0 +1,714 @@
import {
chaiSetup,
constants as devConstants,
expectContractCallFailedAsync,
getLatestBlockTimestampAsync,
provider,
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as ethUtil from 'ethereumjs-util';
import {
ApprovalFactory,
artifacts,
constants,
exchangeDataEncoder,
hashUtils,
TECSignatureType,
TECTransactionFactory,
TestMixinsContract,
} from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
describe('Mixins tests', () => {
let transactionSignerAddress: string;
let approvalSignerAddress1: string;
let approvalSignerAddress2: string;
let mixins: TestMixinsContract;
let transactionFactory: TECTransactionFactory;
let approvalFactory1: ApprovalFactory;
let approvalFactory2: ApprovalFactory;
let defaultOrder: SignedOrder;
before(async () => {
await blockchainLifecycle.startAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
mixins = await TestMixinsContract.deployFrom0xArtifactAsync(artifacts.TestMixins, provider, txDefaults);
const accounts = await web3Wrapper.getAvailableAddressesAsync();
[transactionSignerAddress, approvalSignerAddress1, approvalSignerAddress2] = accounts.slice(0, 3);
defaultOrder = {
exchangeAddress: devConstants.NULL_ADDRESS,
makerAddress: devConstants.NULL_ADDRESS,
takerAddress: devConstants.NULL_ADDRESS,
senderAddress: mixins.address,
feeRecipientAddress: approvalSignerAddress1,
makerAssetData: devConstants.NULL_BYTES,
takerAssetData: devConstants.NULL_BYTES,
makerAssetAmount: devConstants.ZERO_AMOUNT,
takerAssetAmount: devConstants.ZERO_AMOUNT,
makerFee: devConstants.ZERO_AMOUNT,
takerFee: devConstants.ZERO_AMOUNT,
expirationTimeSeconds: devConstants.ZERO_AMOUNT,
salt: devConstants.ZERO_AMOUNT,
signature: devConstants.NULL_BYTES,
};
const transactionSignerPrivateKey =
devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(transactionSignerAddress)];
const approvalSignerPrivateKey1 = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(approvalSignerAddress1)];
const approvalSignerPrivateKey2 = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(approvalSignerAddress2)];
transactionFactory = new TECTransactionFactory(transactionSignerPrivateKey, mixins.address);
approvalFactory1 = new ApprovalFactory(approvalSignerPrivateKey1, mixins.address);
approvalFactory2 = new ApprovalFactory(approvalSignerPrivateKey2, mixins.address);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('getSignerAddress', () => {
it('should return the correct address using the EthSign signature type', async () => {
const data = devConstants.NULL_BYTES;
const transaction = transactionFactory.newSignedTECTransaction(data, TECSignatureType.EthSign);
const transactionHash = hashUtils.getTransactionHashHex(transaction);
const signerAddress = await mixins.getSignerAddress.callAsync(transactionHash, transaction.signature);
expect(transaction.signerAddress).to.eq(signerAddress);
});
it('should return the correct address using the EIP712 signature type', async () => {
const data = devConstants.NULL_BYTES;
const transaction = transactionFactory.newSignedTECTransaction(data, TECSignatureType.EIP712);
const transactionHash = hashUtils.getTransactionHashHex(transaction);
const signerAddress = await mixins.getSignerAddress.callAsync(transactionHash, transaction.signature);
expect(transaction.signerAddress).to.eq(signerAddress);
});
it('should revert with with the Illegal signature type', async () => {
const data = devConstants.NULL_BYTES;
const transaction = transactionFactory.newSignedTECTransaction(data);
const illegalSignatureByte = ethUtil.toBuffer(TECSignatureType.Illegal).toString('hex');
transaction.signature = `${transaction.signature.slice(
0,
transaction.signature.length - 2,
)}${illegalSignatureByte}`;
const transactionHash = hashUtils.getTransactionHashHex(transaction);
expectContractCallFailedAsync(
mixins.getSignerAddress.callAsync(transactionHash, transaction.signature),
RevertReason.SignatureIllegal,
);
});
it("should revert with with a signature type that doesn't exist", async () => {
const data = devConstants.NULL_BYTES;
const transaction = transactionFactory.newSignedTECTransaction(data);
const invalidSignatureByte = '03';
transaction.signature = `${transaction.signature.slice(
0,
transaction.signature.length - 2,
)}${invalidSignatureByte}`;
const transactionHash = hashUtils.getTransactionHashHex(transaction);
expectContractCallFailedAsync(
mixins.getSignerAddress.callAsync(transactionHash, transaction.signature),
RevertReason.SignatureUnsupported,
);
});
});
describe('Single order approvals', () => {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1], expiration=[valid]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName}, caller=tx_signer, senderAddress=[null], approval_sig=[approver1], expiration=[valid]`, async () => {
const order = {
...defaultOrder,
senderAddress: devConstants.NULL_ADDRESS,
};
const orders = [order];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName}, caller=approver1, senderAddress=[verifier], approval_sig=[], expiration=[]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: approvalSignerAddress1,
});
});
it(`Should be successful: function=${fnName}, caller=approver1, senderAddress=[verifier], approval_sig=[approver1], expiration=[invalid]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress1 },
);
});
it(`Should be successful: function=${fnName}, caller=approver1, senderAddress=[verifier], approval_sig=[], expiration=[]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: approvalSignerAddress1,
});
});
it(`Should revert: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[invalid], expiration=[valid]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`Should revert: function=${fnName}, caller=tx_signer, senderAddress=[verifier], approval_sig=[approver1], expiration=[invalid]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).minus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
});
it(`Should revert: function=${fnName}, caller=approver2, senderAddress=[verifier], approval_sig=[approver1], expiration=[valid]`, async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidSender,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidSender,
);
});
}
});
describe('Batch order approvals', () => {
for (const fnName of [
...constants.BATCH_FILL_FN_NAMES,
...constants.MARKET_FILL_FN_NAMES,
constants.MATCH_ORDERS,
]) {
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver1], approval_sig=[approver1], expiration=[valid]`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[null,null], feeRecipient=[approver1,approver1], approval_sig=[approver1], expiration=[valid]`, async () => {
const orders = [defaultOrder, defaultOrder].map(order => ({
...order,
senderAddress: devConstants.NULL_ADDRESS,
}));
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[null,null], feeRecipient=[approver1,approver1], approval_sig=[], expiration=[]`, async () => {
const orders = [defaultOrder, defaultOrder].map(order => ({
...order,
senderAddress: devConstants.NULL_ADDRESS,
}));
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[],
[],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: transactionSignerAddress,
});
});
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[verifier,null], feeRecipient=[approver1,approver1], approval_sig=[approver1], expiration=[valid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, senderAddress: devConstants.NULL_ADDRESS }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver2], approval_sig=[approver1,approver2], expiration=[valid,valid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval1 = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
);
});
it(`Should be successful: function=${fnName} caller=approver1, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver1], approval_sig=[], expiration=[]`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[],
[],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: approvalSignerAddress1,
});
});
it(`Should be successful: function=${fnName} caller=approver1, senderAddress=[verifier,verifier], feeRecipient=[approver1,approver2], approval_sig=[approver2], expiration=[valid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
);
await mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
);
});
it(`Should revert: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver1], approval_sig=[], expiration=[]`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[],
[],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: transactionSignerAddress,
}),
RevertReason.InvalidApprovalSignature,
);
});
it(`Should revert: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver1], approval_sig=[invalid], expiration=[valid]`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`Should revert: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver2], approval_sig=[valid,invalid], expiration=[valid,valid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval1 = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approvalSignature2],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds, approvalExpirationTimeSeconds],
[approval1.signature, approvalSignature2],
{ from: transactionSignerAddress },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`Should revert: function=${fnName} caller=approver1, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver2], approval_sig=[invalid], expiration=[valid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const approvalSignature2 = `${approval2.signature.slice(0, 4)}FFFFFFFF${approval2.signature.slice(12)}`;
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approvalSignature2],
{ from: approvalSignerAddress1 },
),
RevertReason.InvalidApprovalSignature,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approvalSignature2],
{ from: approvalSignerAddress1 },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`Should revert: function=${fnName} caller=tx_signer, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver2], approval_sig=[valid,valid], expiration=[valid,invalid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds1 = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approvalExpirationTimeSeconds2 = new BigNumber(currentTimestamp).minus(constants.TIME_BUFFER);
const approval1 = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds1);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds2);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds1, approvalExpirationTimeSeconds2],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds1, approvalExpirationTimeSeconds2],
[approval1.signature, approval2.signature],
{ from: transactionSignerAddress },
),
RevertReason.ApprovalExpired,
);
});
it(`Should revert: function=${fnName} caller=approver1, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver2], approval_sig=[valid], expiration=[invalid]`, async () => {
const orders = [defaultOrder, { ...defaultOrder, feeRecipientAddress: approvalSignerAddress2 }];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).minus(constants.TIME_BUFFER);
const approval2 = approvalFactory2.newSignedApproval(transaction, approvalExpirationTimeSeconds);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
),
RevertReason.ApprovalExpired,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval2.signature],
{ from: approvalSignerAddress1 },
),
RevertReason.ApprovalExpired,
);
});
it(`Should revert: function=${fnName} caller=approver2, senderAddress=[verifier,verifier], feeRecipient=[approver1, approver1], approval_sig=[valid], expiration=[valid]`, async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval1 = approvalFactory1.newSignedApproval(transaction, approvalExpirationTimeSeconds);
expectContractCallFailedAsync(
mixins.assertValidTransactionOrdersApproval.callAsync(
transaction,
orders,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval1.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidSender,
);
expectContractCallFailedAsync(
mixins.assertValidTECApprovals.callAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval1.signature],
{ from: approvalSignerAddress2 },
),
RevertReason.InvalidSender,
);
});
}
});
describe('cancels', () => {
it('should allow the tx signer to call `cancelOrders` without approval', async () => {
const orders = [defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: transactionSignerAddress,
});
});
it('should allow the tx signer to call `batchCancelOrders` without approval', async () => {
const orders = [defaultOrder, defaultOrder];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.BATCH_CANCEL_ORDERS, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: transactionSignerAddress,
});
});
it('should allow the tx signer to call `cancelOrdersUpTo` without approval', async () => {
const orders: SignedOrder[] = [];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS_UP_TO, orders);
const transaction = transactionFactory.newSignedTECTransaction(data);
await mixins.assertValidTECApprovals.callAsync(transaction, transaction.signature, [], [], {
from: transactionSignerAddress,
});
});
});
});
// tslint:disable:max-file-line-count

449
contracts/tec/test/tec.ts Normal file
View File

@@ -0,0 +1,449 @@
import { DummyERC20TokenContract, ERC20ProxyContract, ERC20Wrapper } from '@0x/contracts-asset-proxy';
import {
artifacts as exchangeArtifacts,
ExchangeCancelEventArgs,
ExchangeCancelUpToEventArgs,
ExchangeContract,
ExchangeFillEventArgs,
} from '@0x/contracts-exchange';
import {
chaiSetup,
constants as devConstants,
expectTransactionFailedAsync,
getLatestBlockTimestampAsync,
OrderFactory,
provider,
TransactionFactory,
txDefaults,
web3Wrapper,
} from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import { LogWithDecodedArgs } from 'ethereum-types';
import { ApprovalFactory, artifacts, constants, exchangeDataEncoder, TECContract } from '../src';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
web3Wrapper.abiDecoder.addABI(exchangeArtifacts.Exchange.compilerOutput.abi);
// tslint:disable:no-unnecessary-type-assertion
describe('TEC tests', () => {
let makerAddress: string;
let owner: string;
let takerAddress: string;
let feeRecipientAddress: string;
let erc20Proxy: ERC20ProxyContract;
let erc20TokenA: DummyERC20TokenContract;
let erc20TokenB: DummyERC20TokenContract;
let zrxToken: DummyERC20TokenContract;
let tecContract: TECContract;
let exchange: ExchangeContract;
let erc20Wrapper: ERC20Wrapper;
let orderFactory: OrderFactory;
let takerTransactionFactory: TransactionFactory;
let makerTransactionFactory: TransactionFactory;
let approvalFactory: ApprovalFactory;
before(async () => {
await blockchainLifecycle.startAsync();
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
before(async () => {
const accounts = await web3Wrapper.getAvailableAddressesAsync();
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts.slice(0, 4));
erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
erc20Proxy = await erc20Wrapper.deployProxyAsync();
const numDummyErc20ToDeploy = 3;
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
numDummyErc20ToDeploy,
devConstants.DUMMY_TOKEN_DECIMALS,
);
await erc20Wrapper.setBalancesAndAllowancesAsync();
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
exchangeArtifacts.Exchange,
provider,
txDefaults,
assetDataUtils.encodeERC20AssetData(zrxToken.address),
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
tecContract = await TECContract.deployFrom0xArtifactAsync(
artifacts.TEC,
provider,
txDefaults,
exchange.address,
);
// Configure order defaults
const defaultOrderParams = {
...devConstants.STATIC_ORDER_PARAMS,
exchangeAddress: exchange.address,
senderAddress: tecContract.address,
makerAddress,
feeRecipientAddress,
makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
takerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
};
const makerPrivateKey = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
const takerPrivateKey = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
const feeRecipientPrivateKey = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(feeRecipientAddress)];
orderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
makerTransactionFactory = new TransactionFactory(makerPrivateKey, exchange.address);
takerTransactionFactory = new TransactionFactory(takerPrivateKey, exchange.address);
approvalFactory = new ApprovalFactory(feeRecipientPrivateKey, tecContract.address);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('single order fills', () => {
for (const fnName of constants.SINGLE_FILL_FN_NAMES) {
it(`${fnName} should fill the order with a signed approval`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: takerAddress },
),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
const fillLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
);
expect(fillLogs.length).to.eq(1);
const fillLogArgs = (fillLogs[0] as LogWithDecodedArgs<ExchangeFillEventArgs>).args;
expect(fillLogArgs.makerAddress).to.eq(makerAddress);
expect(fillLogArgs.takerAddress).to.eq(takerAddress);
expect(fillLogArgs.senderAddress).to.eq(tecContract.address);
expect(fillLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(fillLogArgs.makerAssetData).to.eq(orders[0].makerAssetData);
expect(fillLogArgs.takerAssetData).to.eq(orders[0].takerAssetData);
expect(fillLogArgs.makerAssetFilledAmount).to.bignumber.eq(orders[0].makerAssetAmount);
expect(fillLogArgs.takerAssetFilledAmount).to.bignumber.eq(orders[0].takerAssetAmount);
expect(fillLogArgs.makerFeePaid).to.bignumber.eq(orders[0].makerFee);
expect(fillLogArgs.takerFeePaid).to.bignumber.eq(orders[0].takerFee);
expect(fillLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(orders[0]));
});
it(`${fnName} should fill the order if called by approver`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[],
[],
{ from: feeRecipientAddress },
),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
const fillLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
);
expect(fillLogs.length).to.eq(1);
const fillLogArgs = (fillLogs[0] as LogWithDecodedArgs<ExchangeFillEventArgs>).args;
expect(fillLogArgs.makerAddress).to.eq(makerAddress);
expect(fillLogArgs.takerAddress).to.eq(takerAddress);
expect(fillLogArgs.senderAddress).to.eq(tecContract.address);
expect(fillLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(fillLogArgs.makerAssetData).to.eq(orders[0].makerAssetData);
expect(fillLogArgs.takerAssetData).to.eq(orders[0].takerAssetData);
expect(fillLogArgs.makerAssetFilledAmount).to.bignumber.eq(orders[0].makerAssetAmount);
expect(fillLogArgs.takerAssetFilledAmount).to.bignumber.eq(orders[0].takerAssetAmount);
expect(fillLogArgs.makerFeePaid).to.bignumber.eq(orders[0].makerFee);
expect(fillLogArgs.takerFeePaid).to.bignumber.eq(orders[0].takerFee);
expect(fillLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(orders[0]));
});
it(`${fnName} should revert with no approval signature`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(transaction, transaction.signature, [], [], {
from: takerAddress,
gas: devConstants.MAX_EXECUTE_TRANSACTION_GAS,
}),
RevertReason.InvalidApprovalSignature,
);
});
it(`${fnName} should revert with an invalid approval signature`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: takerAddress },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`${fnName} should revert with an expired approval`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).minus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: takerAddress },
),
RevertReason.ApprovalExpired,
);
});
it(`${fnName} should revert if not called by tx signer or approver`, async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: owner },
),
RevertReason.InvalidSender,
);
});
}
});
describe('batch order fills', () => {
for (const fnName of [...constants.MARKET_FILL_FN_NAMES, ...constants.BATCH_FILL_FN_NAMES]) {
it(`${fnName} should fill the orders with a signed approval`, async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: takerAddress, gas: devConstants.MAX_EXECUTE_TRANSACTION_GAS },
),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
const fillLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
);
expect(fillLogs.length).to.eq(orders.length);
orders.forEach((order, index) => {
const fillLogArgs = (fillLogs[index] as LogWithDecodedArgs<ExchangeFillEventArgs>).args;
expect(fillLogArgs.makerAddress).to.eq(makerAddress);
expect(fillLogArgs.takerAddress).to.eq(takerAddress);
expect(fillLogArgs.senderAddress).to.eq(tecContract.address);
expect(fillLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(fillLogArgs.makerAssetData).to.eq(order.makerAssetData);
expect(fillLogArgs.takerAssetData).to.eq(order.takerAssetData);
expect(fillLogArgs.makerAssetFilledAmount).to.bignumber.eq(order.makerAssetAmount);
expect(fillLogArgs.takerAssetFilledAmount).to.bignumber.eq(order.takerAssetAmount);
expect(fillLogArgs.makerFeePaid).to.bignumber.eq(order.makerFee);
expect(fillLogArgs.takerFeePaid).to.bignumber.eq(order.takerFee);
expect(fillLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(order));
});
});
it(`${fnName} should fill the orders if called by approver`, async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[],
[],
{ from: feeRecipientAddress, gas: devConstants.MAX_EXECUTE_TRANSACTION_GAS },
),
devConstants.AWAIT_TRANSACTION_MINED_MS,
);
const fillLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
);
expect(fillLogs.length).to.eq(orders.length);
orders.forEach((order, index) => {
const fillLogArgs = (fillLogs[index] as LogWithDecodedArgs<ExchangeFillEventArgs>).args;
expect(fillLogArgs.makerAddress).to.eq(makerAddress);
expect(fillLogArgs.takerAddress).to.eq(takerAddress);
expect(fillLogArgs.senderAddress).to.eq(tecContract.address);
expect(fillLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(fillLogArgs.makerAssetData).to.eq(order.makerAssetData);
expect(fillLogArgs.takerAssetData).to.eq(order.takerAssetData);
expect(fillLogArgs.makerAssetFilledAmount).to.bignumber.eq(order.makerAssetAmount);
expect(fillLogArgs.takerAssetFilledAmount).to.bignumber.eq(order.takerAssetAmount);
expect(fillLogArgs.makerFeePaid).to.bignumber.eq(order.makerFee);
expect(fillLogArgs.takerFeePaid).to.bignumber.eq(order.takerFee);
expect(fillLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(order));
});
});
it(`${fnName} should revert with an invalid approval signature`, async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
const signature = `${approval.signature.slice(0, 4)}FFFFFFFF${approval.signature.slice(12)}`;
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[signature],
{ from: takerAddress },
),
RevertReason.InvalidApprovalSignature,
);
});
it(`${fnName} should revert with an expired approval`, async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).minus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: takerAddress },
),
RevertReason.ApprovalExpired,
);
});
it(`${fnName} should revert if not called by tx signer or approver`, async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(fnName, orders);
const transaction = takerTransactionFactory.newSignedTransaction(data);
const currentTimestamp = await getLatestBlockTimestampAsync();
const approvalExpirationTimeSeconds = new BigNumber(currentTimestamp).plus(constants.TIME_BUFFER);
const approval = approvalFactory.newSignedApproval(transaction, approvalExpirationTimeSeconds);
await expectTransactionFailedAsync(
tecContract.executeTransaction.sendTransactionAsync(
transaction,
transaction.signature,
[approvalExpirationTimeSeconds],
[approval.signature],
{ from: owner },
),
RevertReason.InvalidSender,
);
});
}
});
describe('cancels', () => {
it('cancelOrder call should be successful without an approval', async () => {
const orders = [await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS, orders);
const transaction = makerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(transaction, transaction.signature, [], [], {
from: makerAddress,
}),
);
const cancelLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeCancelEventArgs>).event === 'Cancel',
);
expect(cancelLogs.length).to.eq(1);
const cancelLogArgs = (cancelLogs[0] as LogWithDecodedArgs<ExchangeCancelEventArgs>).args;
expect(cancelLogArgs.makerAddress).to.eq(makerAddress);
expect(cancelLogArgs.senderAddress).to.eq(tecContract.address);
expect(cancelLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(cancelLogArgs.makerAssetData).to.eq(orders[0].makerAssetData);
expect(cancelLogArgs.takerAssetData).to.eq(orders[0].takerAssetData);
expect(cancelLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(orders[0]));
});
it('batchCancelOrders call should be successful without an approval', async () => {
const orders = [await orderFactory.newSignedOrderAsync(), await orderFactory.newSignedOrderAsync()];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.BATCH_CANCEL_ORDERS, orders);
const transaction = makerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(transaction, transaction.signature, [], [], {
from: makerAddress,
}),
);
const cancelLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeCancelEventArgs>).event === 'Cancel',
);
expect(cancelLogs.length).to.eq(orders.length);
orders.forEach((order, index) => {
const cancelLogArgs = (cancelLogs[index] as LogWithDecodedArgs<ExchangeCancelEventArgs>).args;
expect(cancelLogArgs.makerAddress).to.eq(makerAddress);
expect(cancelLogArgs.senderAddress).to.eq(tecContract.address);
expect(cancelLogArgs.feeRecipientAddress).to.eq(feeRecipientAddress);
expect(cancelLogArgs.makerAssetData).to.eq(order.makerAssetData);
expect(cancelLogArgs.takerAssetData).to.eq(order.takerAssetData);
expect(cancelLogArgs.orderHash).to.eq(orderHashUtils.getOrderHashHex(order));
});
});
it('cancelOrdersUpTo call should be successful without an approval', async () => {
const orders: SignedOrder[] = [];
const data = exchangeDataEncoder.encodeOrdersToExchangeData(constants.CANCEL_ORDERS_UP_TO, orders);
const transaction = makerTransactionFactory.newSignedTransaction(data);
const transactionReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
await tecContract.executeTransaction.sendTransactionAsync(transaction, transaction.signature, [], [], {
from: makerAddress,
}),
);
const cancelLogs = transactionReceipt.logs.filter(
log => (log as LogWithDecodedArgs<ExchangeCancelUpToEventArgs>).event === 'CancelUpTo',
);
expect(cancelLogs.length).to.eq(1);
const cancelLogArgs = (cancelLogs[0] as LogWithDecodedArgs<ExchangeCancelUpToEventArgs>).args;
expect(cancelLogArgs.makerAddress).to.eq(makerAddress);
expect(cancelLogArgs.senderAddress).to.eq(tecContract.address);
expect(cancelLogArgs.orderEpoch).to.bignumber.eq(new BigNumber(1));
});
});
});

View File

@@ -0,0 +1,32 @@
import { SignedZeroExTransaction } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as ethUtil from 'ethereumjs-util';
import { hashUtils, SignedTECApproval, signingUtils, TECSignatureType } from './index';
export class ApprovalFactory {
private readonly _privateKey: Buffer;
private readonly _verifyingContractAddress: string;
constructor(privateKey: Buffer, verifyingContractAddress: string) {
this._privateKey = privateKey;
this._verifyingContractAddress = verifyingContractAddress;
}
public newSignedApproval(
transaction: SignedZeroExTransaction,
approvalExpirationTimeSeconds: BigNumber,
signatureType: TECSignatureType = TECSignatureType.EthSign,
): SignedTECApproval {
const tecTransaction = {
...transaction,
verifyingContractAddress: this._verifyingContractAddress,
};
const approvalHashBuff = hashUtils.getApprovalHashBuffer(tecTransaction, approvalExpirationTimeSeconds);
const signatureBuff = signingUtils.signMessage(approvalHashBuff, this._privateKey, signatureType);
const signedApproval = {
transaction: tecTransaction,
approvalExpirationTimeSeconds,
signature: ethUtil.addHexPrefix(signatureBuff.toString('hex')),
};
return signedApproval;
}
}

View File

@@ -0,0 +1,22 @@
import { BigNumber } from '@0x/utils';
export const constants = {
TEC_DOMAIN_NAME: '0x Protocol Trade Execution Coordinator',
TEC_DOMAIN_VERSION: '1.0.0',
TEC_APPROVAL_SCHEMA: {
name: 'TECApproval',
parameters: [
{ name: 'transactionHash', type: 'bytes32' },
{ name: 'transactionSignature', type: 'bytes' },
{ name: 'approvalExpirationTimeSeconds', type: 'uint256' },
],
},
SINGLE_FILL_FN_NAMES: ['fillOrder', 'fillOrKillOrder', 'fillOrderNoThrow'],
BATCH_FILL_FN_NAMES: ['batchFillOrders', 'batchFillOrKillOrders', 'batchFillOrdersNoThrow'],
MARKET_FILL_FN_NAMES: ['marketBuyOrders', 'marketBuyOrdersNoThrow', 'marketSellOrders', 'marketSellOrdersNoThrow'],
MATCH_ORDERS: 'matchOrders',
CANCEL_ORDERS: 'cancelOrders',
BATCH_CANCEL_ORDERS: 'batchCancelOrders',
CANCEL_ORDERS_UP_TO: 'cancelOrdersUpTo',
TIME_BUFFER: new BigNumber(1000),
};

View File

@@ -0,0 +1,51 @@
import { artifacts, IExchangeContract } from '@0x/contracts-exchange';
import { constants as devConstants, provider } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/types';
import { constants } from './index';
export const exchangeDataEncoder = {
encodeOrdersToExchangeData(fnName: string, orders: SignedOrder[]): string {
const exchangeInstance = new IExchangeContract(
artifacts.IExchange.compilerOutput.abi,
devConstants.NULL_ADDRESS,
provider,
);
let data;
if (constants.SINGLE_FILL_FN_NAMES.indexOf(fnName) !== -1) {
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders[0],
orders[0].takerAssetAmount,
orders[0].signature,
);
} else if (constants.BATCH_FILL_FN_NAMES.indexOf(fnName) !== -1) {
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders,
orders.map(order => order.takerAssetAmount),
orders.map(order => order.signature),
);
} else if (constants.MARKET_FILL_FN_NAMES.indexOf(fnName) !== -1) {
data = (exchangeInstance as any)[fnName].getABIEncodedTransactionData(
orders,
orders.map(order => order.takerAssetAmount).reduce((prev, curr) => prev.plus(curr)),
orders.map(order => order.signature),
);
} else if (fnName === constants.MATCH_ORDERS) {
data = exchangeInstance.matchOrders.getABIEncodedTransactionData(
orders[0],
orders[1],
orders[0].signature,
orders[1].signature,
);
} else if (fnName === constants.CANCEL_ORDERS) {
data = exchangeInstance.cancelOrder.getABIEncodedTransactionData(orders[0]);
} else if (fnName === constants.BATCH_CANCEL_ORDERS) {
data = exchangeInstance.batchCancelOrders.getABIEncodedTransactionData(orders);
} else if (fnName === constants.CANCEL_ORDERS_UP_TO) {
data = exchangeInstance.cancelOrdersUpTo.getABIEncodedTransactionData(devConstants.ZERO_AMOUNT);
} else {
throw new Error(`Error: ${fnName} not a supported function`);
}
return data;
},
};

View File

@@ -0,0 +1,61 @@
import { eip712Utils } from '@0x/order-utils';
import { constants as orderUtilsConstants } from '@0x/order-utils/lib/src/constants';
import { SignedZeroExTransaction, ZeroExTransaction } from '@0x/types';
import { BigNumber, signTypedDataUtils } from '@0x/utils';
import * as _ from 'lodash';
import { constants } from './index';
export const hashUtils = {
getApprovalHashBuffer(transaction: SignedZeroExTransaction, approvalExpirationTimeSeconds: BigNumber): Buffer {
const domain = {
name: constants.TEC_DOMAIN_NAME,
version: constants.TEC_DOMAIN_VERSION,
verifyingContractAddress: transaction.verifyingContractAddress,
};
const transactionHash = hashUtils.getTransactionHashHex(transaction);
const approval = {
transactionHash,
transactionSignature: transaction.signature,
approvalExpirationTimeSeconds: approvalExpirationTimeSeconds.toString(),
};
const typedData = eip712Utils.createTypedData(
constants.TEC_APPROVAL_SCHEMA.name,
{
TECApproval: constants.TEC_APPROVAL_SCHEMA.parameters,
},
approval,
domain,
);
const hashBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
return hashBuffer;
},
getApprovalHashHex(transaction: SignedZeroExTransaction, approvalExpirationTimeSeconds: BigNumber): string {
const hashHex = `0x${hashUtils
.getApprovalHashBuffer(transaction, approvalExpirationTimeSeconds)
.toString('hex')}`;
return hashHex;
},
getTransactionHashBuffer(transaction: ZeroExTransaction | SignedZeroExTransaction): Buffer {
const domain = {
name: constants.TEC_DOMAIN_NAME,
version: constants.TEC_DOMAIN_VERSION,
verifyingContractAddress: transaction.verifyingContractAddress,
};
const normalizedTransaction = _.mapValues(transaction, value => {
return !_.isString(value) ? value.toString() : value;
});
const typedData = eip712Utils.createTypedData(
orderUtilsConstants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name,
{ ZeroExTransaction: orderUtilsConstants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.parameters },
normalizedTransaction,
domain,
);
const hashBuffer = signTypedDataUtils.generateTypedDataHash(typedData);
return hashBuffer;
},
getTransactionHashHex(transaction: ZeroExTransaction | SignedZeroExTransaction): string {
const hashHex = `0x${hashUtils.getTransactionHashBuffer(transaction).toString('hex')}`;
return hashHex;
},
};

View File

@@ -0,0 +1,7 @@
export { hashUtils } from './hash_utils';
export { signingUtils } from './signing_utils';
export { TECTransactionFactory } from './tec_transaction_factory';
export { ApprovalFactory } from './approval_factory';
export { constants } from './constants';
export { exchangeDataEncoder } from './exchange_data_encoder';
export * from './types';

View File

@@ -0,0 +1,30 @@
import * as ethUtil from 'ethereumjs-util';
import { TECSignatureType } from './types';
export const signingUtils = {
signMessage(message: Buffer, privateKey: Buffer, signatureType: TECSignatureType): Buffer {
if (signatureType === TECSignatureType.EthSign) {
const prefixedMessage = ethUtil.hashPersonalMessage(message);
const ecSignature = ethUtil.ecsign(prefixedMessage, privateKey);
const signature = Buffer.concat([
ethUtil.toBuffer(ecSignature.v),
ecSignature.r,
ecSignature.s,
ethUtil.toBuffer(signatureType),
]);
return signature;
} else if (signatureType === TECSignatureType.EIP712) {
const ecSignature = ethUtil.ecsign(message, privateKey);
const signature = Buffer.concat([
ethUtil.toBuffer(ecSignature.v),
ecSignature.r,
ecSignature.s,
ethUtil.toBuffer(signatureType),
]);
return signature;
} else {
throw new Error(`${signatureType} is not a valid signature type`);
}
},
};

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