Compare commits

..

124 Commits

Author SHA1 Message Date
Fabio Berger
5b7eff217e Publish
- 0x.js@3.0.0
 - @0x/abi-gen@1.0.20
 - @0x/abi-gen-wrappers@2.1.0
 - @0x/assert@1.0.21
 - @0x/asset-buyer@3.0.5
 - @0x/base-contract@3.0.11
 - @0x/connect@3.0.11
 - @0x/contract-addresses@2.1.0
 - @0x/contract-artifacts@1.2.0
 - @0x/contract-wrappers@4.2.0
 - @0x/dev-tools-pages@0.0.11
 - @0x/dev-utils@1.0.22
 - @0x/fill-scenarios@1.1.0
 - @0x/instant@1.0.5
 - @0x/json-schemas@2.1.5
 - @0x/metacoin@0.0.33
 - @0x/migrations@2.3.0
 - @0x/monorepo-scripts@1.0.16
 - @0x/order-utils@3.1.0
 - @0x/order-watcher@2.4.0
 - @0x/pipeline@1.0.3
 - @0x/react-docs@1.0.23
 - @0x/react-shared@1.1.0
 - @0x/sol-compiler@2.0.0
 - @0x/sol-cov@2.1.17
 - @0x/sol-doc@1.0.12
 - @0x/sol-resolver@1.2.1
 - @0x/sra-spec@1.0.14
 - @0x/subproviders@2.1.9
 - @0x/testnet-faucets@1.0.61
 - @0x/types@1.5.0
 - @0x/utils@2.1.1
 - @0x/web3-wrapper@3.2.2
 - @0x/website@0.0.64
 - @0x/contracts-examples@1.0.3
 - @0x/contracts-extensions@1.2.0
 - @0x/contracts-interfaces@1.0.3
 - @0x/contracts-libs@1.0.3
 - @0x/contracts-multisig@1.0.3
 - @0x/contracts-protocol@2.2.0
 - @0x/contracts-test-utils@1.0.3
 - @0x/contracts-tokens@1.0.3
 - @0x/contracts-utils@1.0.3
2019-01-09 14:44:17 +01:00
Fabio Berger
0a6ead90d9 Updated CHANGELOGS 2019-01-09 14:44:03 +01:00
Leonid Logvinov
2fa4ed1fb7 Merge pull request #1496 from 0xProject/feature/solc-5.0
Solc 5.0 support in sol-compiler
2019-01-09 13:22:20 +01:00
Leonid Logvinov
3733a29ee2 Add CHENGELOG entrie 2019-01-09 12:46:51 +01:00
Leonid Logvinov
62b5eef4a0 Update sol-compiler binPaths to include the newest solidity 2019-01-09 12:36:05 +01:00
Leonid Logvinov
377d6367e0 Update solc used by sol-compiler 2019-01-09 12:35:35 +01:00
Leonid Logvinov
a3b364dbdf Remove contracts dependency on solc 2019-01-09 12:34:45 +01:00
Fabio B
5dd55491b8 Merge pull request #1494 from 0xProject/feature/order-watcher/dockerize
Dockerize OrderWatcher WS Server
2019-01-09 11:27:22 +01:00
Fabio Berger
28aa12691e rename method 2019-01-09 11:06:15 +01:00
Jacob Evans
c1bf2754a8 Merge pull request #1439 from 0xProject/migrations/docker-image
Add Docker image and Snapshot commands for migrations
2019-01-09 12:55:42 +11:00
Chris Kalani
c388e6d2b8 Update README.md 2019-01-08 17:15:20 -08:00
Chris Kalani
622fa951ca Update README.md
Fixing logo
2019-01-08 17:13:04 -08:00
Xianny
27fc640a9e fetch and save copper (#1472)
Fetch and save Copper CRM
2019-01-08 13:50:51 -08:00
F. Eugene Aumson
4689f20b86 Move json_schemas to its own package (#1435)
* Move zero_ex.json_schemas to its own package

* Support ALL the schemas

* Stop installing packages as editable

* HACK: cp files because CircleCI isn't

* Add example usage to sra_client README

* Tweak special case: only strip Schema as suffix

* Correct doc titles

* Clarify what kind of support ticket was raised.

* Correct inconsistencies in JSON schema names

In both ref ID's and file names.

* Add entry point for validation of JSON strings
2019-01-08 14:28:32 -05:00
Fabio Berger
de927d7207 Merge branch 'development' of github.com:0xProject/0x-monorepo into development
* 'development' of github.com:0xProject/0x-monorepo:
  Remove beta note from asset-buyer
2019-01-08 20:16:48 +01:00
Fabio Berger
93121892d6 Fix typo 2019-01-08 20:16:34 +01:00
Francesco Agosti
c3a7cbc57d Merge pull request #1493 from 0xProject/fix/asset-buyer/no-longer-beta
[asset-buyer] Remove beta note from asset-buyer
2019-01-08 18:33:53 +00:00
Fabio Berger
0cfeea7c8c Remove stray console 2019-01-08 17:15:05 +01:00
Fabio Berger
e2df4b355b Add assertions to catch trying to add undefined schemas 2019-01-08 17:07:10 +01:00
Steve Klebanoff
74ed0f4134 Remove beta note from asset-buyer 2019-01-08 08:02:33 -08:00
Fabio Berger
5e39eae84e Fixx request payload and expected responses 2019-01-08 15:37:50 +01:00
Fabio Berger
0ea8669552 Fixx OrderWatcher WS tests so they are completely independent from one another 2019-01-08 15:37:14 +01:00
Fabio Berger
1631031fa7 Merge branch 'development' into feature/order-watcher/dockerize
* development: (898 commits)
  Fixed merge conflict from development
  Ran prettier
  Doc generation working for changes by dutch auction wrapper
  added changelog entry for monorepo-scripts
  Hide dutch auction wrapper from docs -- hopefully this will prevent the "must export Web3Wrapper" error from doc generation
  relaxed version on contract-extension dependencies
  Added NetworkID 50 address for dutch auction wrapper
  removed manual updte of package.json version
  export dutch auction wrapper types from 0x.js
  Export dutch auction wrapper in 0x.js
  ran prettier
  Minor documentation updates to dutch auction wrapper
  `afterAuctionDetails` -> `auctionDetails`
  Added @todo for including dutch auction addresses once deployed
  Ran prettier & linter
  Removed redundant assignment
  removed needless newline on contract-wrappers changelog
  removed timestamp from changelog for abi-gen-wrappers
  added dutch auction address for testnets
  removed .only
  ...
2019-01-08 14:30:38 +01:00
Fabio Berger
0bcb81d3a9 Create server entry point and Dockerfile for OrderWatcher 2019-01-08 14:29:45 +01:00
Greg Hysen
0ac36cef28 Merge pull request #1465 from 0xProject/feature/contracts/dutchAuctionWrapper
Dutch Auction Wrapper
2019-01-07 17:16:06 -07:00
Greg Hysen
04db7f0fae Fixed merge conflict from development 2019-01-07 15:50:48 -08:00
Greg Hysen
e39ae0350b Ran prettier 2019-01-07 15:50:48 -08:00
Greg Hysen
d0a0673694 Doc generation working for changes by dutch auction wrapper 2019-01-07 15:50:48 -08:00
Greg Hysen
3c62815fe3 added changelog entry for monorepo-scripts 2019-01-07 15:50:48 -08:00
Greg Hysen
37b6858869 Hide dutch auction wrapper from docs -- hopefully this will prevent the "must export Web3Wrapper" error from doc generation 2019-01-07 15:50:48 -08:00
Greg Hysen
641685a41e relaxed version on contract-extension dependencies 2019-01-07 15:50:48 -08:00
Greg Hysen
7ad23ef6dc Added NetworkID 50 address for dutch auction wrapper 2019-01-07 15:50:48 -08:00
Greg Hysen
5f2a7cb78f removed manual updte of package.json version 2019-01-07 15:50:48 -08:00
Greg Hysen
edb989fbf3 export dutch auction wrapper types from 0x.js 2019-01-07 15:50:48 -08:00
Greg Hysen
ff0093460d Export dutch auction wrapper in 0x.js 2019-01-07 15:50:48 -08:00
Greg Hysen
a00e416a19 ran prettier 2019-01-07 15:50:48 -08:00
Greg Hysen
77a2ca1ddc Minor documentation updates to dutch auction wrapper 2019-01-07 15:50:48 -08:00
Greg Hysen
61a3368826 afterAuctionDetails -> auctionDetails 2019-01-07 15:50:48 -08:00
Greg Hysen
55e3774480 Added @todo for including dutch auction addresses once deployed 2019-01-07 15:50:48 -08:00
Greg Hysen
c6ab380685 Ran prettier & linter 2019-01-07 15:50:48 -08:00
Greg Hysen
d6467d707f Removed redundant assignment 2019-01-07 15:50:48 -08:00
Greg Hysen
0893614859 removed needless newline on contract-wrappers changelog 2019-01-07 15:50:48 -08:00
Greg Hysen
dc940d692f removed timestamp from changelog for abi-gen-wrappers 2019-01-07 15:50:48 -08:00
Greg Hysen
e83a108c52 added dutch auction address for testnets 2019-01-07 15:50:48 -08:00
Greg Hysen
bbd4828340 removed .only 2019-01-07 15:50:48 -08:00
Greg Hysen
6de3a33f36 updated relevant changelogs 2019-01-07 15:50:48 -08:00
Greg Hysen
06139cbfe5 Added dutch auction utils to contract-wrappers 2019-01-07 15:50:48 -08:00
Greg Hysen
cb1bfa0f97 ran prettier + added changelog entry for contract wrappers 2019-01-07 15:50:48 -08:00
Greg Hysen
b249a50d8f ran prettier 2019-01-07 15:50:48 -08:00
Greg Hysen
0432212a34 dutch wrapper tests working 2019-01-07 15:50:48 -08:00
Greg Hysen
7203ca90cf all dutchie wrapper tests passing 2019-01-07 15:50:48 -08:00
Greg Hysen
5da748a062 Progress on dutch auction wrapper. Need to add auction data decoding to it. 2019-01-07 15:50:48 -08:00
Greg Hysen
09afee55ed Removed unnecessary fields from dutch auction artifacts 2019-01-07 15:50:48 -08:00
Greg Hysen
43b648e7dc Dutch wrapper 2019-01-07 15:50:48 -08:00
Greg Hysen
89fcbec43b changed name for confusion 2019-01-07 15:50:48 -08:00
Greg Hysen
c850046ea0 Dutch Auction Contract Wrapper 2019-01-07 15:50:48 -08:00
Alex Browne
7dda953bc9 Optimize SQL queries in pull_missing_blocks (#1458)
* Optimize SQL queries in pull_missing_blocks

* Update comment in pull_missing_blocks
2019-01-07 15:04:00 -08:00
Brandon Millman
b8f3fa9c8c chore(website): update copy on market making page 2019-01-07 13:21:42 -08:00
Brandon Millman
42e04012df fix(website): fix some copy on the market maker page 2019-01-07 13:03:45 -08:00
Brandon Millman
17f0878707 Merge pull request #1487 from 0xProject/feature/website/market-maker-page
[website] Add market making grant program page
2019-01-07 12:41:10 -08:00
Brandon Millman
e4bb6a4652 chore(website): fix linter 2019-01-07 12:19:21 -08:00
Amir Bandeali
3cdb85606a Merge pull request #1363 from 0xProject/feat/order-utils/abiEncoder
Add MAP support to order-utils, order-watcher, and types
2019-01-07 11:30:00 -08:00
Amir Bandeali
fd37e88bdb Use enums in pipeline 2019-01-07 11:11:19 -08:00
Amir Bandeali
24564b986d Minimize unnecessary type assertions 2019-01-07 10:31:11 -08:00
Amir Bandeali
a91bc415ed Fix linting errors 2019-01-07 10:31:11 -08:00
Amir Bandeali
ccdb81ac40 Add tests for MAP in order watcher 2019-01-07 10:31:11 -08:00
Amir Bandeali
d7f9e3f0a0 Do not export AssetData in 0x.js 2019-01-07 10:31:11 -08:00
Amir Bandeali
5720589515 Add tests for recursive MAP decoding 2019-01-07 10:31:11 -08:00
Amir Bandeali
70508f52a1 Update CHANGELOGs 2019-01-07 10:31:11 -08:00
Amir Bandeali
b90c3196a3 FIx linting errors 2019-01-07 10:31:11 -08:00
Amir Bandeali
1dda10b4f3 Add recursive MultiAsset decoding, store first address in pipeline 2019-01-07 10:31:11 -08:00
Amir Bandeali
0fba0b1a1b feat: Add balance and allowance checks for MultiAssetProxy 2019-01-07 10:31:11 -08:00
Amir Bandeali
df4f3d9eac feat: Add fields to OrderRelevantState and change AssetData to SingleAssetData 2019-01-07 10:31:11 -08:00
Amir Bandeali
de4916ccb8 Add individual balances and allowances to OrderRelevantState 2019-01-07 10:31:11 -08:00
Amir Bandeali
b797a45d4a Do not attempt to parse tokenAddress if decoding data from multiAssetProxy 2019-01-07 10:31:11 -08:00
Amir Bandeali
eeb07d76fc Fix transferFrom to work with MAP 2019-01-07 10:31:11 -08:00
Amir Bandeali
0abace337c Rename functions 2019-01-07 10:31:11 -08:00
Amir Bandeali
c6ff77bdd8 Add prefix to names of properties in EncodingRules and DecodingRules 2019-01-07 10:31:11 -08:00
Amir Bandeali
492e0ae345 feat: Export MultiAssetData in types 2019-01-07 10:31:11 -08:00
Amir Bandeali
8549252a2c Fix decoding and add tests 2019-01-07 10:31:11 -08:00
Amir Bandeali
aae32037da Run linter 2019-01-07 10:31:11 -08:00
Amir Bandeali
46359c098b Add support for MAP in fill-scenarios 2019-01-07 10:31:11 -08:00
Amir Bandeali
fc71d87d2b Update CHANGELOG 2019-01-07 10:31:11 -08:00
Amir Bandeali
67dfe6030c feat: Add support for MultiAssetProxy 2019-01-07 10:31:11 -08:00
Amir Bandeali
19e93440b3 fix: Add error message if assetProxyId is not ERC20 or ERC721 2019-01-07 10:31:11 -08:00
Amir Bandeali
0cb5209266 Add length check to MultiAsset encoding 2019-01-07 10:31:11 -08:00
Amir Bandeali
1553b366da Update CHANGELOGs 2019-01-07 10:31:11 -08:00
Amir Bandeali
d957cd5344 Use assetDataUtils instead of IAssetData for encoding MultiAsset values 2019-01-07 10:31:11 -08:00
Amir Bandeali
354f7053dc Use new AbiEncoder, add logic for encoding/decoding MultiAsset assetData 2019-01-07 10:31:11 -08:00
Amir Bandeali
4d5fcf8985 feat: Add MultiAsset types 2019-01-07 10:31:11 -08:00
Steve Klebanoff
71c9b2f718 Merge pull request #1484 from 0xProject/fix/sra-spec/title-tag
[sra-spec] Add title tag
2019-01-07 09:40:39 -08:00
Brandon Millman
79863d830e chore(website): update market making page copy 2019-01-06 21:40:39 -08:00
Brandon Millman
59ec243c26 feat(website): add contact us hero action to market maker page 2019-01-06 21:40:14 -08:00
Brandon Millman
5e8da70eae feat(website): implement market maker form 2019-01-06 20:45:46 -08:00
Brandon Millman
99b6ca5b4f feat(website): Add support for copper forms in the offers 2019-01-04 10:00:41 -08:00
Brandon Millman
4e4de07e69 feat(website): add link underneath the first feature in market maker page 2019-01-04 09:44:25 -08:00
Brandon Millman
1b65efb38c feat(website): update market maker page copy and links 2019-01-04 09:24:59 -08:00
Brandon Millman
ed0e6181bd feat(website): add market making section to developers dropdown 2019-01-04 09:09:34 -08:00
Steve Klebanoff
4dded13259 fix(sra-spec): Add title tag 2019-01-04 07:47:41 -08:00
Brandon Millman
c82393d763 feature(website): add market making page 2019-01-03 16:18:33 -08:00
Steve Klebanoff
2111ea159e Merge pull request #1481 from 0xProject/fix/instant/dropdown-color
[instant] Dropdown hover 10% of primary color
2019-01-03 09:07:57 -08:00
Francesco Agosti
c1150824dc Merge pull request #1480 from 0xProject/feature/instant/performance-boost
[instant] No more laggy input
2019-01-03 13:36:18 +01:00
Steve Klebanoff
c62d862967 fix(instant): Dropdown hover should be 10% of primary color 2019-01-02 10:58:41 -08:00
fragosti
1ceb3c9664 feat: unmount the token selector when its not displaying 2019-01-02 19:07:02 +01:00
fragosti
4252a760f0 feat: dont re-render the token selector on every input change 2019-01-02 16:55:29 +01:00
fragosti
5721b25c3a feat: give all stateless components a displayName or make them private 2019-01-02 16:08:15 +01:00
fragosti
586a8ba8e7 feat: use PureComponent instead of Component 2019-01-02 16:01:40 +01:00
Jacob Evans
72a56db5ab chore(python-packages): Change docker command in setup.py 2019-01-02 15:03:09 +11:00
Jacob Evans
646e856b51 Python ganache snapshot 2.2.2 2018-12-29 10:20:42 +11:00
F. Eugene Aumson
e62e61bf71 Add entry point for validation of JSON strings 2018-12-28 15:28:30 -05:00
F. Eugene Aumson
a3eab71908 Correct inconsistencies in JSON schema names
In both ref ID's and file names.
2018-12-28 15:08:15 -05:00
Jacob Evans
9d5d0dbe14 Readme, read snapshot name from package.json 2018-12-27 12:45:29 +11:00
Jacob Evans
2b7875571d Dockerfile defaults to latest 2018-12-24 13:22:39 +11:00
Jacob Evans
0a1701eac9 Copy latest published version to 0x_ganache_snapshot-latest.zip 2018-12-24 13:20:50 +11:00
Jacob Evans
bcd20081d3 Use new bucket, bind on 0.0.0.0 2018-12-24 13:14:16 +11:00
F. Eugene Aumson
7e12ae1bfc Clarify what kind of support ticket was raised. 2018-12-20 17:34:14 -05:00
Jacob Evans
2a577e0475 Add Docker image and Snapshot commands 2018-12-17 15:44:24 +11:00
F. Eugene Aumson
c6815bddac Correct doc titles 2018-12-14 16:22:58 -08:00
F. Eugene Aumson
6639201fdb Tweak special case: only strip Schema as suffix 2018-12-14 16:11:00 -08:00
F. Eugene Aumson
57ac2f28a4 Add example usage to sra_client README 2018-12-14 16:08:57 -08:00
F. Eugene Aumson
210840444d HACK: cp files because CircleCI isn't 2018-12-14 13:53:21 -08:00
F. Eugene Aumson
d92e143a7e Stop installing packages as editable 2018-12-14 13:53:21 -08:00
F. Eugene Aumson
087469f1f3 Support ALL the schemas 2018-12-14 13:53:21 -08:00
F. Eugene Aumson
b6c8126589 Move zero_ex.json_schemas to its own package 2018-12-14 13:53:15 -08:00
310 changed files with 8008 additions and 1297 deletions

View File

@@ -188,9 +188,7 @@ jobs:
working_directory: ~/repo
docker:
- image: circleci/python
- image: 0xorg/ganache-cli
command: |
ganache-cli --gasLimit 10000000 --noVMErrorsOnRPCResponse --db /snapshot --noVMErrorsOnRPCResponse -p 8545 --networkId 50 -m "concert load couple harbor equip island argue ramp clarify fence smart topic"
- image: 0xorg/ganache-cli:2.2.2
- image: 0xorg/launch-kit-ci
command: |
yarn start:ts -p 3000:3000
@@ -200,16 +198,27 @@ jobs:
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- restore_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages/json_schemas
python -m ensurepip
python -m pip install .[dev]
# HACK! installing the package should do the following
# copy for us, but it's not working in CircleCI for some
# reason. Zendesk support ticket raised (#43979) with
# CircleCI.
mkdir /usr/local/lib/python3.7/site-packages/zero_ex/json_schemas/schemas
cp -R src/zero_ex/json_schemas/schemas/* /usr/local/lib/python3.7/site-packages/zero_ex/json_schemas/schemas
- run:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
python -m pip install .[dev]
- run:
command: |
cd python-packages/sra_client
python -m ensurepip
python -m pip install -e .
python -m pip install .[dev]
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -219,6 +228,10 @@ jobs:
- '.mypy_cache'
- '.pytest_cache'
- '.tox'
- run:
command: |
cd python-packages/json_schemas
coverage run setup.py test
- run:
command: |
cd python-packages/order_utils
@@ -227,6 +240,10 @@ jobs:
command: |
cd python-packages/sra_client
coverage run setup.py test
- save_cache:
key: coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/json_schemas/.coverage
- save_cache:
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -249,7 +266,7 @@ jobs:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
python -m pip install .
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -273,16 +290,25 @@ jobs:
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- restore_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages/json_schemas
python -m ensurepip
python -m pip install .[dev]
- run:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
python -m pip install .[dev]
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- '/usr/local/bin'
- '/usr/local/lib/python3.7/site-packages'
- run:
command: |
cd python-packages/json_schemas
python setup.py lint
- run:
command: |
cd python-packages/order_utils
@@ -355,6 +381,9 @@ jobs:
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}

View File

@@ -20,10 +20,13 @@ lib
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
/packages/json-schemas/schemas
/python-packages/order_utils/src/zero_ex/json_schemas/schemas
/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
/packages/metacoin/src/contract_wrappers
/packages/metacoin/artifacts
/packages/sra-spec/public/
package.json
scripts/postpublish_utils.js
packages/sol-cov/test/fixtures/artifacts
.pytest_cache
.mypy_cache
.tox

View File

@@ -1,4 +1,4 @@
<img src="https://github.com/0xProject/branding/blob/master/0x_Black_CMYK.png" width="200px" >
<img src="https://github.com/0xProject/branding/blob/master/0x%20Logo/PNG/0x-Logo-Black.png" width="150px" >
---
@@ -24,10 +24,11 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
### Python Packages
| Package | Version | Description |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
| Package | Version | Description |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x-json-schemas`](/python-packages/json_schemas) | [![PyPI](https://img.shields.io/pypi/v/0x-json-schemas.svg)](https://pypi.org/project/0x-json-schemas/) | 0x-related JSON schemas |
| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
### Typescript/Javascript Packages

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-examples",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -33,12 +33,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -53,24 +53,23 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,4 +1,14 @@
[
{
"version": "1.2.0",
"changes": [
{
"note": "Added Dutch Auction Wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "1.1.0",
"changes": [

View File

@@ -5,6 +5,16 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.2.0 - _January 9, 2019_
* Added Dutch Auction Wrapper (#1465)
## v1.1.0 - _Invalid date_
* Added Balance Threshold Filter (#1383)
* Add OrderMatcher (#1117)
* Add OrderValidator (#1464)
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "1.0.2",
"version": "1.2.0",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contract-wrappers": "^4.2.0",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,24 +65,23 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-protocol": "^2.1.59",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-protocol": "^2.2.0",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,3 +1,4 @@
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
import {
artifacts as protocolArtifacts,
ERC20Wrapper,
@@ -29,12 +30,11 @@ import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import ethAbi = require('ethereumjs-abi');
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
import { artifacts } from '../../src/artifacts';
import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -68,19 +68,8 @@ describe(ContractName.DutchAuction, () => {
let erc721MakerAssetIds: BigNumber[];
const tenMinutesInSeconds = 10 * 60;
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
return ethUtil.bufferToHex(
Buffer.concat([
ethUtil.toBuffer(makerAssetData),
ethUtil.toBuffer(
(ethAbi as any).rawEncode(
['uint256', 'uint256'],
[beginTimeSeconds.toString(), beginAmount.toString()],
),
),
]),
);
}
let dutchAuctionTestWrapper: DutchAuctionTestWrapper;
let defaultERC20MakerAssetData: string;
before(async () => {
await blockchainLifecycle.startAsync();
@@ -136,6 +125,7 @@ describe(ContractName.DutchAuction, () => {
dutchAuctionInstance.address,
provider,
);
dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider);
defaultMakerAssetAddress = erc20TokenA.address;
const defaultTakerAssetAddress = wethContract.address;
@@ -174,7 +164,7 @@ describe(ContractName.DutchAuction, () => {
feeRecipientAddress,
// taker address or sender address should be set to the ducth auction contract
takerAddress: dutchAuctionContract.address,
makerAssetData: extendMakerAssetData(
makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
@@ -199,6 +189,7 @@ describe(ContractName.DutchAuction, () => {
const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams);
buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams);
defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress);
});
after(async () => {
await blockchainLifecycle.revertAsync();
@@ -215,49 +206,41 @@ describe(ContractName.DutchAuction, () => {
describe('matchOrders', () => {
it('should be worth the begin price at the begining of the auction', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
});
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData });
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.lte(auctionBeginTimeSeconds);
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount);
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
});
it('should be be worth the end price at the end of the auction', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
expirationTimeSeconds: auctionEndTimeSeconds,
});
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.gte(auctionEndTimeSeconds);
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount);
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
});
it('should match orders at current amount and send excess to buyer', async () => {
const beforeAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
makerAssetAmount: beforeAuctionDetails.currentAmount.times(2),
});
await web3Wrapper.awaitTransactionSuccessAsync(
await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal(
constants.ZERO_AMOUNT,
@@ -276,17 +259,8 @@ describe(ContractName.DutchAuction, () => {
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerFee: new BigNumber(1),
});
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
@@ -299,18 +273,9 @@ describe(ContractName.DutchAuction, () => {
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
makerFee: new BigNumber(1),
});
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
);
@@ -321,24 +286,17 @@ describe(ContractName.DutchAuction, () => {
it('should revert when auction expires', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
expirationTimeSeconds: auctionEndTimeSeconds,
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionExpired,
);
});
@@ -347,15 +305,7 @@ describe(ContractName.DutchAuction, () => {
makerAssetAmount: sellOrder.takerAssetAmount,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidAmount,
);
});
@@ -364,38 +314,23 @@ describe(ContractName.DutchAuction, () => {
takerAssetAmount: auctionBeginAmount.plus(1),
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidAmount,
);
});
it('begin time is less than end time', async () => {
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
expirationTimeSeconds: auctionEndTimeSeconds,
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidBeginTime,
);
});
@@ -404,45 +339,30 @@ describe(ContractName.DutchAuction, () => {
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.InvalidAssetData,
);
});
describe('ERC721', () => {
it('should match orders when ERC721', async () => {
const makerAssetId = erc721MakerAssetIds[0];
const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
erc721MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetAmount: new BigNumber(1),
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
takerAssetAmount: new BigNumber(1),
takerAssetData: sellOrder.makerAssetData,
});
await web3Wrapper.awaitTransactionSuccessAsync(
await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
// HACK gte used here due to a bug in ganache where the timestamp can change
// between multiple calls to the same block. Which can move the amount in our case

View File

@@ -0,0 +1,62 @@
import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
import { LogDecoder } from '@0x/contracts-test-utils';
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
import { artifacts } from '../../src/artifacts';
export class DutchAuctionTestWrapper {
private readonly _dutchAuctionContract: DutchAuctionContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(contractInstance: DutchAuctionContract, provider: Provider) {
this._dutchAuctionContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
...tokensArtifacts,
...protocolArtifacts,
});
}
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
* start time and the auction begin amount. The sell order is a an order at the lowest amount
* at the end of the auction. Excess from the match is transferred to the seller.
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
* @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @param from Address the transaction is being sent from.
* @return Transaction receipt with decoded logs.
*/
public async matchOrdersAsync(
buyOrder: SignedOrder,
sellOrder: SignedOrder,
from: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const txHash = await this._dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from,
},
);
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
return tx;
}
/**
* Calculates the Auction Details for the given order
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @return The dutch auction details.
*/
public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
return auctionDetails;
}
}

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-interfaces",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -30,8 +30,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/sol-compiler": "^1.1.16",
"@0x/abi-gen": "^1.0.20",
"@0x/sol-compiler": "^2.0.0",
"@0x/tslint-config": "^2.0.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -41,13 +41,13 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-libs",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,21 +64,20 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -64,19 +64,18 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -14,7 +14,8 @@
"note": "Move OrderValidator to extensions",
"pr": 1464
}
]
],
"timestamp": 1547040760
},
{
"timestamp": 1544741676,

View File

@@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.0 - _January 9, 2019_
* Added LibAddressArray (#1383)
* Add validation and comments to MultiAssetProxy (#1455)
* Move OrderValidator to extensions (#1464)
## v2.1.59 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-protocol",
"version": "2.1.59",
"version": "2.2.0",
"engines": {
"node": ">=6.12"
},
@@ -44,11 +44,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -63,26 +63,25 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-examples": "^1.0.2",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-examples": "^1.0.3",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -715,7 +715,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -778,7 +778,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -811,7 +811,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -849,7 +849,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc721Amount];
const nestedAssetData = [erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -881,7 +881,7 @@ describe('Asset Transfer Proxies', () => {
const erc721Amount = new BigNumber(1);
const amounts = [erc721Amount, erc721Amount];
const nestedAssetData = [erc721AssetData1, erc721AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -913,7 +913,7 @@ describe('Asset Transfer Proxies', () => {
const erc721Amount = new BigNumber(1);
const amounts = [erc721Amount, erc721Amount];
const nestedAssetData = [erc721AssetData1, erc721AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -946,7 +946,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -984,10 +984,7 @@ describe('Asset Transfer Proxies', () => {
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const extraData = '0102030405060708';
const assetData = `${assetDataInterface.MultiAsset.getABIEncodedTransactionData(
amounts,
nestedAssetData,
)}${extraData}`;
const assetData = `${assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData)}${extraData}`;
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1024,7 +1021,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1085,7 +1082,7 @@ describe('Asset Transfer Proxies', () => {
erc721AssetData3,
erc721AssetData4,
];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1143,7 +1140,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1169,6 +1166,7 @@ describe('Asset Transfer Proxies', () => {
const invalidErc721AssetData = `${invalidProxyId}${erc721AssetData.slice(10)}`;
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, invalidErc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1192,6 +1190,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1214,7 +1213,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1238,6 +1237,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = '0x123456';
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1262,7 +1262,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,

View File

@@ -1,4 +1,3 @@
import { artifacts as interfacesArtifacts, IAssetDataContract } from '@0x/contracts-interfaces';
import {
chaiSetup,
constants,
@@ -43,11 +42,6 @@ import { ExchangeWrapper } from '../utils/exchange_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetDataInterface = new IAssetDataContract(
interfacesArtifacts.IAssetData.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
// tslint:disable:no-unnecessary-type-assertion
describe('Exchange core', () => {
let makerAddress: string;
@@ -777,10 +771,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(1);
const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const takerAssetAmount = new BigNumber(10);
@@ -830,10 +821,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(1);
const takerAmounts = [new BigNumber(10), new BigNumber(1)];
const takerAssetId = erc721TakerAssetIds[0];
@@ -841,10 +829,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(zrxToken.address),
assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
];
const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
takerAmounts,
takerNestedAssetData,
);
const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
const takerAssetAmount = new BigNumber(1);
signedOrder = await orderFactory.newSignedOrderAsync({
makerAssetData,
@@ -900,10 +885,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(30);
const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const takerAssetAmount = new BigNumber(10);
@@ -980,10 +962,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
takerAmounts,
takerNestedAssetData,
);
const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
const takerAssetAmount = new BigNumber(30);
const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const makerAssetAmount = new BigNumber(10);

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -40,17 +40,17 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/dev-utils": "^1.0.21",
"@0x/order-utils": "^3.0.7",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/dev-utils": "^1.0.22",
"@0x/order-utils": "^3.1.0",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@0x/types": "^1.4.1",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
"@types/js-combinatorics": "^0.5.29",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-tokens",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,23 +64,22 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -22,6 +22,7 @@ import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/Unlimited
import * as WETH9 from '../../generated-artifacts/WETH9.json';
import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
// tslint:disable:no-unnecessary-type-assertion
export const artifacts = {
DummyERC20Token: DummyERC20Token as ContractArtifact,
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -65,20 +65,19 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-multisig": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-multisig": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"

View File

@@ -1,4 +1,15 @@
[
{
"version": "3.0.0",
"changes": [
{
"note":
"Export `MultiAssetData`, `MultiAssetDataWithRecursiveDecoding`, `ObjectMap`, and `SingleAssetData` from types. No longer export `AssetData`.",
"pr": 1363
}
],
"timestamp": 1547040760
},
{
"version": "2.0.8",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.0 - _January 9, 2019_
* Export `MultiAssetData`, `MultiAssetDataWithRecursiveDecoding`, `ObjectMap`, and `SingleAssetData` from types. No longer export `AssetData`. (#1363)
## v2.0.8 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "2.0.8",
"version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -42,10 +42,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen-wrappers": "^2.0.2",
"@0x/contract-addresses": "^2.0.0",
"@0x/dev-utils": "^1.0.21",
"@0x/migrations": "^2.2.2",
"@0x/abi-gen-wrappers": "^2.1.0",
"@0x/contract-addresses": "^2.1.0",
"@0x/dev-utils": "^1.0.22",
"@0x/migrations": "^2.3.0",
"@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -72,16 +72,16 @@
"webpack": "^4.20.2"
},
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/base-contract": "^3.0.10",
"@0x/contract-wrappers": "^4.1.3",
"@0x/order-utils": "^3.0.7",
"@0x/order-watcher": "^2.2.8",
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/base-contract": "^3.0.11",
"@0x/contract-wrappers": "^4.2.0",
"@0x/order-utils": "^3.1.0",
"@0x/order-watcher": "^2.4.0",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",

View File

@@ -4,6 +4,7 @@ export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtil
export {
ContractWrappers,
DutchAuctionWrapper,
ERC20TokenWrapper,
ERC721TokenWrapper,
EtherTokenWrapper,
@@ -27,6 +28,7 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
DutchAuctionData,
} from '@0x/contract-wrappers';
export {
@@ -80,11 +82,16 @@ export {
OrderState,
AssetProxyId,
AssetData,
SingleAssetData,
ERC20AssetData,
ERC721AssetData,
MultiAssetData,
MultiAssetDataWithRecursiveDecoding,
SignatureType,
ObjectMap,
OrderRelevantState,
Stats,
DutchAuctionDetails,
} from '@0x/types';
export {

View File

@@ -1,4 +1,14 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "Added Dutch Auction Wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "2.0.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.0 - _January 9, 2019_
* Added Dutch Auction Wrapper (#1465)
## v2.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
"version": "2.0.2",
"version": "2.1.0",
"engines": {
"node": ">=6.12"
},
@@ -18,7 +18,7 @@
"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 src/generated-wrappers --backend ethers"
},
"config": {
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
@@ -30,19 +30,19 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/abi-gen": "^1.0.20",
"@0x/abi-gen-templates": "^1.0.1",
"@0x/tslint-config": "^2.0.0",
"@0x/types": "^1.4.1",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/types": "^1.5.0",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
"@0x/base-contract": "^3.0.10"
"@0x/base-contract": "^3.0.11"
},
"publishConfig": {
"access": "public"

View File

@@ -0,0 +1,322 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
/* istanbul ignore next */
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class DutchAuctionContract extends BaseContract {
public getAuctionDetails = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [order
]);
const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
self.getAuctionDetails.estimateGasAsync.bind(
self,
order
),
);
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString);
const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
getABIEncodedTransactionData(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
): string {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString);
const abiEncodedTransactionData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
return abiEncodedTransactionData;
},
async callAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
> {
const self = this as any as DutchAuctionContract;
const functionSignature = 'getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [order
]);
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuctionDetails;
const encodedData = ethersFunction.encode([order
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
let resultArray = ethersFunction.decode(rawCallResult);
const outputAbi = (_.find(self.abi, {name: 'getAuctionDetails'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public matchOrders = {
async sendTransactionAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('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)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
self.matchOrders.estimateGasAsync.bind(
self,
buyOrder,
sellOrder,
buySignature,
sellSignature
),
);
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
async estimateGasAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('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)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString);
const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
getABIEncodedTransactionData(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
): string {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('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)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString);
const abiEncodedTransactionData = self._lookupEthersInterface('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)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
return abiEncodedTransactionData;
},
async callAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
> {
const self = this as any as DutchAuctionContract;
const functionSignature = '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)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
const encodedData = ethersFunction.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
let resultArray = ethersFunction.decode(rawCallResult);
const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
): Promise<DutchAuctionContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
): Promise<DutchAuctionContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_exchange
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_exchange
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_exchange
]);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
txDefaults,
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
);
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
logUtils.log(`transactionHash: ${txHash}`);
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new DutchAuctionContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_exchange
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('DutchAuction', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method

View File

@@ -1,6 +1,7 @@
export * from './generated-wrappers/asset_proxy_owner';
export * from './generated-wrappers/dummy_erc20_token';
export * from './generated-wrappers/dummy_erc721_token';
export * from './generated-wrappers/dutch_auction';
export * from './generated-wrappers/erc20_proxy';
export * from './generated-wrappers/erc20_token';
export * from './generated-wrappers/erc721_proxy';

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.19",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.20 - _January 9, 2019_
* Dependencies updated
## v1.0.19 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
"version": "1.0.19",
"version": "1.0.20",
"engines": {
"node": ">=6.12"
},
@@ -32,7 +32,7 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.4",
"glob": "^7.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.21",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.20",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.21 - _January 9, 2019_
* Dependencies updated
## v1.0.20 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
"version": "1.0.20",
"version": "1.0.21",
"engines": {
"node": ">=6.12"
},
@@ -44,9 +44,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/json-schemas": "^2.1.4",
"@0x/json-schemas": "^2.1.5",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "3.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.4",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.5 - _January 9, 2019_
* Dependencies updated
## v3.0.4 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,7 +1,5 @@
## @0x/asset-buyer
**Warning: In Beta, has not been extensively tested.**
Convenience package for buying assets represented on the Ethereum blockchain using 0x. In its simplest form, the package helps in the usage of the [0x forwarder contract](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md), which allows users to execute [Wrapped Ether](https://weth.io/) based 0x orders without having to set allowances, wrap Ether or own ZRX, meaning they can buy tokens with Ether alone. Given some liquidity (0x signed orders), it helps estimate the Ether cost of buying a certain asset (giving a range) and then buying that asset.
In its more advanced and useful form, it integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api) and takes care of sourcing liquidity for you given an SRA compliant endpoint. The final result is a library that tells you what assets are available, provides an Ether based quote for any asset desired, and allows you to buy that asset using Ether alone.

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
"version": "3.0.4",
"version": "3.0.5",
"engines": {
"node": ">=6.12"
},
@@ -36,16 +36,16 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/connect": "^3.0.10",
"@0x/contract-wrappers": "^4.1.3",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/connect": "^3.0.11",
"@0x/contract-wrappers": "^4.2.0",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "3.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.11 - _January 9, 2019_
* Dependencies updated
## v3.0.10 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
"version": "3.0.10",
"version": "3.0.11",
"engines": {
"node": ">=6.12"
},
@@ -41,8 +41,8 @@
},
"dependencies": {
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "3.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.11 - _January 9, 2019_
* Dependencies updated
## v3.0.10 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
"version": "3.0.10",
"version": "3.0.11",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",

View File

@@ -1,4 +1,14 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten)",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.0 - _January 9, 2019_
* Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten) (#1465)
## v2.0.0 - _November 28, 2018_
* Redeployed Rinkeby with testnet Exchange artifact (#1318)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "2.0.0",
"version": "2.1.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -9,6 +9,7 @@ export interface ContractAddresses {
assetProxyOwner: string;
forwarder: string;
orderValidator: string;
dutchAuction: string;
}
export enum NetworkId {
@@ -19,6 +20,8 @@ export enum NetworkId {
Ganache = 50,
}
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
const networkToAddresses: { [networkId: number]: ContractAddresses } = {
1: {
erc20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
@@ -29,6 +32,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
forwarder: '0x5468a1dc173652ee28d249c271fa9933144746b1',
orderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138',
// @todo hysz/dekz: Add mainnet address once deployed.
dutchAuction: NULL_ADDRESS,
},
3: {
erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa',
@@ -39,6 +44,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b',
forwarder: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
dutchAuction: '0x2df6b59309f35ada230ec7d61d7d97355017a1df',
},
4: {
exchange: '0xbce0b5f6eb618c565c3e5f5cd69652bbc279f44e',
@@ -49,6 +55,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0xe1703da878afcebff5b7624a826902af475b9c03',
forwarder: '0x2d40589abbdee84961f3a7656b9af7adb0ee5ab4',
orderValidator: '0x0c5173a51e26b29d6126c686756fb9fbef71f762',
dutchAuction: '0xdd7bd6437e67c422879364740ab5855fe3dc41f7',
},
42: {
erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
@@ -59,6 +66,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8',
forwarder: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
dutchAuction: '0xe11667fb51f34c5367f40d7e379327ce32ee7150',
},
// NetworkId 50 represents our Ganache snapshot generated from migrations.
50: {
@@ -70,6 +78,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
dutchAuction: '0xdc688d29394a3f1e6f1e5100862776691afaf3d2',
},
};

View File

@@ -1,4 +1,14 @@
[
{
"version": "1.2.0",
"changes": [
{
"pr": 1465,
"note": "Added artifact for Dutch Auction contract"
}
],
"timestamp": 1547040760
},
{
"version": "1.1.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.2.0 - _January 9, 2019_
* Added artifact for Dutch Auction contract (#1465)
## v1.1.2 - _November 28, 2018_
* Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
"version": "1.1.2",
"version": "1.2.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,5 @@
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
@@ -15,6 +16,7 @@ import * as ZRXToken from '../artifacts/ZRXToken.json';
export {
AssetProxyOwner,
DutchAuction,
DummyERC20Token,
DummyERC721Token,
ERC20Proxy,

View File

@@ -8,6 +8,7 @@
"include": ["./src/**/*"],
"files": [
"./artifacts/AssetProxyOwner.json",
"./artifacts/DutchAuction.json",
"./artifacts/DummyERC20Token.json",
"./artifacts/DummyERC721Token.json",
"./artifacts/ERC20Proxy.json",

View File

@@ -1,9 +1,23 @@
[
{
"version": "4.2.0",
"changes": [
{
"note": "Added Dutch Auction wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "4.1.4",
"changes": [
{
"note": "Add support for Trust Wallet signature denial error"
},
{
"note": "Add balance and allowance queries for `MultiAssetProxy`",
"pr": 1363
}
]
},

View File

@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.0 - _January 9, 2019_
* Added Dutch Auction wrapper (#1465)
## v4.1.4 - _Invalid date_
* Add support for Trust Wallet signature denial error
* Add balance and allowance queries for `MultiAssetProxy` (#1363)
## v4.1.3 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "4.1.3",
"version": "4.2.0",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,9 +37,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.21",
"@0x/migrations": "^2.2.2",
"@0x/subproviders": "^2.1.8",
"@0x/dev-utils": "^1.0.22",
"@0x/migrations": "^2.3.0",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -65,18 +65,20 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^2.0.2",
"@0x/assert": "^1.0.20",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
"@0x/fill-scenarios": "^1.0.16",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/abi-gen-wrappers": "^2.1.0",
"@0x/assert": "^1.0.21",
"@0x/contract-addresses": "^2.1.0",
"@0x/contract-artifacts": "^1.2.0",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/fill-scenarios": "^1.1.0",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethereumjs-abi": "0.6.5",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",

View File

@@ -12,6 +12,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
import { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
import { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
import { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
@@ -65,6 +66,10 @@ export class ContractWrappers {
* An instance of the OrderValidatorWrapper class containing methods for interacting with any OrderValidator smart contract.
*/
public orderValidator: OrderValidatorWrapper;
/**
* An instance of the DutchAuctionWrapper class containing methods for interacting with any DutchAuction smart contract.
*/
public dutchAuction: DutchAuctionWrapper;
private readonly _web3Wrapper: Web3Wrapper;
/**
@@ -141,6 +146,11 @@ export class ContractWrappers {
config.networkId,
contractAddresses.orderValidator,
);
this.dutchAuction = new DutchAuctionWrapper(
this._web3Wrapper,
config.networkId,
contractAddresses.dutchAuction,
);
}
/**
* Unsubscribes from all subscriptions for all contracts.

View File

@@ -0,0 +1,182 @@
import { DutchAuctionContract } from '@0x/abi-gen-wrappers';
import { DutchAuction } from '@0x/contract-artifacts';
import { schemas } from '@0x/json-schemas';
import { assetDataUtils } from '@0x/order-utils';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as ethAbi from 'ethereumjs-abi';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import { DutchAuctionData, DutchAuctionWrapperError, OrderTransactionOpts } from '../types';
import { assert } from '../utils/assert';
import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { ContractWrapper } from './contract_wrapper';
export class DutchAuctionWrapper extends ContractWrapper {
public abi: ContractAbi = DutchAuction.compilerOutput.abi;
public address: string;
private _dutchAuctionContractIfExists?: DutchAuctionContract;
/**
* Dutch auction details are encoded with the asset data for a 0x order. This function produces a hex
* encoded assetData string, containing information both about the asset being traded and the
* dutch auction; which is usable in the makerAssetData or takerAssetData fields in a 0x order.
* @param assetData Hex encoded assetData string for the asset being auctioned.
* @param beginTimeSeconds Begin time of the dutch auction.
* @param beginAmount Starting amount being sold in the dutch auction.
* @return The hex encoded assetData string.
*/
public static encodeDutchAuctionAssetData(
assetData: string,
beginTimeSeconds: BigNumber,
beginAmount: BigNumber,
): string {
const assetDataBuffer = ethUtil.toBuffer(assetData);
const abiEncodedAuctionData = (ethAbi as any).rawEncode(
['uint256', 'uint256'],
[beginTimeSeconds.toString(), beginAmount.toString()],
);
const abiEncodedAuctionDataBuffer = ethUtil.toBuffer(abiEncodedAuctionData);
const dutchAuctionDataBuffer = Buffer.concat([assetDataBuffer, abiEncodedAuctionDataBuffer]);
const dutchAuctionData = ethUtil.bufferToHex(dutchAuctionDataBuffer);
return dutchAuctionData;
}
/**
* Dutch auction details are encoded with the asset data for a 0x order. This function decodes a hex
* encoded assetData string, containing information both about the asset being traded and the
* dutch auction.
* @param dutchAuctionData Hex encoded assetData string for the asset being auctioned.
* @return An object containing the auction asset, auction begin time and auction begin amount.
*/
public static decodeDutchAuctionData(dutchAuctionData: string): DutchAuctionData {
const dutchAuctionDataBuffer = ethUtil.toBuffer(dutchAuctionData);
// Decode asset data
const dutchAuctionDataLengthInBytes = 64;
const assetDataBuffer = dutchAuctionDataBuffer.slice(
0,
dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
);
const assetDataHex = ethUtil.bufferToHex(assetDataBuffer);
const assetData = assetDataUtils.decodeAssetDataOrThrow(assetDataHex);
// Decode auction details
const dutchAuctionDetailsBuffer = dutchAuctionDataBuffer.slice(
dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
);
const [beginTimeSecondsAsBN, beginAmountAsBN] = ethAbi.rawDecode(
['uint256', 'uint256'],
dutchAuctionDetailsBuffer,
);
const beginTimeSeconds = new BigNumber(`0x${beginTimeSecondsAsBN.toString()}`);
const beginAmount = new BigNumber(`0x${beginAmountAsBN.toString()}`);
return {
assetData,
beginTimeSeconds,
beginAmount,
};
}
/**
* Instantiate DutchAuctionWrapper
* @param web3Wrapper Web3Wrapper instance to use.
* @param networkId Desired networkId.
* @param address The address of the Dutch Auction contract. If undefined, will
* default to the known address corresponding to the networkId.
*/
public constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
super(web3Wrapper, networkId);
this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).dutchAuction : address;
}
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
* start time and the auction begin amount. The sell order is a an order at the lowest amount
* at the end of the auction. Excess from the match is transferred to the seller.
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
* @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied
* Provider provided at instantiation.
* @return Transaction hash.
*/
public async matchOrdersAsync(
buyOrder: SignedOrder,
sellOrder: SignedOrder,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true },
): Promise<string> {
// type assertions
assert.doesConformToSchema('buyOrder', buyOrder, schemas.signedOrderSchema);
assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]);
const normalizedTakerAddress = takerAddress.toLowerCase();
// other assertions
if (
sellOrder.makerAssetData !== buyOrder.takerAssetData ||
sellOrder.takerAssetData !== buyOrder.makerAssetData
) {
throw new Error(DutchAuctionWrapperError.AssetDataMismatch);
}
// get contract
const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
// validate transaction
if (orderTransactionOpts.shouldValidate) {
await dutchAuctionInstance.matchOrders.callAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
nonce: orderTransactionOpts.nonce,
},
);
}
// send transaction
const txHash = await dutchAuctionInstance.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
nonce: orderTransactionOpts.nonce,
},
);
return txHash;
}
/**
* Fetches the Auction Details for the given order
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @return The dutch auction details.
*/
public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
// type assertions
assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
// get contract
const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
// call contract
const auctionDetails = await dutchAuctionInstance.getAuctionDetails.callAsync(sellOrder);
return auctionDetails;
}
private async _getDutchAuctionContractAsync(): Promise<DutchAuctionContract> {
if (!_.isUndefined(this._dutchAuctionContractIfExists)) {
return this._dutchAuctionContractIfExists;
}
const contractInstance = new DutchAuctionContract(
this.abi,
this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
this._dutchAuctionContractIfExists = contractInstance;
return this._dutchAuctionContractIfExists;
}
}

View File

@@ -1,8 +1,7 @@
// tslint:disable:no-unnecessary-type-assertion
import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0x/order-utils';
import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParamLiteral } from 'ethereum-types';
import * as _ from 'lodash';
import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper';
import { ERC721TokenWrapper } from '../contract_wrappers/erc721_token_wrapper';
@@ -18,42 +17,45 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
let balance: BigNumber | undefined;
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
balance = await this._erc20Token.getBalanceAsync(decodedAssetData.tokenAddress, userAddress, {
defaultBlock: this._stateLayer,
});
return balance;
} else {
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const tokenOwner = await this._erc721Token.getOwnerOfAsync(
decodedERC721AssetData.tokenAddress,
decodedERC721AssetData.tokenId,
decodedAssetData.tokenAddress,
decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
return balance;
balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
// The `balance` for MultiAssetData is the total units of the entire `assetData` that are held by the `userAddress`.
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
const nestedAmountElement = decodedAssetData.amounts[index];
const nestedAssetBalance = (await this.getBalanceAsync(
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
balance = nestedAssetBalance;
}
}
}
return balance as BigNumber;
}
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
decodedERC20AssetData.tokenAddress,
userAddress,
{
defaultBlock: this._stateLayer,
},
);
return proxyAllowance;
} else {
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
let proxyAllowance: BigNumber | undefined;
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(decodedAssetData.tokenAddress, userAddress, {
defaultBlock: this._stateLayer,
});
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
decodedERC721AssetData.tokenAddress,
decodedAssetData.tokenAddress,
userAddress,
{
defaultBlock: this._stateLayer,
@@ -63,15 +65,27 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
} else {
const isApproved = await this._erc721Token.isProxyApprovedAsync(
decodedERC721AssetData.tokenAddress,
decodedERC721AssetData.tokenId,
decodedAssetData.tokenAddress,
decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
return proxyAllowance;
proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
}
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
// The `proxyAllowance` for MultiAssetData is the total units of the entire `assetData` that the proxies have been approved to spend by the `userAddress`.
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
const nestedAmountElement = decodedAssetData.amounts[index];
const nestedAssetAllowance = (await this.getProxyAllowanceAsync(
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
proxyAllowance = nestedAssetAllowance;
}
}
}
return proxyAllowance as BigNumber;
}
}

View File

@@ -34,6 +34,7 @@ export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
export { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper';
export { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
export { TransactionEncoder } from './utils/transaction_encoder';
@@ -54,9 +55,21 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
DutchAuctionData,
} from './types';
export { Order, SignedOrder, AssetProxyId } from '@0x/types';
export {
AssetData,
ERC20AssetData,
ERC721AssetData,
SingleAssetData,
MultiAssetData,
MultiAssetDataWithRecursiveDecoding,
DutchAuctionDetails,
Order,
SignedOrder,
AssetProxyId,
} from '@0x/types';
export {
BlockParamLiteral,

View File

@@ -9,7 +9,7 @@ import {
WETH9Events,
} from '@0x/abi-gen-wrappers';
import { ContractAddresses } from '@0x/contract-addresses';
import { OrderState, SignedOrder } from '@0x/types';
import { AssetData, OrderState, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParam, ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types';
@@ -206,3 +206,13 @@ export interface BalanceAndAllowance {
balance: BigNumber;
allowance: BigNumber;
}
export enum DutchAuctionWrapperError {
AssetDataMismatch = 'ASSET_DATA_MISMATCH',
}
export interface DutchAuctionData {
assetData: AssetData;
beginTimeSeconds: BigNumber;
beginAmount: BigNumber;
}

View File

@@ -0,0 +1,128 @@
import { expectTransactionFailedAsync, getLatestBlockTimestampAsync } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import 'mocha';
import { ContractWrappers } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { DutchAuctionUtils } from './utils/dutch_auction_utils';
import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
// tslint:disable:custom-no-magic-numbers
describe('DutchAuctionWrapper', () => {
const makerAssetAmount = new BigNumber(5);
const auctionEndTakerAmount = new BigNumber(10);
const auctionBeginTakerAmount = auctionEndTakerAmount.times(2);
const tenMinutesInSeconds = 10 * 60;
let contractWrappers: ContractWrappers;
let exchangeContractAddress: string;
let userAddresses: string[];
let makerAddress: string;
let takerAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
let buyOrder: SignedOrder;
let sellOrder: SignedOrder;
let makerTokenAssetData: string;
let takerTokenAssetData: string;
let auctionBeginTimeSeconds: BigNumber;
let auctionEndTimeSeconds: BigNumber;
before(async () => {
// setup contract wrappers & addresses
const contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
contractAddresses,
blockPollingIntervalMs: 10,
};
contractWrappers = new ContractWrappers(provider, config);
exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
[, makerAddress, takerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
// construct asset data for tokens being swapped
[makerTokenAssetData, takerTokenAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
];
// setup auction details in maker asset data
const currentBlockTimestamp: number = await getLatestBlockTimestampAsync();
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp + tenMinutesInSeconds);
// create auction orders
const coinbase = userAddresses[0];
const dutchAuctionUtils = new DutchAuctionUtils(
web3Wrapper,
coinbase,
exchangeContractAddress,
contractWrappers.erc20Proxy.address,
);
sellOrder = await dutchAuctionUtils.createSignedSellOrderAsync(
auctionBeginTimeSeconds,
auctionEndTimeSeconds,
auctionBeginTakerAmount,
auctionEndTakerAmount,
makerAssetAmount,
makerTokenAssetData,
takerTokenAssetData,
makerAddress,
constants.NULL_ADDRESS,
);
buyOrder = await dutchAuctionUtils.createSignedBuyOrderAsync(sellOrder, takerAddress);
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#matchOrdersAsync', () => {
it('should match two orders', async () => {
const txHash = await contractWrappers.dutchAuction.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
});
it('should throw when invalid transaction and shouldValidate is true', async () => {
// request match with bad buy/sell orders
const badSellOrder = buyOrder;
const badBuyOrder = sellOrder;
return expectTransactionFailedAsync(
contractWrappers.dutchAuction.matchOrdersAsync(badBuyOrder, badSellOrder, takerAddress, {
shouldValidate: true,
}),
RevertReason.InvalidAssetData,
);
});
});
describe('#getAuctionDetailsAsync', () => {
it('should get auction details', async () => {
// get auction details
const auctionDetails = await contractWrappers.dutchAuction.getAuctionDetailsAsync(sellOrder);
// run some basic sanity checks on the return value
expect(auctionDetails.beginTimeSeconds, 'auctionDetails.beginTimeSeconds').to.be.bignumber.equal(
auctionBeginTimeSeconds,
);
expect(auctionDetails.beginAmount, 'auctionDetails.beginAmount').to.be.bignumber.equal(
auctionBeginTakerAmount,
);
expect(auctionDetails.endTimeSeconds, 'auctionDetails.endTimeSeconds').to.be.bignumber.equal(
auctionEndTimeSeconds,
);
});
});
});

View File

@@ -0,0 +1,153 @@
import { DummyERC20TokenContract } from '@0x/abi-gen-wrappers';
import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { DutchAuctionWrapper } from '../../src/contract_wrappers/dutch_auction_wrapper';
import { constants } from './constants';
export class DutchAuctionUtils {
private readonly _web3Wrapper: Web3Wrapper;
private readonly _coinbase: string;
private readonly _exchangeAddress: string;
private readonly _erc20ProxyAddress: string;
constructor(web3Wrapper: Web3Wrapper, coinbase: string, exchangeAddress: string, erc20ProxyAddress: string) {
this._web3Wrapper = web3Wrapper;
this._coinbase = coinbase;
this._exchangeAddress = exchangeAddress;
this._erc20ProxyAddress = erc20ProxyAddress;
}
public async createSignedSellOrderAsync(
auctionBeginTimeSections: BigNumber,
acutionEndTimeSeconds: BigNumber,
auctionBeginTakerAssetAmount: BigNumber,
auctionEndTakerAssetAmount: BigNumber,
makerAssetAmount: BigNumber,
makerAssetData: string,
takerAssetData: string,
makerAddress: string,
takerAddress: string,
senderAddress?: string,
makerFee?: BigNumber,
takerFee?: BigNumber,
feeRecipientAddress?: string,
): Promise<SignedOrder> {
// Notes on sell order:
// - The `takerAssetAmount` is set to the `auctionEndTakerAssetAmount`, which is the lowest amount the
// the seller can expect to receive
// - The `makerAssetData` is overloaded to include the auction begin time and begin taker asset amount
const makerAssetDataWithAuctionDetails = DutchAuctionWrapper.encodeDutchAuctionAssetData(
makerAssetData,
auctionBeginTimeSections,
auctionBeginTakerAssetAmount,
);
const signedOrder = await orderFactory.createSignedOrderAsync(
this._web3Wrapper.getProvider(),
makerAddress,
makerAssetAmount,
makerAssetDataWithAuctionDetails,
auctionEndTakerAssetAmount,
takerAssetData,
this._exchangeAddress,
{
takerAddress,
senderAddress,
makerFee,
takerFee,
feeRecipientAddress,
expirationTimeSeconds: acutionEndTimeSeconds,
},
);
const erc20AssetData = assetDataUtils.decodeERC20AssetData(makerAssetData);
await this._increaseERC20BalanceAndAllowanceAsync(erc20AssetData.tokenAddress, makerAddress, makerAssetAmount);
return signedOrder;
}
public async createSignedBuyOrderAsync(
sellOrder: SignedOrder,
buyerAddress: string,
senderAddress?: string,
makerFee?: BigNumber,
takerFee?: BigNumber,
feeRecipientAddress?: string,
expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
const dutchAuctionData = DutchAuctionWrapper.decodeDutchAuctionData(sellOrder.makerAssetData);
// Notes on buy order:
// - The `makerAssetAmount` is set to `dutchAuctionData.beginAmount`, which is
// the highest amount the buyer would have to pay out at any point during the auction.
// - The `takerAssetAmount` is set to the seller's `makerAssetAmount`, as the buyer
// receives the entire amount being sold by the seller.
// - The `makerAssetData`/`takerAssetData` are reversed from the sell order
const signedOrder = await orderFactory.createSignedOrderAsync(
this._web3Wrapper.getProvider(),
buyerAddress,
dutchAuctionData.beginAmount,
sellOrder.takerAssetData,
sellOrder.makerAssetAmount,
sellOrder.makerAssetData,
sellOrder.exchangeAddress,
{
senderAddress,
makerFee,
takerFee,
feeRecipientAddress,
expirationTimeSeconds,
},
);
const buyerERC20AssetData = assetDataUtils.decodeERC20AssetData(sellOrder.takerAssetData);
await this._increaseERC20BalanceAndAllowanceAsync(
buyerERC20AssetData.tokenAddress,
buyerAddress,
dutchAuctionData.beginAmount,
);
return signedOrder;
}
private async _increaseERC20BalanceAndAllowanceAsync(
tokenAddress: string,
address: string,
amount: BigNumber,
): Promise<void> {
if (amount.isZero() || address === constants.NULL_ADDRESS) {
return; // noop
}
await Promise.all([
this._increaseERC20BalanceAsync(tokenAddress, address, amount),
this._increaseERC20AllowanceAsync(tokenAddress, address, amount),
]);
}
private async _increaseERC20BalanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> {
const erc20Token = new DummyERC20TokenContract(
artifacts.DummyERC20Token.compilerOutput.abi,
tokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
const txHash = await erc20Token.transfer.sendTransactionAsync(address, amount, {
from: this._coinbase,
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
private async _increaseERC20AllowanceAsync(
tokenAddress: string,
address: string,
amount: BigNumber,
): Promise<void> {
const erc20Token = new DummyERC20TokenContract(
artifacts.DummyERC20Token.compilerOutput.abi,
tokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
const oldMakerAllowance = await erc20Token.allowance.callAsync(address, this._erc20ProxyAddress);
const newMakerAllowance = oldMakerAllowance.plus(amount);
const txHash = await erc20Token.approve.sendTransactionAsync(this._erc20ProxyAddress, newMakerAllowance, {
from: address,
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/dev-tools-pages",
"version": "0.0.10",
"version": "0.0.11",
"engines": {
"node": ">=6.12"
},
@@ -16,7 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@0x/react-shared": "^1.0.25",
"@0x/react-shared": "^1.1.0",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"less": "^2.7.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.22",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.21",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.22 - _January 9, 2019_
* Dependencies updated
## v1.0.21 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/dev-utils",
"version": "1.0.21",
"version": "1.0.22",
"engines": {
"node": ">=6.12"
},
@@ -41,11 +41,11 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/web3-provider-engine": "^14.0.0",
"chai": "^4.0.1",
"ethereum-types": "^1.1.4",

View File

@@ -17,6 +17,7 @@ export interface Web3Config {
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
rpcUrl?: string; // default: localhost:8545
shouldUseFakeGasEstimate?: boolean; // default: true
ganacheDatabasePath?: string; // default: undefined, creates a tmp dir
}
export const web3Factory = {
@@ -45,9 +46,14 @@ export const web3Factory = {
const shouldThrowErrorsOnGanacheRPCResponse =
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
config.shouldThrowErrorsOnGanacheRPCResponse;
if (!_.isUndefined(config.ganacheDatabasePath)) {
// Saving the snapshot to a local db. Ganache requires this directory to exist
fs.mkdirSync(config.ganacheDatabasePath);
}
provider.addProvider(
new GanacheSubprovider({
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
db_path: config.ganacheDatabasePath,
gasLimit: constants.GAS_LIMIT,
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),

View File

@@ -1,4 +1,14 @@
[
{
"version": "1.1.0",
"changes": [
{
"note": "Add support for MultiAssetProxy",
"pr": 1363
}
],
"timestamp": 1547040760
},
{
"version": "1.0.16",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.1.0 - _January 9, 2019_
* Add support for MultiAssetProxy (#1363)
## v1.0.16 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
"version": "1.0.16",
"version": "1.1.0",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -28,14 +28,14 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^2.0.2",
"@0x/base-contract": "^3.0.10",
"@0x/contract-artifacts": "^1.1.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/abi-gen-wrappers": "^2.1.0",
"@0x/base-contract": "^3.0.11",
"@0x/contract-artifacts": "^1.2.0",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -2,7 +2,7 @@ import { DummyERC20TokenContract, DummyERC721TokenContract, ExchangeContract } f
import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
import { AssetProxyId, ERC721AssetData, OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
@@ -150,39 +150,8 @@ export class FillScenarios {
feeRecipientAddress: string,
expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(makerAssetData);
if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
await this._increaseERC20BalanceAndAllowanceAsync(
decodedMakerAssetData.tokenAddress,
makerAddress,
makerFillableAmount,
);
} else {
if (!makerFillableAmount.equals(1)) {
throw new Error(`ERC721 makerFillableAmount should be equal 1. Found: ${makerFillableAmount}`);
}
await this._increaseERC721BalanceAndAllowanceAsync(
decodedMakerAssetData.tokenAddress,
makerAddress,
// tslint:disable-next-line:no-unnecessary-type-assertion
(decodedMakerAssetData as ERC721AssetData).tokenId,
);
}
const decodedTakerAssetData = assetDataUtils.decodeAssetDataOrThrow(takerAssetData);
if (decodedTakerAssetData.assetProxyId === AssetProxyId.ERC20) {
const takerTokenAddress = decodedTakerAssetData.tokenAddress;
await this._increaseERC20BalanceAndAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount);
} else {
if (!takerFillableAmount.equals(1)) {
throw new Error(`ERC721 takerFillableAmount should be equal 1. Found: ${takerFillableAmount}`);
}
await this._increaseERC721BalanceAndAllowanceAsync(
decodedTakerAssetData.tokenAddress,
takerAddress,
// tslint:disable-next-line:no-unnecessary-type-assertion
(decodedMakerAssetData as ERC721AssetData).tokenId,
);
}
await this._increaseBalanceAndAllowanceWithAssetDataAsync(makerAssetData, makerAddress, makerFillableAmount);
await this._increaseBalanceAndAllowanceWithAssetDataAsync(takerAssetData, takerAddress, takerFillableAmount);
// Fees
await Promise.all([
this._increaseERC20BalanceAndAllowanceAsync(this._zrxTokenAddress, makerAddress, makerFee),
@@ -298,4 +267,30 @@ export class FillScenarios {
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
private async _increaseBalanceAndAllowanceWithAssetDataAsync(
assetData: string,
userAddress: string,
amount: BigNumber,
): Promise<void> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
await this._increaseERC20BalanceAndAllowanceAsync(decodedAssetData.tokenAddress, userAddress, amount);
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
await this._increaseERC721BalanceAndAllowanceAsync(
decodedAssetData.tokenAddress,
userAddress,
decodedAssetData.tokenId,
);
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
const amountsElement = decodedAssetData.amounts[index];
const totalAmount = amount.times(amountsElement);
await this._increaseBalanceAndAllowanceWithAssetDataAsync(
nestedAssetDataElement,
userAddress,
totalAmount,
);
}
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/instant",
"version": "1.0.4",
"version": "1.0.5",
"engines": {
"node": ">=6.12"
},
@@ -41,15 +41,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/asset-buyer": "^3.0.4",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/asset-buyer": "^3.0.5",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"bowser": "^1.9.4",
"copy-to-clipboard": "^3.0.8",
"ethereum-types": "^1.1.4",

View File

@@ -30,3 +30,5 @@ export const AmountPlaceholder: React.StatelessComponent<AmountPlaceholderProps>
return <PlainPlaceholder color={props.color} />;
}
};
AmountPlaceholder.displayName = 'AmountPlaceholder';

View File

@@ -11,6 +11,7 @@ export interface SlideAnimationProps {
slideOutSettings: OptionallyScreenSpecific<PositionAnimationSettings>;
zIndex?: OptionallyScreenSpecific<number>;
height?: string;
onAnimationEnd?: () => void;
}
export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = props => {
@@ -19,8 +20,15 @@ export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = pro
}
const positionSettings = props.animationState === 'slidIn' ? props.slideInSettings : props.slideOutSettings;
return (
<PositionAnimation height={props.height} positionSettings={positionSettings} zIndex={props.zIndex}>
<PositionAnimation
onAnimationEnd={props.onAnimationEnd}
height={props.height}
positionSettings={positionSettings}
zIndex={props.zIndex}
>
{props.children}
</PositionAnimation>
);
};
SlideAnimation.displayName = 'SlideAnimation';

View File

@@ -32,7 +32,7 @@ export interface BuyButtonProps {
onBuyFailure: (buyQuote: BuyQuote, txHash: string) => void;
}
export class BuyButton extends React.Component<BuyButtonProps> {
export class BuyButton extends React.PureComponent<BuyButtonProps> {
public static defaultProps = {
onClick: util.boundNoop,
onBuySuccess: util.boundNoop,

View File

@@ -31,3 +31,5 @@ export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> =
}
return null;
};
BuyOrderProgress.displayName = 'BuyOrderProgress';

View File

@@ -71,3 +71,5 @@ export const BuyOrderStateButtons: React.StatelessComponent<BuyOrderStateButtonP
/>
);
};
BuyOrderStateButtons.displayName = 'BuyOrderStateButtons';

View File

@@ -31,7 +31,7 @@ export interface ERC20AssetAmountInputState {
currentFontSizePx: number;
}
export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInputProps, ERC20AssetAmountInputState> {
export class ERC20AssetAmountInput extends React.PureComponent<ERC20AssetAmountInputProps, ERC20AssetAmountInputState> {
public static defaultProps = {
onChange: util.boundNoop,
isDisabled: false,

View File

@@ -21,12 +21,12 @@ export interface ERC20TokenSelectorState {
searchQuery: string;
}
export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps> {
export class ERC20TokenSelector extends React.PureComponent<ERC20TokenSelectorProps> {
public state: ERC20TokenSelectorState = {
searchQuery: '',
};
public render(): React.ReactNode {
const { tokens, onTokenSelect } = this.props;
const { tokens } = this.props;
return (
<Container height="100%">
<Container marginBottom="10px">
@@ -42,12 +42,11 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
tabIndex={-1}
/>
<Container overflow="scroll" height="calc(100% - 90px)" marginTop="10px">
{_.map(tokens, token => {
if (!this._isTokenQueryMatch(token)) {
return null;
}
return <TokenSelectorRow key={token.assetData} token={token} onClick={onTokenSelect} />;
})}
<TokenRowFilter
tokens={tokens}
onClick={this._handleTokenClick}
searchQuery={this.state.searchQuery}
/>
</Container>
</Container>
);
@@ -59,8 +58,32 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
});
analytics.trackTokenSelectorSearched(searchQuery);
};
private readonly _handleTokenClick = (token: ERC20Asset): void => {
this.props.onTokenSelect(token);
};
}
interface TokenRowFilterProps {
tokens: ERC20Asset[];
onClick: (token: ERC20Asset) => void;
searchQuery: string;
}
class TokenRowFilter extends React.Component<TokenRowFilterProps> {
public render(): React.ReactNode {
return _.map(this.props.tokens, token => {
if (!this._isTokenQueryMatch(token)) {
return null;
}
return <TokenSelectorRow key={token.assetData} token={token} onClick={this.props.onClick} />;
});
}
public shouldComponentUpdate(nextProps: TokenRowFilterProps): boolean {
const arePropsDeeplyEqual = _.isEqual(nextProps, this.props);
return !arePropsDeeplyEqual;
}
private readonly _isTokenQueryMatch = (token: ERC20Asset): boolean => {
const { searchQuery } = this.state;
const { searchQuery } = this.props;
const searchQueryLowerCase = searchQuery.toLowerCase().trim();
if (searchQueryLowerCase === '') {
return true;
@@ -76,7 +99,7 @@ interface TokenSelectorRowProps {
onClick: (token: ERC20Asset) => void;
}
class TokenSelectorRow extends React.Component<TokenSelectorRowProps> {
class TokenSelectorRow extends React.PureComponent<TokenSelectorRowProps> {
public render(): React.ReactNode {
const { token } = this.props;
const circleColor = token.metaData.primaryColor || 'black';
@@ -131,21 +154,23 @@ const getTokenIcon = (symbol: string): React.StatelessComponent | undefined => {
}
};
const TokenSelectorRowIcon: React.StatelessComponent<TokenSelectorRowIconProps> = props => {
const { token } = props;
const iconUrlIfExists = token.metaData.iconUrl;
class TokenSelectorRowIcon extends React.PureComponent<TokenSelectorRowIconProps> {
public render(): React.ReactNode {
const { token } = this.props;
const iconUrlIfExists = token.metaData.iconUrl;
const TokenIcon = getTokenIcon(token.metaData.symbol);
const displaySymbol = assetUtils.bestNameForAsset(token);
if (!_.isUndefined(iconUrlIfExists)) {
return <img src={iconUrlIfExists} />;
} else if (!_.isUndefined(TokenIcon)) {
return <TokenIcon />;
} else {
return (
<Text fontColor={ColorOption.white} fontSize="8px">
{displaySymbol}
</Text>
);
const TokenIcon = getTokenIcon(token.metaData.symbol);
const displaySymbol = assetUtils.bestNameForAsset(token);
if (!_.isUndefined(iconUrlIfExists)) {
return <img src={iconUrlIfExists} />;
} else if (!_.isUndefined(TokenIcon)) {
return <TokenIcon />;
} else {
return (
<Text fontColor={ColorOption.white} fontSize="8px">
{displaySymbol}
</Text>
);
}
}
};
}

View File

@@ -18,7 +18,7 @@ import { Button } from './ui/button';
export interface InstallWalletPanelContentProps {}
export class InstallWalletPanelContent extends React.Component<InstallWalletPanelContentProps> {
export class InstallWalletPanelContent extends React.PureComponent<InstallWalletPanelContentProps> {
public render(): React.ReactNode {
const panelProps = this._getStandardPanelContentProps();
return <StandardPanelContent {...panelProps} />;

View File

@@ -28,7 +28,7 @@ const ICON_WIDTH = 34;
const ICON_HEIGHT = 34;
const ICON_COLOR = ColorOption.white;
export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
export class InstantHeading extends React.PureComponent<InstantHeadingProps, {}> {
public render(): React.ReactNode {
const iconOrAmounts = this._renderIcon() || this._renderAmountsSection();
return (

View File

@@ -26,7 +26,7 @@ export interface OrderDetailsProps {
onBaseCurrencySwitchEth: () => void;
onBaseCurrencySwitchUsd: () => void;
}
export class OrderDetails extends React.Component<OrderDetailsProps> {
export class OrderDetails extends React.PureComponent<OrderDetailsProps> {
public render(): React.ReactNode {
const shouldShowUsdError = this.props.baseCurrency === BaseCurrency.USD && this._hadErrorFetchingUsdPrice();
return (
@@ -200,7 +200,7 @@ export interface OrderDetailsRowProps {
primaryValue: React.ReactNode;
secondaryValue?: React.ReactNode;
}
export class OrderDetailsRow extends React.Component<OrderDetailsRowProps, {}> {
export class OrderDetailsRow extends React.PureComponent<OrderDetailsRowProps, {}> {
public render(): React.ReactNode {
return (
<Container padding="10px 0px" borderTop="1px dashed" borderColor={ColorOption.feintGrey}>

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