Compare commits

..

1230 Commits

Author SHA1 Message Date
Brandon Millman
0bfcf79e79 Increase number of columns in relayer grid for small screens 2018-06-18 17:44:09 -07:00
Amir Bandeali
49f5495c45 Merge pull request #716 from 0xProject/feature/contracts/publicSignatureValidator
Make isValidSignature public
2018-06-18 16:20:16 -07:00
Amir Bandeali
9e431df848 Make isValidSignature public 2018-06-18 16:00:55 -07:00
Amir Bandeali
12476c52a4 Merge pull request #713 from 0xProject/feature/contracts/batchFillReturn
Make batchFill methods return FIllResults struct
2018-06-18 16:00:43 -07:00
Amir Bandeali
8fd9aebcb9 Make batchFill methods return FIllResults struct 2018-06-18 15:50:02 -07:00
Fabio Berger
8c83f4ba3b Merge pull request #722 from 0xProject/improvement/publishing-v2
Improvements to pre-publishing checks
2018-06-18 23:33:17 +02:00
Fabio Berger
25b6d1a232 Remove remove_tags script 2018-06-18 23:20:07 +02:00
Fabio Berger
880cbd88c2 Small fixes 2018-06-18 23:15:52 +02:00
Fabio Berger
dcd53c3c5b Use semver package instead of getNextPatchVersion 2018-06-18 23:08:44 +02:00
Fabio Berger
3e64b3da39 Use semver library instead of semverUtils 2018-06-18 23:08:33 +02:00
Fabio Berger
9a748c8bf1 small fixes 2018-06-18 23:07:03 +02:00
Fabio Berger
53eae14763 Show all errors of a given kind at once rather then throwing after the first instance is encountered 2018-06-18 23:06:55 +02:00
Fabio Berger
074c42e8b6 fix package.json 2018-06-18 23:06:48 +02:00
Fabio Berger
8633fa7024 Add more prepublish checks 2018-06-18 23:06:32 +02:00
Fabio Berger
19668b9b48 remove remove_tags script 2018-06-18 23:05:03 +02:00
Brandon Millman
3f02631b98 Merge pull request #712 from 0xProject/feature/website/portal-facelift
Change relayer grid tile to use logos and primary colors
2018-06-18 12:11:59 -07:00
Brandon Millman
da46eefe2e Create a shared Image component 2018-06-18 12:09:31 -07:00
Francesco Agosti
a3ca3ed33f Merge pull request #704 from 0xProject/bug/website/fix-filling-order
Fix filling orders on Portal
2018-06-18 10:24:42 -07:00
Francesco Agosti
efaa33c4d5 Merge pull request #711 from 0xProject/website/feature/prettier-onboarding-components
Made onboarding look like the mocks
2018-06-18 10:13:19 -07:00
fragosti
0cdfe7f458 Adjust version in changelog 2018-06-18 10:06:38 -07:00
Brandon Millman
2ad411ea29 Update RelayerGridTile render logic to incorportate colors and logos 2018-06-16 13:34:09 -07:00
Brandon Millman
55cbcd728d Add max width to top bar 2018-06-16 13:34:09 -07:00
Brandon Millman
8880860105 Set max-width for LargeLayout 2018-06-16 13:34:09 -07:00
Remco Bloemen
0c238448fd Merge pull request #700 from 0xProject/fix/contracts/tokenbugs
Handle tokens that do not return bool
2018-06-16 10:10:17 +02:00
fragosti
8a76fdc126 Finish last onboarding step 2018-06-15 18:34:57 -07:00
fragosti
433f830cf3 Finish set allowance step 2018-06-15 18:15:03 -07:00
fragosti
8893bc102c Add onboarding assets 2018-06-15 18:03:10 -07:00
fragosti
0cf9927132 Add all steps to their own file 2018-06-15 18:02:46 -07:00
fragosti
5993125cc7 Prettify account setup and add eth steps of onboarding 2018-06-15 15:17:20 -07:00
fragosti
0c34309133 Make metamask part of the fow pretty 2018-06-15 14:49:01 -07:00
fragosti
3d6ce0fb76 Make start onboarding button pretty 2018-06-15 14:06:17 -07:00
fragosti
54f79c2798 Improve styles of onboarding tooltip 2018-06-15 13:24:59 -07:00
fragosti
d0a3779091 Add Pointer component 2018-06-14 18:19:07 -07:00
Alex Browne
ff0960b174 Merge pull request #705 from 0xProject/feature/revert-trace-subprovider
Introduce subprovider for printing revert stack traces
2018-06-14 17:07:03 -07:00
Alex Browne
7032825e35 Change wording of error message when you try to use more than one subprovider 2018-06-14 16:53:48 -07:00
Alex Browne
d118533d87 Remove redundant check in trace.ts and revert_trace.ts 2018-06-14 16:53:29 -07:00
fragosti
35f4f75733 Prettier 2018-06-14 16:49:06 -07:00
Alex Browne
ef61c3543f Fix linter errors 2018-06-14 16:38:21 -07:00
Alex Browne
897560745a De-duplicate code by refactoring subprovider classes 2018-06-14 16:33:09 -07:00
Alex Browne
5a8539a122 Fix linter errors and remove coverage.json 2018-06-14 16:04:08 -07:00
Alex Browne
d9292a70bf Remove unused variables and other small fixes 2018-06-14 16:00:24 -07:00
Alex Browne
a9c23b7c28 Reverse order of stack trace to match behavior of most other language stack traces 2018-06-14 15:50:54 -07:00
Alex Browne
263bfb1bda Fix a bug in revert_trace.ts 2018-06-14 15:46:59 -07:00
Francesco Agosti
e7eb220c50 Merge pull request #695 from 0xProject/feature/website/onboarding-flow-allowances
Implement allowances and final "congrats" onboarding flow step
2018-06-14 14:41:42 -07:00
fragosti
7d67005820 Run prettify 2018-06-14 14:26:17 -07:00
fragosti
fadd91b6a2 Add to changelog for contract-wrappers 2018-06-14 14:22:53 -07:00
fragosti
5fa6a2848f Fix typo 2018-06-14 14:07:41 -07:00
Alex Browne
7ab921669b Introduce subprovider for printing revert stack traces 2018-06-14 13:58:54 -07:00
fragosti
4811dfa663 Fix filling orders on Portal 2018-06-14 13:56:36 -07:00
Remco Bloemen
2c7d6a7711 Handle tokens that do not return bool 2018-06-14 10:54:54 +02:00
Brandon Millman
0e354e5ea1 Merge pull request #685 from 0xProject/feature/website/jobs-page
Jobs page
2018-06-13 13:34:54 -07:00
Brandon Millman
d172a97247 Add back redirector behind feature flag 2018-06-13 12:29:36 -07:00
Brandon Millman
8a3df7e434 Update minHeight in Text 2018-06-13 12:19:14 -07:00
Brandon Millman
eafcbabaa2 Use Text components in Values 2018-06-13 12:10:21 -07:00
Brandon Millman
14071ea119 Use spread operator instead of React.createElement 2018-06-13 12:01:08 -07:00
fragosti
421e568232 Implement allowance and final flow step 2018-06-12 16:54:37 -07:00
Alex Browne
4efd28c092 Merge pull request #694 from 0xProject/refactor-sol-cov
Refactor sol-cov to de-duplicate code for coverage and profiling
2018-06-12 16:51:58 -07:00
Brandon Millman
d0bbee7e8c Fix issue with positions hash 2018-06-12 16:11:31 -07:00
Brandon Millman
7640563991 Revert localhost config 2018-06-12 16:09:23 -07:00
Amir Bandeali
90cf85c3f0 Merge pull request #682 from 0xProject/feature/contracts/popProxyId
Remove proxyId checks in AssetProxies
2018-06-12 16:05:46 -07:00
Brandon Millman
f1a98693d0 Use Text in Teams 2018-06-12 15:58:24 -07:00
Brandon Millman
2794d64d3e Use Text in OpenPositions 2018-06-12 15:54:27 -07:00
Alex Browne
82743cca92 Rename _coverageCollector -> _profilerCollector in TraceCollectionSubprovider 2018-06-12 15:46:41 -07:00
Alex Browne
d0c348e595 Refactor sol-cov to de-duplicate code for coverage and profiling 2018-06-12 15:40:18 -07:00
Alex Browne
f50d3088dc Merge pull request #691 from 0xProject/fix/sol-cov-memory
Refactor sol-cov to avoid keeping traceInfo in memory
2018-06-12 15:38:28 -07:00
Amir Bandeali
0917fa0d75 Rename popByte and popAddress 2018-06-12 15:30:46 -07:00
Amir Bandeali
cfb73dd534 Hard code test addresses/bytes32 instead of generating pseudorandom ones 2018-06-12 15:30:46 -07:00
Amir Bandeali
ef497b7989 Update artifacts 2018-06-12 15:30:41 -07:00
Brandon Millman
9d9341901f Use Text component for HeaderItem 2018-06-12 15:25:47 -07:00
Brandon Millman
155e3d225d Remove FloatingImage 2018-06-12 15:03:16 -07:00
Brandon Millman
ca41f100ab Move FilledImage into components/ui 2018-06-12 14:49:42 -07:00
Brandon Millman
084285a760 Replace FlatButton with Button in Retry 2018-06-12 14:26:48 -07:00
Brandon Millman
982391cd7c Fix incorrect colors 2018-06-12 14:23:47 -07:00
Brandon Millman
d206d0a3ae Add font family to Button component and use in Join0x component 2018-06-12 14:23:03 -07:00
Alex Browne
627ea6c860 Rename computeCoverageAsync -> computeSingleTraceCoverageAsync 2018-06-12 14:11:11 -07:00
Alex Browne
bcc76b3764 Fix linter errors 2018-06-12 14:09:42 -07:00
fragosti
39692a8b3f Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/onboarding-flow-allowances 2018-06-12 14:01:19 -07:00
Brandon Millman
eba8b4bf00 Consolidate jobs page grey colors with shared colors 2018-06-12 13:45:56 -07:00
Brandon Millman
f149665660 Fix lint errors 2018-06-12 13:40:15 -07:00
Brandon Millman
e3bb64cf35 Remove extra packages 2018-06-12 12:52:36 -07:00
Alex Browne
33f0669100 Refactor sol-cov to avoid keeping traceInfo in memory 2018-06-12 12:42:14 -07:00
Amir Bandeali
3a5f3e8b55 Unpop byte rather than making deep copy 2018-06-12 11:45:02 -07:00
Amir Bandeali
a0a90afbc0 Pass gas in to marketBuyOrdersNoThrow 2018-06-12 11:45:02 -07:00
Greg Hysen
2f96cb257c Looks up the memory location of makerAssetData/takerAssetData 2018-06-12 11:45:02 -07:00
Amir Bandeali
5910bec52e Make ZRX_PROXY_ID constant rather than popping it from ZRX_ASSET_DATA 2018-06-12 11:45:02 -07:00
Amir Bandeali
764b1c35cb Add tests for deepCopyBytes and missing write methods from LibBytes 2018-06-12 11:45:02 -07:00
Amir Bandeali
ee8c9b764d Pop id from assetData before dispatching to AssetProxies 2018-06-12 11:45:02 -07:00
Brandon Millman
7080f0c35a Implement small open positions 2018-06-12 10:44:03 -07:00
Brandon Millman
679d60cd5a Implement large screen open positions 2018-06-12 10:41:09 -07:00
Brandon Millman
bc36c0faed Teams section 2018-06-12 10:41:09 -07:00
Brandon Millman
3c073bc360 Benefits section 2018-06-12 10:41:08 -07:00
Brandon Millman
c52d5e1084 Refactor into BulletedItemList component 2018-06-12 10:41:08 -07:00
Brandon Millman
b7bb27fa21 Rework values section 2018-06-12 10:41:08 -07:00
Brandon Millman
087aaa2f94 Polish mission section and photo section 2018-06-12 10:41:08 -07:00
Brandon Millman
474b93a22f Add link to open positions section 2018-06-12 10:41:08 -07:00
Brandon Millman
0c2f002a7d Add scroll to top for jobs page 2018-06-12 10:41:08 -07:00
Brandon Millman
3d76d83a39 Skeleton for jobs page and initial implementation 2018-06-12 10:41:05 -07:00
Leonid Logvinov
787015f537 Upgrade solidity-parser-entlr 0.2.11 => 0.2.12 2018-06-12 10:22:15 -07:00
Leonid Logvinov
fb624fddc4 Fix import order 2018-06-11 22:30:14 -07:00
Leonid Logvinov
605ddacb71 Merge pull request #689 from 0xProject/geth-increase-startup-tx-delay
Increase delay when sending transactions during devnet startup
2018-06-11 22:15:51 -07:00
Leonid Logvinov
71934f05a8 Merge pull request #687 from 0xProject/feature/metacoin-docs
Add profiler and geth tests to metacoin
2018-06-11 22:03:22 -07:00
Leonid Logvinov
534a0d6836 Fix typos 2018-06-11 22:03:07 -07:00
Leonid Logvinov
746b1d0c4d Merge pull request #688 from 0xProject/feature/await-transaction-speedup
Speedup awaitTransactionMinedAsync and reduce polling interval in contracts tests
2018-06-11 21:56:56 -07:00
Leonid Logvinov
387c80e00a Merge pull request #690 from 0xProject/feature/truffle-sol-cov-fixes
Sol-cov fixes
2018-06-11 21:55:38 -07:00
Leonid Logvinov
05c914691f Add CHANGELOGs 2018-06-11 18:12:32 -07:00
Leonid Logvinov
94398d70f4 Speed-up sol-cov 2018-06-11 18:01:33 -07:00
Alex Browne
915ddb2b2b Increase delay when sending transactions during devnet startup 2018-06-11 17:26:10 -07:00
Alex Browne
b916e7f7ef Add note to web3-wrapper CHANGELOG.json 2018-06-11 17:13:58 -07:00
Alex Browne
3cc30f91a9 Speedup awaitTransactionMinedAsync and reduce polling interval in contracts tests 2018-06-11 17:07:28 -07:00
Leonid Logvinov
f4a61b4c70 Don't throw when no config file is found 2018-06-11 16:10:56 -07:00
Leonid Logvinov
6eebd693ce Fix solidityVersion schema regex 2018-06-11 16:10:15 -07:00
Fabio Berger
bc0ae6be31 Merge pull request #684 from 0xProject/fix/contract-wrappers/exchangeTransferSimulator
Move ExchangeTransferSimulator & OrderValidationUtils to Order-Utils
2018-06-12 00:14:19 +02:00
Fabio Berger
c03119d10a Stop exporting ArtifactWriter 2018-06-12 00:13:57 +02:00
Fabio Berger
e1879ef4d9 Fix no-unused-variable tslint rule to include parameters and fix issues 2018-06-11 23:42:30 +02:00
Fabio Berger
b6df727efb Fix linter exclude rule 2018-06-11 23:15:03 +02:00
Fabio Berger
fe58b44916 Validate all signature types rather then only ECSignatures 2018-06-11 22:14:03 +02:00
Fabio Berger
0a2694811d Store the instantiated OrderValidationUtils 2018-06-11 22:13:36 +02:00
Fabio Berger
31fe232bac Remove global hooks from tests and deploy contracts from within the specific tests 2018-06-11 22:13:12 +02:00
Leonid Logvinov
682f6d273c Fix linter issues 2018-06-11 12:49:46 -07:00
Leonid Logvinov
83ddaccf4a Add profiler and geth tests to metacoin 2018-06-11 11:59:48 -07:00
Leonid Logvinov
e0c0584c59 Add EmitStatement to ASTVisitor 2018-06-11 11:14:49 -07:00
Fabio Berger
60f5a52964 Merge branch 'v2-prototype' into fix/contract-wrappers/exchangeTransferSimulator
* v2-prototype:
  Fix a bug in SolCompilerArtifacts adapter config overriding
  Increase timeout for contract migrations
  Remove some copy-paste code
  Await transactions in migrations
  Fix typos
  Await transactions in migrations
  Await fake transactions
  Fix a typo
  Implement SolidityProfiler & adapt sol-cov to work with Geth

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

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

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

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

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

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

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

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

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

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

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

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

# Conflicts:
#	packages/0x.js/CHANGELOG.json
#	packages/0x.js/package.json
2018-04-19 10:38:43 +09:00
Fabio Berger
1ca86730fa Remove hack above migrations package 2018-04-19 10:37:13 +09:00
Jacob Evans
12ae7c009d Support Tuples from function returns 2018-04-19 11:21:32 +10:00
Brandon Millman
51b2fce8c1 Implement backendClient object to unify calls to the portal api 2018-04-18 20:12:38 -04:00
Leonid Logvinov
62fcb51e1a Publish
- 0x.js@0.36.3
 - contracts@2.1.25
 - @0xproject/sra-report@0.0.11
 - @0xproject/testnet-faucets@1.0.26
 - @0xproject/website@0.0.28
2018-04-18 21:30:28 +02:00
Leonid Logvinov
cbc55f2ef8 Updated CHANGELOGS 2018-04-18 21:30:20 +02:00
Leonid Logvinov
679f828e4e Move @0xproject/migrations to devDependencies 2018-04-18 21:18:18 +02:00
Leonid Logvinov
4a8b4e7398 Publish
- 0x.js@0.36.2
 - contracts@2.1.24
 - @0xproject/migrations@0.0.3
 - @0xproject/sra-report@0.0.10
 - @0xproject/testnet-faucets@1.0.25
 - @0xproject/website@0.0.27
2018-04-18 19:57:42 +02:00
Leonid Logvinov
b6a11ca31e Updated CHANGELOGS 2018-04-18 19:57:36 +02:00
Leonid Logvinov
a30ccf2b25 Make @0xproject/migrations public 2018-04-18 19:32:53 +02:00
Leonid Logvinov
2574405699 Fix expiration watcher comparator 2018-04-18 13:45:04 +02:00
Brandon Millman
39c0064ffb Add price information to wallet 2018-04-18 00:30:52 -04:00
903 changed files with 54294 additions and 17361 deletions

View File

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

28
.gitignore vendored
View File

@@ -70,22 +70,28 @@ TODO.md
packages/website/public/bundle*
packages/react-docs/example/public/bundle*
# generated binaries
bin/
# server cli
packages/testnet-faucets/server/
# generated contract artifacts
packages/sol-cov/test/fixtures/artifacts
packages/metacoin/artifacts
packages/0x.js/test/artifacts
packages/migrations/src/artifacts
# generated contract artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
packages/order-watcher/test/artifacts/
packages/contract-wrappers/test/artifacts/
# generated contract wrappers
packages/0x.js/src/contract_wrappers/generated/
packages/contracts/src/contract_wrappers/generated/
packages/0x.js/src/generated_contract_wrappers/
packages/contracts/src/generated_contract_wrappers/
packages/contract-wrappers/src/contract_wrappers/generated/
packages/metacoin/src/contract_wrappers
packages/fill-scenarios/src/generated_contract_wrappers/
packages/order-watcher/src/generated_contract_wrappers/
packages/order-utils/src/generated_contract_wrappers/
packages/migrations/src/v1/contract_wrappers
packages/migrations/src/v2/contract_wrappers
# solc-bin in deployer
packages/deployer/solc_bin/
# solc-bin in sol-compiler
packages/sol-compiler/solc_bin/
# Monorepo scripts
packages/*/scripts/

View File

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

View File

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

46
CODE_OF_CONDUCT.md Normal file
View File

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

123
README.md
View File

@@ -17,27 +17,27 @@ This repository is a monorepo including the 0x protocol smart contracts and nume
### Published Packages
| Package | Version | Description |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0xproject/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0xproject/abi-gen.svg)](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0xproject/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0xproject/assert.svg)](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages |
| [`@0xproject/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0xproject/base-contract.svg)](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0xproject/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0xproject/connect.svg)](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0xproject/deployer`](/packages/deployer) | [![npm](https://img.shields.io/npm/v/@0xproject/deployer.svg)](https://www.npmjs.com/package/@0xproject/deployer) | Solidity project compiler and deployer framework |
| [`@0xproject/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0xproject/dev-utils.svg)](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0xproject/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0xproject/json-schemas.svg)](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas |
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0xproject/monorepo-scripts.svg)](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts |
| [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
| [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool |
| [`@0xproject/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0xproject/subproviders.svg)](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0xproject/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0xproject/tslint-config.svg)](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
| [`@0xproject/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0xproject/types.svg)](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
| [`@0xproject/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0xproject/typescript-typings.svg)](https://www.npmjs.com/package/@0xproject/typescript-typings) | Repository of types for external packages |
| [`@0xproject/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0xproject/utils.svg)](https://www.npmjs.com/package/@0xproject/utils) | Shared utilities |
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0xproject/web3-wrapper.svg)](https://www.npmjs.com/package/@0xproject/web3-wrapper) | Web3 wrapper |
| Package | Version | Description |
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
| [`@0xproject/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0xproject/abi-gen.svg)](https://www.npmjs.com/package/@0xproject/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
| [`@0xproject/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0xproject/assert.svg)](https://www.npmjs.com/package/@0xproject/assert) | Type and schema assertions used by our packages |
| [`@0xproject/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0xproject/base-contract.svg)](https://www.npmjs.com/package/@0xproject/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
| [`@0xproject/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0xproject/connect.svg)](https://www.npmjs.com/package/@0xproject/connect) | A Javascript library for interacting with the Standard Relayer API |
| [`@0xproject/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-compiler.svg)](https://www.npmjs.com/package/@0xproject/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties. |
| [`@0xproject/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0xproject/dev-utils.svg)](https://www.npmjs.com/package/@0xproject/dev-utils) | Dev utils to be shared across 0x projects and packages |
| [`@0xproject/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0xproject/json-schemas.svg)](https://www.npmjs.com/package/@0xproject/json-schemas) | 0x-related json schemas |
| [`@0xproject/monorepo-scripts`](/packages/monorepo-scripts) | [![npm](https://img.shields.io/npm/v/@0xproject/monorepo-scripts.svg)](https://www.npmjs.com/package/@0xproject/monorepo-scripts) | Monorepo scripts |
| [`@0xproject/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0xproject/react-docs.svg)](https://www.npmjs.com/package/@0xproject/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
| [`@0xproject/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0xproject/react-shared.svg)](https://www.npmjs.com/package/@0xproject/react-shared) | 0x shared react components |
| [`@0xproject/sra-report`](/packages/sra-report) | [![npm](https://img.shields.io/npm/v/@0xproject/sra-report.svg)](https://www.npmjs.com/package/@0xproject/sra-report) | Generate reports for standard relayer API compliance |
| [`@0xproject/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0xproject/sol-cov.svg)](https://www.npmjs.com/package/@0xproject/sol-cov) | Solidity test coverage tool |
| [`@0xproject/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0xproject/subproviders.svg)](https://www.npmjs.com/package/@0xproject/subproviders) | Useful web3 subproviders (e.g LedgerSubprovider) |
| [`@0xproject/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0xproject/tslint-config.svg)](https://www.npmjs.com/package/@0xproject/tslint-config) | Custom 0x development TSLint rules |
| [`@0xproject/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0xproject/types.svg)](https://www.npmjs.com/package/@0xproject/types) | Shared type declarations |
| [`@0xproject/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0xproject/typescript-typings.svg)](https://www.npmjs.com/package/@0xproject/typescript-typings) | Repository of types for external packages |
| [`@0xproject/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0xproject/utils.svg)](https://www.npmjs.com/package/@0xproject/utils) | Shared utilities |
| [`@0xproject/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0xproject/web3-wrapper.svg)](https://www.npmjs.com/package/@0xproject/web3-wrapper) | Web3 wrapper |
### Private Packages
@@ -56,12 +56,14 @@ Dedicated documentation pages:
* [0x Connect](https://0xproject.com/docs/connect)
* [Smart contracts](https://0xproject.com/docs/contracts)
* [Subproviders](https://0xproject.com/docs/subproviders)
* [Deployer](https://0xproject.com/docs/deployer)
* [Sol Compiler](https://0xproject.com/docs/sol-compiler)
* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
* [JSON-schemas](https://0xproject.com/docs/json-schemas)
* [Sol-cov](https://0xproject.com/docs/sol-cov)
* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
Node version >= 6.12 is required.
Most of the packages require additional typings for external dependencies.
You can include those by prepending @0xproject/typescript-typings package to your [`typeRoots`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) config.
@@ -91,32 +93,87 @@ yarn install
### Build
Build all packages. You need to do this before working on any given package. Although these packages
as independent, when run from within the monorepo, they are internally symlinked, to make development
easier. You can change several packages and run the changes without publishing them first to NPM. When
running `rebuild`, Lerna will figure out the dependency order of all the packages, and build them in
this order.
To build all packages:
```bash
yarn lerna:rebuild
yarn build
```
Or continuously rebuild on change:
To build a specific package:
```bash
yarn dev
PKG=@0xproject/web3-wrapper yarn build
```
### Watch
To re-build all packages on change:
```bash
yarn watch
```
To watch a specific package and all it's dependent packages:
```bash
PKG=[NPM_PACKAGE_NAME] yarn watch
e.g
PKG=@0xproject/web3-wrapper yarn watch
```
### Clean
Clean all packages:
```bash
yarn clean
```
Clean a specific package
```bash
PKG=0x.js yarn clean
```
### Rebuild
To re-build (clean & build) all packages:
```bash
yarn rebuild
```
To re-build (clean & build) a specific package & it's deps:
```bash
PKG=0x.js yarn rebuild
```
### Lint
Lint all packages
Lint all packages:
```bash
yarn lerna:run lint
yarn lint
```
Lint a specific package:
```bash
PKG=0x.js yarn lint
```
### Run Tests
Run all tests:
```bash
yarn lerna:test
yarn test
```
Run a specific package's test:
```bash
PKG=@0xproject/web3-wrapper yarn test
```

View File

@@ -1,27 +1,36 @@
{
"private": true,
"name": "0x-monorepo",
"engines": {
"node" : ">=6.12"
},
"workspaces": [
"packages/*"
],
"scripts": {
"dev": "lerna run --parallel build:watch",
"testrpc": "testrpc -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"ganache": "ganache-cli -p 8545 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
"prettier": "prettier --write '**/*.{ts,tsx,json,md}' --config .prettierrc",
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
"report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
"lerna:install": "yarn install",
"lerna:run": "lerna run",
"lerna:test": "lerna run test",
"lerna:clean": "lerna run clean",
"lerna:build": "lerna run build",
"lerna:rebuild": "run-s lerna:clean lerna:build",
"lerna:publish": "run-s lerna:install lerna:rebuild script:publish",
"lerna:publish:dry": "run-s lerna:install lerna:rebuild script:publish:dry",
"lerna:stage_docs": "lerna run docs:stage",
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild script:publish",
"run:publish:dry": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild script:publish:dry",
"script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js",
"script:publish": "node ./packages/monorepo-scripts/lib/publish.js",
"script:publish:dry": "IS_DRY_RUN=true yarn script:publish"
"script:publish:dry": "IS_DRY_RUN=true yarn script:publish",
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna:run": "lerna run",
"watch": "wsrun watch_without_deps $PKG --fast-exit -r --stages --done-criteria='complete|successfully'",
"build": "wsrun build $PKG --fast-exit -r --stages",
"build:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build",
"clean": "wsrun clean $PKG --fast-exit -r --parallel",
"rebuild": "run-s clean build",
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
"stage_docs": "wsrun docs:stage $PKG --fast-exit --parallel --exclude-missing",
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
"comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete.",
"postinstall": "rm -rf `pwd`/packages/order-utils/node_modules/@0xproject; mkdir `pwd`/packages/order-utils/node_modules/@0xproject; ln -s `pwd`/packages/json-schemas `pwd`/packages/order-utils/node_modules/@0xproject/json-schemas; ln -s `pwd`/packages/types `pwd`/packages/order-utils/node_modules/@0xproject/types; rm -f `pwd`/packages/contracts/node_modules/@0xproject/types; ln -s `pwd`/packages/types `pwd`/packages/contracts/node_modules/@0xproject/types; mkdir -p `pwd`/packages/fill-scenarios/node_modules/@0xproject; ln -s `pwd`/packages/types `pwd`/packages/fill-scenarios/node_modules/@0xproject/types; ln -s `pwd`/packages/order-utils `pwd`/packages/fill-scenarios/node_modules/@0xproject/order-utils"
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic"
@@ -29,10 +38,16 @@
"devDependencies": {
"async-child-process": "^1.1.1",
"coveralls": "^3.0.0",
"ethereumjs-testrpc": "^6.0.3",
"lcov-result-merger": "^2.0.0",
"ganache-cli": "^6.1.0",
"lcov-result-merger": "^3.0.0",
"lerna": "^2.5.1",
"npm-run-all": "^4.1.2",
"prettier": "^1.11.1"
"prettier": "^1.11.1",
"wsrun": "^2.2.0",
"source-map-support": "^0.5.6"
},
"resolutions": {
"ethereumjs-tx": "0xProject/ethereumjs-tx#fake-tx-include-signature-by-default",
"ethers": "0xproject/ethers.js#eip-838-reasons"
}
}

View File

@@ -1,4 +1,77 @@
[
{
"version": "0.38.0",
"changes": [
{
"note": "Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async",
"pr": 579
},
{
"note":
"Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage",
"pr": 579
}
],
"timestamp": 1527008270
},
{
"timestamp": 1525477860,
"version": "0.37.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525453812,
"version": "0.37.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.37.0",
"changes": [
{
"note": "Fixed expiration watcher comparator to handle orders with equal expiration times",
"pr": 526
},
{
"note": "Update Web3 Provider Engine to 14.0.4",
"pr": 555
},
{
"note": "Add `zeroEx.getProvider()`",
"pr": 559
},
{
"note": "Move `ZeroExError.InvalidSignature` to `@0xproject/order-utils` `OrderError.InvalidSignature`",
"pr": 559
}
],
"timestamp": 1525428773
},
{
"version": "0.36.3",
"changes": [
{
"note": "Move @0xproject/migrations to devDependencies"
}
],
"timestamp": 1524079658
},
{
"timestamp": 1524073495,
"version": "0.36.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.36.1",
"changes": [

View File

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

View File

@@ -44,7 +44,7 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
We strongly recommend that the community help us make improvements and determine the future direction of 0x protocol. To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
@@ -64,28 +64,16 @@ yarn install
### Build
If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn lerna:rebuild
PKG=0x.js yarn build
```
Or continuously rebuild on change:
```bash
yarn dev
```
You can also build this specific package by running the following from within its directory:
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn build:watch
PKG=0x.js yarn watch
```
### Clean

View File

@@ -1,6 +1,9 @@
{
"name": "0x.js",
"version": "0.36.1",
"version": "0.38.0",
"engines": {
"node": ">=6.12"
},
"description": "A javascript library for interacting with the 0x protocol",
"keywords": [
"0x.js",
@@ -12,29 +15,29 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"prebuild": "run-s clean generate_contract_wrappers",
"build": "run-p build:umd:prod build:commonjs; exit 0;",
"generate_contract_wrappers": "node ../abi-gen/lib/index.js --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"watch_without_deps": "yarn pre_build && tsc -w",
"build": "yarn pre_build && yarn build:all && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"build:all": "run-p build:umd:prod build:commonjs; exit 0;",
"pre_build": "run-s generate_contract_wrappers copy_artifacts",
"copy_artifacts": "copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts",
"generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers",
"lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*",
"test:circleci": "run-s test:coverage",
"test": "run-s clean test:commonjs",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/src/artifacts/$i.json test/artifacts; done;",
"clean": "shx rm -rf _bundles lib test_temp scripts",
"clean": "shx rm -rf _bundles lib test_temp scripts src/generated_contract_wrappers",
"build:umd:prod": "NODE_ENV=production webpack",
"build:commonjs": "tsc && yarn update_artifacts && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"test:commonjs": "run-s build:commonjs run_mocha",
"run_mocha": "mocha lib/test/**/*_test.js --timeout 10000 --bail --exit",
"build:commonjs": "tsc && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
"docs:stage": "node scripts/stage_docs.js",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
},
"config": {
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
"postpublish": {
"assets": [
"packages/0x.js/_bundles/index.js",
@@ -43,9 +46,17 @@
"docPublishConfigs": {
"extraFileIncludes": [
"../types/src/index.ts",
"./src/contract_wrappers/generated/ether_token.ts",
"./src/contract_wrappers/generated/token.ts",
"./src/contract_wrappers/generated/exchange.ts"
"../ethereum-types/src/index.ts",
"../contract-wrappers/src/types.ts",
"../contract-wrappers/src/contract_wrappers/ether_token_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/exchange_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/token_registry_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/token_transfer_proxy_wrapper.ts",
"../contract-wrappers/src/contract_wrappers/token_wrapper.ts",
"../order-watcher/src/order_watcher/order_watcher.ts",
"./src/generated_contract_wrappers/ether_token.ts",
"./src/generated_contract_wrappers/token.ts",
"./src/generated_contract_wrappers/exchange.ts"
],
"s3BucketPath": "s3://doc-jsons/0x.js/",
"s3StagingBucketPath": "s3://staging-doc-jsons/0x.js/"
@@ -57,22 +68,17 @@
"url": "https://github.com/0xProject/0x-monorepo"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/deployer": "^0.4.1",
"@0xproject/dev-utils": "^0.3.6",
"@0xproject/monorepo-scripts": "^0.1.18",
"@0xproject/subproviders": "^0.9.0",
"@0xproject/tslint-config": "^0.4.16",
"@types/bintrees": "^1.0.2",
"@0xproject/abi-gen": "^0.3.0",
"@0xproject/dev-utils": "^0.4.2",
"@0xproject/migrations": "^0.0.6",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/sol-compiler": "^0.5.0",
"@0xproject/tslint-config": "^0.4.18",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
"@types/request": "2.47.0",
"@types/sinon": "^2.2.2",
"@types/uuid": "^3.4.2",
"awesome-typescript-loader": "^3.1.3",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
@@ -80,42 +86,33 @@
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"json-loader": "^0.5.4",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"opn-cli": "^3.1.0",
"prettier": "^1.11.1",
"request": "^2.81.0",
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"tslint": "5.8.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
"web3-provider-engine": "^13.0.1",
"webpack": "^3.1.0"
},
"dependencies": {
"@0xproject/assert": "^0.2.7",
"@0xproject/base-contract": "^0.2.1",
"@0xproject/json-schemas": "^0.7.21",
"@0xproject/types": "^0.6.1",
"@0xproject/typescript-typings": "^0.2.0",
"@0xproject/utils": "^0.5.2",
"@0xproject/web3-wrapper": "^0.6.1",
"bintrees": "^1.0.2",
"bn.js": "^4.11.8",
"ethereumjs-abi": "^0.6.4",
"ethereumjs-blockstream": "^2.0.6",
"ethereumjs-util": "^5.1.1",
"ethers-contracts": "^2.2.1",
"js-sha3": "^0.7.0",
"lodash": "^4.17.4",
"uuid": "^3.1.0",
"web3": "^0.20.0"
},
"optionalDependencies": {
"@0xproject/migrations": "^0.0.1"
"@0xproject/assert": "^0.2.10",
"@0xproject/base-contract": "^0.3.2",
"@0xproject/contract-wrappers": "^0.0.2",
"@0xproject/order-utils": "0.0.5",
"@0xproject/order-watcher": "^0.0.2",
"@0xproject/sol-compiler": "^0.5.0",
"@0xproject/types": "0.7.0",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"@0xproject/web3-wrapper": "^0.6.4",
"ethereum-types": "^0.0.1",
"ethers": "^3.0.15",
"lodash": "^4.17.4"
},
"publishConfig": {
"access": "public"

View File

@@ -1,26 +1,26 @@
import { schemas, SchemaValidator } from '@0xproject/json-schemas';
import { assert } from '@0xproject/assert';
import {
ContractWrappers,
ContractWrappersConfig,
EtherTokenWrapper,
ExchangeWrapper,
TokenRegistryWrapper,
TokenTransferProxyWrapper,
TokenWrapper,
} from '@0xproject/contract-wrappers';
import {
generatePseudoRandomSalt,
getOrderHashHex,
isValidOrderHash,
isValidSignature,
signOrderHashAsync,
} from '@0xproject/order-utils';
import { OrderWatcher, OrderWatcherConfig } from '@0xproject/order-watcher';
import { ECSignature, Order, Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
import { AbiDecoder, BigNumber, intervalUtils } from '@0xproject/utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper';
import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper';
import { TokenWrapper } from './contract_wrappers/token_wrapper';
import { OrderStateWatcher } from './order_watcher/order_state_watcher';
import { zeroExConfigSchema } from './schemas/zero_ex_config_schema';
import { zeroExPrivateNetworkConfigSchema } from './schemas/zero_ex_private_network_config_schema';
import { zeroExPublicNetworkConfigSchema } from './schemas/zero_ex_public_network_config_schema';
import { OrderStateWatcherConfig, ZeroExConfig, ZeroExError } from './types';
import { assert } from './utils/assert';
import { constants } from './utils/constants';
import { decorators } from './utils/decorators';
import { signatureUtils } from './utils/signature_utils';
import { utils } from './utils/utils';
/**
* The ZeroEx class is the single entry-point into the 0x.js library. It contains all of the library's functionality
@@ -33,7 +33,6 @@ export class ZeroEx {
* this constant for your convenience.
*/
public static NULL_ADDRESS = constants.NULL_ADDRESS;
/**
* An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
*/
@@ -57,7 +56,16 @@ export class ZeroEx {
* tokenTransferProxy smart contract.
*/
public proxy: TokenTransferProxyWrapper;
private _web3Wrapper: Web3Wrapper;
private _contractWrappers: ContractWrappers;
/**
* Generates a pseudo-random 256-bit salt.
* The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
* and will not collide with other outstanding orders that are identical in all other parameters.
* @return A pseudo-random 256-bit number that can be used as a salt.
*/
public static generatePseudoRandomSalt(): BigNumber {
return generatePseudoRandomSalt();
}
/**
* Verifies that the elliptic curve signature `signature` was generated
* by signing `data` with the private key corresponding to the `signerAddress` address.
@@ -67,27 +75,15 @@ export class ZeroEx {
* @return Whether the signature is valid for the supplied signerAddress and data.
*/
public static isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
assert.isHexString('data', data);
assert.doesConformToSchema('signature', signature, schemas.ecSignatureSchema);
assert.isETHAddressHex('signerAddress', signerAddress);
const normalizedSignerAddress = signerAddress.toLowerCase();
const isValidSignature = signatureUtils.isValidSignature(data, signature, normalizedSignerAddress);
return isValidSignature;
return isValidSignature(data, signature, signerAddress);
}
/**
* Generates a pseudo-random 256-bit salt.
* The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
* and will not collide with other outstanding orders that are identical in all other parameters.
* @return A pseudo-random 256-bit number that can be used as a salt.
* Computes the orderHash for a supplied order.
* @param order An object that conforms to the Order or SignedOrder interface definitions.
* @return The resulting orderHash from hashing the supplied order.
*/
public static generatePseudoRandomSalt(): BigNumber {
// BigNumber.random returns a pseudo-random number between 0 & 1 with a passed in number of decimal places.
// Source: https://mikemcl.github.io/bignumber.js/#random
const randomNumber = BigNumber.random(constants.MAX_DIGITS_IN_UNSIGNED_256_INT);
const factor = new BigNumber(10).pow(constants.MAX_DIGITS_IN_UNSIGNED_256_INT - 1);
const salt = randomNumber.times(factor).round();
return salt;
public static getOrderHashHex(order: Order | SignedOrder): string {
return getOrderHashHex(order);
}
/**
* Checks if the supplied hex encoded order hash is valid.
@@ -97,12 +93,7 @@ export class ZeroEx {
* @return Whether the supplied orderHash has the expected format.
*/
public static isValidOrderHash(orderHash: string): boolean {
// Since this method can be called to check if any arbitrary string conforms to an orderHash's
// format, we only assert that we were indeed passed a string.
assert.isString('orderHash', orderHash);
const schemaValidator = new SchemaValidator();
const isValidOrderHash = schemaValidator.validate(orderHash, schemas.orderHashSchema).valid;
return isValidOrderHash;
return isValidOrderHash(orderHash);
}
/**
* A unit amount is defined as the amount of a token above the specified decimal places (integer part).
@@ -132,17 +123,6 @@ export class ZeroEx {
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, decimals);
return baseUnitAmount;
}
/**
* Computes the orderHash for a supplied order.
* @param order An object that conforms to the Order or SignedOrder interface definitions.
* @return The resulting orderHash from hashing the supplied order.
*/
@decorators.syncZeroExErrorHandler
public static getOrderHashHex(order: Order | SignedOrder): string {
assert.doesConformToSchema('order', order, schemas.orderSchema);
const orderHashHex = utils.getOrderHashHex(order);
return orderHashHex;
}
/**
* Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library.
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
@@ -150,40 +130,15 @@ export class ZeroEx {
* @param config The configuration object. Look up the type for the description.
* @return An instance of the 0x.js ZeroEx class.
*/
constructor(provider: Provider, config: ZeroExConfig) {
constructor(provider: Provider, config: ContractWrappersConfig) {
assert.isWeb3Provider('provider', provider);
assert.doesConformToSchema('config', config, zeroExConfigSchema, [
zeroExPrivateNetworkConfigSchema,
zeroExPublicNetworkConfigSchema,
]);
const artifactJSONs = _.values(artifacts);
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
const defaults = {
gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(provider, defaults);
_.forEach(abiArrays, abi => {
this._web3Wrapper.abiDecoder.addABI(abi);
});
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
config.networkId,
config.tokenTransferProxyContractAddress,
);
this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this.proxy);
this.exchange = new ExchangeWrapper(
this._web3Wrapper,
config.networkId,
this.token,
config.exchangeContractAddress,
config.zrxContractAddress,
);
this.tokenRegistry = new TokenRegistryWrapper(
this._web3Wrapper,
config.networkId,
config.tokenRegistryContractAddress,
);
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this.token);
this._contractWrappers = new ContractWrappers(provider, config);
this.proxy = this._contractWrappers.proxy;
this.token = this._contractWrappers.token;
this.exchange = this._contractWrappers.exchange;
this.tokenRegistry = this._contractWrappers.tokenRegistry;
this.etherToken = this._contractWrappers.etherToken;
}
/**
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
@@ -192,24 +147,23 @@ export class ZeroEx {
* @param networkId The id of the network your provider is connected to
*/
public setProvider(provider: Provider, networkId: number): void {
this._web3Wrapper.setProvider(provider);
(this.exchange as any)._invalidateContractInstances();
(this.exchange as any)._setNetworkId(networkId);
(this.tokenRegistry as any)._invalidateContractInstance();
(this.tokenRegistry as any)._setNetworkId(networkId);
(this.token as any)._invalidateContractInstances();
(this.token as any)._setNetworkId(networkId);
(this.proxy as any)._invalidateContractInstance();
(this.proxy as any)._setNetworkId(networkId);
(this.etherToken as any)._invalidateContractInstance();
(this.etherToken as any)._setNetworkId(networkId);
this._contractWrappers.setProvider(provider, networkId);
}
/**
* Get the provider instance currently used by 0x.js
* @return Web3 provider instance
*/
public getProvider(): Provider {
return this._contractWrappers.getProvider();
}
/**
* Get user Ethereum addresses available through the supplied web3 provider available for sending transactions.
* @return An array of available user Ethereum addresses.
*/
public async getAvailableAddressesAsync(): Promise<string[]> {
const availableAddresses = await this._web3Wrapper.getAvailableAddressesAsync();
// Hack: Get Web3Wrapper from ContractWrappers
const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper;
const availableAddresses = await web3Wrapper.getAvailableAddressesAsync();
return availableAddresses;
}
/**
@@ -229,41 +183,12 @@ export class ZeroEx {
signerAddress: string,
shouldAddPersonalMessagePrefix: boolean,
): Promise<ECSignature> {
assert.isHexString('orderHash', orderHash);
await assert.isSenderAddressAsync('signerAddress', signerAddress, this._web3Wrapper);
const normalizedSignerAddress = signerAddress.toLowerCase();
let msgHashHex = orderHash;
if (shouldAddPersonalMessagePrefix) {
const orderHashBuff = ethUtil.toBuffer(orderHash);
const msgHashBuff = ethUtil.hashPersonalMessage(orderHashBuff);
msgHashHex = ethUtil.bufferToHex(msgHashBuff);
}
const signature = await this._web3Wrapper.signMessageAsync(normalizedSignerAddress, msgHashHex);
// HACK: There is no consensus on whether the signatureHex string should be formatted as
// v + r + s OR r + s + v, and different clients (even different versions of the same client)
// return the signature params in different orders. In order to support all client implementations,
// we parse the signature in both ways, and evaluate if either one is a valid signature.
const validVParamValues = [27, 28];
const ecSignatureVRS = signatureUtils.parseSignatureHexAsVRS(signature);
if (_.includes(validVParamValues, ecSignatureVRS.v)) {
const isValidVRSSignature = ZeroEx.isValidSignature(orderHash, ecSignatureVRS, normalizedSignerAddress);
if (isValidVRSSignature) {
return ecSignatureVRS;
}
}
const ecSignatureRSV = signatureUtils.parseSignatureHexAsRSV(signature);
if (_.includes(validVParamValues, ecSignatureRSV.v)) {
const isValidRSVSignature = ZeroEx.isValidSignature(orderHash, ecSignatureRSV, normalizedSignerAddress);
if (isValidRSVSignature) {
return ecSignatureRSV;
}
}
throw new Error(ZeroExError.InvalidSignature);
return signOrderHashAsync(
this._contractWrappers.getProvider(),
orderHash,
signerAddress,
shouldAddPersonalMessagePrefix,
);
}
/**
* Waits for a transaction to be mined and returns the transaction receipt.
@@ -274,10 +199,12 @@ export class ZeroEx {
*/
public async awaitTransactionMinedAsync(
txHash: string,
pollingIntervalMs = 1000,
pollingIntervalMs: number = 1000,
timeoutMs?: number,
): Promise<TransactionReceiptWithDecodedLogs> {
const transactionReceiptWithDecodedLogs = await this._web3Wrapper.awaitTransactionMinedAsync(
// Hack: Get Web3Wrapper from ContractWrappers
const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper;
const transactionReceiptWithDecodedLogs = await web3Wrapper.awaitTransactionMinedAsync(
txHash,
pollingIntervalMs,
timeoutMs,
@@ -285,22 +212,17 @@ export class ZeroEx {
return transactionReceiptWithDecodedLogs;
}
/**
* Instantiates and returns a new OrderStateWatcher instance.
* Instantiates and returns a new OrderWatcher instance.
* Defaults to watching the pending state.
* @param config The configuration object. Look up the type for the description.
* @return An instance of the 0x.js OrderStateWatcher class.
* @return An instance of the 0x.js OrderWatcher class.
*/
public createOrderStateWatcher(config?: OrderStateWatcherConfig) {
return new OrderStateWatcher(this._web3Wrapper, this.token, this.exchange, config);
}
/*
* HACK: `TokenWrapper` needs a token transfer proxy address. `TokenTransferProxy` address is fetched from
* an `ExchangeWrapper`. `ExchangeWrapper` needs `TokenWrapper` to validate orders, creating a dependency cycle.
* In order to break this - we create this function here and pass it as a parameter to the `TokenWrapper`
* and `ProxyWrapper`.
*/
private async _getTokenTransferProxyAddressAsync(): Promise<string> {
const tokenTransferProxyAddress = await (this.exchange as any)._getTokenTransferProxyAddressAsync();
return tokenTransferProxyAddress;
public async createOrderWatcherAsync(config?: OrderWatcherConfig): Promise<OrderWatcher> {
// Hack: Get Web3Wrapper from ContractWrappers
const web3Wrapper: Web3Wrapper = (this._contractWrappers as any)._web3Wrapper;
const networkId = await web3Wrapper.getNetworkIdAsync();
const provider = this._contractWrappers.getProvider();
const orderWatcher = new OrderWatcher(provider, networkId, config);
return orderWatcher;
}
}

View File

@@ -1,6 +0,0 @@
import { BigNumber } from '@0xproject/utils';
export abstract class BalanceAndProxyAllowanceFetcher {
public abstract async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>;
public abstract async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>;
}

View File

@@ -1,6 +0,0 @@
import { BigNumber } from '@0xproject/utils';
export abstract class OrderFilledCancelledFetcher {
public abstract async getFilledTakerAmountAsync(orderHash: string): Promise<BigNumber>;
public abstract async getCancelledTakerAmountAsync(orderHash: string): Promise<BigNumber>;
}

View File

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

View File

@@ -1,61 +1,51 @@
export { ZeroEx } from './0x';
export {
ZeroExError,
EventCallback,
ExchangeContractErrs,
ContractEvent,
Token,
IndexedFilterValues,
BlockRange,
OrderCancellationRequest,
OrderFillRequest,
ContractEventArgs,
ZeroExConfig,
MethodOpts,
OrderTransactionOpts,
TransactionOpts,
LogEvent,
DecodedLogEvent,
EventWatcherCallback,
OnOrderStateChangeCallback,
OrderStateValid,
OrderStateInvalid,
OrderState,
} from './types';
export {
BlockParamLiteral,
FilterObject,
BlockParam,
ContractEventArg,
ExchangeContractErrs,
LogWithDecodedArgs,
Order,
Provider,
SignedOrder,
ECSignature,
OrderStateValid,
OrderStateInvalid,
OrderState,
Token,
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
} from '@0xproject/types';
export {
EventCallback,
ContractEvent,
IndexedFilterValues,
BlockRange,
OrderCancellationRequest,
OrderFillRequest,
ContractEventArgs,
MethodOpts,
OrderTransactionOpts,
TransactionOpts,
LogEvent,
DecodedLogEvent,
OnOrderStateChangeCallback,
ContractWrappersError,
EtherTokenContractEventArgs,
WithdrawalContractEventArgs,
DepositContractEventArgs,
EtherTokenEvents,
} from './contract_wrappers/generated/ether_token';
export {
TransferContractEventArgs,
ApprovalContractEventArgs,
TokenContractEventArgs,
TokenEvents,
} from './contract_wrappers/generated/token';
export {
LogErrorContractEventArgs,
LogCancelContractEventArgs,
LogFillContractEventArgs,
ExchangeContractEventArgs,
ExchangeEvents,
} from './contract_wrappers/generated/exchange';
ContractWrappersConfig,
} from '@0xproject/contract-wrappers';

View File

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

View File

@@ -1,9 +1,23 @@
const networkNameToId: { [networkName: string]: number } = {
mainnet: 1,
ropsten: 3,
rinkeby: 4,
kovan: 42,
ganache: 50,
};
export const zeroExPublicNetworkConfigSchema = {
id: '/ZeroExPublicNetworkConfig',
properties: {
networkId: {
type: 'number',
enum: [1, 3, 4, 42, 50],
enum: [
networkNameToId.mainnet,
networkNameToId.ropsten,
networkNameToId.rinkeby,
networkNameToId.kovan,
networkNameToId.ganache,
],
},
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,21 +1,15 @@
import { Deployer } from '@0xproject/deployer';
import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils';
// HACK: This dependency is optional since it is only available when run from within
// the monorepo. tslint doesn't handle optional dependencies
// tslint:disable-next-line:no-implicit-dependencies
import { runMigrationsAsync } from '@0xproject/migrations';
import { ContractWrappers } from '@0xproject/contract-wrappers';
import { BlockchainLifecycle } from '@0xproject/dev-utils';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import 'make-promises-safe';
import 'mocha';
import * as path from 'path';
import * as Sinon from 'sinon';
import { ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, ZeroEx } from '../src';
import { ApprovalContractEventArgs, LogWithDecodedArgs, TokenEvents, ZeroEx } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { deployer } from './utils/deployer';
import { TokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
@@ -23,12 +17,9 @@ const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
chaiSetup.configure();
const expect = chai.expect;
const SHOULD_ADD_PERSONAL_MESSAGE_PREFIX = false;
describe('ZeroEx library', () => {
let zeroEx: ZeroEx;
before(async () => {
await runMigrationsAsync(deployer);
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
};
@@ -50,9 +41,9 @@ describe('ZeroEx library', () => {
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined();
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined();
// Check that all nested web3 wrapper instances return the updated provider
const nestedWeb3WrapperProvider = (zeroEx as any)._web3Wrapper.getProvider();
expect(nestedWeb3WrapperProvider.zeroExTestId).to.be.a('number');
// Check that all nested zeroExContract/web3Wrapper instances return the updated provider
const nestedWeb3WrapperProvider = ((zeroEx as any)._contractWrappers as ContractWrappers).getProvider();
expect((nestedWeb3WrapperProvider as any).zeroExTestId).to.be.a('number');
const exchangeWeb3WrapperProvider = (zeroEx.exchange as any)._web3Wrapper.getProvider();
expect(exchangeWeb3WrapperProvider.zeroExTestId).to.be.a('number');
const tokenRegistryWeb3WrapperProvider = (zeroEx.tokenRegistry as any)._web3Wrapper.getProvider();
@@ -70,14 +61,12 @@ describe('ZeroEx library', () => {
};
const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
it("should return false if the data doesn't pertain to the signature & address", async () => {
expect(ZeroEx.isValidSignature('0x0', signature, address)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync('0x0', signature, address),
).to.become(false);
});
it("should return false if the address doesn't pertain to the signature & data", async () => {
const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42';
expect(ZeroEx.isValidSignature(dataHex, signature, validUnrelatedAddress)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(
dataHex,
@@ -88,45 +77,16 @@ describe('ZeroEx library', () => {
});
it("should return false if the signature doesn't pertain to the dataHex & address", async () => {
const wrongSignature = _.assign({}, signature, { v: 28 });
expect(ZeroEx.isValidSignature(dataHex, wrongSignature, address)).to.be.false();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, wrongSignature, address),
).to.become(false);
});
it('should return true if the signature does pertain to the dataHex & address', async () => {
const isValidSignatureLocal = ZeroEx.isValidSignature(dataHex, signature, address);
expect(isValidSignatureLocal).to.be.true();
return expect(
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, signature, address),
).to.become(true);
});
});
describe('#generateSalt', () => {
it('generates different salts', () => {
const equal = ZeroEx.generatePseudoRandomSalt().eq(ZeroEx.generatePseudoRandomSalt());
expect(equal).to.be.false();
});
it('generates salt in range [0..2^256)', () => {
const salt = ZeroEx.generatePseudoRandomSalt();
expect(salt.greaterThanOrEqualTo(0)).to.be.true();
const twoPow256 = new BigNumber(2).pow(256);
expect(salt.lessThan(twoPow256)).to.be.true();
});
});
describe('#isValidOrderHash', () => {
it('returns false if the value is not a hex string', () => {
const isValid = ZeroEx.isValidOrderHash('not a hex');
expect(isValid).to.be.false();
});
it('returns false if the length is wrong', () => {
const isValid = ZeroEx.isValidOrderHash('0xdeadbeef');
expect(isValid).to.be.false();
});
it('returns true if order hash is correct', () => {
const isValid = ZeroEx.isValidOrderHash('0x' + Array(65).join('0'));
expect(isValid).to.be.true();
});
});
describe('#toUnitAmount', () => {
it('should throw if invalid baseUnit amount supplied as argument', () => {
const invalidBaseUnitAmount = new BigNumber(1000000000.4);
@@ -159,106 +119,6 @@ describe('ZeroEx library', () => {
);
});
});
describe('#getOrderHashHex', () => {
const expectedOrderHash = '0x39da987067a3c9e5f1617694f1301326ba8c8b0498ebef5df4863bed394e3c83';
const fakeExchangeContractAddress = '0xb69e673309512a9d726f87304c6984054f87a93b';
const order: Order = {
maker: constants.NULL_ADDRESS,
taker: constants.NULL_ADDRESS,
feeRecipient: constants.NULL_ADDRESS,
makerTokenAddress: constants.NULL_ADDRESS,
takerTokenAddress: constants.NULL_ADDRESS,
exchangeContractAddress: fakeExchangeContractAddress,
salt: new BigNumber(0),
makerFee: new BigNumber(0),
takerFee: new BigNumber(0),
makerTokenAmount: new BigNumber(0),
takerTokenAmount: new BigNumber(0),
expirationUnixTimestampSec: new BigNumber(0),
};
it('calculates the order hash', async () => {
const orderHash = ZeroEx.getOrderHashHex(order);
expect(orderHash).to.be.equal(expectedOrderHash);
});
it('throws a readable error message if taker format is invalid', async () => {
const orderWithInvalidtakerFormat = {
...order,
taker: (null as any) as string,
};
const expectedErrorMessage =
'Order taker must be of type string. If you want anyone to be able to fill an order - pass ZeroEx.NULL_ADDRESS';
expect(() => ZeroEx.getOrderHashHex(orderWithInvalidtakerFormat)).to.throw(expectedErrorMessage);
});
});
describe('#signOrderHashAsync', () => {
let stubs: Sinon.SinonStub[] = [];
let makerAddress: string;
before(async () => {
const availableAddreses = await zeroEx.getAvailableAddressesAsync();
makerAddress = availableAddreses[0];
});
afterEach(() => {
// clean up any stubs after the test has completed
_.each(stubs, s => s.restore());
stubs = [];
});
it('Should return the correct ECSignature', async () => {
const orderHash = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
const expectedECSignature = {
v: 27,
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
};
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
it('should return the correct ECSignature for signatureHex concatenated as R + S + V', async () => {
const orderHash = '0x34decbedc118904df65f379a175bb39ca18209d6ce41d5ed549d54e6e0a95004';
const signature =
'0x22109d11d79cb8bf96ed88625e1cd9558800c4073332a9a02857499883ee5ce3050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb021b';
const expectedECSignature = {
v: 27,
r: '0x22109d11d79cb8bf96ed88625e1cd9558800c4073332a9a02857499883ee5ce3',
s: '0x050aa3cc1f2c435e67e114cdce54b9527b4f50548342401bc5d2b77adbdacb02',
};
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'signMessageAsync').returns(Promise.resolve(signature)),
Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
];
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
it('should return the correct ECSignature for signatureHex concatenated as V + R + S', async () => {
const orderHash = '0xc793e33ffded933b76f2f48d9aa3339fc090399d5e7f5dec8d3660f5480793f7';
const signature =
'0x1bc80bedc6756722672753413efdd749b5adbd4fd552595f59c13427407ee9aee02dea66f25a608bbae457e020fb6decb763deb8b7192abab624997242da248960';
const expectedECSignature = {
v: 27,
r: '0xc80bedc6756722672753413efdd749b5adbd4fd552595f59c13427407ee9aee0',
s: '0x2dea66f25a608bbae457e020fb6decb763deb8b7192abab624997242da248960',
};
stubs = [
Sinon.stub((zeroEx as any)._web3Wrapper, 'signMessageAsync').returns(Promise.resolve(signature)),
Sinon.stub(ZeroEx, 'isValidSignature').returns(true),
];
const ecSignature = await zeroEx.signOrderHashAsync(
orderHash,
makerAddress,
SHOULD_ADD_PERSONAL_MESSAGE_PREFIX,
);
expect(ecSignature).to.deep.equal(expectedECSignature);
});
});
describe('#awaitTransactionMinedAsync', () => {
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -275,6 +135,7 @@ describe('ZeroEx library', () => {
const proxyAddress = zeroEx.proxy.getContractAddress();
const txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase);
const txReceiptWithDecodedLogs = await zeroEx.awaitTransactionMinedAsync(txHash);
// tslint:disable-next-line:no-unnecessary-type-assertion
const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs<ApprovalContractEventArgs>;
expect(log.event).to.be.equal(TokenEvents.Approval);
expect(log.args._owner).to.be.equal(coinbase);

View File

@@ -1,5 +1,5 @@
import { web3Factory } from '@0xproject/dev-utils';
import * as fs from 'fs';
import 'make-promises-safe';
import { ZeroEx } from '../src';
@@ -14,7 +14,7 @@ const TIMEOUT = 10000;
describe('Artifacts', () => {
describe('contracts are deployed on kovan', () => {
const kovanRpcUrl = constants.KOVAN_RPC_URL;
const provider = web3Factory.create({ rpcUrl: kovanRpcUrl }).currentProvider;
const provider = web3Factory.getRpcProvider({ rpcUrl: kovanRpcUrl });
const config = {
networkId: constants.KOVAN_NETWORK_ID,
};
@@ -31,7 +31,7 @@ describe('Artifacts', () => {
});
describe('contracts are deployed on ropsten', () => {
const ropstenRpcUrl = constants.ROPSTEN_RPC_URL;
const provider = web3Factory.create({ rpcUrl: ropstenRpcUrl }).currentProvider;
const provider = web3Factory.getRpcProvider({ rpcUrl: ropstenRpcUrl });
const config = {
networkId: constants.ROPSTEN_NETWORK_ID,
};

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,18 +0,0 @@
import { Deployer } from '@0xproject/deployer';
import { devConstants } from '@0xproject/dev-utils';
import * as path from 'path';
import { constants } from './constants';
import { provider } from './web3_wrapper';
const artifactsDir = path.resolve('test', 'artifacts');
const deployerOpts = {
artifactsDir,
provider,
networkId: constants.TESTRPC_NETWORK_ID,
defaults: {
gas: devConstants.GAS_ESTIMATE,
},
};
export const deployer = new Deployer(deployerOpts);

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
import { Token } from '@0xproject/types';
import * as _ from 'lodash';
import { InternalZeroExError, Token } from '../../src/types';
import { InternalZeroExError } from '../../src/types';
const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
const WETH_TOKEN_SYMBOL = 'WETH';

View File

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

View File

@@ -1,4 +1,32 @@
[
{
"version": "0.3.0",
"changes": [
{
"note": "Properly export the executable binary",
"pr": 588
}
],
"timestamp": 1527008270
},
{
"timestamp": 1525477860,
"version": "0.2.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525428773,
"version": "0.2.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1524044013,
"version": "0.2.11",

View File

@@ -5,11 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.3.0 - _May 22, 2018_
* Properly export the executable binary (#588)
## v0.2.13 - _May 4, 2018_
* Dependencies updated
## v0.2.12 - _May 4, 2018_
* Dependencies updated
## v0.2.11 - _April 18, 2018_
* Dependencies updated
## v0.2.10 - _April 12, 2018_
## v0.2.10 - _April 11, 2018_
* Dependencies updated
@@ -21,26 +33,26 @@ CHANGELOG
* Dependencies updated
## v0.2.5 - _March 18, 2018_
## v0.2.5 - _March 17, 2018_
* Consolidate all `console.log` calls into `logUtils` in the `@0xproject/utils` package (#452)
## v0.2.4 - _March 4, 2018_
## v0.2.4 - _March 3, 2018_
* Add a `backend` parameter that allows you to specify the Ethereum library you use in your templates (`web3` or `ethers`). Ethers auto-converts small ints to numbers whereas Web3 doesn't. Defaults to `web3` (#413)
* Add support for [tuple types](https://solidity.readthedocs.io/en/develop/abi-spec.html#handling-tuple-types) (#413)
* Add `hasReturnValue` to context data (#413)
## v0.2.1 - _February 9, 2018_
## v0.2.1 - _February 8, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.2.0 - _February 7, 2018_
## v0.2.0 - _February 6, 2018_
* Added CLI options for explicit specifying location of partials and main template (#346)
* Added CLI option to specify networkId, adding support for the JSON artifact format found in @0xproject/contracts (#388)
## v0.1.0 - _January 11, 2018_
## v0.1.0 - _January 10, 2018_
* Fixed array typings with union types (#295)
* Add event ABIs to context data passed to templates (#302)

View File

@@ -4,8 +4,7 @@ This package allows you to generate TypeScript contract wrappers from ABI files.
It's heavily inspired by [Geth abigen](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) but takes a different approach.
You can write your custom handlebars templates which will allow you to seamlessly integrate the generated code into your existing codebase with existing conventions.
For an example of the generated [wrapper files](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/src/contract_wrappers/generated) check out 0x.js.
[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate those files.
[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate the contract wrappers used by 0x.js.e
## Installation
@@ -45,7 +44,7 @@ You need to also specify the location of your main template used for every contr
## How to write custom templates?
The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) and start adjusting them for your needs.
The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates) and start adjusting them for your needs.
We use [handlebars](http://handlebarsjs.com/) template engine under the hood.
You need to have a master template called `contract.mustache`. it will be used to generate each contract wrapper. Although - you don't need and probably shouldn't write all your logic in a single template file. You can write [partial templates](http://handlebarsjs.com/partials.html) and as long as they are within a partials folder - they will be registered and available.
@@ -80,28 +79,16 @@ yarn install
### Build
If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn lerna:rebuild
PKG=@0xproject/abi-gen yarn build
```
Or continuously rebuild on change:
```bash
yarn dev
```
You can also build this specific package by running the following from within its directory:
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn build:watch
PKG=@0xproject/abi-gen yarn watch
```
### Clean

View File

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

View File

@@ -1,18 +1,21 @@
{
"name": "@0xproject/abi-gen",
"version": "0.2.11",
"version": "0.3.0",
"engines": {
"node": ">=6.12"
},
"description": "Generate contract wrappers from ABI and handlebars templates",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"lint": "tslint --project . 'src/**/*.ts'",
"watch_without_deps": "tsc -w",
"lint": "tslint --project .",
"clean": "shx rm -rf lib scripts",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"bin": {
"abi-gen": "lib/index.js"
"abi-gen": "bin/abi-gen.js"
},
"repository": {
"type": "git",
@@ -24,9 +27,9 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0xproject/types": "^0.6.1",
"@0xproject/typescript-typings": "^0.2.0",
"@0xproject/utils": "^0.5.2",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"ethereum-types": "^0.0.1",
"chalk": "^2.3.0",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
@@ -36,14 +39,15 @@
"yargs": "^10.0.3"
},
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.18",
"@0xproject/tslint-config": "^0.4.16",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/tslint-config": "^0.4.18",
"@types/glob": "^5.0.33",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
"@types/node": "^8.0.53",
"@types/yargs": "^10.0.0",
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.8.0",

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env node
import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from '@0xproject/types';
import { abiUtils, logUtils } from '@0xproject/utils';
import chalk from 'chalk';
import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from 'ethereum-types';
import * as fs from 'fs';
import { sync as globSync } from 'glob';
import * as Handlebars from 'handlebars';
@@ -12,7 +12,7 @@ import * as yargs from 'yargs';
import toSnakeCase = require('to-snake-case');
import { ContextData, ContractsBackend, Method, ParamKind } from './types';
import { ContextData, ContractsBackend, ParamKind } from './types';
import { utils } from './utils';
const ABI_TYPE_CONSTRUCTOR = 'constructor';
@@ -61,14 +61,13 @@ const args = yargs
'Full usage example',
).argv;
function registerPartials(partialsGlob: string) {
function registerPartials(partialsGlob: string): void {
const partialTemplateFileNames = globSync(partialsGlob);
logUtils.log(`Found ${chalk.green(`${partialTemplateFileNames.length}`)} ${chalk.bold('partial')} templates`);
for (const partialTemplateFileName of partialTemplateFileNames) {
const namedContent = utils.getNamedContent(partialTemplateFileName);
Handlebars.registerPartial(namedContent.name, namedContent.content);
}
return partialsGlob;
}
function writeOutputFile(name: string, renderedTsCode: string): void {
@@ -108,13 +107,13 @@ for (const abiFileName of abiFileNames) {
ABI = parsedContent; // ABI file
} else if (!_.isUndefined(parsedContent.abi)) {
ABI = parsedContent.abi; // Truffle artifact
} else if (!_.isUndefined(parsedContent.networks) && !_.isUndefined(parsedContent.networks[args.networkId])) {
ABI = parsedContent.networks[args.networkId].abi; // 0x contracts package artifact
} else if (!_.isUndefined(parsedContent.compilerOutput.abi)) {
ABI = parsedContent.compilerOutput.abi; // 0x artifact
}
if (_.isUndefined(ABI)) {
logUtils.log(`${chalk.red(`ABI not found in ${abiFileName}.`)}`);
logUtils.log(
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x deployer artifact`,
`Please make sure your ABI file is either an array with ABI entries or a truffle artifact or 0x sol-compiler artifact`,
);
process.exit(1);
}

View File

@@ -1,4 +1,4 @@
import { EventAbi, MethodAbi } from '@0xproject/types';
import { EventAbi, MethodAbi } from 'ethereum-types';
export enum ParamKind {
Input = 'input',

View File

@@ -1,4 +1,4 @@
import { AbiType, ConstructorAbi, DataItem } from '@0xproject/types';
import { AbiType, ConstructorAbi, DataItem } from 'ethereum-types';
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
@@ -56,7 +56,7 @@ export const utils = {
const componentType = `${component.name}: ${componentValueType}`;
return componentType;
});
const tsType = `{${componentsType}}`;
const tsType = `{${componentsType.join(';')}}`;
return tsType;
}
throw new Error(`Unknown Solidity type found: ${solType}`);

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1527008270,
"version": "0.2.10",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525477860,
"version": "0.2.9",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525428773,
"version": "0.2.8",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1524044013,
"version": "0.2.7",

View File

@@ -5,11 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.2.10 - _May 22, 2018_
* Dependencies updated
## v0.2.9 - _May 4, 2018_
* Dependencies updated
## v0.2.8 - _May 4, 2018_
* Dependencies updated
## v0.2.7 - _April 18, 2018_
* Dependencies updated
## v0.2.6 - _April 12, 2018_
## v0.2.6 - _April 11, 2018_
* Dependencies updated
@@ -21,20 +33,20 @@ CHANGELOG
* Dependencies updated
## v0.2.0 - _March 8, 2018_
## v0.2.0 - _March 7, 2018_
* Rename `isHttpUrl` to `isWebUri` (#412)
## v0.1.0 - _March 4, 2018_
## v0.1.0 - _March 3, 2018_
* Remove isETHAddressHex checksum address check and assume address will be lowercased (#373)
* Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385)
## v0.0.18 - _February 9, 2017_
## v0.0.18 - _February 8, 2017_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.0.4 - _November 14, 2017_
## v0.0.4 - _November 13, 2017_
* Re-publish Assert previously published under NPM package @0xproject/0x-assert
* Added assertion isValidBaseUnitAmount which checks both that the value is a valid bigNumber and that it does not contain decimals.

View File

@@ -46,28 +46,16 @@ yarn install
### Build
If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn lerna:rebuild
PKG=@0xproject/assert yarn build
```
Or continuously rebuild on change:
```bash
yarn dev
```
You can also build this specific package by running the following from within its directory:
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn build:watch
PKG=@0xproject/assert yarn watch
```
### Clean

View File

@@ -1,17 +1,21 @@
{
"name": "@0xproject/assert",
"version": "0.2.7",
"version": "0.2.10",
"engines": {
"node": ">=6.12"
},
"description": "Provides a standard way of performing type and schema validation across 0x projects",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib test_temp scripts",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"run_mocha": "mocha lib/test/**/*_test.js --exit",
"lint": "tslint --project .",
"run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js --exit",
"prepublishOnly": "run-p build",
"test": "run-s clean build run_mocha",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
@@ -27,14 +31,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.18",
"@0xproject/tslint-config": "^0.4.16",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/tslint-config": "^0.4.18",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
@@ -43,9 +48,9 @@
"typescript": "2.7.1"
},
"dependencies": {
"@0xproject/json-schemas": "^0.7.21",
"@0xproject/typescript-typings": "^0.2.0",
"@0xproject/utils": "^0.5.2",
"@0xproject/json-schemas": "0.7.22",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"lodash": "^4.17.4",
"valid-url": "^1.0.9"
},

View File

@@ -10,7 +10,7 @@ export const assert = {
const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
},
isValidBaseUnitAmount(variableName: string, value: BigNumber) {
isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
assert.isBigNumber(variableName, value);
const isNegative = value.lessThan(0);
this.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
@@ -64,6 +64,9 @@ export const assert = {
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Provider', value));
},
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
if (_.isUndefined(value)) {
throw new Error(`${variableName} can't be undefined`);
}
const schemaValidator = new SchemaValidator();
if (!_.isUndefined(subSchemas)) {
_.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator));

View File

@@ -2,6 +2,7 @@ import { schemas } from '@0xproject/json-schemas';
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
import 'make-promises-safe';
import 'mocha';
import { assert } from '../src/index';
@@ -10,6 +11,7 @@ chai.config.includeStack = true;
chai.use(dirtyChai);
const expect = chai.expect;
// tslint:disable:custom-no-magic-numbers
describe('Assertions', () => {
const variableName = 'variable';
describe('#isBigNumber', () => {
@@ -251,3 +253,4 @@ describe('Assertions', () => {
});
});
});
// tslint:enable:custom-no-magic-numbers

View File

@@ -1,4 +1,32 @@
[
{
"timestamp": 1527008270,
"version": "0.3.2",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525477860,
"version": "0.3.1",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "0.3.0",
"changes": [
{
"note": "Update ethers-contracts to ethers.js",
"pr": 540
}
],
"timestamp": 1525428773
},
{
"timestamp": 1524044013,
"version": "0.2.1",

View File

@@ -5,11 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.3.2 - _May 22, 2018_
* Dependencies updated
## v0.3.1 - _May 4, 2018_
* Dependencies updated
## v0.3.0 - _May 4, 2018_
* Update ethers-contracts to ethers.js (#540)
## v0.2.1 - _April 18, 2018_
* Dependencies updated
## v0.2.0 - _April 12, 2018_
## v0.2.0 - _April 11, 2018_
* Contract wrappers now accept Provider and defaults instead of Web3Wrapper (#501)
@@ -23,6 +35,6 @@ CHANGELOG
* Dependencies updated
## v0.0.2 - _March 4, 2018_
## v0.0.2 - _March 3, 2018_
* Initial release

View File

@@ -44,14 +44,16 @@ yarn install
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn build
PKG=@0xproject/base-contract yarn build
```
or
Or continuously rebuild on change:
```bash
yarn build:watch
PKG=@0xproject/base-contract yarn watch
```
### Lint

View File

@@ -1,19 +1,23 @@
{
"name": "@0xproject/base-contract",
"version": "0.2.1",
"version": "0.3.2",
"engines": {
"node": ">=6.12"
},
"description": "0x Base TS contract",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib scripts",
"test": "run-s clean build run_mocha",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:circleci": "yarn test:coverage",
"run_mocha": "mocha lib/test/**/*_test.js --bail --exit",
"run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js --bail --exit",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"lint": "tslint --project .",
"lint": "tslint --project . --exclude **/src/contract_wrappers/**/*",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"license": "Apache-2.0",
@@ -26,11 +30,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.18",
"@0xproject/tslint-config": "^0.4.16",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/tslint-config": "^0.4.18",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -38,11 +43,11 @@
"typescript": "2.7.1"
},
"dependencies": {
"@0xproject/types": "^0.6.1",
"@0xproject/typescript-typings": "^0.2.0",
"@0xproject/utils": "^0.5.2",
"@0xproject/web3-wrapper": "^0.6.1",
"ethers-contracts": "^2.2.1",
"ethereum-types": "^0.0.1",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"@0xproject/web3-wrapper": "^0.6.4",
"ethers": "^3.0.15",
"lodash": "^4.17.4"
},
"publishConfig": {

View File

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

View File

@@ -1,4 +1,4 @@
import { DataItem } from '@0xproject/types';
import { DataItem } from 'ethereum-types';
import * as _ from 'lodash';
// tslint:disable-next-line:completed-docs

View File

@@ -1,5 +1,6 @@
import { BigNumber } from '@0xproject/utils';
import * as chai from 'chai';
import 'make-promises-safe';
import 'mocha';
import { formatABIDataItem } from '../src/utils';

View File

@@ -1,4 +1,31 @@
[
{
"timestamp": 1527008270,
"version": "0.6.13",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525477860,
"version": "0.6.12",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1525428773,
"version": "0.6.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1524044013,
"version": "0.6.10",

View File

@@ -5,11 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v0.6.13 - _May 22, 2018_
* Dependencies updated
## v0.6.12 - _May 4, 2018_
* Dependencies updated
## v0.6.11 - _May 4, 2018_
* Dependencies updated
## v0.6.10 - _April 18, 2018_
* Dependencies updated
## v0.6.9 - _April 12, 2018_
## v0.6.9 - _April 11, 2018_
* Dependencies updated
@@ -21,44 +33,44 @@ CHANGELOG
* Dependencies updated
## v0.6.4 - _March 18, 2018_
## v0.6.4 - _March 17, 2018_
* Consolidate `Order`, `SignedOrder`, and `ECSignature` into the `@0xproject/types` package (#456)
## v0.6.2 - _February 16, 2018_
## v0.6.2 - _February 15, 2018_
* Fix JSON parse empty response (#407)
## v0.6.0 - _February 16, 2018_
## v0.6.0 - _February 15, 2018_
* Add pagination options to HttpClient methods (#393)
* Add heartbeat configuration to WebSocketOrderbookChannel constructor (#406)
## v0.5.7 - _February 9, 2018_
## v0.5.7 - _February 8, 2018_
* Fix publishing issue where .npmignore was not properly excluding undesired content (#389)
## v0.5.0 - _January 17, 2018_
## v0.5.0 - _January 16, 2018_
* Sanitize api endpoint url and remove trailing slashes (#318)
* Improve error message text in HttpClient (#318)
* Stop appending '/v0' to api endpoint url in HttpClient (#318)
## v0.4.0 - _January 11, 2018_
## v0.4.0 - _January 10, 2018_
* Prevent getFeesAsync method on HttpClient from mutating input (#296)
## v0.3.0 - _December 8, 2017_
## v0.3.0 - _December 7, 2017_
* Expose WebSocketOrderbookChannel and associated types to public interface (#251)
* Remove tokenA and tokenB fields from OrdersRequest (#256)
## v0.2.0 - _November 29, 2017_
## v0.2.0 - _November 28, 2017_
* Add SignedOrder and TokenTradeInfo to the public interface
* Add ECSignature and Order to the public interface
* Remove dependency on 0x.js
## v0.1.0 - _November 22, 2017_
## v0.1.0 - _November 21, 2017_
* Provide a HttpClient class for interacting with standard relayer api compliant HTTP urls

View File

@@ -43,28 +43,16 @@ yarn install
### Build
If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
yarn lerna:rebuild
PKG=@0xproject/connect yarn build
```
Or continuously rebuild on change:
```bash
yarn dev
```
You can also build this specific package by running the following from within its directory:
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn build:watch
PKG=@0xproject/connect yarn watch
```
### Clean

View File

@@ -1,6 +1,9 @@
{
"name": "@0xproject/connect",
"version": "0.6.10",
"version": "0.6.13",
"engines": {
"node": ">=6.12"
},
"description": "A javascript library for interacting with the standard relayer api",
"keywords": [
"connect",
@@ -12,18 +15,19 @@
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"build:watch": "tsc -w",
"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib test_temp scripts",
"copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures",
"lint": "tslint --project . 'src/**/*.ts' 'test/**/*.ts'",
"run_mocha": "mocha lib/test/**/*_test.js --exit",
"test": "run-s clean build copy_test_fixtures run_mocha",
"lint": "tslint --project .",
"run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js --exit",
"test": "run-s copy_test_fixtures run_mocha",
"rebuild_and_test": "run-s clean build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"test:circleci": "yarn test:coverage",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
"docs:stage": "yarn build && node ./scripts/stage_docs.js",
"docs:stage": "node scripts/stage_docs.js",
"docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
"upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
},
@@ -42,27 +46,24 @@
},
"author": "Brandon Millman",
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
},
"bugs": {
"url": "https://github.com/0xProject/0x-monorepo/issues"
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
"@0xproject/assert": "^0.2.7",
"@0xproject/json-schemas": "^0.7.21",
"@0xproject/types": "^0.6.1",
"@0xproject/typescript-typings": "^0.2.0",
"@0xproject/utils": "^0.5.2",
"@0xproject/assert": "^0.2.10",
"@0xproject/json-schemas": "0.7.22",
"@0xproject/types": "^0.7.0",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4",
"query-string": "^5.0.1",
"websocket": "^1.0.25"
},
"devDependencies": {
"@0xproject/monorepo-scripts": "^0.1.18",
"@0xproject/tslint-config": "^0.4.16",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/tslint-config": "^0.4.18",
"@types/fetch-mock": "^5.12.1",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -74,6 +75,7 @@
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"fetch-mock": "^5.13.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",

View File

@@ -48,7 +48,7 @@ export class HttpClient implements Client {
return '';
}
// format params into a form the api expects
const formattedParams = _.mapKeys(params, (value: any, key: string) => {
const formattedParams = _.mapKeys(params, (_value: any, key: string) => {
return _.get(OPTS_TO_QUERY_FIELD_MAP, key, key);
});
// stringify the formatted object

View File

@@ -17,4 +17,4 @@ export {
WebSocketOrderbookChannelConfig,
} from './types';
export { ECSignature, Order, SignedOrder } from '@0xproject/types';
export { Order, SignedOrder } from '@0xproject/types';

View File

@@ -1,4 +1,4 @@
import { ECSignature, Order, SignedOrder } from '@0xproject/types';
import { SignedOrder } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
export interface Client {

View File

@@ -1,7 +1,6 @@
import { assert } from '@0xproject/assert';
import { schemas } from '@0xproject/json-schemas';
import { SignedOrder } from '@0xproject/types';
import * as _ from 'lodash';
import { FeesResponse, OrderbookResponse, TokenPairsItem } from '../types';

View File

@@ -78,7 +78,7 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
connection.on(WebsocketConnectionEventType.Error, wsError => {
handler.onError(this, subscriptionOpts, wsError);
});
connection.on(WebsocketConnectionEventType.Close, (code: number, desc: string) => {
connection.on(WebsocketConnectionEventType.Close, (_code: number, _desc: string) => {
handler.onClose(this, subscriptionOpts);
});
connection.on(WebsocketConnectionEventType.Message, message => {
@@ -91,7 +91,7 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
/**
* Close the websocket and stop receiving updates
*/
public close() {
public close(): void {
if (!_.isUndefined(this._connectionIfExists)) {
this._connectionIfExists.close();
}
@@ -99,7 +99,7 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
clearInterval(this._heartbeatTimerIfExists);
}
}
private _getConnection(callback: (error?: Error, connection?: WebSocket.connection) => void) {
private _getConnection(callback: (error?: Error, connection?: WebSocket.connection) => void): void {
if (!_.isUndefined(this._connectionIfExists) && this._connectionIfExists.connected) {
callback(undefined, this._connectionIfExists);
} else {

View File

@@ -3,6 +3,7 @@ import * as chai from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import * as dirtyChai from 'dirty-chai';
import * as fetchMock from 'fetch-mock';
import 'make-promises-safe';
import 'mocha';
import { HttpClient } from '../src/index';

View File

@@ -1,5 +1,6 @@
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
import 'make-promises-safe';
import 'mocha';
import { orderbookChannelMessageParser } from '../src/utils/orderbook_channel_message_parser';

View File

@@ -1,6 +1,7 @@
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
import * as _ from 'lodash';
import 'make-promises-safe';
import 'mocha';
import { WebSocketOrderbookChannel } from '../src/ws_orderbook_channel';

View File

@@ -0,0 +1,11 @@
.*
tsconfig.json
webpack.config.js
yarn-error.log
test/
/src/
/_bundles/
/contract_templates/
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/

View File

@@ -0,0 +1,29 @@
[
{
"version": "0.1.0",
"changes": [
{
"note": "Expose 'abi' ContractAbi property on all contract wrappers"
}
]
},
{
"version": "0.0.2",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1527008544
},
{
"timestamp": 1527008270,
"version": "0.0.1",
"changes": [
{
"note": "Moved contractWrappers out of 0x.js",
"pr": 579
}
]
}
]

View File

@@ -0,0 +1,14 @@
<!--
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
Edit the package's CHANGELOG.json file only.
-->
CHANGELOG
## v0.0.2 - _May 22, 2018_
* Dependencies updated
## v0.0.1 - _May 22, 2018_
* Moved contractWrappers out of 0x.js (#579)

View File

@@ -0,0 +1,89 @@
## @0xproject/contract-wrappers
Smart TS wrappers for 0x smart contracts. The wrappers have simplified interfaces, perform client-side validation on transactions and throw helpful error messages.
### Read the [Documentation](https://0xproject.com/docs/0x.js).
## Installation
**Install**
```bash
npm install @0xproject/contract-wrappers --save
```
**Import**
```javascript
import { ContractWrappers } from '@0xproject/contract-wrappers';
```
If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
```json
"compilerOptions": {
"typeRoots": ["node_modules/@0xproject/typescript-typings/types", "node_modules/@types"],
}
```
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
```bash
yarn config set workspaces-experimental true
```
Then install dependencies
```bash
yarn install
```
### Build
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
```bash
PKG=@0xproject/contract-wrappers yarn build
```
Or continuously rebuild on change:
```bash
PKG=@0xproject/contract-wrappers yarn watch
```
```bash
yarn build
```
or continuously rebuild on change:
```bash
yarn watch
```
### Clean
```bash
yarn clean
```
### Lint
```bash
yarn lint
```
### Run Tests
```bash
yarn test
```

View File

@@ -0,0 +1,100 @@
{
"name": "@0xproject/contract-wrappers",
"version": "0.0.2",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
"ethereum",
"tokens",
"exchange"
],
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",
"scripts": {
"watch_without_deps": "yarn pre_build && tsc -w",
"build": "yarn pre_build && tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
"pre_build": "run-s generate_contract_wrappers update_test_artifacts update_compact_artifacts",
"generate_contract_wrappers": "abi-gen --abis 'src/compact_artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken|TokenRegistry|DummyToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers && prettier --write 'src/contract_wrappers/generated/**.ts'",
"lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*",
"test:circleci": "run-s test:coverage",
"test": "yarn run_mocha",
"rebuild_and_test": "run-s build test",
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"update_compact_artifacts": "copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts",
"update_test_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/1.0.0/$i.json test/artifacts; done;",
"clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/contract_wrappers/generated",
"run_mocha": "mocha --require source-map-support/register lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"config": {
"compact_artifacts": "Exchange DummyToken ZRXToken Token EtherToken TokenTransferProxy TokenRegistry",
"contracts": "Exchange DummyToken ZRXToken Token WETH9 TokenTransferProxy_v1 MultiSigWallet MultiSigWalletWithTimeLock MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress MaliciousToken TokenRegistry Arbitrage EtherDelta AccountLevels",
"postpublish": {
"assets": [
"packages/contract-wrappers/_bundles/index.js",
"packages/contract-wrappers/_bundles/index.min.js"
]
}
},
"repository": {
"type": "git",
"url": "https://github.com/0xProject/0x-monorepo"
},
"license": "Apache-2.0",
"engines": {
"node": ">=6.0.0"
},
"devDependencies": {
"@0xproject/abi-gen": "^0.3.0",
"@0xproject/dev-utils": "^0.4.2",
"@0xproject/migrations": "^0.0.6",
"@0xproject/monorepo-scripts": "^0.1.20",
"@0xproject/sol-compiler": "^0.5.0",
"@0xproject/subproviders": "^0.10.2",
"@0xproject/tslint-config": "^0.4.18",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
"@types/sinon": "^2.2.2",
"@types/uuid": "^3.4.2",
"awesome-typescript-loader": "^3.1.3",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
"copyfiles": "^1.2.0",
"dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"opn-cli": "^3.1.0",
"shx": "^0.2.2",
"sinon": "^4.0.0",
"source-map-support": "^0.5.0",
"tslint": "5.8.0",
"typescript": "2.7.1",
"web3-provider-engine": "^14.0.4"
},
"dependencies": {
"@0xproject/assert": "^0.2.10",
"@0xproject/base-contract": "^0.3.2",
"@0xproject/fill-scenarios": "^0.0.2",
"@0xproject/json-schemas": "0.7.22",
"@0xproject/order-utils": "0.0.5",
"@0xproject/types": "0.7.0",
"@0xproject/typescript-typings": "^0.3.2",
"@0xproject/utils": "^0.6.2",
"@0xproject/web3-wrapper": "^0.6.4",
"ethereum-types": "^0.0.1",
"ethereumjs-blockstream": "^2.0.6",
"ethereumjs-util": "^5.1.1",
"ethers": "^3.0.15",
"js-sha3": "^0.7.0",
"lodash": "^4.17.4",
"uuid": "^3.1.0"
},
"publishConfig": {
"access": "public"
}
}

View File

@@ -0,0 +1,11 @@
import { BigNumber } from '@0xproject/utils';
export abstract class AbstractBalanceAndProxyAllowanceLazyStore {
public abstract async getBalanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>;
public abstract async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise<BigNumber>;
public abstract setBalance(tokenAddress: string, userAddress: string, balance: BigNumber): void;
public abstract deleteBalance(tokenAddress: string, userAddress: string): void;
public abstract setProxyAllowance(tokenAddress: string, userAddress: string, proxyAllowance: BigNumber): void;
public abstract deleteProxyAllowance(tokenAddress: string, userAddress: string): void;
public abstract deleteAll(): void;
}

View File

@@ -0,0 +1,18 @@
import { Artifact } from '@0xproject/types';
import * as DummyToken from './compact_artifacts/DummyToken.json';
import * as EtherToken from './compact_artifacts/EtherToken.json';
import * as Exchange from './compact_artifacts/Exchange.json';
import * as Token from './compact_artifacts/Token.json';
import * as TokenRegistry from './compact_artifacts/TokenRegistry.json';
import * as TokenTransferProxy from './compact_artifacts/TokenTransferProxy.json';
import * as ZRX from './compact_artifacts/ZRX.json';
export const artifacts = {
ZRX: (ZRX as any) as Artifact,
DummyToken: (DummyToken as any) as Artifact,
Token: (Token as any) as Artifact,
Exchange: (Exchange as any) as Artifact,
EtherToken: (EtherToken as any) as Artifact,
TokenRegistry: (TokenRegistry as any) as Artifact,
TokenTransferProxy: (TokenTransferProxy as any) as Artifact,
};

View File

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

View File

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

View File

@@ -0,0 +1,610 @@
{
"contract_name": "Exchange",
"abi": [
{
"constant": true,
"inputs": [
{
"name": "numerator",
"type": "uint256"
},
{
"name": "denominator",
"type": "uint256"
},
{
"name": "target",
"type": "uint256"
}
],
"name": "isRoundingError",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "bytes32"
}
],
"name": "filled",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "bytes32"
}
],
"name": "cancelled",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5][]"
},
{
"name": "orderValues",
"type": "uint256[6][]"
},
{
"name": "fillTakerTokenAmount",
"type": "uint256"
},
{
"name": "shouldThrowOnInsufficientBalanceOrAllowance",
"type": "bool"
},
{
"name": "v",
"type": "uint8[]"
},
{
"name": "r",
"type": "bytes32[]"
},
{
"name": "s",
"type": "bytes32[]"
}
],
"name": "fillOrdersUpTo",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5]"
},
{
"name": "orderValues",
"type": "uint256[6]"
},
{
"name": "cancelTakerTokenAmount",
"type": "uint256"
}
],
"name": "cancelOrder",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "ZRX_TOKEN_CONTRACT",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5][]"
},
{
"name": "orderValues",
"type": "uint256[6][]"
},
{
"name": "fillTakerTokenAmounts",
"type": "uint256[]"
},
{
"name": "v",
"type": "uint8[]"
},
{
"name": "r",
"type": "bytes32[]"
},
{
"name": "s",
"type": "bytes32[]"
}
],
"name": "batchFillOrKillOrders",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5]"
},
{
"name": "orderValues",
"type": "uint256[6]"
},
{
"name": "fillTakerTokenAmount",
"type": "uint256"
},
{
"name": "v",
"type": "uint8"
},
{
"name": "r",
"type": "bytes32"
},
{
"name": "s",
"type": "bytes32"
}
],
"name": "fillOrKillOrder",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "orderHash",
"type": "bytes32"
}
],
"name": "getUnavailableTakerTokenAmount",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "signer",
"type": "address"
},
{
"name": "hash",
"type": "bytes32"
},
{
"name": "v",
"type": "uint8"
},
{
"name": "r",
"type": "bytes32"
},
{
"name": "s",
"type": "bytes32"
}
],
"name": "isValidSignature",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "numerator",
"type": "uint256"
},
{
"name": "denominator",
"type": "uint256"
},
{
"name": "target",
"type": "uint256"
}
],
"name": "getPartialAmount",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "TOKEN_TRANSFER_PROXY_CONTRACT",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5][]"
},
{
"name": "orderValues",
"type": "uint256[6][]"
},
{
"name": "fillTakerTokenAmounts",
"type": "uint256[]"
},
{
"name": "shouldThrowOnInsufficientBalanceOrAllowance",
"type": "bool"
},
{
"name": "v",
"type": "uint8[]"
},
{
"name": "r",
"type": "bytes32[]"
},
{
"name": "s",
"type": "bytes32[]"
}
],
"name": "batchFillOrders",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5][]"
},
{
"name": "orderValues",
"type": "uint256[6][]"
},
{
"name": "cancelTakerTokenAmounts",
"type": "uint256[]"
}
],
"name": "batchCancelOrders",
"outputs": [],
"payable": false,
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5]"
},
{
"name": "orderValues",
"type": "uint256[6]"
},
{
"name": "fillTakerTokenAmount",
"type": "uint256"
},
{
"name": "shouldThrowOnInsufficientBalanceOrAllowance",
"type": "bool"
},
{
"name": "v",
"type": "uint8"
},
{
"name": "r",
"type": "bytes32"
},
{
"name": "s",
"type": "bytes32"
}
],
"name": "fillOrder",
"outputs": [
{
"name": "filledTakerTokenAmount",
"type": "uint256"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "orderAddresses",
"type": "address[5]"
},
{
"name": "orderValues",
"type": "uint256[6]"
}
],
"name": "getOrderHash",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "EXTERNAL_QUERY_GAS_LIMIT",
"outputs": [
{
"name": "",
"type": "uint16"
}
],
"payable": false,
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "VERSION",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"type": "function"
},
{
"inputs": [
{
"name": "_zrxToken",
"type": "address"
},
{
"name": "_tokenTransferProxy",
"type": "address"
}
],
"payable": false,
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "maker",
"type": "address"
},
{
"indexed": false,
"name": "taker",
"type": "address"
},
{
"indexed": true,
"name": "feeRecipient",
"type": "address"
},
{
"indexed": false,
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"name": "filledMakerTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"name": "filledTakerTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"name": "paidMakerFee",
"type": "uint256"
},
{
"indexed": false,
"name": "paidTakerFee",
"type": "uint256"
},
{
"indexed": true,
"name": "tokens",
"type": "bytes32"
},
{
"indexed": false,
"name": "orderHash",
"type": "bytes32"
}
],
"name": "LogFill",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "maker",
"type": "address"
},
{
"indexed": true,
"name": "feeRecipient",
"type": "address"
},
{
"indexed": false,
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"name": "cancelledMakerTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"name": "cancelledTakerTokenAmount",
"type": "uint256"
},
{
"indexed": true,
"name": "tokens",
"type": "bytes32"
},
{
"indexed": false,
"name": "orderHash",
"type": "bytes32"
}
],
"name": "LogCancel",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "errorId",
"type": "uint8"
},
{
"indexed": true,
"name": "orderHash",
"type": "bytes32"
}
],
"name": "LogError",
"type": "event"
}
],
"networks": {
"1": {
"address": "0x12459c951127e0c374ff9105dda097662a027093"
},
"3": {
"address": "0x479cc461fecd078f766ecc58533d6f69580cf3ac"
},
"4": {
"address": "0x1d16ef40fac01cec8adac2ac49427b9384192c05"
},
"42": {
"address": "0x90fe2af704b34e0224bf2299c838e04d4dcf1364"
},
"50": {
"address": "0x48bacb9266a570d521063ef5dd96e61686dbe788"
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,112 @@
import { Provider } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from './artifacts';
import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
import { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper';
import { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper';
import { TokenWrapper } from './contract_wrappers/token_wrapper';
import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema';
import { contractWrappersPrivateNetworkConfigSchema } from './schemas/contract_wrappers_private_network_config_schema';
import { contractWrappersPublicNetworkConfigSchema } from './schemas/contract_wrappers_public_network_config_schema';
import { ContractWrappersConfig } from './types';
import { assert } from './utils/assert';
/**
* The ContractWrappers class contains smart contract wrappers helpful when building on 0x protocol.
*/
export class ContractWrappers {
/**
* An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
*/
public exchange: ExchangeWrapper;
/**
* An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x
* TokenRegistry smart contract.
*/
public tokenRegistry: TokenRegistryWrapper;
/**
* An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
*/
public token: TokenWrapper;
/**
* An instance of the EtherTokenWrapper class containing methods for interacting with the
* wrapped ETH ERC20 token smart contract.
*/
public etherToken: EtherTokenWrapper;
/**
* An instance of the TokenTransferProxyWrapper class containing methods for interacting with the
* tokenTransferProxy smart contract.
*/
public proxy: TokenTransferProxyWrapper;
private _web3Wrapper: Web3Wrapper;
/**
* Instantiates a new ContractWrappers instance.
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
* the Ethereum network.
* @param config The configuration object. Look up the type for the description.
* @return An instance of the ContractWrappers class.
*/
constructor(provider: Provider, config: ContractWrappersConfig) {
assert.isWeb3Provider('provider', provider);
assert.doesConformToSchema('config', config, ContractWrappersConfigSchema, [
contractWrappersPrivateNetworkConfigSchema,
contractWrappersPublicNetworkConfigSchema,
]);
const artifactJSONs = _.values(artifacts);
const abiArrays = _.map(artifactJSONs, artifact => artifact.abi);
const txDefaults = {
gasPrice: config.gasPrice,
};
this._web3Wrapper = new Web3Wrapper(provider, txDefaults);
_.forEach(abiArrays, abi => {
this._web3Wrapper.abiDecoder.addABI(abi);
});
this.proxy = new TokenTransferProxyWrapper(
this._web3Wrapper,
config.networkId,
config.tokenTransferProxyContractAddress,
);
this.token = new TokenWrapper(this._web3Wrapper, config.networkId, this.proxy);
this.exchange = new ExchangeWrapper(
this._web3Wrapper,
config.networkId,
this.token,
config.exchangeContractAddress,
config.zrxContractAddress,
);
this.tokenRegistry = new TokenRegistryWrapper(
this._web3Wrapper,
config.networkId,
config.tokenRegistryContractAddress,
);
this.etherToken = new EtherTokenWrapper(this._web3Wrapper, config.networkId, this.token);
}
/**
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
* subscriptions so you will need to re-subscribe to all events relevant to your app after this call.
* @param provider The Web3Provider you would like the 0x.js library to use from now on.
* @param networkId The id of the network your provider is connected to
*/
public setProvider(provider: Provider, networkId: number): void {
this._web3Wrapper.setProvider(provider);
(this.exchange as any)._invalidateContractInstances();
(this.exchange as any)._setNetworkId(networkId);
(this.tokenRegistry as any)._invalidateContractInstance();
(this.tokenRegistry as any)._setNetworkId(networkId);
(this.token as any)._invalidateContractInstances();
(this.token as any)._setNetworkId(networkId);
(this.proxy as any)._invalidateContractInstance();
(this.proxy as any)._setNetworkId(networkId);
(this.etherToken as any)._invalidateContractInstance();
(this.etherToken as any)._setNetworkId(networkId);
}
/**
* Get the provider instance currently used by 0x.js
* @return Web3 provider instance
*/
public getProvider(): Provider {
return this._web3Wrapper.getProvider();
}
}

View File

@@ -1,35 +1,42 @@
import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from '@0xproject/types';
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
import {
Artifact,
BlockParamLiteral,
ContractAbi,
FilterObject,
LogEntry,
LogWithDecodedArgs,
RawLog,
} from '@0xproject/types';
import { intervalUtils } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Block, BlockAndLogStreamer } from 'ethereumjs-blockstream';
import * as _ from 'lodash';
import * as Web3 from 'web3';
import {
Artifact,
BlockRange,
ContractEventArgs,
ContractEvents,
ContractWrappersError,
EventCallback,
IndexedFilterValues,
InternalZeroExError,
ZeroExError,
InternalContractWrappersError,
} from '../types';
import { constants } from '../utils/constants';
import { filterUtils } from '../utils/filter_utils';
const CONTRACT_NAME_TO_NOT_FOUND_ERROR: {
[contractName: string]: ZeroExError;
[contractName: string]: ContractWrappersError;
} = {
ZRX: ZeroExError.ZRXContractDoesNotExist,
EtherToken: ZeroExError.EtherTokenContractDoesNotExist,
Token: ZeroExError.TokenContractDoesNotExist,
TokenRegistry: ZeroExError.TokenRegistryContractDoesNotExist,
TokenTransferProxy: ZeroExError.TokenTransferProxyContractDoesNotExist,
Exchange: ZeroExError.ExchangeContractDoesNotExist,
ZRX: ContractWrappersError.ZRXContractDoesNotExist,
EtherToken: ContractWrappersError.EtherTokenContractDoesNotExist,
Token: ContractWrappersError.TokenContractDoesNotExist,
TokenRegistry: ContractWrappersError.TokenRegistryContractDoesNotExist,
TokenTransferProxy: ContractWrappersError.TokenTransferProxyContractDoesNotExist,
Exchange: ContractWrappersError.ExchangeContractDoesNotExist,
};
export class ContractWrapper {
export abstract class ContractWrapper {
public abstract abi: ContractAbi;
protected _web3Wrapper: Web3Wrapper;
protected _networkId: number;
private _blockAndLogStreamerIfExists?: BlockAndLogStreamer;
@@ -57,7 +64,7 @@ export class ContractWrapper {
}
protected _unsubscribe(filterToken: string, err?: Error): void {
if (_.isUndefined(this._filters[filterToken])) {
throw new Error(ZeroExError.SubscriptionNotFound);
throw new Error(ContractWrappersError.SubscriptionNotFound);
}
if (!_.isUndefined(err)) {
const callback = this._filterCallbacks[filterToken];
@@ -101,7 +108,7 @@ export class ContractWrapper {
log: LogEntry,
): LogWithDecodedArgs<ArgsType> | RawLog {
if (_.isUndefined(this._web3Wrapper.abiDecoder)) {
throw new Error(InternalZeroExError.NoAbiDecoder);
throw new Error(InternalContractWrappersError.NoAbiDecoder);
}
const logWithDecodedArgs = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop(log);
return logWithDecodedArgs;
@@ -113,7 +120,7 @@ export class ContractWrapper {
let contractAddress: string;
if (_.isUndefined(addressIfExists)) {
if (_.isUndefined(artifact.networks[this._networkId])) {
throw new Error(ZeroExError.ContractNotDeployedOnNetwork);
throw new Error(ContractWrappersError.ContractNotDeployedOnNetwork);
}
contractAddress = artifact.networks[this._networkId].address.toLowerCase();
} else {
@@ -130,7 +137,7 @@ export class ContractWrapper {
if (_.isUndefined(addressIfExists)) {
const contractAddress = artifact.networks[this._networkId].address;
if (_.isUndefined(contractAddress)) {
throw new Error(ZeroExError.ExchangeContractDoesNotExist);
throw new Error(ContractWrappersError.ExchangeContractDoesNotExist);
}
return contractAddress;
} else {
@@ -151,7 +158,7 @@ export class ContractWrapper {
}
private _startBlockAndLogStream(): void {
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
throw new Error(ZeroExError.SubscriptionAlreadyPresent);
throw new Error(ContractWrappersError.SubscriptionAlreadyPresent);
}
this._blockAndLogStreamerIfExists = new BlockAndLogStreamer(
this._web3Wrapper.getBlockAsync.bind(this._web3Wrapper),
@@ -179,12 +186,13 @@ export class ContractWrapper {
this._unsubscribe(filterToken, err);
});
}
// tslint:disable-next-line:no-unused-variable
private _setNetworkId(networkId: number): void {
this._networkId = networkId;
}
private _stopBlockAndLogStream(): void {
if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
throw new Error(ZeroExError.SubscriptionNotFound);
throw new Error(ContractWrappersError.SubscriptionNotFound);
}
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogAdded(this._onLogAddedSubscriptionToken as string);
this._blockAndLogStreamerIfExists.unsubscribeFromOnLogRemoved(this._onLogRemovedSubscriptionToken as string);

View File

@@ -1,11 +1,11 @@
import { schemas } from '@0xproject/json-schemas';
import { LogWithDecodedArgs } from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { ContractAbi, LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { BlockRange, EventCallback, IndexedFilterValues, TransactionOpts, ZeroExError } from '../types';
import { BlockRange, ContractWrappersError, EventCallback, IndexedFilterValues, TransactionOpts } from '../types';
import { assert } from '../utils/assert';
import { ContractWrapper } from './contract_wrapper';
@@ -17,6 +17,7 @@ import { TokenWrapper } from './token_wrapper';
* The caller can convert ETH into the equivalent number of wrapped ETH ERC20 tokens and back.
*/
export class EtherTokenWrapper extends ContractWrapper {
public abi: ContractAbi = artifacts.EtherToken.abi;
private _etherTokenContractsByAddress: {
[address: string]: EtherTokenContract;
} = {};
@@ -48,7 +49,7 @@ export class EtherTokenWrapper extends ContractWrapper {
const normalizedDepositorAddress = depositor.toLowerCase();
const ethBalanceInWei = await this._web3Wrapper.getBalanceInWeiAsync(normalizedDepositorAddress);
assert.assert(ethBalanceInWei.gte(amountInWei), ZeroExError.InsufficientEthBalanceForDeposit);
assert.assert(ethBalanceInWei.gte(amountInWei), ContractWrappersError.InsufficientEthBalanceForDeposit);
const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress);
const txHash = await wethContract.deposit.sendTransactionAsync({
@@ -84,7 +85,10 @@ export class EtherTokenWrapper extends ContractWrapper {
normalizedEtherTokenAddress,
normalizedWithdrawerAddress,
);
assert.assert(WETHBalanceInBaseUnits.gte(amountInWei), ZeroExError.InsufficientWEthBalanceForWithdrawal);
assert.assert(
WETHBalanceInBaseUnits.gte(amountInWei),
ContractWrappersError.InsufficientWEthBalanceForWithdrawal,
);
const wethContract = await this._getEtherTokenContractAsync(normalizedEtherTokenAddress);
const txHash = await wethContract.withdraw.sendTransactionAsync(amountInWei, {
@@ -119,7 +123,7 @@ export class EtherTokenWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
artifacts.EtherTokenArtifact.abi,
artifacts.EtherToken.abi,
);
return logs;
}
@@ -147,7 +151,7 @@ export class EtherTokenWrapper extends ContractWrapper {
normalizedEtherTokenAddress,
eventName,
indexFilterValues,
artifacts.EtherTokenArtifact.abi,
artifacts.EtherToken.abi,
callback,
);
return subscriptionToken;
@@ -172,12 +176,13 @@ export class EtherTokenWrapper extends ContractWrapper {
* @returns The Ethereum address of the EtherToken contract or undefined.
*/
public getContractAddressIfExists(): string | undefined {
const networkSpecificArtifact = artifacts.EtherTokenArtifact.networks[this._networkId];
const networkSpecificArtifact = artifacts.EtherToken.networks[this._networkId];
const contractAddressIfExists = _.isUndefined(networkSpecificArtifact)
? undefined
: networkSpecificArtifact.address;
return contractAddressIfExists;
}
// tslint:disable-next-line:no-unused-variable
private _invalidateContractInstance(): void {
this.unsubscribeAll();
this._etherTokenContractsByAddress = {};
@@ -188,7 +193,7 @@ export class EtherTokenWrapper extends ContractWrapper {
return etherTokenContract;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.EtherTokenArtifact,
artifacts.EtherToken,
etherTokenAddress,
);
const contractInstance = new EtherTokenContract(

View File

@@ -1,41 +1,40 @@
import { schemas } from '@0xproject/json-schemas';
import { formatters, getOrderHashHex, OrderStateUtils } from '@0xproject/order-utils';
import {
BlockParamLiteral,
ContractAbi,
DecodedLogArgs,
ECSignature,
ExchangeContractErrs,
LogEntry,
LogWithDecodedArgs,
Order,
OrderState,
SignedOrder,
} from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { SimpleBalanceAndProxyAllowanceFetcher } from '../fetchers/simple_balance_and_proxy_allowance_fetcher';
import { SimpleOrderFilledCancelledFetcher } from '../fetchers/simple_order_filled_cancelled_fetcher';
import { BalanceAndProxyAllowanceLazyStore } from '../stores/balance_proxy_allowance_lazy_store';
import {
BlockRange,
EventCallback,
ExchangeContractErrCodes,
ExchangeContractErrs,
IndexedFilterValues,
MethodOpts,
OrderAddresses,
OrderCancellationRequest,
OrderFillRequest,
OrderState,
OrderTransactionOpts,
OrderValues,
ValidateOrderFillableOpts,
} from '../types';
import { assert } from '../utils/assert';
import { decorators } from '../utils/decorators';
import { ExchangeTransferSimulator } from '../utils/exchange_transfer_simulator';
import { OrderStateUtils } from '../utils/order_state_utils';
import { OrderValidationUtils } from '../utils/order_validation_utils';
import { utils } from '../utils/utils';
import { ContractWrapper } from './contract_wrapper';
import {
@@ -56,8 +55,9 @@ interface ExchangeContractErrCodesToMsgs {
* events of the 0x Exchange smart contract.
*/
export class ExchangeWrapper extends ContractWrapper {
public abi: ContractAbi = artifacts.Exchange.abi;
private _exchangeContractIfExists?: ExchangeContract;
private _orderValidationUtils: OrderValidationUtils;
private _orderValidationUtilsIfExists?: OrderValidationUtils;
private _tokenWrapper: TokenWrapper;
private _exchangeContractErrCodesToMsg: ExchangeContractErrCodesToMsgs = {
[ExchangeContractErrCodes.ERROR_FILL_EXPIRED]: ExchangeContractErrs.OrderFillExpired,
@@ -69,24 +69,6 @@ export class ExchangeWrapper extends ContractWrapper {
};
private _contractAddressIfExists?: string;
private _zrxContractAddressIfExists?: string;
private static _getOrderAddressesAndValues(order: Order): [OrderAddresses, OrderValues] {
const orderAddresses: OrderAddresses = [
order.maker,
order.taker,
order.makerTokenAddress,
order.takerTokenAddress,
order.feeRecipient,
];
const orderValues: OrderValues = [
order.makerTokenAmount,
order.takerTokenAmount,
order.makerFee,
order.takerFee,
order.expirationUnixTimestampSec,
order.salt,
];
return [orderAddresses, orderValues];
}
constructor(
web3Wrapper: Web3Wrapper,
networkId: number,
@@ -96,7 +78,6 @@ export class ExchangeWrapper extends ContractWrapper {
) {
super(web3Wrapper, networkId);
this._tokenWrapper = tokenWrapper;
this._orderValidationUtils = new OrderValidationUtils(this);
this._contractAddressIfExists = contractAddressIfExists;
this._zrxContractAddressIfExists = zrxContractAddressIfExists;
}
@@ -198,8 +179,13 @@ export class ExchangeWrapper extends ContractWrapper {
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
@@ -208,7 +194,7 @@ export class ExchangeWrapper extends ContractWrapper {
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder);
const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(signedOrder);
const txHash: string = await exchangeInstance.fillOrder.sendTransactionAsync(
orderAddresses,
@@ -273,9 +259,14 @@ export class ExchangeWrapper extends ContractWrapper {
if (shouldValidate) {
let filledTakerTokenAmount = new BigNumber(0);
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
for (const signedOrder of signedOrders) {
const singleFilledTakerTokenAmount = await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
const singleFilledTakerTokenAmount = await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount.minus(filledTakerTokenAmount),
@@ -295,7 +286,7 @@ export class ExchangeWrapper extends ContractWrapper {
const orderAddressesValuesAndSignatureArray = _.map(signedOrders, signedOrder => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(signedOrder),
...formatters.getOrderAddressesAndValues(signedOrder),
signedOrder.ecSignature.v,
signedOrder.ecSignature.r,
signedOrder.ecSignature.s,
@@ -366,9 +357,14 @@ export class ExchangeWrapper extends ContractWrapper {
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
for (const orderFillRequest of orderFillRequests) {
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
orderFillRequest.signedOrder,
orderFillRequest.takerTokenFillAmount,
@@ -383,7 +379,7 @@ export class ExchangeWrapper extends ContractWrapper {
const orderAddressesValuesAmountsAndSignatureArray = _.map(orderFillRequests, orderFillRequest => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(orderFillRequest.signedOrder),
...formatters.getOrderAddressesAndValues(orderFillRequest.signedOrder),
orderFillRequest.takerTokenFillAmount,
orderFillRequest.signedOrder.ecSignature.v,
orderFillRequest.signedOrder.ecSignature.r,
@@ -442,8 +438,13 @@ export class ExchangeWrapper extends ContractWrapper {
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
await orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
@@ -452,7 +453,7 @@ export class ExchangeWrapper extends ContractWrapper {
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder);
const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(signedOrder);
const txHash = await exchangeInstance.fillOrKillOrder.sendTransactionAsync(
orderAddresses,
orderValues,
@@ -504,9 +505,14 @@ export class ExchangeWrapper extends ContractWrapper {
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
for (const orderFillRequest of orderFillRequests) {
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
await orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
orderFillRequest.signedOrder,
orderFillRequest.takerTokenFillAmount,
@@ -518,7 +524,7 @@ export class ExchangeWrapper extends ContractWrapper {
const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillRequests, request => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(request.signedOrder),
...formatters.getOrderAddressesAndValues(request.signedOrder),
request.takerTokenFillAmount,
request.signedOrder.ecSignature.v,
request.signedOrder.ecSignature.r,
@@ -570,7 +576,7 @@ export class ExchangeWrapper extends ContractWrapper {
? SHOULD_VALIDATE_BY_DEFAULT
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
const orderHash = utils.getOrderHashHex(order);
const orderHash = getOrderHashHex(order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
order,
@@ -579,7 +585,7 @@ export class ExchangeWrapper extends ContractWrapper {
);
}
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order);
const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(order);
const txHash = await exchangeInstance.cancelOrder.sendTransactionAsync(
orderAddresses,
orderValues,
@@ -629,7 +635,7 @@ export class ExchangeWrapper extends ContractWrapper {
: orderTransactionOpts.shouldValidate;
if (shouldValidate) {
for (const orderCancellationRequest of orderCancellationRequests) {
const orderHash = utils.getOrderHashHex(orderCancellationRequest.order);
const orderHash = getOrderHashHex(orderCancellationRequest.order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
orderCancellationRequest.order,
@@ -644,7 +650,7 @@ export class ExchangeWrapper extends ContractWrapper {
const exchangeInstance = await this._getExchangeContractAsync();
const orderAddressesValuesAndTakerTokenCancelAmounts = _.map(orderCancellationRequests, cancellationRequest => {
return [
...ExchangeWrapper._getOrderAddressesAndValues(cancellationRequest.order),
...formatters.getOrderAddressesAndValues(cancellationRequest.order),
cancellationRequest.takerTokenCancelAmount,
];
});
@@ -685,7 +691,7 @@ export class ExchangeWrapper extends ContractWrapper {
exchangeContractAddress,
eventName,
indexFilterValues,
artifacts.ExchangeArtifact.abi,
artifacts.Exchange.abi,
callback,
);
return subscriptionToken;
@@ -725,7 +731,7 @@ export class ExchangeWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
artifacts.ExchangeArtifact.abi,
artifacts.Exchange.abi,
);
return logs;
}
@@ -735,7 +741,7 @@ export class ExchangeWrapper extends ContractWrapper {
* @returns The Ethereum address of the Exchange contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(artifacts.ExchangeArtifact, this._contractAddressIfExists);
const contractAddress = this._getContractAddress(artifacts.Exchange, this._contractAddressIfExists);
return contractAddress;
}
/**
@@ -754,8 +760,13 @@ export class ExchangeWrapper extends ContractWrapper {
assert.doesConformToSchema('signedOrder', signedOrder, schemas.signedOrderSchema);
const zrxTokenAddress = this.getZRXTokenAddress();
const expectedFillTakerTokenAmount = !_.isUndefined(opts) ? opts.expectedFillTakerTokenAmount : undefined;
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateOrderFillableOrThrowAsync(
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
await orderValidationUtils.validateOrderFillableOrThrowAsync(
exchangeTradeEmulator,
signedOrder,
zrxTokenAddress,
@@ -780,8 +791,13 @@ export class ExchangeWrapper extends ContractWrapper {
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
@@ -801,7 +817,7 @@ export class ExchangeWrapper extends ContractWrapper {
): Promise<void> {
assert.doesConformToSchema('order', order, schemas.orderSchema);
assert.isValidBaseUnitAmount('cancelTakerTokenAmount', cancelTakerTokenAmount);
const orderHash = utils.getOrderHashHex(order);
const orderHash = getOrderHashHex(order);
const unavailableTakerTokenAmount = await this.getUnavailableTakerAmountAsync(orderHash);
OrderValidationUtils.validateCancelOrderThrowIfInvalid(
order,
@@ -827,8 +843,13 @@ export class ExchangeWrapper extends ContractWrapper {
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
const normalizedTakerAddress = takerAddress.toLowerCase();
const zrxTokenAddress = this.getZRXTokenAddress();
const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest);
await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
const balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(
this._tokenWrapper,
BlockParamLiteral.Latest,
);
const exchangeTradeEmulator = new ExchangeTransferSimulator(balanceAndProxyAllowanceLazyStore);
const orderValidationUtils = await this._getOrderValidationUtilsAsync();
await orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync(
exchangeTradeEmulator,
signedOrder,
fillTakerTokenAmount,
@@ -903,9 +924,10 @@ export class ExchangeWrapper extends ContractWrapper {
* @return Address of ZRX token
*/
public getZRXTokenAddress(): string {
const contractAddress = this._getContractAddress(artifacts.ZRXArtifact, this._zrxContractAddressIfExists);
const contractAddress = this._getContractAddress(artifacts.ZRX, this._zrxContractAddressIfExists);
return contractAddress;
}
// tslint:disable:no-unused-variable
private _invalidateContractInstances(): void {
this.unsubscribeAll();
delete this._exchangeContractIfExists;
@@ -933,16 +955,25 @@ export class ExchangeWrapper extends ContractWrapper {
}
private async _getOrderHashHexUsingContractCallAsync(order: Order | SignedOrder): Promise<string> {
const exchangeInstance = await this._getExchangeContractAsync();
const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order);
const [orderAddresses, orderValues] = formatters.getOrderAddressesAndValues(order);
const orderHashHex = await exchangeInstance.getOrderHash.callAsync(orderAddresses, orderValues);
return orderHashHex;
}
private async _getOrderValidationUtilsAsync(): Promise<OrderValidationUtils> {
if (!_.isUndefined(this._orderValidationUtilsIfExists)) {
return this._orderValidationUtilsIfExists;
}
const exchangeContract = await this._getExchangeContractAsync();
this._orderValidationUtilsIfExists = new OrderValidationUtils(exchangeContract);
return this._orderValidationUtilsIfExists;
}
// tslint:enable:no-unused-variable
private async _getExchangeContractAsync(): Promise<ExchangeContract> {
if (!_.isUndefined(this._exchangeContractIfExists)) {
return this._exchangeContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.ExchangeArtifact,
artifacts.Exchange,
this._contractAddressIfExists,
);
const contractInstance = new ExchangeContract(
@@ -954,10 +985,4 @@ export class ExchangeWrapper extends ContractWrapper {
this._exchangeContractIfExists = contractInstance;
return this._exchangeContractIfExists;
}
private async _getTokenTransferProxyAddressAsync(): Promise<string> {
const exchangeInstance = await this._getExchangeContractAsync();
const tokenTransferProxyAddress = await exchangeInstance.TOKEN_TRANSFER_PROXY_CONTRACT.callAsync();
const tokenTransferProxyAddressLowerCase = tokenTransferProxyAddress.toLowerCase();
return tokenTransferProxyAddressLowerCase;
}
} // tslint:disable:max-file-line-count

View File

@@ -1,8 +1,9 @@
import { ContractAbi, Token } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { Token, TokenMetadata } from '../types';
import { TokenMetadata } from '../types';
import { assert } from '../utils/assert';
import { constants } from '../utils/constants';
@@ -13,6 +14,7 @@ import { TokenRegistryContract } from './generated/token_registry';
* This class includes all the functionality related to interacting with the 0x Token Registry smart contract.
*/
export class TokenRegistryWrapper extends ContractWrapper {
public abi: ContractAbi = artifacts.TokenRegistry.abi;
private _tokenRegistryContractIfExists?: TokenRegistryContract;
private _contractAddressIfExists?: string;
private static _createTokenFromMetadata(metadata: TokenMetadata): Token | undefined {
@@ -104,12 +106,10 @@ export class TokenRegistryWrapper extends ContractWrapper {
* @returns The Ethereum address of the TokenRegistry contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(
artifacts.TokenRegistryArtifact,
this._contractAddressIfExists,
);
const contractAddress = this._getContractAddress(artifacts.TokenRegistry, this._contractAddressIfExists);
return contractAddress;
}
// tslint:disable-next-line:no-unused-variable
private _invalidateContractInstance(): void {
delete this._tokenRegistryContractIfExists;
}
@@ -118,7 +118,7 @@ export class TokenRegistryWrapper extends ContractWrapper {
return this._tokenRegistryContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenRegistryArtifact,
artifacts.TokenRegistry,
this._contractAddressIfExists,
);
const contractInstance = new TokenRegistryContract(

View File

@@ -1,4 +1,5 @@
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { ContractAbi } from '@0xproject/types';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
@@ -11,6 +12,7 @@ import { TokenTransferProxyContract } from './generated/token_transfer_proxy';
* This class includes the functionality related to interacting with the TokenTransferProxy contract.
*/
export class TokenTransferProxyWrapper extends ContractWrapper {
public abi: ContractAbi = artifacts.TokenTransferProxy.abi;
private _tokenTransferProxyContractIfExists?: TokenTransferProxyContract;
private _contractAddressIfExists?: string;
constructor(web3Wrapper: Web3Wrapper, networkId: number, contractAddressIfExists?: string) {
@@ -46,12 +48,10 @@ export class TokenTransferProxyWrapper extends ContractWrapper {
* @returns The Ethereum address of the TokenTransferProxy contract being used.
*/
public getContractAddress(): string {
const contractAddress = this._getContractAddress(
artifacts.TokenTransferProxyArtifact,
this._contractAddressIfExists,
);
const contractAddress = this._getContractAddress(artifacts.TokenTransferProxy, this._contractAddressIfExists);
return contractAddress;
}
// tslint:disable-next-line:no-unused-variable
private _invalidateContractInstance(): void {
delete this._tokenTransferProxyContractIfExists;
}
@@ -60,7 +60,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper {
return this._tokenTransferProxyContractIfExists;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenTransferProxyArtifact,
artifacts.TokenTransferProxy,
this._contractAddressIfExists,
);
const contractInstance = new TokenTransferProxyContract(

View File

@@ -1,11 +1,18 @@
import { schemas } from '@0xproject/json-schemas';
import { LogWithDecodedArgs } from '@0xproject/types';
import { AbiDecoder, BigNumber } from '@0xproject/utils';
import { ContractAbi, LogWithDecodedArgs } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { artifacts } from '../artifacts';
import { BlockRange, EventCallback, IndexedFilterValues, MethodOpts, TransactionOpts, ZeroExError } from '../types';
import {
BlockRange,
ContractWrappersError,
EventCallback,
IndexedFilterValues,
MethodOpts,
TransactionOpts,
} from '../types';
import { assert } from '../utils/assert';
import { constants } from '../utils/constants';
@@ -19,6 +26,7 @@ import { TokenTransferProxyWrapper } from './token_transfer_proxy_wrapper';
* to the 0x Proxy smart contract.
*/
export class TokenWrapper extends ContractWrapper {
public abi: ContractAbi = artifacts.Token.abi;
public UNLIMITED_ALLOWANCE_IN_BASE_UNITS = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
private _tokenContractsByAddress: { [address: string]: TokenContract };
private _tokenTransferProxyWrapper: TokenTransferProxyWrapper;
@@ -266,7 +274,7 @@ export class TokenWrapper extends ContractWrapper {
const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress);
if (fromAddressBalance.lessThan(amountInBaseUnits)) {
throw new Error(ZeroExError.InsufficientBalanceForTransfer);
throw new Error(ContractWrappersError.InsufficientBalanceForTransfer);
}
const txHash = await tokenContract.transfer.sendTransactionAsync(normalizedToAddress, amountInBaseUnits, {
@@ -316,12 +324,12 @@ export class TokenWrapper extends ContractWrapper {
normalizedSenderAddress,
);
if (fromAddressAllowance.lessThan(amountInBaseUnits)) {
throw new Error(ZeroExError.InsufficientAllowanceForTransfer);
throw new Error(ContractWrappersError.InsufficientAllowanceForTransfer);
}
const fromAddressBalance = await this.getBalanceAsync(normalizedTokenAddress, normalizedFromAddress);
if (fromAddressBalance.lessThan(amountInBaseUnits)) {
throw new Error(ZeroExError.InsufficientBalanceForTransfer);
throw new Error(ContractWrappersError.InsufficientBalanceForTransfer);
}
const txHash = await tokenContract.transferFrom.sendTransactionAsync(
@@ -360,7 +368,7 @@ export class TokenWrapper extends ContractWrapper {
normalizedTokenAddress,
eventName,
indexFilterValues,
artifacts.TokenArtifact.abi,
artifacts.Token.abi,
callback,
);
return subscriptionToken;
@@ -403,10 +411,11 @@ export class TokenWrapper extends ContractWrapper {
eventName,
blockRange,
indexFilterValues,
artifacts.TokenArtifact.abi,
artifacts.Token.abi,
);
return logs;
}
// tslint:disable-next-line:no-unused-variable
private _invalidateContractInstances(): void {
this.unsubscribeAll();
this._tokenContractsByAddress = {};
@@ -418,7 +427,7 @@ export class TokenWrapper extends ContractWrapper {
return tokenContract;
}
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
artifacts.TokenArtifact,
artifacts.Token,
normalizedTokenAddress,
);
const contractInstance = new TokenContract(

View File

@@ -1,10 +1,10 @@
import { AbstractBalanceAndProxyAllowanceFetcher } from '@0xproject/order-utils';
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
export class SimpleBalanceAndProxyAllowanceFetcher implements BalanceAndProxyAllowanceFetcher {
export class SimpleBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndProxyAllowanceFetcher {
private _tokenWrapper: TokenWrapper;
private _defaultBlock: BlockParamLiteral;
constructor(token: TokenWrapper, defaultBlock: BlockParamLiteral) {

View File

@@ -1,10 +1,10 @@
import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFetcher {
export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCancelledFetcher {
private _exchangeWrapper: ExchangeWrapper;
private _defaultBlock: BlockParamLiteral;
constructor(exchange: ExchangeWrapper, defaultBlock: BlockParamLiteral) {
@@ -25,4 +25,12 @@ export class SimpleOrderFilledCancelledFetcher implements OrderFilledCancelledFe
const cancelledTakerAmount = this._exchangeWrapper.getCancelledTakerAmountAsync(orderHash, methodOpts);
return cancelledTakerAmount;
}
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
const unavailableTakerAmount = await this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash);
return unavailableTakerAmount;
}
public getZRXTokenAddress(): string {
const zrxToken = this._exchangeWrapper.getZRXTokenAddress();
return zrxToken;
}
}

View File

@@ -0,0 +1,68 @@
export { ContractWrappers } from './contract_wrappers';
export { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
export { TokenWrapper } from './contract_wrappers/token_wrapper';
export { TokenRegistryWrapper } from './contract_wrappers/token_registry_wrapper';
export { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
export { TokenTransferProxyWrapper } from './contract_wrappers/token_transfer_proxy_wrapper';
export {
ContractWrappersError,
EventCallback,
ContractEvent,
Token,
IndexedFilterValues,
BlockRange,
OrderCancellationRequest,
OrderFillRequest,
ContractEventArgs,
ContractWrappersConfig,
MethodOpts,
OrderTransactionOpts,
TransactionOpts,
LogEvent,
DecodedLogEvent,
OnOrderStateChangeCallback,
} from './types';
export {
BlockParamLiteral,
FilterObject,
BlockParam,
ContractEventArg,
ExchangeContractErrs,
LogWithDecodedArgs,
Order,
Provider,
SignedOrder,
ECSignature,
OrderStateValid,
OrderStateInvalid,
OrderState,
TransactionReceipt,
TransactionReceiptWithDecodedLogs,
} from '@0xproject/types';
export {
EtherTokenContractEventArgs,
WithdrawalContractEventArgs,
DepositContractEventArgs,
EtherTokenEvents,
} from './contract_wrappers/generated/ether_token';
export {
TransferContractEventArgs,
ApprovalContractEventArgs,
TokenContractEventArgs,
TokenEvents,
} from './contract_wrappers/generated/token';
export {
LogErrorContractEventArgs,
LogCancelContractEventArgs,
LogFillContractEventArgs,
ExchangeContractEventArgs,
ExchangeEvents,
} from './contract_wrappers/generated/exchange';
export { BalanceAndProxyAllowanceLazyStore } from './stores/balance_proxy_allowance_lazy_store';
export { OrderFilledCancelledLazyStore } from './stores/order_filled_cancelled_lazy_store';

View File

@@ -0,0 +1,5 @@
export const ContractWrappersConfigSchema = {
id: '/ContractWrappersConfig',
oneOf: [{ $ref: '/ZeroExContractPrivateNetworkConfig' }, { $ref: '/ZeroExContractPublicNetworkConfig' }],
type: 'object',
};

View File

@@ -0,0 +1,35 @@
export const contractWrappersPrivateNetworkConfigSchema = {
id: '/ZeroExContractPrivateNetworkConfig',
properties: {
networkId: {
type: 'number',
minimum: 1,
},
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },
exchangeContractAddress: { $ref: '/Address' },
tokenRegistryContractAddress: { $ref: '/Address' },
tokenTransferProxyContractAddress: { $ref: '/Address' },
orderWatcherConfig: {
type: 'object',
properties: {
pollingIntervalMs: {
type: 'number',
minimum: 0,
},
numConfirmations: {
type: 'number',
minimum: 0,
},
},
},
},
type: 'object',
required: [
'networkId',
'zrxContractAddress',
'exchangeContractAddress',
'tokenRegistryContractAddress',
'tokenTransferProxyContractAddress',
],
};

View File

@@ -0,0 +1,43 @@
const networkNameToId: { [networkName: string]: number } = {
mainnet: 1,
ropsten: 3,
rinkeby: 4,
kovan: 42,
ganache: 50,
};
export const contractWrappersPublicNetworkConfigSchema = {
id: '/ZeroExContractPublicNetworkConfig',
properties: {
networkId: {
type: 'number',
enum: [
networkNameToId.mainnet,
networkNameToId.kovan,
networkNameToId.ropsten,
networkNameToId.rinkeby,
networkNameToId.ganache,
],
},
gasPrice: { $ref: '/Number' },
zrxContractAddress: { $ref: '/Address' },
exchangeContractAddress: { $ref: '/Address' },
tokenRegistryContractAddress: { $ref: '/Address' },
tokenTransferProxyContractAddress: { $ref: '/Address' },
orderWatcherConfig: {
type: 'object',
properties: {
pollingIntervalMs: {
type: 'number',
minimum: 0,
},
numConfirmations: {
type: 'number',
minimum: 0,
},
},
},
},
type: 'object',
required: ['networkId'],
};

View File

@@ -2,13 +2,13 @@ import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { BalanceAndProxyAllowanceFetcher } from '../abstract/balance_and_proxy_allowance_fetcher';
import { AbstractBalanceAndProxyAllowanceLazyStore } from '../abstract/abstract_balance_and_proxy_allowance_lazy_store';
import { TokenWrapper } from '../contract_wrappers/token_wrapper';
/**
* Copy on read store for balances/proxyAllowances of tokens/accounts
*/
export class BalanceAndProxyAllowanceLazyStore implements BalanceAndProxyAllowanceFetcher {
export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProxyAllowanceLazyStore {
private _tokenWrapper: TokenWrapper;
private _defaultBlock: BlockParamLiteral;
private _balance: {

View File

@@ -1,14 +1,14 @@
import { AbstractOrderFilledCancelledFetcher } from '@0xproject/order-utils';
import { BlockParamLiteral } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import { OrderFilledCancelledFetcher } from '../abstract/order_filled_cancelled_fetcher';
import { ExchangeWrapper } from '../contract_wrappers/exchange_wrapper';
/**
* Copy on read store for filled/cancelled taker amounts
*/
export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetcher {
export class OrderFilledCancelledLazyStore implements AbstractOrderFilledCancelledFetcher {
private _exchangeWrapper: ExchangeWrapper;
private _defaultBlock: BlockParamLiteral;
private _filledTakerAmount: {
@@ -64,4 +64,12 @@ export class OrderFilledCancelledLazyStore implements OrderFilledCancelledFetche
this._filledTakerAmount = {};
this._cancelledTakerAmount = {};
}
public async getUnavailableTakerAmountAsync(orderHash: string): Promise<BigNumber> {
const unavailableTakerAmount = await this._exchangeWrapper.getUnavailableTakerAmountAsync(orderHash);
return unavailableTakerAmount;
}
public getZRXTokenAddress(): string {
const zrxToken = this._exchangeWrapper.getZRXTokenAddress();
return zrxToken;
}
}

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