Compare commits
736 Commits
@0xproject
...
@0xproject
Author | SHA1 | Date | |
---|---|---|---|
|
7c8a7a2420 | ||
|
3b0fa1aa87 | ||
|
283175df98 | ||
|
aeb368a1d9 | ||
|
e51deb93ee | ||
|
a351757493 | ||
|
0025c6640b | ||
|
25a8554be1 | ||
|
cd76c129da | ||
|
7340338626 | ||
|
9d3c287918 | ||
|
c2b5fe3d84 | ||
|
5ef84d61fa | ||
|
58321a36dc | ||
|
ca4905c343 | ||
|
b6d793aec4 | ||
|
83fb9df63d | ||
|
083319786f | ||
|
719699eb30 | ||
|
889ec81ff3 | ||
|
2f66f26048 | ||
|
713f285f37 | ||
|
938a99f435 | ||
|
f97ec000e1 | ||
|
1b5c5e7a3b | ||
|
c804e2230d | ||
|
3f610d4865 | ||
|
8404e0e73f | ||
|
b2c666bb1f | ||
|
f3761af567 | ||
|
b9d8d2d5e3 | ||
|
b60a74c8bc | ||
|
0113ecee96 | ||
|
eb20e86947 | ||
|
15e15f994a | ||
|
d44ff6a915 | ||
|
68605ca261 | ||
|
5d4dd406f2 | ||
|
9dd6ba7825 | ||
|
45e9fbe8f9 | ||
|
53713188fe | ||
|
c4c37cafa0 | ||
|
5b7774f9d0 | ||
|
ca7d8a8940 | ||
|
762bbe9bcd | ||
|
03fb73d1d2 | ||
|
d10e2652ae | ||
|
9a5d7b7635 | ||
|
1fb3da6b53 | ||
|
970bef717e | ||
|
2a85f79040 | ||
|
651a468b44 | ||
|
5e8ad0aef4 | ||
|
44d909c0c7 | ||
|
44b01f2069 | ||
|
d7d51791a6 | ||
|
9e3fe7092b | ||
|
083d42c8f7 | ||
|
6121a6d2bf | ||
|
09af23f950 | ||
|
52e094addc | ||
|
6a6739ebbe | ||
|
6a5965d73b | ||
|
19cda0eb03 | ||
|
cc67c0df51 | ||
|
76b91cbcda | ||
|
13f0d27f7c | ||
|
5ccf41c566 | ||
|
797fd38e00 | ||
|
9aacceb0e4 | ||
|
68fb1bf376 | ||
|
a6ccfaf9ca | ||
|
c9e1b7c5dc | ||
|
6e2e658162 | ||
|
149c07dfd2 | ||
|
853b5aa38b | ||
|
4e30bc3e16 | ||
|
95b656f360 | ||
|
b0a7db81cb | ||
|
e6c91493f2 | ||
|
3771df728c | ||
|
f6dbc23995 | ||
|
f36a43a83f | ||
|
f4c2fabbf8 | ||
|
3d6cf50364 | ||
|
0a616ad3b8 | ||
|
57a4429123 | ||
|
3b542bf356 | ||
|
be472b61e7 | ||
|
8199e87943 | ||
|
35201af4b1 | ||
|
0bc775cdb8 | ||
|
2273798df9 | ||
|
7d0bec9b2a | ||
|
8382161f75 | ||
|
bc5f8e52de | ||
|
09c0fc94fc | ||
|
e5d65b585a | ||
|
d9933237a0 | ||
|
a016747c36 | ||
|
1c06380ef5 | ||
|
47fef1f8ff | ||
|
3cb955c136 | ||
|
47673ba4bb | ||
|
3865a081a0 | ||
|
d00ee5df0d | ||
|
4f381ca1d9 | ||
|
bb4d15005a | ||
|
477c3dc4f6 | ||
|
81f689e693 | ||
|
e80fa6e311 | ||
|
c94168981c | ||
|
749ec0cefe | ||
|
bd488020df | ||
|
ab398751e1 | ||
|
74d5f2f0b9 | ||
|
260640feed | ||
|
36e7cb16aa | ||
|
0390a5ecbf | ||
|
82092ab50a | ||
|
c3e6be7956 | ||
|
1ce6579c3a | ||
|
afc5c2616a | ||
|
6e74896620 | ||
|
30c6fe08ec | ||
|
7c864b81e0 | ||
|
4f006fdc5c | ||
|
9f7f61085c | ||
|
2414b47a30 | ||
|
f8a252d142 | ||
|
962d6e71b6 | ||
|
48aaf22855 | ||
|
8351f5998a | ||
|
86eafeb826 | ||
|
63e088730a | ||
|
a78d35f84e | ||
|
63e869f6d0 | ||
|
4aff9515d8 | ||
|
6f0daa5463 | ||
|
a658aaaf30 | ||
|
37590d5f5e | ||
|
ca1f926d6d | ||
|
5d44a67e62 | ||
|
8ed3d59f96 | ||
|
bc93ff0cb5 | ||
|
44498f2263 | ||
|
045751a430 | ||
|
162fe797fc | ||
|
e671563f1e | ||
|
a7238d0fdb | ||
|
2a899f5295 | ||
|
b7cd84fad6 | ||
|
36b6da7c4f | ||
|
02eb575813 | ||
|
ca8a6665ba | ||
|
2ecf7a3349 | ||
|
5283dcce2e | ||
|
48e538f5c7 | ||
|
c851c37630 | ||
|
a0d7b1efa5 | ||
|
1a06e6b305 | ||
|
43d7045a5b | ||
|
9199a56b7a | ||
|
44d1be27e6 | ||
|
554d5f97df | ||
|
78a4b9897c | ||
|
c1fcbe3f04 | ||
|
efa67d87aa | ||
|
4fe410a277 | ||
|
3235606644 | ||
|
260976914d | ||
|
3ca4b7e7a7 | ||
|
95c627f581 | ||
|
512dbb448b | ||
|
b793c1cc73 | ||
|
aea048ecc7 | ||
|
d0e6413fcf | ||
|
3b7ad1688b | ||
|
e907b99314 | ||
|
973bcb0483 | ||
|
87fb9a76ce | ||
|
0187e0c47d | ||
|
8732d8ece8 | ||
|
2e7c130f62 | ||
|
a90f434df5 | ||
|
3b005ad47c | ||
|
735bc2f178 | ||
|
e3cfa6363d | ||
|
331b1cb9a0 | ||
|
55dbb0ece0 | ||
|
af4071e119 | ||
|
9947e643d0 | ||
|
d3be4f2852 | ||
|
e320f343f8 | ||
|
f6cc7d9c3c | ||
|
b756f76b0e | ||
|
034948065d | ||
|
0c2df7e589 | ||
|
2ae6a71ca3 | ||
|
206fd0f78e | ||
|
b84225ac70 | ||
|
5ebcea53d6 | ||
|
a491e01144 | ||
|
1236efc008 | ||
|
e63bbdeb87 | ||
|
084ccb62a6 | ||
|
015469885d | ||
|
061f223269 | ||
|
88ee35d5f9 | ||
|
6c5b33ec71 | ||
|
31b8dd1bfc | ||
|
35113487f1 | ||
|
9ce8e10115 | ||
|
d07d059eda | ||
|
d836b0f815 | ||
|
1b1733ce7c | ||
|
5fd64a969b | ||
|
9a762e584c | ||
|
7fc0fd9fb6 | ||
|
da4b70fcae | ||
|
a0db69ee05 | ||
|
2c62504b79 | ||
|
67303106dc | ||
|
600d574042 | ||
|
07d4f21807 | ||
|
4da12067b9 | ||
|
24ab24879c | ||
|
dc51741b83 | ||
|
dd979dbf6d | ||
|
0cfea5613a | ||
|
98dd3ecab7 | ||
|
fe05e0bac3 | ||
|
d3f9b72c84 | ||
|
05b35c0fdc | ||
|
36b61650b3 | ||
|
c37b6f0eeb | ||
|
28114c3b5a | ||
|
2617df4ec7 | ||
|
0d28c48eb9 | ||
|
c6a6a54cce | ||
|
e5aa03da64 | ||
|
47c0195b07 | ||
|
f13d43dbf5 | ||
|
f9e99a27d3 | ||
|
854b8fad22 | ||
|
91c7105d43 | ||
|
c1e3533287 | ||
|
bb7c308081 | ||
|
fcbaf2f4e3 | ||
|
109c5df973 | ||
|
b0fab3ea4a | ||
|
490fed6228 | ||
|
9c81692d48 | ||
|
c505ba6f3e | ||
|
ee71f57453 | ||
|
f133aebfaf | ||
|
88556d31e2 | ||
|
c0d75c6476 | ||
|
5b6cf447e5 | ||
|
3890f8224d | ||
|
b9f5c93830 | ||
|
c40b3dea6c | ||
|
dbc798596b | ||
|
fac90c446c | ||
|
c5859b65a3 | ||
|
14bb697924 | ||
|
dbd815c1e0 | ||
|
9592a9a821 | ||
|
dd9f020c9b | ||
|
56f21f4bab | ||
|
91bc1b468b | ||
|
97268d2253 | ||
|
14b3c50b69 | ||
|
333bf9de05 | ||
|
16a38c687e | ||
|
24aa5cd1bf | ||
|
f699da90ba | ||
|
d1e33a3dff | ||
|
f50ac932d6 | ||
|
cab32d7593 | ||
|
2073aa9abc | ||
|
0386025395 | ||
|
0772403ea9 | ||
|
8acfc9a2f9 | ||
|
de087abc8d | ||
|
98b2875512 | ||
|
e9e73aa0a3 | ||
|
d280311734 | ||
|
789762617f | ||
|
6f38d1bee5 | ||
|
73d75bc405 | ||
|
91dcfd5ee8 | ||
|
5fe0e9f2e7 | ||
|
51fb6e6a23 | ||
|
9392d5c84f | ||
|
e49d136b99 | ||
|
d50174b89e | ||
|
1d9a77027e | ||
|
b4cd8897b2 | ||
|
df341717f7 | ||
|
68974313e1 | ||
|
39a06e1d3b | ||
|
bfe57b84d6 | ||
|
dae975b08c | ||
|
27d44e3021 | ||
|
df00d93b9c | ||
|
15bbbb3762 | ||
|
c9ee526d8b | ||
|
b110d95de1 | ||
|
76eab5d3ec | ||
|
4a2715e61f | ||
|
7fbcc3999f | ||
|
e873b8948f | ||
|
c8108a1db2 | ||
|
195c3af84e | ||
|
39724292e3 | ||
|
24b5aa0e82 | ||
|
3af2ef8439 | ||
|
e2d027e252 | ||
|
bddcebfbb1 | ||
|
a05b14e4d9 | ||
|
9a36e73f4e | ||
|
a66ccaa1da | ||
|
f05a563802 | ||
|
06396b8874 | ||
|
e5e68de2d7 | ||
|
dcc0908617 | ||
|
45d68285f1 | ||
|
e20f3a0f97 | ||
|
c5029e61e3 | ||
|
e90ed01105 | ||
|
d8099d53fe | ||
|
0a976a3fb8 | ||
|
4636d5fbc2 | ||
|
3506ec1caa | ||
|
1f0e819756 | ||
|
799ff2a5c3 | ||
|
ec5f768f9b | ||
|
66ab010055 | ||
|
6fb157488c | ||
|
814518dd80 | ||
|
554b18a466 | ||
|
855b6b1dc5 | ||
|
c2ae9f62a4 | ||
|
4159a8fe6e | ||
|
d8b44283a2 | ||
|
2c1daf9c9a | ||
|
c7962216e9 | ||
|
ffdaf88fd0 | ||
|
f84f879950 | ||
|
eb6027fba7 | ||
|
9a1f0ac8e2 | ||
|
51b6f8bc71 | ||
|
4f73b81b9c | ||
|
195d11f9d0 | ||
|
b325ad1735 | ||
|
74483631d0 | ||
|
89b24a21a0 | ||
|
f0f13aa1dd | ||
|
06f61949f9 | ||
|
0e72b67865 | ||
|
b987eebf21 | ||
|
c808d12b74 | ||
|
b466431ede | ||
|
bf69ca6e53 | ||
|
6ffa907f0e | ||
|
e54501522d | ||
|
f2baeddc30 | ||
|
fd349b618a | ||
|
6ca2a02766 | ||
|
d9a282bd92 | ||
|
dc151f7290 | ||
|
cce2127f72 | ||
|
0f8e6b395e | ||
|
b28cc6d7d3 | ||
|
3bf12a98a7 | ||
|
f27084ced4 | ||
|
cdcf624e9e | ||
|
ad4c2b95e4 | ||
|
8e7c395f59 | ||
|
02d50a513a | ||
|
d61759f6dd | ||
|
5790ed7ba9 | ||
|
067adbfb62 | ||
|
7fadba59e7 | ||
|
bcde0731db | ||
|
052afb67a4 | ||
|
6e15d7bb0f | ||
|
5bb68974ec | ||
|
0a3ba4d27d | ||
|
482a226dc5 | ||
|
9e69458ba8 | ||
|
71e386d5fa | ||
|
60b501b137 | ||
|
36f8e9f1d5 | ||
|
78707bd3ca | ||
|
56137d0605 | ||
|
681a582630 | ||
|
846a447c4d | ||
|
f76be4f016 | ||
|
ed19067096 | ||
|
eb9f7c2c9d | ||
|
52693f7d0a | ||
|
5e015872ef | ||
|
08c291bd3f | ||
|
48c5d69c9d | ||
|
0f9c262bb0 | ||
|
dff0fc65bf | ||
|
161f96c07d | ||
|
67ad21b368 | ||
|
d5e633c38f | ||
|
617ef5b6ce | ||
|
8bd4e38d02 | ||
|
f364b5c5ab | ||
|
6486fced34 | ||
|
bc9f2a51a2 | ||
|
9c03b54d75 | ||
|
eae08ea1e4 | ||
|
6f276223c6 | ||
|
21effcaa8b | ||
|
114b31a813 | ||
|
1a1b7a2bc4 | ||
|
c9b213839a | ||
|
4043fa76cc | ||
|
9c8e3bc4c9 | ||
|
18b1f01641 | ||
|
9085c674e4 | ||
|
b5d19d3fb1 | ||
|
cc0477153b | ||
|
76008b41c5 | ||
|
8193fdc304 | ||
|
9d06c81078 | ||
|
cdf85e5eee | ||
|
d774dbc432 | ||
|
0369f5ebc4 | ||
|
1e6b11b27e | ||
|
7a8231435b | ||
|
b1aa7725df | ||
|
bfe0ba3e9a | ||
|
2d39329ee7 | ||
|
761b0063a0 | ||
|
0f27ce3424 | ||
|
2b0c0a6ff7 | ||
|
5bd96f6fe9 | ||
|
37ac6749ba | ||
|
bf955bd87f | ||
|
6bd921d0bc | ||
|
534decea95 | ||
|
267830d463 | ||
|
e82d0c21ec | ||
|
ece6417699 | ||
|
74d5449719 | ||
|
4af7ff9cc3 | ||
|
46dedfcb67 | ||
|
a9fa1a0df6 | ||
|
a8572b4944 | ||
|
91c0d47ad4 | ||
|
fd2611794a | ||
|
1fe1c5321b | ||
|
f063a5db0f | ||
|
3883315447 | ||
|
7679e07957 | ||
|
c39ba37ad8 | ||
|
f1c3840c3b | ||
|
e5c5b36a73 | ||
|
c51f7a8375 | ||
|
e53e2ac31b | ||
|
b72857cd8b | ||
|
cc223b9eab | ||
|
f2c49e8b37 | ||
|
9b6476a6b7 | ||
|
d8898cf9a3 | ||
|
34df5af295 | ||
|
3de88d5345 | ||
|
9ab6ab1bf9 | ||
|
b6de0bdd43 | ||
|
a2b62fd808 | ||
|
fc166dea26 | ||
|
f9c4d0925e | ||
|
1df9370bc2 | ||
|
7d840c7a18 | ||
|
ff12aafc0f | ||
|
c08b4aa6a1 | ||
|
52a6e6357b | ||
|
74c0fd419b | ||
|
6f540e3e58 | ||
|
dead04dce8 | ||
|
886a03fdcd | ||
|
81007c453c | ||
|
6529e06057 | ||
|
55336f96d7 | ||
|
938aabde3d | ||
|
c7f196b579 | ||
|
b28a88dbb2 | ||
|
e6558b7135 | ||
|
2c8fb9aa31 | ||
|
f48c6b6285 | ||
|
4f42f60bde | ||
|
3942647910 | ||
|
e0fbc78925 | ||
|
f3e43d7d94 | ||
|
f36547241c | ||
|
7ad29950a8 | ||
|
cbf91ad45c | ||
|
a039b66533 | ||
|
3a18c249f5 | ||
|
7c0775aa1b | ||
|
6514c34ed8 | ||
|
ba92754669 | ||
|
30afd39129 | ||
|
41699406cf | ||
|
9aa49e59d0 | ||
|
29d5034260 | ||
|
00d1622b3f | ||
|
a1acf19ff3 | ||
|
86328af6b7 | ||
|
36c27bdbf8 | ||
|
c839965c05 | ||
|
e1a9f3435f | ||
|
9f74feb347 | ||
|
f99232095b | ||
|
5044fe4fe4 | ||
|
8e49169e6b | ||
|
c71781d9ab | ||
|
8a2a4052f3 | ||
|
dad557164e | ||
|
e2fb49a8f8 | ||
|
f3241ff86a | ||
|
b9e7973a0f | ||
|
004b1f5288 | ||
|
857bd24c6d | ||
|
904968cf4a | ||
|
83747934ad | ||
|
7f90f5ecd4 | ||
|
12f02b9814 | ||
|
8931388309 | ||
|
25160d7344 | ||
|
ab6bf6edc7 | ||
|
56a4a374cd | ||
|
caa5b4e342 | ||
|
b6172c3965 | ||
|
02ddfa07a7 | ||
|
5022878680 | ||
|
2bfacbb8ba | ||
|
b18d2b0274 | ||
|
f20b496dca | ||
|
cca17f70b8 | ||
|
b8e69718a1 | ||
|
50ed7d2af2 | ||
|
698de932ed | ||
|
a3d8858bb1 | ||
|
83f3ba21b8 | ||
|
2aa729b212 | ||
|
1de70e4474 | ||
|
f2393de59b | ||
|
94ea7cc451 | ||
|
f8dbf57582 | ||
|
c59cd36da6 | ||
|
15e92958d6 | ||
|
96c648c4b4 | ||
|
f56a7d0cb2 | ||
|
01e617bb83 | ||
|
59fd5c69c0 | ||
|
28a9a8c380 | ||
|
6c2796b433 | ||
|
82ad5f7897 | ||
|
bf8ac3b9e6 | ||
|
edcdc9b1b9 | ||
|
4227aaa68a | ||
|
b750ce8be6 | ||
|
03a6a088c5 | ||
|
1e787a7646 | ||
|
766ac3f1fe | ||
|
a9038f2afc | ||
|
9828fa335e | ||
|
0c04d490bb | ||
|
bffffffc95 | ||
|
e9589ff786 | ||
|
c3bd3437f5 | ||
|
01789e6750 | ||
|
c3f7ba1b91 | ||
|
90d72a3683 | ||
|
f9bcf936ed | ||
|
acff177c54 | ||
|
658214a2e2 | ||
|
55f6f02c9b | ||
|
c5ba52910a | ||
|
994ccd6694 | ||
|
4921a83813 | ||
|
a97ba41b86 | ||
|
67e2623d2c | ||
|
4111095da3 | ||
|
6c21ddcedb | ||
|
d86349658f | ||
|
151ce6e3c7 | ||
|
6bdee26c30 | ||
|
5e4b1eed30 | ||
|
ab5cd95ccc | ||
|
a3dc398da5 | ||
|
b70f5d1a1e | ||
|
26363931ed | ||
|
e2438330f5 | ||
|
c5fcdd0657 | ||
|
345f3c07a5 | ||
|
f3477ff28c | ||
|
7ac4fa50b5 | ||
|
2f0a914838 | ||
|
5fc7d9a603 | ||
|
ced68e4e02 | ||
|
80071beaac | ||
|
de1029d5ef | ||
|
ffeb3194a8 | ||
|
95e9f33f6a | ||
|
c599a20b34 | ||
|
ca59528a32 | ||
|
6f4fd06d38 | ||
|
4715c2d006 | ||
|
fcfa43b6f1 | ||
|
56b4c55654 | ||
|
830790eeac | ||
|
39de9c7879 | ||
|
7b6cc14b71 | ||
|
ec749a4033 | ||
|
fe32214613 | ||
|
f6fcb775b7 | ||
|
d209108a95 | ||
|
efc64cf17f | ||
|
2f41ed50c1 | ||
|
fcc8cdd36a | ||
|
248632ce76 | ||
|
25681754bd | ||
|
179c487da9 | ||
|
350989bbec | ||
|
f5293e6c38 | ||
|
70c3515c94 | ||
|
4c7fd5a4e8 | ||
|
9d24341d94 | ||
|
512502ca08 | ||
|
6ce662c7a4 | ||
|
701ea5c46b | ||
|
2e5ff53d72 | ||
|
1229c61ba4 | ||
|
ee54438e92 | ||
|
65af78c85d | ||
|
b4747c3f85 | ||
|
1df074b73e | ||
|
254d30b8df | ||
|
ac5588c7c4 | ||
|
ddb70a89ad | ||
|
f4b2a9625d | ||
|
c2a1317c38 | ||
|
49f1a6933c | ||
|
9b387b8ec3 | ||
|
a45a29432e | ||
|
819d069edc | ||
|
b0a57a5091 | ||
|
d8678d562d | ||
|
34a9035164 | ||
|
0941e0a929 | ||
|
1ee78062d7 | ||
|
09f5609618 | ||
|
098322c564 | ||
|
365e24c1cd | ||
|
b82fdd59e7 | ||
|
6190ac7791 | ||
|
ed3aeb7997 | ||
|
33f92b6bcf | ||
|
9131a72a47 | ||
|
e5617dfe61 | ||
|
e67d67419f | ||
|
17c34716f9 | ||
|
e12f7c3026 | ||
|
af395eccda | ||
|
c403dcdabf | ||
|
c500cc095f | ||
|
6ecda647ad | ||
|
3e7ee1f090 | ||
|
0c120cb7a3 | ||
|
cab6829df9 | ||
|
0efe6df416 | ||
|
a4b6112a31 | ||
|
47debf0134 | ||
|
16ddd1edfc | ||
|
0f1fd0e90d | ||
|
ef76d83d2a | ||
|
df9f6004f2 | ||
|
9a87f99dcd | ||
|
30011db6d7 | ||
|
b6ac132c78 | ||
|
abf87a643d | ||
|
3824ea9079 | ||
|
5e22ce05c5 | ||
|
8fcc7aefa7 | ||
|
0b6ea1d046 | ||
|
22d3981a74 | ||
|
81b4f4928d | ||
|
dd77a38535 | ||
|
d319b53e23 | ||
|
b9627e14d0 | ||
|
56a96d36a1 | ||
|
e60630fa73 | ||
|
5ef6613024 | ||
|
af7e02de27 | ||
|
51d5b9d35d | ||
|
092ca6bcf5 | ||
|
2625cbbfed | ||
|
cedd1d5596 | ||
|
fb9e14a229 | ||
|
4e1bd7b5f0 | ||
|
5dfed8cd00 | ||
|
a2672a0d78 | ||
|
ee5ac6b800 | ||
|
a481d2ab46 | ||
|
c8bb21d12d | ||
|
e817cd7d43 | ||
|
bd6085fffd | ||
|
7efe9a9385 | ||
|
50da40a727 | ||
|
48390a1875 | ||
|
a3d27cd128 | ||
|
589c814ee6 | ||
|
4b60a3cbab | ||
|
1aaf633df8 | ||
|
82771ec64a | ||
|
ada8a402da | ||
|
17956efe35 | ||
|
8378c9f85e | ||
|
324b1079e7 | ||
|
c6da829713 | ||
|
844b0687a6 | ||
|
2ed2dd2fb7 | ||
|
d2f7dd3d5a | ||
|
9f08916cf1 | ||
|
a0e3676e3a | ||
|
2276793629 | ||
|
cfe57f52f4 |
@@ -56,6 +56,16 @@ jobs:
|
||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||
# initialized
|
||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
|
||||
test-publish:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: verdaccio/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:publish:circleci
|
||||
test-rest:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
@@ -64,7 +74,8 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0xproject/0x.js
|
||||
- run: yarn wsrun test:circleci 0x.js
|
||||
- run: yarn wsrun test:circleci @0xproject/abi-gen
|
||||
- run: yarn wsrun test:circleci @0xproject/assert
|
||||
- run: yarn wsrun test:circleci @0xproject/base-contract
|
||||
- run: yarn wsrun test:circleci @0xproject/connect
|
||||
@@ -79,10 +90,15 @@ jobs:
|
||||
- run: yarn wsrun test:circleci @0xproject/sra-report
|
||||
- run: yarn wsrun test:circleci @0xproject/subproviders
|
||||
- run: yarn wsrun test:circleci @0xproject/web3-wrapper
|
||||
- run: yarn wsrun test:circleci @0xproject/utils
|
||||
- save_cache:
|
||||
key: coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/0x.js/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/abi-gen/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -148,7 +164,7 @@ jobs:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn prettier:ci
|
||||
- run: yarn lerna:run lint
|
||||
- run: yarn lerna run lint
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
@@ -160,6 +176,9 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-0xjs-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-abi-gen-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-assert-{{ .Environment.CIRCLE_SHA1 }}
|
||||
@@ -223,6 +242,9 @@ workflows:
|
||||
- static-tests:
|
||||
requires:
|
||||
- build
|
||||
- test-publish:
|
||||
requires:
|
||||
- build
|
||||
- submit-coverage:
|
||||
requires:
|
||||
- test-rest
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -41,6 +41,7 @@ typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
.npmrc
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
@@ -81,8 +82,10 @@ packages/sol-cov/test/fixtures/artifacts/
|
||||
packages/metacoin/artifacts/
|
||||
packages/order-watcher/test/artifacts/
|
||||
packages/contract-wrappers/test/artifacts/
|
||||
packages/contract-wrappers/src/artifacts/
|
||||
packages/order-watcher/src/artifacts/
|
||||
|
||||
# generated contract wrappers
|
||||
# generated contract watcher
|
||||
packages/0x.js/src/generated_contract_wrappers/
|
||||
packages/contracts/generated_contract_wrappers/
|
||||
packages/contract-wrappers/src/contract_wrappers/generated/
|
||||
|
@@ -10,9 +10,12 @@ lib
|
||||
/packages/migrations/src/1.0.0/contract_wrappers
|
||||
/packages/migrations/src/2.0.0/contract_wrappers
|
||||
/packages/migrations/src/2.0.0-beta-testnet/contract_wrappers
|
||||
/packages/0x.js/test/artifacts
|
||||
/packages/0x.js/src/artifacts
|
||||
/packages/contracts/src/artifacts
|
||||
/packages/contract-wrappers/src/artifacts
|
||||
/packages/order-watcher/src/artifacts
|
||||
/packages/metacoin/artifacts
|
||||
/packages/sra-api/public/
|
||||
/packages/contract-wrappers/test/artifacts
|
||||
/packages/order-watcher/test/artifacts
|
||||
/packages/migrations/artifacts/1.0.0
|
||||
|
@@ -8,20 +8,20 @@
|
||||
|
||||
## Types of changes
|
||||
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
<!--- What types of changes does your code introduce? Uncomment all the bullets that apply: -->
|
||||
|
||||
* [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
* [ ] New feature (non-breaking change which adds functionality)
|
||||
* [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
<!-- * Bug fix (non-breaking change which fixes an issue) -->
|
||||
|
||||
<!-- * New feature (non-breaking change which adds functionality) -->
|
||||
|
||||
<!-- * Breaking change (fix or feature that would cause existing functionality to change) -->
|
||||
|
||||
## Checklist:
|
||||
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- The following points should be used to indicate the progress of your PR. Put an `x` in all the boxes that apply right now, and come back over time and check them off as you make progress. If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
|
||||
* [ ] Change requires a change to the documentation.
|
||||
* [ ] Added tests to cover my changes.
|
||||
* [ ] Added new entries to the relevant CHANGELOG.jsons.
|
||||
* [ ] Labeled this PR with the 'WIP' label if it is a work in progress.
|
||||
* [ ] Labeled this PR with the labels corresponding to the changed package.
|
||||
* [ ] Prefix PR title with `[WIP]` if necessary.
|
||||
* [ ] Prefix PR title with bracketed package name(s) corresponding to the changed package(s). For example: `[sol-cov] Fixed bug`.
|
||||
* [ ] Add tests to cover changes as needed.
|
||||
* [ ] Update documentation as needed.
|
||||
* [ ] Add new entries to the relevant CHANGELOG.jsons.
|
||||
|
@@ -82,10 +82,12 @@ We strongly recommend that the community help us make improvements and determine
|
||||
|
||||
### Install dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
Make sure you are using Yarn v1.6. To install using brew:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
brew unlink yarn
|
||||
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/76215230de5f7f7bee2cfcdd7185cf49d949862d/Formula/yarn.rb
|
||||
brew switch yarn 1.6.0_1
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
11
lerna.json
11
lerna.json
@@ -1,15 +1,10 @@
|
||||
{
|
||||
"lerna": "2.5.1",
|
||||
"lerna": "3.0.0-beta.23",
|
||||
"packages": ["packages/*"],
|
||||
"commands": {
|
||||
"publish": {
|
||||
"allowBranch": "development"
|
||||
}
|
||||
},
|
||||
"version": "independent",
|
||||
"commands": {
|
||||
"command": {
|
||||
"publish": {
|
||||
"ignore": ["test/**/*", "*.md", "scripts", "lib", "tslint.json", "tsconfig.json"]
|
||||
"ignoreChanges": ["test/**/*", "*.md", "scripts", "lib", "tslint.json", "tsconfig.json"]
|
||||
}
|
||||
},
|
||||
"npmClient": "yarn",
|
||||
|
21
package.json
21
package.json
@@ -13,39 +13,42 @@
|
||||
"prettier:ci": "prettier --list-different '**/*.{ts,tsx,json,md}' --config .prettierrc",
|
||||
"report_coverage": "lcov-result-merger 'packages/*/coverage/lcov.info' | coveralls",
|
||||
"test:installation": "node ./packages/monorepo-scripts/lib/test_installation.js",
|
||||
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild script:publish",
|
||||
"run:publish:dry": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild script:publish:dry",
|
||||
"test:installation:local": "IS_LOCAL_PUBLISH=true node ./packages/monorepo-scripts/lib/test_installation.js",
|
||||
"test:publish:circleci:comment": "HACK(albrow) We need an automated way to login to npm and echo+sleep piped to stdin was the only way I could find to do it.",
|
||||
"test:publish:circleci": "{ echo \"test\"; sleep 1; echo \"test\"; sleep 1; echo \"test@example.com\"; } | npm login --registry=http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
|
||||
"run:publish": "run-s install:all build:monorepo_scripts script:prepublish_checks rebuild:no_website script:publish",
|
||||
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
|
||||
"script:prepublish_checks": "node ./packages/monorepo-scripts/lib/prepublish_checks.js",
|
||||
"script:publish": "node ./packages/monorepo-scripts/lib/publish.js",
|
||||
"script:publish:dry": "IS_DRY_RUN=true yarn script:publish",
|
||||
"install:all": "yarn install",
|
||||
"wsrun": "wsrun",
|
||||
"lerna:run": "lerna run",
|
||||
"lerna": "lerna",
|
||||
"watch": "wsrun watch_without_deps $PKG --fast-exit -r --stages --done-criteria='complete|successfully'",
|
||||
"build": "wsrun build $PKG --fast-exit -r --stages",
|
||||
"build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0xproject/website",
|
||||
"build:monorepo_scripts": "PKG=@0xproject/monorepo-scripts yarn build",
|
||||
"clean": "wsrun clean $PKG --fast-exit -r --parallel",
|
||||
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
|
||||
"rebuild": "run-s clean build",
|
||||
"rebuild:no_website": "run-s clean build:no_website",
|
||||
"test": "wsrun test $PKG --fast-exit --serial --exclude-missing",
|
||||
"stage_docs": "wsrun docs:stage $PKG --fast-exit --parallel --exclude-missing",
|
||||
"lint": "wsrun lint $PKG --fast-exit --parallel --exclude-missing",
|
||||
"comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete.",
|
||||
"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/assert `pwd`/packages/order-utils/node_modules/@0xproject/assert; 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; rm -rf `pwd`/packages/fill-scenarios/node_modules/@0xproject; 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/json-schemas `pwd`/packages/fill-scenarios/node_modules/@0xproject/json-schemas; ln -s `pwd`/packages/order-utils `pwd`/packages/fill-scenarios/node_modules/@0xproject/order-utils; rm -rf `pwd`/packages/contract-wrappers/node_modules/@0xproject; mkdir -p `pwd`/packages/contract-wrappers/node_modules/@0xproject; ln -s `pwd`/packages/order-utils `pwd`/packages/contract-wrappers/node_modules/@0xproject/order-utils; ln -s `pwd`/packages/assert `pwd`/packages/contract-wrappers/node_modules/@0xproject/assert; ln -s `pwd`/packages/json-schemas `pwd`/packages/contract-wrappers/node_modules/@0xproject/json-schemas; ln -s `pwd`/packages/types `pwd`/packages/contract-wrappers/node_modules/@0xproject/types; ln -s `pwd`/packages/fill-scenarios `pwd`/packages/contract-wrappers/node_modules/@0xproject/fill-scenarios; rm -rf `pwd`/packages/assert/node_modules/@0xproject; mkdir -p `pwd`/packages/assert/node_modules/@0xproject; ln -s `pwd`/packages/json-schemas `pwd`/packages/assert/node_modules/@0xproject/json-schemas"
|
||||
"comment:postinstall": "HACK: For some reason `yarn` is not setting up symlinks properly for order-utils. We temporarily set them manually. Remove this after V2 refactor is complete."
|
||||
},
|
||||
"config": {
|
||||
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0x-lerna-fork/lerna": "3.0.0-beta.23",
|
||||
"async-child-process": "^1.1.1",
|
||||
"coveralls": "^3.0.0",
|
||||
"ganache-cli": "6.1.3",
|
||||
"lcov-result-merger": "^3.0.0",
|
||||
"lerna": "^2.5.1",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"prettier": "^1.11.1",
|
||||
"wsrun": "^2.2.0",
|
||||
"source-map-support": "^0.5.6"
|
||||
"source-map-support": "^0.5.6",
|
||||
"wsrun": "^2.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"ethers": "0xproject/ethers.js#eip-838-reasons"
|
||||
|
@@ -1,4 +1,112 @@
|
||||
[
|
||||
{
|
||||
"version": "1.0.1-rc.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
},
|
||||
{
|
||||
"pr": 914,
|
||||
"note": "Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts"
|
||||
}
|
||||
],
|
||||
"timestamp": 1534210131
|
||||
},
|
||||
{
|
||||
"version": "1.0.1-rc.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fixed bug caused by importing non-existent dep"
|
||||
}
|
||||
],
|
||||
"timestamp": 1532619515
|
||||
},
|
||||
{
|
||||
"version": "1.0.1-rc.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1532605697
|
||||
},
|
||||
{
|
||||
"timestamp": 1532357734,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043100,
|
||||
"version": "1.0.0-rc.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx`"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0-rc.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove tokenRegistry wrapper",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note": "Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token`",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note": "Rename `zeroEx.proxy` to `zeroEx.erc20Proxy` and add `zeroEx.erc721Proxy`",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Refactored `ZeroEx.isValidSignature` to `zeroEx.isValidSignatureAsync`. It is now async so that it can verify contract-dependent signature types",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Refactored `signOrderHashAsync` to `ecSignOrderHashAsync`. There are now many non-ECSignature ways to sign orders too.",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note":
|
||||
"Removed `createOrderWatcherAsync` method. Will be added back once OrderWatcher is refactored for V2",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note": "0x.js exports renamed contract events and event arg types",
|
||||
"pr": 863
|
||||
},
|
||||
{
|
||||
"note": "Export `ZeroEx.assetData` with methods to decode/encode assetData fields found in 0x orders",
|
||||
"pr": 884
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.38.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531149657,
|
||||
"version": "0.38.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1529397769,
|
||||
"version": "0.38.4",
|
||||
|
@@ -1,10 +1,50 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.1-rc.3 - _August 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
* Update ecSignOrderHashAsync to return the signature as a string for immediate use in contracts (#914)
|
||||
|
||||
## v1.0.1-rc.2 - _July 26, 2018_
|
||||
|
||||
* Fixed bug caused by importing non-existent dep
|
||||
|
||||
## v1.0.1-rc.1 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0-rc.2 - _July 19, 2018_
|
||||
|
||||
* Remove `zeroEx.assetData` and instead re-export it's static functions directly off `ZeroEx`
|
||||
|
||||
## v1.0.0-rc.1 - _July 19, 2018_
|
||||
|
||||
* Remove tokenRegistry wrapper (#863)
|
||||
* Rename `zeroEx.token` to `zeroEx.erc20Token`, and add `zeroEx.erc721Token` (#863)
|
||||
* Rename `zeroEx.proxy` to `zeroEx.erc20Proxy` and add `zeroEx.erc721Proxy` (#863)
|
||||
* Refactored `ZeroEx.isValidSignature` to `zeroEx.isValidSignatureAsync`. It is now async so that it can verify contract-dependent signature types (#863)
|
||||
* Refactored `signOrderHashAsync` to `ecSignOrderHashAsync`. There are now many non-ECSignature ways to sign orders too. (#863)
|
||||
* Removed `createOrderWatcherAsync` method. Will be added back once OrderWatcher is refactored for V2 (#863)
|
||||
* 0x.js exports renamed contract events and event arg types (#863)
|
||||
* Export `ZeroEx.assetData` with methods to decode/encode assetData fields found in 0x orders (#884)
|
||||
|
||||
## v0.38.6 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.38.5 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.38.4 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -26,7 +66,7 @@ CHANGELOG
|
||||
* Renamed createOrderStateWatcher to createOrderWatcherAsync since it is now async (#579)
|
||||
* Renamed ZeroExError to ContractWrappersErrors since they now lives in the @0xproject/contract-wrappers subpackage (#579)
|
||||
|
||||
## v0.37.2 - _May 5, 2018_
|
||||
## v0.37.2 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "0x.js",
|
||||
"version": "0.38.4",
|
||||
"version": "1.0.1-rc.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -18,9 +18,10 @@
|
||||
"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",
|
||||
"pre_build": "run-s update_artifacts generate_contract_wrappers",
|
||||
"copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
|
||||
"update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;",
|
||||
"generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(ZRXToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers",
|
||||
"lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*",
|
||||
"test:circleci": "run-s test:coverage",
|
||||
"test": "yarn run_mocha",
|
||||
@@ -29,7 +30,7 @@
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"clean": "shx rm -rf _bundles lib test_temp scripts src/generated_contract_wrappers",
|
||||
"build:umd:prod": "NODE_ENV=production webpack",
|
||||
"build:commonjs": "tsc && copyfiles -u 2 './src/compact_artifacts/**/*.json' ./lib/src/compact_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"build:commonjs": "tsc && yarn copy_artifacts && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js",
|
||||
"docs:stage": "node scripts/stage_docs.js",
|
||||
@@ -37,7 +38,7 @@
|
||||
"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": "ZRXToken",
|
||||
"postpublish": {
|
||||
"assets": [
|
||||
"packages/0x.js/_bundles/index.js",
|
||||
@@ -50,13 +51,11 @@
|
||||
"../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"
|
||||
"../contract-wrappers/src/contract_wrappers/erc20_proxy_wrapper.ts",
|
||||
"../contract-wrappers/src/contract_wrappers/erc721_proxy_wrapper.ts",
|
||||
"../contract-wrappers/src/contract_wrappers/erc20_token_wrapper.ts",
|
||||
"../contract-wrappers/src/contract_wrappers/erc721_token_wrapper.ts",
|
||||
"../order-watcher/src/order_watcher/order_watcher.ts"
|
||||
],
|
||||
"s3BucketPath": "s3://doc-jsons/0x.js/",
|
||||
"s3StagingBucketPath": "s3://staging-doc-jsons/0x.js/"
|
||||
@@ -69,12 +68,11 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@0xproject/abi-gen": "^0.3.2",
|
||||
"@0xproject/dev-utils": "^0.4.4",
|
||||
"@0xproject/migrations": "^0.0.8",
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/sol-compiler": "^0.5.2",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@0xproject/abi-gen": "^1.0.4",
|
||||
"@0xproject/dev-utils": "^1.0.3",
|
||||
"@0xproject/migrations": "^1.0.3",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^8.0.53",
|
||||
@@ -87,32 +85,32 @@
|
||||
"dirty-chai": "^2.0.1",
|
||||
"json-loader": "^0.5.4",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha": "^4.1.0",
|
||||
"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",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "0xProject/typedoc",
|
||||
"typescript": "2.7.1",
|
||||
"typescript": "2.9.2",
|
||||
"webpack": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^0.2.12",
|
||||
"@0xproject/base-contract": "^0.3.4",
|
||||
"@0xproject/contract-wrappers": "^0.0.5",
|
||||
"@0xproject/order-utils": "^0.0.7",
|
||||
"@0xproject/order-watcher": "^0.0.6",
|
||||
"@0xproject/sol-compiler": "^0.5.2",
|
||||
"@0xproject/types": "^0.8.1",
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"@0xproject/web3-wrapper": "^0.7.1",
|
||||
"ethereum-types": "^0.0.2",
|
||||
"@0xproject/assert": "^1.0.4",
|
||||
"@0xproject/base-contract": "^1.0.4",
|
||||
"@0xproject/contract-wrappers": "^1.0.1-rc.2",
|
||||
"@0xproject/order-utils": "^1.0.1-rc.2",
|
||||
"@0xproject/sol-compiler": "^1.0.4",
|
||||
"@0xproject/subproviders": "^1.0.4",
|
||||
"@0xproject/types": "^1.0.1-rc.3",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"@0xproject/web3-wrapper": "^1.1.2",
|
||||
"ethereum-types": "^1.0.3",
|
||||
"ethers": "3.0.22",
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -2,23 +2,27 @@ import { assert } from '@0xproject/assert';
|
||||
import {
|
||||
ContractWrappers,
|
||||
ContractWrappersConfig,
|
||||
ERC20ProxyWrapper,
|
||||
ERC20TokenWrapper,
|
||||
ERC721ProxyWrapper,
|
||||
ERC721TokenWrapper,
|
||||
EtherTokenWrapper,
|
||||
ExchangeWrapper,
|
||||
TokenRegistryWrapper,
|
||||
TokenTransferProxyWrapper,
|
||||
TokenWrapper,
|
||||
} from '@0xproject/contract-wrappers';
|
||||
import {
|
||||
assetDataUtils,
|
||||
ecSignOrderHashAsync,
|
||||
generatePseudoRandomSalt,
|
||||
getOrderHashHex,
|
||||
isValidOrderHash,
|
||||
isValidSignature,
|
||||
signOrderHashAsync,
|
||||
isValidSignatureAsync,
|
||||
orderHashUtils,
|
||||
} from '@0xproject/order-utils';
|
||||
import { OrderWatcher, OrderWatcherConfig } from '@0xproject/order-watcher';
|
||||
import { ECSignature, Order, Provider, SignedOrder, TransactionReceiptWithDecodedLogs } from '@0xproject/types';
|
||||
// HACK: Since we export assetDataUtils from ZeroEx and it has AssetProxyId, ERC20AssetData and ERC721AssetData
|
||||
// in it's public interface, we need to import these types here.
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { AssetProxyId, ERC20AssetData, ERC721AssetData, Order, SignedOrder, SignerType } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import { constants } from './utils/constants';
|
||||
|
||||
@@ -38,25 +42,29 @@ export class ZeroEx {
|
||||
*/
|
||||
public exchange: ExchangeWrapper;
|
||||
/**
|
||||
* An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x
|
||||
* TokenRegistry smart contract.
|
||||
* An instance of the ERC20TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
|
||||
*/
|
||||
public tokenRegistry: TokenRegistryWrapper;
|
||||
public erc20Token: ERC20TokenWrapper;
|
||||
/**
|
||||
* An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
|
||||
* An instance of the ERC721TokenWrapper class containing methods for interacting with any ERC721 token smart contract.
|
||||
*/
|
||||
public token: TokenWrapper;
|
||||
public erc721Token: ERC721TokenWrapper;
|
||||
/**
|
||||
* An instance of the EtherTokenWrapper class containing methods for interacting with the
|
||||
* wrapped ETH ERC20 token smart contract.
|
||||
*/
|
||||
public etherToken: EtherTokenWrapper;
|
||||
/**
|
||||
* An instance of the TokenTransferProxyWrapper class containing methods for interacting with the
|
||||
* tokenTransferProxy smart contract.
|
||||
* An instance of the ERC20ProxyWrapper class containing methods for interacting with the
|
||||
* ERC20 proxy smart contract.
|
||||
*/
|
||||
public proxy: TokenTransferProxyWrapper;
|
||||
private _contractWrappers: ContractWrappers;
|
||||
public erc20Proxy: ERC20ProxyWrapper;
|
||||
/**
|
||||
* An instance of the ERC721ProxyWrapper class containing methods for interacting with the
|
||||
* ERC721 proxy smart contract.
|
||||
*/
|
||||
public erc721Proxy: ERC721ProxyWrapper;
|
||||
private readonly _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
|
||||
@@ -66,24 +74,13 @@ export class ZeroEx {
|
||||
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.
|
||||
* @param data The hex encoded data signed by the supplied signature.
|
||||
* @param signature An object containing the elliptic curve signature parameters.
|
||||
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
|
||||
* @return Whether the signature is valid for the supplied signerAddress and data.
|
||||
*/
|
||||
public static isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
|
||||
return isValidSignature(data, signature, signerAddress);
|
||||
}
|
||||
/**
|
||||
* Computes the orderHash for a supplied order.
|
||||
* @param order An object that conforms to the Order or SignedOrder interface definitions.
|
||||
* @return The resulting orderHash from hashing the supplied order.
|
||||
*/
|
||||
public static getOrderHashHex(order: Order | SignedOrder): string {
|
||||
return getOrderHashHex(order);
|
||||
return orderHashUtils.getOrderHashHex(order);
|
||||
}
|
||||
/**
|
||||
* Checks if the supplied hex encoded order hash is valid.
|
||||
@@ -93,7 +90,7 @@ export class ZeroEx {
|
||||
* @return Whether the supplied orderHash has the expected format.
|
||||
*/
|
||||
public static isValidOrderHash(orderHash: string): boolean {
|
||||
return isValidOrderHash(orderHash);
|
||||
return orderHashUtils.isValidOrderHash(orderHash);
|
||||
}
|
||||
/**
|
||||
* A unit amount is defined as the amount of a token above the specified decimal places (integer part).
|
||||
@@ -123,6 +120,57 @@ export class ZeroEx {
|
||||
const baseUnitAmount = Web3Wrapper.toBaseUnitAmount(amount, decimals);
|
||||
return baseUnitAmount;
|
||||
}
|
||||
/**
|
||||
* Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or
|
||||
* takerAssetData fields in a 0x order.
|
||||
* @param tokenAddress The ERC20 token address to encode
|
||||
* @return The hex encoded assetData string
|
||||
*/
|
||||
public static encodeERC20AssetData(tokenAddress: string): string {
|
||||
return assetDataUtils.encodeERC20AssetData(tokenAddress);
|
||||
}
|
||||
/**
|
||||
* Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId
|
||||
* @param assetData Hex encoded assetData string to decode
|
||||
* @return An object containing the decoded tokenAddress & assetProxyId
|
||||
*/
|
||||
public static decodeERC20AssetData(assetData: string): ERC20AssetData {
|
||||
return assetDataUtils.decodeERC20AssetData(assetData);
|
||||
}
|
||||
/**
|
||||
* Encodes an ERC721 token address into a hex encoded assetData string, usable in the makerAssetData or
|
||||
* takerAssetData fields in a 0x order.
|
||||
* @param tokenAddress The ERC721 token address to encode
|
||||
* @param tokenId The ERC721 tokenId to encode
|
||||
* @return The hex encoded assetData string
|
||||
*/
|
||||
public static encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
|
||||
return assetDataUtils.encodeERC721AssetData(tokenAddress, tokenId);
|
||||
}
|
||||
/**
|
||||
* Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId
|
||||
* @param assetData Hex encoded assetData string to decode
|
||||
* @return An object containing the decoded tokenAddress, tokenId & assetProxyId
|
||||
*/
|
||||
public static decodeERC721AssetData(assetData: string): ERC721AssetData {
|
||||
return assetDataUtils.decodeERC721AssetData(assetData);
|
||||
}
|
||||
/**
|
||||
* Decode and return the assetProxyId from the assetData
|
||||
* @param assetData Hex encoded assetData string to decode
|
||||
* @return The assetProxyId
|
||||
*/
|
||||
public static decodeAssetProxyId(assetData: string): AssetProxyId {
|
||||
return assetDataUtils.decodeAssetProxyId(assetData);
|
||||
}
|
||||
/**
|
||||
* Decode any assetData into it's corresponding assetData object
|
||||
* @param assetData Hex encoded assetData string to decode
|
||||
* @return Either a ERC20 or ERC721 assetData object
|
||||
*/
|
||||
public static decodeAssetDataOrThrow(assetData: string): ERC20AssetData | ERC721AssetData {
|
||||
return assetDataUtils.decodeAssetDataOrThrow(assetData);
|
||||
}
|
||||
/**
|
||||
* Instantiates a new ZeroEx instance that provides the public interface to the 0x.js library.
|
||||
* @param provider The Provider instance you would like the 0x.js library to use for interacting with
|
||||
@@ -134,12 +182,29 @@ export class ZeroEx {
|
||||
assert.isWeb3Provider('provider', provider);
|
||||
this._contractWrappers = new ContractWrappers(provider, config);
|
||||
|
||||
this.proxy = this._contractWrappers.proxy;
|
||||
this.token = this._contractWrappers.token;
|
||||
this.erc20Proxy = this._contractWrappers.erc20Proxy;
|
||||
this.erc721Proxy = this._contractWrappers.erc721Proxy;
|
||||
this.erc20Token = this._contractWrappers.erc20Token;
|
||||
this.erc721Token = this._contractWrappers.erc721Token;
|
||||
this.exchange = this._contractWrappers.exchange;
|
||||
this.tokenRegistry = this._contractWrappers.tokenRegistry;
|
||||
this.etherToken = this._contractWrappers.etherToken;
|
||||
}
|
||||
/**
|
||||
* Verifies that the provided signature is valid according to the 0x Protocol smart contracts
|
||||
* @param data The hex encoded data signed by the supplied signature.
|
||||
* @param signature The hex encoded signature.
|
||||
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
|
||||
* @return Whether the signature is valid for the supplied signerAddress and data.
|
||||
*/
|
||||
public async isValidSignatureAsync(data: string, signature: string, signerAddress: string): Promise<boolean> {
|
||||
const isValid = await isValidSignatureAsync(
|
||||
this._contractWrappers.getProvider(),
|
||||
data,
|
||||
signature,
|
||||
signerAddress,
|
||||
);
|
||||
return isValid;
|
||||
}
|
||||
/**
|
||||
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
|
||||
* subscriptions so you will need to re-subscribe to all events relevant to your app after this call.
|
||||
@@ -172,23 +237,23 @@ export class ZeroEx {
|
||||
* @param orderHash Hex encoded orderHash to sign.
|
||||
* @param signerAddress The hex encoded Ethereum address you wish to sign it with. This address
|
||||
* must be available via the Provider supplied to 0x.js.
|
||||
* @param shouldAddPersonalMessagePrefix Some signers add the personal message prefix `\x19Ethereum Signed Message`
|
||||
* themselves (e.g Parity Signer, Ledger, TestRPC) and others expect it to already be done by the client
|
||||
* (e.g Metamask). Depending on which signer this request is going to, decide on whether to add the prefix
|
||||
* before sending the request.
|
||||
* @return An object containing the Elliptic curve signature parameters generated by signing the orderHash.
|
||||
* @param signerType the signer type that will perform the `eth_sign` operation. E.g Default, Metamask, Ledger or Trezor.
|
||||
* Some implementations exhibit different behaviour. Default will assume a spec compliant eth_sign implementation.
|
||||
* This parameter is defaulted to `SignerType.Default`.
|
||||
* @return A hex encoded string of the Elliptic curve signature parameters generated by signing the orderHash and signature type.
|
||||
*/
|
||||
public async signOrderHashAsync(
|
||||
public async ecSignOrderHashAsync(
|
||||
orderHash: string,
|
||||
signerAddress: string,
|
||||
shouldAddPersonalMessagePrefix: boolean,
|
||||
): Promise<ECSignature> {
|
||||
return signOrderHashAsync(
|
||||
signerType: SignerType = SignerType.Default,
|
||||
): Promise<string> {
|
||||
const signature = await ecSignOrderHashAsync(
|
||||
this._contractWrappers.getProvider(),
|
||||
orderHash,
|
||||
signerAddress,
|
||||
shouldAddPersonalMessagePrefix,
|
||||
signerType,
|
||||
);
|
||||
return signature;
|
||||
}
|
||||
/**
|
||||
* Waits for a transaction to be mined and returns the transaction receipt.
|
||||
@@ -211,18 +276,4 @@ export class ZeroEx {
|
||||
);
|
||||
return transactionReceiptWithDecodedLogs;
|
||||
}
|
||||
/**
|
||||
* 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 OrderWatcher class.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
7
packages/0x.js/src/artifacts.ts
Normal file
7
packages/0x.js/src/artifacts.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
|
||||
import * as ZRXToken from './artifacts/ZRXToken.json';
|
||||
|
||||
export const artifacts = {
|
||||
ZRXToken: (ZRXToken as any) as ContractArtifact,
|
||||
};
|
10031
packages/0x.js/src/artifacts/ZRXToken.json
Normal file
10031
packages/0x.js/src/artifacts/ZRXToken.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"contract_name": "DummyToken",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setBalance",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,287 +0,0 @@
|
||||
{
|
||||
"contract_name": "EtherToken",
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"payable": true,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Deposit",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Withdrawal",
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"networks": {
|
||||
"1": {
|
||||
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
},
|
||||
"3": {
|
||||
"address": "0xc00fd9820cd2898cc4c054b7bf142de637ad129a"
|
||||
},
|
||||
"4": {
|
||||
"address": "0xc778417e063141139fce010982780140aa0cd5ab"
|
||||
},
|
||||
"42": {
|
||||
"address": "0x653e49e301e508a13237c0ddc98ae7d4cd2667a1"
|
||||
},
|
||||
"50": {
|
||||
"address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,610 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,172 +0,0 @@
|
||||
{
|
||||
"contract_name": "Token",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "supply",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "success",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "remaining",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,547 +0,0 @@
|
||||
{
|
||||
"contract_name": "TokenRegistry",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeToken",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "getTokenAddressByName",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "getTokenAddressBySymbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_swarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "setTokenSwarmHash",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "getTokenMetaData",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "_decimals",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "_ipfsHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "_swarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "addToken",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "setTokenName",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "tokens",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "decimals",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "ipfsHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "swarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "tokenAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "getTokenByName",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getTokenAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_ipfsHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "setTokenIpfsHash",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "getTokenBySymbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "setTokenSymbol",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "decimals",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "ipfsHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "swarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "LogAddToken",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "decimals",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "ipfsHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "swarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "LogRemoveToken",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "oldName",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "newName",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "LogTokenNameChange",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "oldSymbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "newSymbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"name": "LogTokenSymbolChange",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "oldIpfsHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "newIpfsHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "LogTokenIpfsHashChange",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "oldSwarmHash",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "newSwarmHash",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "LogTokenSwarmHashChange",
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"networks": {
|
||||
"1": {
|
||||
"address": "0x926a74c5c36adf004c87399e65f75628b0f98d2c"
|
||||
},
|
||||
"3": {
|
||||
"address": "0x6b1a50f0bb5a7995444bd3877b22dc89c62843ed"
|
||||
},
|
||||
"4": {
|
||||
"address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6"
|
||||
},
|
||||
"42": {
|
||||
"address": "0xf18e504561f4347bea557f3d4558f559dddbae7f"
|
||||
},
|
||||
"50": {
|
||||
"address": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,187 +0,0 @@
|
||||
{
|
||||
"contract_name": "TokenTransferProxy",
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "authorities",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "authorized",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getAuthorizedAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAuthorizedAddressAdded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "LogAuthorizedAddressRemoved",
|
||||
"type": "event"
|
||||
}
|
||||
],
|
||||
"networks": {
|
||||
"1": {
|
||||
"address": "0x8da0d80f5007ef1e431dd2127178d224e32c2ef4"
|
||||
},
|
||||
"3": {
|
||||
"address": "0x4e9aad8184de8833365fea970cd9149372fdf1e6"
|
||||
},
|
||||
"4": {
|
||||
"address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d"
|
||||
},
|
||||
"42": {
|
||||
"address": "0x087eed4bc1ee3de49befbd66c662b434b15d49d4"
|
||||
},
|
||||
"50": {
|
||||
"address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"contract_name": "ZRX",
|
||||
"networks": {
|
||||
"1": {
|
||||
"address": "0xe41d2489571d322189246dafa5ebde1f4699f498"
|
||||
},
|
||||
"3": {
|
||||
"address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d"
|
||||
},
|
||||
"4": {
|
||||
"address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8"
|
||||
},
|
||||
"42": {
|
||||
"address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570"
|
||||
},
|
||||
"50": {
|
||||
"address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,32 +1,38 @@
|
||||
export { ZeroEx } from './0x';
|
||||
|
||||
export { Web3ProviderEngine, RPCSubprovider } from '@0xproject/subproviders';
|
||||
|
||||
export {
|
||||
BlockParamLiteral,
|
||||
FilterObject,
|
||||
BlockParam,
|
||||
ContractEventArg,
|
||||
ExchangeContractErrs,
|
||||
LogWithDecodedArgs,
|
||||
Order,
|
||||
Provider,
|
||||
SignedOrder,
|
||||
SignerType,
|
||||
ECSignature,
|
||||
OrderStateValid,
|
||||
OrderStateInvalid,
|
||||
OrderState,
|
||||
Token,
|
||||
TransactionReceipt,
|
||||
TransactionReceiptWithDecodedLogs,
|
||||
ERC20AssetData,
|
||||
ERC721AssetData,
|
||||
AssetProxyId,
|
||||
} from '@0xproject/types';
|
||||
|
||||
export { OrderWatcherConfig } from '@0xproject/order-watcher';
|
||||
export {
|
||||
BlockParamLiteral,
|
||||
FilterObject,
|
||||
BlockParam,
|
||||
LogWithDecodedArgs,
|
||||
ContractEventArg,
|
||||
Provider,
|
||||
TransactionReceipt,
|
||||
TransactionReceiptWithDecodedLogs,
|
||||
} from 'ethereum-types';
|
||||
|
||||
export {
|
||||
EventCallback,
|
||||
ContractEvent,
|
||||
IndexedFilterValues,
|
||||
BlockRange,
|
||||
OrderCancellationRequest,
|
||||
OrderFillRequest,
|
||||
ContractEventArgs,
|
||||
MethodOpts,
|
||||
@@ -36,18 +42,25 @@ export {
|
||||
DecodedLogEvent,
|
||||
OnOrderStateChangeCallback,
|
||||
ContractWrappersError,
|
||||
EtherTokenContractEventArgs,
|
||||
WithdrawalContractEventArgs,
|
||||
DepositContractEventArgs,
|
||||
EtherTokenEvents,
|
||||
TransferContractEventArgs,
|
||||
ApprovalContractEventArgs,
|
||||
TokenContractEventArgs,
|
||||
TokenEvents,
|
||||
LogErrorContractEventArgs,
|
||||
LogCancelContractEventArgs,
|
||||
LogFillContractEventArgs,
|
||||
ExchangeContractEventArgs,
|
||||
ExchangeEvents,
|
||||
WETH9Events,
|
||||
WETH9WithdrawalEventArgs,
|
||||
WETH9ApprovalEventArgs,
|
||||
WETH9EventArgs,
|
||||
WETH9DepositEventArgs,
|
||||
WETH9TransferEventArgs,
|
||||
ERC20TokenTransferEventArgs,
|
||||
ERC20TokenApprovalEventArgs,
|
||||
ERC20TokenEvents,
|
||||
ERC20TokenEventArgs,
|
||||
ERC721TokenApprovalEventArgs,
|
||||
ERC721TokenApprovalForAllEventArgs,
|
||||
ERC721TokenTransferEventArgs,
|
||||
ERC721TokenEvents,
|
||||
ExchangeCancelUpToEventArgs,
|
||||
ExchangeAssetProxyRegisteredEventArgs,
|
||||
ExchangeFillEventArgs,
|
||||
ExchangeCancelEventArgs,
|
||||
ExchangeEventArgs,
|
||||
ContractWrappersConfig,
|
||||
OrderInfo,
|
||||
} from '@0xproject/contract-wrappers';
|
||||
|
@@ -8,8 +8,8 @@ export const zeroExPrivateNetworkConfigSchema = {
|
||||
gasPrice: { $ref: '/Number' },
|
||||
zrxContractAddress: { $ref: '/Address' },
|
||||
exchangeContractAddress: { $ref: '/Address' },
|
||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||
erc20ProxyContractAddress: { $ref: '/Address' },
|
||||
erc721ProxyContractAddress: { $ref: '/Address' },
|
||||
orderWatcherConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -29,7 +29,7 @@ export const zeroExPrivateNetworkConfigSchema = {
|
||||
'networkId',
|
||||
'zrxContractAddress',
|
||||
'exchangeContractAddress',
|
||||
'tokenRegistryContractAddress',
|
||||
'tokenTransferProxyContractAddress',
|
||||
'erc20ProxyContractAddress',
|
||||
'erc721ProxyContractAddress',
|
||||
],
|
||||
};
|
||||
|
@@ -22,8 +22,8 @@ export const zeroExPublicNetworkConfigSchema = {
|
||||
gasPrice: { $ref: '/Number' },
|
||||
zrxContractAddress: { $ref: '/Address' },
|
||||
exchangeContractAddress: { $ref: '/Address' },
|
||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||
erc20ProxyContractAddress: { $ref: '/Address' },
|
||||
erc721ProxyContractAddress: { $ref: '/Address' },
|
||||
orderWatcherConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
|
@@ -2,14 +2,13 @@ import { ContractWrappers } from '@0xproject/contract-wrappers';
|
||||
import { BlockchainLifecycle } from '@0xproject/dev-utils';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
|
||||
import { ApprovalContractEventArgs, LogWithDecodedArgs, TokenEvents, ZeroEx } from '../src';
|
||||
import { ERC20TokenApprovalEventArgs, ERC20TokenEvents, LogWithDecodedArgs, ZeroEx } from '../src';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { constants } from './utils/constants';
|
||||
import { TokenUtils } from './utils/token_utils';
|
||||
import { tokenUtils } from './utils/token_utils';
|
||||
import { provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
@@ -28,9 +27,7 @@ describe('ZeroEx library', () => {
|
||||
it('overrides provider in nested web3s and invalidates contractInstances', async () => {
|
||||
// Instantiate the contract instances with the current provider
|
||||
await (zeroEx.exchange as any)._getExchangeContractAsync();
|
||||
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
|
||||
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined();
|
||||
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.not.be.undefined();
|
||||
|
||||
// Add property to newProvider so that we can differentiate it from old provider
|
||||
(provider as any).zeroExTestId = 1;
|
||||
@@ -38,52 +35,44 @@ describe('ZeroEx library', () => {
|
||||
|
||||
// Check that contractInstances with old provider are removed after provider update
|
||||
expect((zeroEx.exchange as any)._exchangeContractIfExists).to.be.undefined();
|
||||
expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.be.undefined();
|
||||
|
||||
// Check that all nested 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();
|
||||
expect(tokenRegistryWeb3WrapperProvider.zeroExTestId).to.be.a('number');
|
||||
});
|
||||
});
|
||||
describe('#isValidSignature', () => {
|
||||
// The Exchange smart contract `isValidSignature` method only validates orderHashes and assumes
|
||||
// the length of the data is exactly 32 bytes. Thus for these tests, we use data of this size.
|
||||
const dataHex = '0x6927e990021d23b1eb7b8789f6a6feaf98fe104bb0cf8259421b79f9a34222b0';
|
||||
const signature = {
|
||||
v: 27,
|
||||
r: '0x61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33',
|
||||
s: '0x40349190569279751135161d22529dc25add4f6069af05be04cacbda2ace2254',
|
||||
};
|
||||
const ethSignSignature =
|
||||
'0x1B61a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc3340349190569279751135161d22529dc25add4f6069af05be04cacbda2ace225403';
|
||||
const address = '0x5409ed021d9299bf6814279a6a1411a7e866a631';
|
||||
const bytes32Zeros = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
||||
it("should return false if the data doesn't pertain to the signature & address", async () => {
|
||||
return expect(
|
||||
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync('0x0', signature, address),
|
||||
(zeroEx.exchange as any).isValidSignatureAsync(bytes32Zeros, address, ethSignSignature),
|
||||
).to.become(false);
|
||||
});
|
||||
it("should return false if the address doesn't pertain to the signature & data", async () => {
|
||||
const validUnrelatedAddress = '0x8b0292b11a196601ed2ce54b665cafeca0347d42';
|
||||
return expect(
|
||||
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(
|
||||
dataHex,
|
||||
signature,
|
||||
validUnrelatedAddress,
|
||||
),
|
||||
(zeroEx.exchange as any).isValidSignatureAsync(dataHex, validUnrelatedAddress, ethSignSignature),
|
||||
).to.become(false);
|
||||
});
|
||||
it("should return false if the signature doesn't pertain to the dataHex & address", async () => {
|
||||
const wrongSignature = _.assign({}, signature, { v: 28 });
|
||||
return expect(
|
||||
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, wrongSignature, address),
|
||||
).to.become(false);
|
||||
const signatureArray = ethSignSignature.split('');
|
||||
// tslint:disable-next-line:custom-no-magic-numbers
|
||||
signatureArray[5] = 'C'; // V = 28, instead of 27
|
||||
const wrongSignature = signatureArray.join('');
|
||||
return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, wrongSignature)).to.become(
|
||||
false,
|
||||
);
|
||||
});
|
||||
it('should return true if the signature does pertain to the dataHex & address', async () => {
|
||||
return expect(
|
||||
(zeroEx.exchange as any)._isValidSignatureUsingContractCallAsync(dataHex, signature, address),
|
||||
).to.become(true);
|
||||
return expect((zeroEx.exchange as any).isValidSignatureAsync(dataHex, address, ethSignSignature)).to.become(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('#toUnitAmount', () => {
|
||||
@@ -128,18 +117,16 @@ describe('ZeroEx library', () => {
|
||||
it('returns transaction receipt with decoded logs', async () => {
|
||||
const availableAddresses = await zeroEx.getAvailableAddressesAsync();
|
||||
const coinbase = availableAddresses[0];
|
||||
const tokens = await zeroEx.tokenRegistry.getTokensAsync();
|
||||
const tokenUtils = new TokenUtils(tokens);
|
||||
const zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address;
|
||||
const proxyAddress = zeroEx.proxy.getContractAddress();
|
||||
const txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase);
|
||||
const zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
|
||||
const erc20ProxyAddress = zeroEx.erc20Proxy.getContractAddress();
|
||||
const txHash = await zeroEx.erc20Token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase);
|
||||
const txReceiptWithDecodedLogs = await zeroEx.awaitTransactionMinedAsync(txHash);
|
||||
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||
const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs<ApprovalContractEventArgs>;
|
||||
expect(log.event).to.be.equal(TokenEvents.Approval);
|
||||
const log = txReceiptWithDecodedLogs.logs[0] as LogWithDecodedArgs<ERC20TokenApprovalEventArgs>;
|
||||
expect(log.event).to.be.equal(ERC20TokenEvents.Approval);
|
||||
expect(log.args._owner).to.be.equal(coinbase);
|
||||
expect(log.args._spender).to.be.equal(proxyAddress);
|
||||
expect(log.args._value).to.be.bignumber.equal(zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
|
||||
expect(log.args._spender).to.be.equal(erc20ProxyAddress);
|
||||
expect(log.args._value).to.be.bignumber.equal(zeroEx.erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
|
||||
});
|
||||
});
|
||||
describe('#config', () => {
|
||||
@@ -151,15 +138,13 @@ describe('ZeroEx library', () => {
|
||||
const zeroExWithWrongExchangeAddress = new ZeroEx(provider, zeroExConfig);
|
||||
expect(zeroExWithWrongExchangeAddress.exchange.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS);
|
||||
});
|
||||
it('allows to specify token registry token contract address', async () => {
|
||||
it('allows to specify erc20Proxy contract address', async () => {
|
||||
const zeroExConfig = {
|
||||
tokenRegistryContractAddress: ZeroEx.NULL_ADDRESS,
|
||||
erc20ProxyContractAddress: ZeroEx.NULL_ADDRESS,
|
||||
networkId: constants.TESTRPC_NETWORK_ID,
|
||||
};
|
||||
const zeroExWithWrongTokenRegistryAddress = new ZeroEx(provider, zeroExConfig);
|
||||
expect(zeroExWithWrongTokenRegistryAddress.tokenRegistry.getContractAddress()).to.be.equal(
|
||||
ZeroEx.NULL_ADDRESS,
|
||||
);
|
||||
const zeroExWithWrongERC20ProxyAddress = new ZeroEx(provider, zeroExConfig);
|
||||
expect(zeroExWithWrongERC20ProxyAddress.erc20Proxy.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,48 +0,0 @@
|
||||
import { web3Factory } from '@0xproject/dev-utils';
|
||||
|
||||
import { ZeroEx } from '../src';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { constants } from './utils/constants';
|
||||
|
||||
chaiSetup.configure();
|
||||
|
||||
// Those tests are slower cause they're talking to a remote node
|
||||
const TIMEOUT = 10000;
|
||||
|
||||
describe('Artifacts', () => {
|
||||
describe('contracts are deployed on kovan', () => {
|
||||
const kovanRpcUrl = constants.KOVAN_RPC_URL;
|
||||
const provider = web3Factory.getRpcProvider({ rpcUrl: kovanRpcUrl });
|
||||
const config = {
|
||||
networkId: constants.KOVAN_NETWORK_ID,
|
||||
};
|
||||
const zeroEx = new ZeroEx(provider, config);
|
||||
it('token registry contract is deployed', async () => {
|
||||
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
it('proxy contract is deployed', async () => {
|
||||
await (zeroEx.proxy as any)._getTokenTransferProxyContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
it('exchange contract is deployed', async () => {
|
||||
await (zeroEx.exchange as any)._getExchangeContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
});
|
||||
describe('contracts are deployed on ropsten', () => {
|
||||
const ropstenRpcUrl = constants.ROPSTEN_RPC_URL;
|
||||
const provider = web3Factory.getRpcProvider({ rpcUrl: ropstenRpcUrl });
|
||||
const config = {
|
||||
networkId: constants.ROPSTEN_NETWORK_ID,
|
||||
};
|
||||
const zeroEx = new ZeroEx(provider, config);
|
||||
it('token registry contract is deployed', async () => {
|
||||
await (zeroEx.tokenRegistry as any)._getTokenRegistryContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
it('proxy contract is deployed', async () => {
|
||||
await (zeroEx.proxy as any)._getTokenTransferProxyContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
it('exchange contract is deployed', async () => {
|
||||
await (zeroEx.exchange as any)._getExchangeContractAsync();
|
||||
}).timeout(TIMEOUT);
|
||||
});
|
||||
});
|
@@ -1,5 +1,5 @@
|
||||
import { devConstants } from '@0xproject/dev-utils';
|
||||
import { runV1MigrationsAsync } from '@0xproject/migrations';
|
||||
import { runV2MigrationsAsync } from '@0xproject/migrations';
|
||||
|
||||
import { provider } from './utils/web3_wrapper';
|
||||
|
||||
@@ -7,11 +7,11 @@ 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);
|
||||
this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
|
||||
const txDefaults = {
|
||||
gas: devConstants.GAS_LIMIT,
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
};
|
||||
const artifactsDir = `../migrations/artifacts/1.0.0`;
|
||||
await runV1MigrationsAsync(provider, artifactsDir, txDefaults);
|
||||
const artifactsDir = `../migrations/artifacts/2.0.0`;
|
||||
await runV2MigrationsAsync(provider, artifactsDir, txDefaults);
|
||||
});
|
||||
|
@@ -1,34 +1,9 @@
|
||||
import { Token } from '@0xproject/types';
|
||||
import * as _ from 'lodash';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
import { InternalZeroExError } from '../../src/types';
|
||||
import { constants } from './constants';
|
||||
|
||||
const PROTOCOL_TOKEN_SYMBOL = 'ZRX';
|
||||
const WETH_TOKEN_SYMBOL = 'WETH';
|
||||
|
||||
export class TokenUtils {
|
||||
private _tokens: Token[];
|
||||
constructor(tokens: Token[]) {
|
||||
this._tokens = tokens;
|
||||
}
|
||||
public getProtocolTokenOrThrow(): Token {
|
||||
const zrxToken = _.find(this._tokens, { symbol: PROTOCOL_TOKEN_SYMBOL });
|
||||
if (_.isUndefined(zrxToken)) {
|
||||
throw new Error(InternalZeroExError.ZrxNotInTokenRegistry);
|
||||
}
|
||||
return zrxToken;
|
||||
}
|
||||
public getWethTokenOrThrow(): Token {
|
||||
const wethToken = _.find(this._tokens, { symbol: WETH_TOKEN_SYMBOL });
|
||||
if (_.isUndefined(wethToken)) {
|
||||
throw new Error(InternalZeroExError.WethNotInTokenRegistry);
|
||||
}
|
||||
return wethToken;
|
||||
}
|
||||
public getDummyTokens(): Token[] {
|
||||
const dummyTokens = _.filter(this._tokens, token => {
|
||||
return !_.includes([PROTOCOL_TOKEN_SYMBOL, WETH_TOKEN_SYMBOL], token.symbol);
|
||||
});
|
||||
return dummyTokens;
|
||||
}
|
||||
}
|
||||
export const tokenUtils = {
|
||||
getProtocolTokenAddress(): string {
|
||||
return artifacts.ZRXToken.networks[constants.TESTRPC_NETWORK_ID].address;
|
||||
},
|
||||
};
|
||||
|
@@ -1,8 +1,12 @@
|
||||
import { web3Factory } from '@0xproject/dev-utils';
|
||||
import { Provider } from '@0xproject/types';
|
||||
import { devConstants, web3Factory } from '@0xproject/dev-utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
|
||||
const txDefaults = {
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
gas: devConstants.GAS_LIMIT,
|
||||
};
|
||||
const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
|
||||
export { provider, web3Wrapper };
|
||||
export { provider, web3Wrapper, txDefaults };
|
||||
|
@@ -1,6 +1,53 @@
|
||||
[
|
||||
{
|
||||
"version": "0.4.0",
|
||||
"timestamp": 1534210131,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532619515,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532614997,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532605697,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fix the abi-gen entry point in package.json",
|
||||
"pr": 901
|
||||
}
|
||||
],
|
||||
"timestamp": 1532357734
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Convert e_r_c to erc in generated file names",
|
||||
@@ -9,6 +56,28 @@
|
||||
{
|
||||
"note": "Remove the output directory before writing to it",
|
||||
"pr": 822
|
||||
},
|
||||
{
|
||||
"note": "skip generation of wrappers that are already up to date",
|
||||
"pr": 788
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.3.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531149657,
|
||||
"version": "0.3.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@@ -1,15 +1,49 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.1 - _July 23, 2018_
|
||||
|
||||
* Fix the abi-gen entry point in package.json (#901)
|
||||
|
||||
## v1.0.0 - _July 19, 2018_
|
||||
|
||||
* Convert e_r_c to erc in generated file names (#822)
|
||||
* Remove the output directory before writing to it (#822)
|
||||
* skip generation of wrappers that are already up to date (#788)
|
||||
|
||||
## v0.3.4 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.3 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.2 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.1 - _June 1, 2018_
|
||||
## v0.3.1 - _May 31, 2018_
|
||||
|
||||
* Incorrect publish that was unpublished
|
||||
|
||||
@@ -17,7 +51,7 @@ CHANGELOG
|
||||
|
||||
* Properly export the executable binary (#588)
|
||||
|
||||
## v0.2.13 - _May 5, 2018_
|
||||
## v0.2.13 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('../lib/index.js')
|
||||
require('../lib/src/index.js');
|
||||
|
0
packages/abi-gen/coverage/.gitkeep
Normal file
0
packages/abi-gen/coverage/.gitkeep
Normal file
@@ -1,17 +1,22 @@
|
||||
{
|
||||
"name": "@0xproject/abi-gen",
|
||||
"version": "0.3.2",
|
||||
"version": "1.0.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Generate contract wrappers from ABI and handlebars templates",
|
||||
"main": "lib/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"watch_without_deps": "tsc -w",
|
||||
"lint": "tslint --project .",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"test": "yarn run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit",
|
||||
"test:circleci": "yarn test:coverage",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"bin": {
|
||||
@@ -27,33 +32,38 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"ethereum-types": "^0.0.2",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"chalk": "^2.3.0",
|
||||
"ethereum-types": "^1.0.3",
|
||||
"glob": "^7.1.2",
|
||||
"handlebars": "^4.0.11",
|
||||
"lodash": "^4.17.4",
|
||||
"rimraf": "^2.6.2",
|
||||
"lodash": "^4.17.5",
|
||||
"mkdirp": "^0.5.1",
|
||||
"sleep": "^5.1.1",
|
||||
"tmp": "^0.0.33",
|
||||
"to-snake-case": "^1.0.0",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@types/glob": "^5.0.33",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/glob": "5.0.35",
|
||||
"@types/handlebars": "^4.0.36",
|
||||
"@types/mkdirp": "^0.5.1",
|
||||
"@types/node": "^8.0.53",
|
||||
"@types/sleep": "^0.0.7",
|
||||
"@types/tmp": "^0.0.33",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.1.2",
|
||||
"copyfiles": "^1.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^5.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"typescript": "2.7.1"
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "2.9.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -3,16 +3,12 @@
|
||||
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';
|
||||
import * as _ from 'lodash';
|
||||
import * as mkdirp from 'mkdirp';
|
||||
import * as rimraf from 'rimraf';
|
||||
import * as yargs from 'yargs';
|
||||
|
||||
import toSnakeCase = require('to-snake-case');
|
||||
|
||||
import { ContextData, ContractsBackend, ParamKind } from './types';
|
||||
import { utils } from './utils';
|
||||
|
||||
@@ -71,16 +67,6 @@ function registerPartials(partialsGlob: string): void {
|
||||
}
|
||||
}
|
||||
|
||||
function writeOutputFile(name: string, renderedTsCode: string): void {
|
||||
let fileName = toSnakeCase(name);
|
||||
// HACK: Snake case doesn't make a lot of sense for abbreviated names but we can't reliably detect abbreviations
|
||||
// so we special-case the abbreviations we use.
|
||||
fileName = fileName.replace('z_r_x', 'zrx').replace('e_r_c', 'erc');
|
||||
const filePath = `${args.output}/${fileName}.ts`;
|
||||
fs.writeFileSync(filePath, renderedTsCode);
|
||||
logUtils.log(`Created: ${chalk.bold(filePath)}`);
|
||||
}
|
||||
|
||||
Handlebars.registerHelper('parameterType', utils.solTypeToTsType.bind(utils, ParamKind.Input, args.backend));
|
||||
Handlebars.registerHelper('returnType', utils.solTypeToTsType.bind(utils, ParamKind.Output, args.backend));
|
||||
if (args.partials) {
|
||||
@@ -97,7 +83,6 @@ if (_.isEmpty(abiFileNames)) {
|
||||
process.exit(1);
|
||||
} else {
|
||||
logUtils.log(`Found ${chalk.green(`${abiFileNames.length}`)} ${chalk.bold('ABI')} files`);
|
||||
rimraf.sync(args.output);
|
||||
mkdirp.sync(args.output);
|
||||
}
|
||||
for (const abiFileName of abiFileNames) {
|
||||
@@ -120,6 +105,14 @@ for (const abiFileName of abiFileNames) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const outFileName = utils.makeOutputFileName(namedContent.name);
|
||||
const outFilePath = `${args.output}/${outFileName}.ts`;
|
||||
|
||||
if (utils.isOutputFileUpToDate(abiFileName, outFilePath)) {
|
||||
logUtils.log(`Already up to date: ${chalk.bold(outFilePath)}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
let ctor = ABI.find((abi: AbiDefinition) => abi.type === ABI_TYPE_CONSTRUCTOR) as ConstructorAbi;
|
||||
if (_.isUndefined(ctor)) {
|
||||
ctor = utils.getEmptyConstructor(); // The constructor exists, but it's implicit in JSON's ABI definition
|
||||
@@ -154,5 +147,6 @@ for (const abiFileName of abiFileNames) {
|
||||
events: eventAbis,
|
||||
};
|
||||
const renderedTsCode = template(contextData);
|
||||
writeOutputFile(namedContent.name, renderedTsCode);
|
||||
utils.writeOutputFile(outFilePath, renderedTsCode);
|
||||
logUtils.log(`Created: ${chalk.bold(outFilePath)}`);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ import { AbiType, ConstructorAbi, DataItem } from 'ethereum-types';
|
||||
import * as fs from 'fs';
|
||||
import * as _ from 'lodash';
|
||||
import * as path from 'path';
|
||||
import toSnakeCase = require('to-snake-case');
|
||||
|
||||
import { ContractsBackend, ParamKind } from './types';
|
||||
|
||||
@@ -92,4 +93,27 @@ export const utils = {
|
||||
inputs: [],
|
||||
};
|
||||
},
|
||||
makeOutputFileName(name: string): string {
|
||||
let fileName = toSnakeCase(name);
|
||||
// HACK: Snake case doesn't make a lot of sense for abbreviated names but we can't reliably detect abbreviations
|
||||
// so we special-case the abbreviations we use.
|
||||
fileName = fileName.replace('z_r_x', 'zrx').replace('e_r_c', 'erc');
|
||||
return fileName;
|
||||
},
|
||||
writeOutputFile(filePath: string, renderedTsCode: string): void {
|
||||
fs.writeFileSync(filePath, renderedTsCode);
|
||||
},
|
||||
isOutputFileUpToDate(abiFile: string, outputFile: string): boolean {
|
||||
const abiFileModTimeMs = fs.statSync(abiFile).mtimeMs;
|
||||
try {
|
||||
const outFileModTimeMs = fs.statSync(outputFile).mtimeMs;
|
||||
return outFileModTimeMs > abiFileModTimeMs;
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
86
packages/abi-gen/test/utils_test.ts
Normal file
86
packages/abi-gen/test/utils_test.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import * as fs from 'fs';
|
||||
import 'mocha';
|
||||
import * as tmp from 'tmp';
|
||||
|
||||
import { utils } from '../src/utils';
|
||||
|
||||
tmp.setGracefulCleanup(); // remove tmp files even if there are failures
|
||||
|
||||
chai.use(dirtyChai);
|
||||
|
||||
const expect = chai.expect;
|
||||
|
||||
describe('makeOutputFileName()', () => {
|
||||
it('should handle Metacoin usage', () => {
|
||||
expect(utils.makeOutputFileName('Metacoin')).to.equal('metacoin');
|
||||
});
|
||||
it('should handle special zrx_token case', () => {
|
||||
expect(utils.makeOutputFileName('ZRXToken')).to.equal('zrx_token');
|
||||
});
|
||||
it('should handle special erc_token case', () => {
|
||||
expect(utils.makeOutputFileName('ERC20Token')).to.equal('erc20_token');
|
||||
});
|
||||
});
|
||||
|
||||
describe('writeOutputFile()', () => {
|
||||
let tempFilePath: string;
|
||||
before(() => {
|
||||
tempFilePath = tmp.fileSync(
|
||||
{ discardDescriptor: true }, // close file (so we can update it)
|
||||
).name;
|
||||
});
|
||||
it('should write content to output file', () => {
|
||||
const content = 'hello world';
|
||||
|
||||
utils.writeOutputFile(tempFilePath, content);
|
||||
|
||||
expect(fs.readFileSync(tempFilePath).toString()).to.equal(content);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isOutputFileUpToDate()', () => {
|
||||
it('should throw ENOENT when there is no abi file', () => {
|
||||
expect(utils.isOutputFileUpToDate.bind('nonexistant1', 'nonexistant2')).to.throw('ENOENT');
|
||||
});
|
||||
|
||||
describe('when the abi input file exists', () => {
|
||||
let abiFile: string;
|
||||
before(() => {
|
||||
abiFile = tmp.fileSync(
|
||||
{ discardDescriptor: true }, // close file (set timestamp)
|
||||
).name;
|
||||
});
|
||||
|
||||
describe('without an existing output file', () => {
|
||||
it('should return false', () => {
|
||||
expect(utils.isOutputFileUpToDate(abiFile, 'nonexistant_file')).to.be.false();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with an existing output file', () => {
|
||||
let outputFile: string;
|
||||
before(() => {
|
||||
outputFile = tmp.fileSync(
|
||||
{ discardDescriptor: true }, // close file (set timestamp)
|
||||
).name;
|
||||
const abiFileModTimeMs = fs.statSync(abiFile).mtimeMs;
|
||||
const outfileModTimeMs = abiFileModTimeMs + 1;
|
||||
fs.utimesSync(outputFile, outfileModTimeMs, outfileModTimeMs);
|
||||
});
|
||||
|
||||
it('should return true when output file is newer than abi file', async () => {
|
||||
expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.true();
|
||||
});
|
||||
|
||||
it('should return false when output file exists but is older than abi file', () => {
|
||||
const outFileModTimeMs = fs.statSync(outputFile).mtimeMs;
|
||||
const abiFileModTimeMs = outFileModTimeMs + 1;
|
||||
fs.utimesSync(abiFile, abiFileModTimeMs, abiFileModTimeMs);
|
||||
|
||||
expect(utils.isOutputFileUpToDate(abiFile, outputFile)).to.be.false();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,6 +1,52 @@
|
||||
[
|
||||
{
|
||||
"version": "0.2.13",
|
||||
"timestamp": 1534210131,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532619515,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532614997,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532605697,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532357734,
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note":
|
||||
@@ -9,6 +55,24 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.2.14",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531149657,
|
||||
"version": "0.2.13",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1529397769,
|
||||
"version": "0.2.12",
|
||||
|
@@ -1,15 +1,47 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.1 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 19, 2018_
|
||||
|
||||
* Fix bug in string enum assertion. We erroneously were checking against the enum keys, not values (#821)
|
||||
|
||||
## v0.2.14 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.13 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.12 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.11 - _June 1, 2018_
|
||||
## v0.2.11 - _May 31, 2018_
|
||||
|
||||
* Incorrect publish that was unpublished
|
||||
|
||||
@@ -17,7 +49,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.2.9 - _May 5, 2018_
|
||||
## v0.2.9 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/assert",
|
||||
"version": "0.3.0",
|
||||
"version": "1.0.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -13,7 +13,6 @@
|
||||
"clean": "shx rm -rf lib test_temp scripts",
|
||||
"lint": "tslint --project .",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit",
|
||||
"prepublishOnly": "run-p build",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s clean build test",
|
||||
"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
|
||||
@@ -31,8 +30,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
|
||||
"devDependencies": {
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/valid-url": "^1.0.2",
|
||||
@@ -40,18 +39,18 @@
|
||||
"copyfiles": "^1.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"nyc": "^11.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"typescript": "2.7.1"
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "2.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/json-schemas": "^1.0.0",
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"lodash": "^4.17.4",
|
||||
"@0xproject/json-schemas": "^1.0.1-rc.3",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"lodash": "^4.17.5",
|
||||
"valid-url": "^1.0.9"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -8,33 +8,33 @@ const HEX_REGEX = /^0x[0-9A-F]*$/i;
|
||||
export const assert = {
|
||||
isBigNumber(variableName: string, value: BigNumber): void {
|
||||
const isBigNumber = _.isObject(value) && (value as any).isBigNumber;
|
||||
this.assert(isBigNumber, this.typeAssertionMessage(variableName, 'BigNumber', value));
|
||||
assert.assert(isBigNumber, assert.typeAssertionMessage(variableName, 'BigNumber', value));
|
||||
},
|
||||
isValidBaseUnitAmount(variableName: string, value: BigNumber): void {
|
||||
assert.isBigNumber(variableName, value);
|
||||
const isNegative = value.lessThan(0);
|
||||
this.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
|
||||
assert.assert(!isNegative, `${variableName} cannot be a negative number, found value: ${value.toNumber()}`);
|
||||
const hasDecimals = value.decimalPlaces() !== 0;
|
||||
this.assert(
|
||||
assert.assert(
|
||||
!hasDecimals,
|
||||
`${variableName} should be in baseUnits (no decimals), found value: ${value.toNumber()}`,
|
||||
);
|
||||
},
|
||||
isString(variableName: string, value: string): void {
|
||||
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
|
||||
assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
|
||||
},
|
||||
isFunction(variableName: string, value: any): void {
|
||||
this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value));
|
||||
assert.assert(_.isFunction(value), assert.typeAssertionMessage(variableName, 'function', value));
|
||||
},
|
||||
isHexString(variableName: string, value: string): void {
|
||||
this.assert(
|
||||
assert.assert(
|
||||
_.isString(value) && HEX_REGEX.test(value),
|
||||
this.typeAssertionMessage(variableName, 'HexString', value),
|
||||
assert.typeAssertionMessage(variableName, 'HexString', value),
|
||||
);
|
||||
},
|
||||
isETHAddressHex(variableName: string, value: string): void {
|
||||
this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value));
|
||||
this.assert(addressUtils.isAddress(value), this.typeAssertionMessage(variableName, 'ETHAddressHex', value));
|
||||
assert.assert(_.isString(value), assert.typeAssertionMessage(variableName, 'string', value));
|
||||
assert.assert(addressUtils.isAddress(value), assert.typeAssertionMessage(variableName, 'ETHAddressHex', value));
|
||||
},
|
||||
doesBelongToStringEnum(
|
||||
variableName: string,
|
||||
@@ -51,17 +51,17 @@ export const assert = {
|
||||
);
|
||||
},
|
||||
hasAtMostOneUniqueValue(value: any[], errMsg: string): void {
|
||||
this.assert(_.uniq(value).length <= 1, errMsg);
|
||||
assert.assert(_.uniq(value).length <= 1, errMsg);
|
||||
},
|
||||
isNumber(variableName: string, value: number): void {
|
||||
this.assert(_.isFinite(value), this.typeAssertionMessage(variableName, 'number', value));
|
||||
assert.assert(_.isFinite(value), assert.typeAssertionMessage(variableName, 'number', value));
|
||||
},
|
||||
isBoolean(variableName: string, value: boolean): void {
|
||||
this.assert(_.isBoolean(value), this.typeAssertionMessage(variableName, 'boolean', value));
|
||||
assert.assert(_.isBoolean(value), assert.typeAssertionMessage(variableName, 'boolean', value));
|
||||
},
|
||||
isWeb3Provider(variableName: string, value: any): void {
|
||||
const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
|
||||
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Provider', value));
|
||||
assert.assert(isWeb3Provider, assert.typeAssertionMessage(variableName, 'Provider', value));
|
||||
},
|
||||
doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
|
||||
if (_.isUndefined(value)) {
|
||||
@@ -76,15 +76,15 @@ export const assert = {
|
||||
const msg = `Expected ${variableName} to conform to schema ${schema.id}
|
||||
Encountered: ${JSON.stringify(value, null, '\t')}
|
||||
Validation errors: ${validationResult.errors.join(', ')}`;
|
||||
this.assert(!hasValidationErrors, msg);
|
||||
assert.assert(!hasValidationErrors, msg);
|
||||
},
|
||||
isWebUri(variableName: string, value: any): void {
|
||||
const isValidUrl = !_.isUndefined(validUrl.isWebUri(value));
|
||||
this.assert(isValidUrl, this.typeAssertionMessage(variableName, 'web uri', value));
|
||||
assert.assert(isValidUrl, assert.typeAssertionMessage(variableName, 'web uri', value));
|
||||
},
|
||||
isUri(variableName: string, value: any): void {
|
||||
const isValidUri = !_.isUndefined(validUrl.isUri(value));
|
||||
this.assert(isValidUri, this.typeAssertionMessage(variableName, 'uri', value));
|
||||
assert.assert(isValidUri, assert.typeAssertionMessage(variableName, 'uri', value));
|
||||
},
|
||||
assert(condition: boolean, message: string): void {
|
||||
if (!condition) {
|
||||
|
@@ -49,7 +49,7 @@ describe('Assertions', () => {
|
||||
});
|
||||
describe('#isFunction', () => {
|
||||
it('should not throw for valid input', () => {
|
||||
const validInputs = [BigNumber, assert.isString];
|
||||
const validInputs = [BigNumber, assert.isString.bind(assert)];
|
||||
validInputs.forEach(input => expect(assert.isFunction.bind(assert, variableName, input)).to.not.throw());
|
||||
});
|
||||
it('should throw for invalid input', () => {
|
||||
|
@@ -1,4 +1,77 @@
|
||||
[
|
||||
{
|
||||
"version": "2.0.0-rc.1",
|
||||
"changes": [
|
||||
{
|
||||
"pr": 915,
|
||||
"note": "Added strict encoding/decoding checks for sendTransaction and call"
|
||||
}
|
||||
],
|
||||
"timestamp": 1534210131
|
||||
},
|
||||
{
|
||||
"timestamp": 1532619515,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532614997,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532605697,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532357734,
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.3.6",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531149657,
|
||||
"version": "0.3.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.4",
|
||||
"changes": [
|
||||
|
@@ -1,15 +1,47 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.0.0-rc.1 - _August 13, 2018_
|
||||
|
||||
* Added strict encoding/decoding checks for sendTransaction and call (#915)
|
||||
|
||||
## v1.0.4 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.1 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.6 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.5 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.4 - _June 19, 2018_
|
||||
|
||||
* Update EthersJs to fix the `value.toLowerCase()` is not a function bug caused by `ethers.js` breaking patch version https://github.com/ethers-io/ethers.js/issues/201
|
||||
|
||||
## v0.3.3 - _June 1, 2018_
|
||||
## v0.3.3 - _May 31, 2018_
|
||||
|
||||
* Incorrect publish that was unpublished
|
||||
|
||||
@@ -17,7 +49,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.3.1 - _May 5, 2018_
|
||||
## v0.3.1 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/base-contract",
|
||||
"version": "0.3.4",
|
||||
"version": "1.0.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -9,7 +9,7 @@
|
||||
"types": "lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"watch_without_deps": "tsc -w",
|
||||
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
|
||||
"build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
|
||||
"clean": "shx rm -rf lib scripts",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s clean build test",
|
||||
@@ -30,25 +30,25 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
|
||||
"devDependencies": {
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/lodash": "4.14.104",
|
||||
"chai": "^4.0.1",
|
||||
"copyfiles": "^1.2.0",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"typescript": "2.7.1"
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "2.9.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"ethereum-types": "^0.0.2",
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"@0xproject/web3-wrapper": "^0.7.1",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"@0xproject/web3-wrapper": "^1.1.2",
|
||||
"ethereum-types": "^1.0.3",
|
||||
"ethers": "3.0.22",
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -72,18 +72,37 @@ export class BaseContract {
|
||||
// 1. Optional param passed in to public method call
|
||||
// 2. Global config passed in at library instantiation
|
||||
// 3. Gas estimate calculation + safety margin
|
||||
const removeUndefinedProperties = _.pickBy;
|
||||
const txDataWithDefaults: TxData = {
|
||||
const removeUndefinedProperties = _.pickBy.bind(_);
|
||||
const txDataWithDefaults = {
|
||||
...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;
|
||||
...removeUndefinedProperties(txData),
|
||||
};
|
||||
if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
|
||||
txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults as any);
|
||||
txDataWithDefaults.gas = await estimateGasAsync(txDataWithDefaults);
|
||||
}
|
||||
return txDataWithDefaults;
|
||||
}
|
||||
// Throws if the given arguments cannot be safely/correctly encoded based on
|
||||
// the given inputAbi. An argument may not be considered safely encodeable
|
||||
// if it overflows the corresponding Solidity type, there is a bug in the
|
||||
// encoder, or the encoder performs unsafe type coercion.
|
||||
public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
|
||||
const coder = ethers.utils.AbiCoder.defaultCoder;
|
||||
const params = abiUtils.parseEthersParams(inputAbi);
|
||||
const rawEncoded = coder.encode(params.names, params.types, args);
|
||||
const rawDecoded = coder.decode(params.names, params.types, rawEncoded);
|
||||
for (let i = 0; i < rawDecoded.length; i++) {
|
||||
const original = args[i];
|
||||
const decoded = rawDecoded[i];
|
||||
if (!abiUtils.isAbiDataEqual(params.names[i], params.types[i], original, decoded)) {
|
||||
throw new Error(
|
||||
`Cannot safely encode argument: ${params.names[i]} (${original}) of type ${
|
||||
params.types[i]
|
||||
}. (Possible type overflow or other encoding error)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected _lookupEthersInterface(functionSignature: string): ethers.Interface {
|
||||
const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature];
|
||||
if (_.isUndefined(ethersInterface)) {
|
||||
|
114
packages/base-contract/test/base_contract_test.ts
Normal file
114
packages/base-contract/test/base_contract_test.ts
Normal file
@@ -0,0 +1,114 @@
|
||||
import * as chai from 'chai';
|
||||
import 'mocha';
|
||||
|
||||
import { BaseContract } from '../src';
|
||||
|
||||
const { expect } = chai;
|
||||
|
||||
describe('BaseContract', () => {
|
||||
describe('strictArgumentEncodingCheck', () => {
|
||||
it('works for simple types', () => {
|
||||
BaseContract.strictArgumentEncodingCheck(
|
||||
[{ name: 'to', type: 'address' }],
|
||||
['0xe834ec434daba538cd1b9fe1582052b880bd7e63'],
|
||||
);
|
||||
});
|
||||
it('works for array types', () => {
|
||||
const inputAbi = [
|
||||
{
|
||||
name: 'takerAssetFillAmounts',
|
||||
type: 'uint256[]',
|
||||
},
|
||||
];
|
||||
const args = [
|
||||
['9000000000000000000', '79000000000000000000', '979000000000000000000', '7979000000000000000000'],
|
||||
];
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, args);
|
||||
});
|
||||
it('works for tuple/struct types', () => {
|
||||
const inputAbi = [
|
||||
{
|
||||
components: [
|
||||
{
|
||||
name: 'makerAddress',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'takerAddress',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'feeRecipientAddress',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'senderAddress',
|
||||
type: 'address',
|
||||
},
|
||||
{
|
||||
name: 'makerAssetAmount',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'takerAssetAmount',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'makerFee',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'takerFee',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'expirationTimeSeconds',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'salt',
|
||||
type: 'uint256',
|
||||
},
|
||||
{
|
||||
name: 'makerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
{
|
||||
name: 'takerAssetData',
|
||||
type: 'bytes',
|
||||
},
|
||||
],
|
||||
name: 'order',
|
||||
type: 'tuple',
|
||||
},
|
||||
];
|
||||
const args = [
|
||||
{
|
||||
makerAddress: '0x6ecbe1db9ef729cbe972c83fb886247691fb6beb',
|
||||
takerAddress: '0x0000000000000000000000000000000000000000',
|
||||
feeRecipientAddress: '0xe834ec434daba538cd1b9fe1582052b880bd7e63',
|
||||
senderAddress: '0x0000000000000000000000000000000000000000',
|
||||
makerAssetAmount: '0',
|
||||
takerAssetAmount: '200000000000000000000',
|
||||
makerFee: '1000000000000000000',
|
||||
takerFee: '1000000000000000000',
|
||||
expirationTimeSeconds: '1532563026',
|
||||
salt: '59342956082154660870994022243365949771115859664887449740907298019908621891376',
|
||||
makerAssetData: '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48',
|
||||
takerAssetData: '0xf47261b00000000000000000000000001d7022f5b17d2f8b695918fb48fa1089c9f85401',
|
||||
},
|
||||
];
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, args);
|
||||
});
|
||||
it('throws for integer overflows', () => {
|
||||
expect(() =>
|
||||
BaseContract.strictArgumentEncodingCheck([{ name: 'amount', type: 'uint8' }], ['256']),
|
||||
).to.throw();
|
||||
});
|
||||
it('throws for fixed byte array overflows', () => {
|
||||
expect(() =>
|
||||
BaseContract.strictArgumentEncodingCheck([{ name: 'hash', type: 'bytes8' }], ['0x001122334455667788']),
|
||||
).to.throw();
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,4 +1,77 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1534210131,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532619515,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532614997,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532605697,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532357734,
|
||||
"version": "1.0.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note":
|
||||
"Remove `WebSocketOrderbookChannel` from the public interface and replace with `orderbookChannelFactory`"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.6.17",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531149657,
|
||||
"version": "0.6.16",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1529397769,
|
||||
"version": "0.6.15",
|
||||
|
@@ -1,10 +1,42 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.5 - _August 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.1 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 19, 2018_
|
||||
|
||||
* Remove `WebSocketOrderbookChannel` from the public interface and replace with `orderbookChannelFactory`
|
||||
|
||||
## v0.6.17 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.6.16 - _July 9, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.6.15 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -17,7 +49,7 @@ CHANGELOG
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.6.12 - _May 5, 2018_
|
||||
## v0.6.12 - _May 4, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/connect",
|
||||
"version": "0.6.15",
|
||||
"version": "1.0.4",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -51,24 +51,25 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^0.2.12",
|
||||
"@0xproject/json-schemas": "0.8.1",
|
||||
"@0xproject/types": "^0.8.1",
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"lodash": "^4.17.4",
|
||||
"@0xproject/assert": "^0.2.14",
|
||||
"@0xproject/json-schemas": "^0.8.3",
|
||||
"@0xproject/types": "^0.8.2",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"lodash": "^4.17.5",
|
||||
"query-string": "^5.0.1",
|
||||
"sinon": "^4.0.0",
|
||||
"websocket": "^1.0.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@types/fetch-mock": "^5.12.1",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/fetch-mock": "^5.12.2",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/query-string": "^5.0.1",
|
||||
"@types/websocket": "^0.0.34",
|
||||
"@types/sinon": "^2.2.2",
|
||||
"@types/websocket": "^0.0.39",
|
||||
"async-child-process": "^1.1.1",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
@@ -76,13 +77,13 @@
|
||||
"dirty-chai": "^2.0.1",
|
||||
"fetch-mock": "^5.13.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"nyc": "^11.0.1",
|
||||
"shx": "^0.2.2",
|
||||
"tslint": "5.8.0",
|
||||
"tslint": "5.11.0",
|
||||
"typedoc": "~0.8.0",
|
||||
"typescript": "2.7.1"
|
||||
"typescript": "2.9.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import 'isomorphic-fetch';
|
||||
import { fetchAsync } from '@0xproject/utils';
|
||||
import * as _ from 'lodash';
|
||||
import * as queryString from 'query-string';
|
||||
|
||||
@@ -38,7 +38,7 @@ const OPTS_TO_QUERY_FIELD_MAP = {
|
||||
* that implement the standard relayer API v0
|
||||
*/
|
||||
export class HttpClient implements Client {
|
||||
private _apiEndpointUrl: string;
|
||||
private readonly _apiEndpointUrl: string;
|
||||
/**
|
||||
* Format parameters to be appended to http requests into query string form
|
||||
*/
|
||||
@@ -167,7 +167,7 @@ export class HttpClient implements Client {
|
||||
const headers = new Headers({
|
||||
'content-type': 'application/json',
|
||||
});
|
||||
const response = await fetch(url, {
|
||||
const response = await fetchAsync(url, {
|
||||
method: requestType,
|
||||
body: JSON.stringify(payload),
|
||||
headers,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
export { HttpClient } from './http_client';
|
||||
export { WebSocketOrderbookChannel } from './ws_orderbook_channel';
|
||||
export { orderbookChannelFactory } from './orderbook_channel_factory';
|
||||
export {
|
||||
Client,
|
||||
FeesRequest,
|
||||
@@ -14,7 +14,6 @@ export {
|
||||
TokenPairsItem,
|
||||
TokenPairsRequestOpts,
|
||||
TokenTradeInfo,
|
||||
WebSocketOrderbookChannelConfig,
|
||||
} from './types';
|
||||
|
||||
export { Order, SignedOrder } from '@0xproject/types';
|
||||
|
32
packages/connect/src/orderbook_channel_factory.ts
Normal file
32
packages/connect/src/orderbook_channel_factory.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import * as WebSocket from 'websocket';
|
||||
|
||||
import { OrderbookChannel, OrderbookChannelHandler } from './types';
|
||||
import { assert } from './utils/assert';
|
||||
import { WebSocketOrderbookChannel } from './ws_orderbook_channel';
|
||||
|
||||
export const orderbookChannelFactory = {
|
||||
/**
|
||||
* Instantiates a new WebSocketOrderbookChannel instance
|
||||
* @param url The relayer API base WS url you would like to interact with
|
||||
* @param handler An OrderbookChannelHandler instance that responds to various
|
||||
* channel updates
|
||||
* @return An OrderbookChannel Promise
|
||||
*/
|
||||
async createWebSocketOrderbookChannelAsync(
|
||||
url: string,
|
||||
handler: OrderbookChannelHandler,
|
||||
): Promise<OrderbookChannel> {
|
||||
assert.isUri('url', url);
|
||||
assert.isOrderbookChannelHandler('handler', handler);
|
||||
return new Promise<OrderbookChannel>((resolve, reject) => {
|
||||
const client = new WebSocket.w3cwebsocket(url);
|
||||
client.onopen = () => {
|
||||
const orderbookChannel = new WebSocketOrderbookChannel(client, handler);
|
||||
resolve(orderbookChannel);
|
||||
};
|
||||
client.onerror = err => {
|
||||
reject(err);
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
@@ -3,7 +3,6 @@ import { orderBookRequestSchema } from './orderbook_request_schema';
|
||||
import { ordersRequestOptsSchema } from './orders_request_opts_schema';
|
||||
import { pagedRequestOptsSchema } from './paged_request_opts_schema';
|
||||
import { tokenPairsRequestOptsSchema } from './token_pairs_request_opts_schema';
|
||||
import { webSocketOrderbookChannelConfigSchema } from './websocket_orderbook_channel_config_schema';
|
||||
|
||||
export const schemas = {
|
||||
feesRequestSchema,
|
||||
@@ -11,5 +10,4 @@ export const schemas = {
|
||||
ordersRequestOptsSchema,
|
||||
pagedRequestOptsSchema,
|
||||
tokenPairsRequestOptsSchema,
|
||||
webSocketOrderbookChannelConfigSchema,
|
||||
};
|
||||
|
@@ -1,10 +0,0 @@
|
||||
export const webSocketOrderbookChannelConfigSchema = {
|
||||
id: '/WebSocketOrderbookChannelConfig',
|
||||
type: 'object',
|
||||
properties: {
|
||||
heartbeatIntervalMs: {
|
||||
type: 'number',
|
||||
minimum: 10,
|
||||
},
|
||||
},
|
||||
};
|
@@ -11,17 +11,10 @@ export interface Client {
|
||||
}
|
||||
|
||||
export interface OrderbookChannel {
|
||||
subscribe: (subscriptionOpts: OrderbookChannelSubscriptionOpts, handler: OrderbookChannelHandler) => void;
|
||||
subscribe: (subscriptionOpts: OrderbookChannelSubscriptionOpts) => void;
|
||||
close: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* heartbeatInterval: Interval in milliseconds that the orderbook channel should ping the underlying websocket. Default: 15000
|
||||
*/
|
||||
export interface WebSocketOrderbookChannelConfig {
|
||||
heartbeatIntervalMs?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* baseTokenAddress: The address of token designated as the baseToken in the currency pair calculation of price
|
||||
* quoteTokenAddress: The address of token designated as the quoteToken in the currency pair calculation of price
|
||||
@@ -46,8 +39,8 @@ export interface OrderbookChannelHandler {
|
||||
subscriptionOpts: OrderbookChannelSubscriptionOpts,
|
||||
order: SignedOrder,
|
||||
) => void;
|
||||
onError: (channel: OrderbookChannel, subscriptionOpts: OrderbookChannelSubscriptionOpts, err: Error) => void;
|
||||
onClose: (channel: OrderbookChannel, subscriptionOpts: OrderbookChannelSubscriptionOpts) => void;
|
||||
onError: (channel: OrderbookChannel, err: Error, subscriptionOpts?: OrderbookChannelSubscriptionOpts) => void;
|
||||
onClose: (channel: OrderbookChannel) => void;
|
||||
}
|
||||
|
||||
export type OrderbookChannelMessage =
|
||||
|
26
packages/connect/src/utils/assert.ts
Normal file
26
packages/connect/src/utils/assert.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { assert as sharedAssert } from '@0xproject/assert';
|
||||
// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { Schema, schemas } from '@0xproject/json-schemas';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { ECSignature } from '@0xproject/types';
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
export const assert = {
|
||||
...sharedAssert,
|
||||
isOrderbookChannelSubscriptionOpts(variableName: string, subscriptionOpts: any): void {
|
||||
sharedAssert.doesConformToSchema(
|
||||
variableName,
|
||||
subscriptionOpts,
|
||||
schemas.relayerApiOrderbookChannelSubscribePayload,
|
||||
);
|
||||
},
|
||||
isOrderbookChannelHandler(variableName: string, handler: any): void {
|
||||
sharedAssert.isFunction(`${variableName}.onSnapshot`, _.get(handler, 'onSnapshot'));
|
||||
sharedAssert.isFunction(`${variableName}.onUpdate`, _.get(handler, 'onUpdate'));
|
||||
sharedAssert.isFunction(`${variableName}.onError`, _.get(handler, 'onError'));
|
||||
sharedAssert.isFunction(`${variableName}.onClose`, _.get(handler, 'onClose'));
|
||||
},
|
||||
};
|
@@ -8,10 +8,16 @@ import { relayerResponseJsonParsers } from './relayer_response_json_parsers';
|
||||
|
||||
export const orderbookChannelMessageParser = {
|
||||
parse(utf8Data: string): OrderbookChannelMessage {
|
||||
// parse the message
|
||||
const messageObj = JSON.parse(utf8Data);
|
||||
// ensure we have a type parameter to switch on
|
||||
const type: string = _.get(messageObj, 'type');
|
||||
assert.assert(!_.isUndefined(type), `Message is missing a type parameter: ${utf8Data}`);
|
||||
assert.isString('type', type);
|
||||
// ensure we have a request id for the resulting message
|
||||
const requestId: number = _.get(messageObj, 'requestId');
|
||||
assert.assert(!_.isUndefined(requestId), `Message is missing a requestId parameter: ${utf8Data}`);
|
||||
assert.isNumber('requestId', requestId);
|
||||
switch (type) {
|
||||
case OrderbookChannelMessageTypes.Snapshot: {
|
||||
assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelSnapshotSchema);
|
||||
@@ -28,7 +34,7 @@ export const orderbookChannelMessageParser = {
|
||||
default: {
|
||||
return {
|
||||
type: OrderbookChannelMessageTypes.Unknown,
|
||||
requestId: 0,
|
||||
requestId,
|
||||
payload: undefined,
|
||||
};
|
||||
}
|
||||
|
@@ -6,12 +6,12 @@ export const typeConverters = {
|
||||
const bids = _.get(orderbook, 'bids', []);
|
||||
const asks = _.get(orderbook, 'asks', []);
|
||||
return {
|
||||
bids: bids.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
|
||||
asks: asks.map((order: any) => this.convertOrderStringFieldsToBigNumber(order)),
|
||||
bids: bids.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
|
||||
asks: asks.map((order: any) => typeConverters.convertOrderStringFieldsToBigNumber(order)),
|
||||
};
|
||||
},
|
||||
convertOrderStringFieldsToBigNumber(order: any): any {
|
||||
return this.convertStringsFieldsToBigNumbers(order, [
|
||||
return typeConverters.convertStringsFieldsToBigNumbers(order, [
|
||||
'makerTokenAmount',
|
||||
'takerTokenAmount',
|
||||
'makerFee',
|
||||
|
@@ -1,166 +1,105 @@
|
||||
import { assert } from '@0xproject/assert';
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import * as _ from 'lodash';
|
||||
import * as WebSocket from 'websocket';
|
||||
|
||||
import { schemas as clientSchemas } from './schemas/schemas';
|
||||
import {
|
||||
OrderbookChannel,
|
||||
OrderbookChannelHandler,
|
||||
OrderbookChannelMessageTypes,
|
||||
OrderbookChannelSubscriptionOpts,
|
||||
WebsocketClientEventType,
|
||||
WebsocketConnectionEventType,
|
||||
WebSocketOrderbookChannelConfig,
|
||||
} from './types';
|
||||
import { assert } from './utils/assert';
|
||||
import { orderbookChannelMessageParser } from './utils/orderbook_channel_message_parser';
|
||||
|
||||
const DEFAULT_HEARTBEAT_INTERVAL_MS = 15000;
|
||||
const MINIMUM_HEARTBEAT_INTERVAL_MS = 10;
|
||||
|
||||
/**
|
||||
* This class includes all the functionality related to interacting with a websocket endpoint
|
||||
* that implements the standard relayer API v0
|
||||
*/
|
||||
export class WebSocketOrderbookChannel implements OrderbookChannel {
|
||||
private _apiEndpointUrl: string;
|
||||
private _client: WebSocket.client;
|
||||
private _connectionIfExists?: WebSocket.connection;
|
||||
private _heartbeatTimerIfExists?: NodeJS.Timer;
|
||||
private _subscriptionCounter = 0;
|
||||
private _heartbeatIntervalMs: number;
|
||||
private readonly _client: WebSocket.w3cwebsocket;
|
||||
private readonly _handler: OrderbookChannelHandler;
|
||||
private readonly _subscriptionOptsList: OrderbookChannelSubscriptionOpts[] = [];
|
||||
/**
|
||||
* Instantiates a new WebSocketOrderbookChannel instance
|
||||
* @param url The relayer API base WS url you would like to interact with
|
||||
* @param config The configuration object. Look up the type for the description.
|
||||
* @param client A WebSocket client
|
||||
* @param handler An OrderbookChannelHandler instance that responds to various
|
||||
* channel updates
|
||||
* @return An instance of WebSocketOrderbookChannel
|
||||
*/
|
||||
constructor(url: string, config?: WebSocketOrderbookChannelConfig) {
|
||||
assert.isUri('url', url);
|
||||
if (!_.isUndefined(config)) {
|
||||
assert.doesConformToSchema('config', config, clientSchemas.webSocketOrderbookChannelConfigSchema);
|
||||
}
|
||||
this._apiEndpointUrl = url;
|
||||
this._heartbeatIntervalMs =
|
||||
_.isUndefined(config) || _.isUndefined(config.heartbeatIntervalMs)
|
||||
? DEFAULT_HEARTBEAT_INTERVAL_MS
|
||||
: config.heartbeatIntervalMs;
|
||||
this._client = new WebSocket.client();
|
||||
constructor(client: WebSocket.w3cwebsocket, handler: OrderbookChannelHandler) {
|
||||
assert.isOrderbookChannelHandler('handler', handler);
|
||||
// set private members
|
||||
this._client = client;
|
||||
this._handler = handler;
|
||||
// attach client callbacks
|
||||
this._client.onerror = err => {
|
||||
this._handler.onError(this, err);
|
||||
};
|
||||
this._client.onclose = () => {
|
||||
this._handler.onClose(this);
|
||||
};
|
||||
this._client.onmessage = message => {
|
||||
this._handleWebSocketMessage(message);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Subscribe to orderbook snapshots and updates from the websocket
|
||||
* @param subscriptionOpts An OrderbookChannelSubscriptionOpts instance describing which
|
||||
* token pair to subscribe to
|
||||
* @param handler An OrderbookChannelHandler instance that responds to various
|
||||
* channel updates
|
||||
*/
|
||||
public subscribe(subscriptionOpts: OrderbookChannelSubscriptionOpts, handler: OrderbookChannelHandler): void {
|
||||
assert.doesConformToSchema(
|
||||
'subscriptionOpts',
|
||||
subscriptionOpts,
|
||||
schemas.relayerApiOrderbookChannelSubscribePayload,
|
||||
);
|
||||
assert.isFunction('handler.onSnapshot', _.get(handler, 'onSnapshot'));
|
||||
assert.isFunction('handler.onUpdate', _.get(handler, 'onUpdate'));
|
||||
assert.isFunction('handler.onError', _.get(handler, 'onError'));
|
||||
assert.isFunction('handler.onClose', _.get(handler, 'onClose'));
|
||||
this._subscriptionCounter += 1;
|
||||
public subscribe(subscriptionOpts: OrderbookChannelSubscriptionOpts): void {
|
||||
assert.isOrderbookChannelSubscriptionOpts('subscriptionOpts', subscriptionOpts);
|
||||
assert.assert(this._client.readyState === WebSocket.w3cwebsocket.OPEN, 'WebSocket connection is closed');
|
||||
this._subscriptionOptsList.push(subscriptionOpts);
|
||||
// TODO: update requestId management to use UUIDs for v2
|
||||
const subscribeMessage = {
|
||||
type: 'subscribe',
|
||||
channel: 'orderbook',
|
||||
requestId: this._subscriptionCounter,
|
||||
requestId: this._subscriptionOptsList.length - 1,
|
||||
payload: subscriptionOpts,
|
||||
};
|
||||
this._getConnection((error, connection) => {
|
||||
if (!_.isUndefined(error)) {
|
||||
handler.onError(this, subscriptionOpts, error);
|
||||
} else if (!_.isUndefined(connection) && connection.connected) {
|
||||
connection.on(WebsocketConnectionEventType.Error, wsError => {
|
||||
handler.onError(this, subscriptionOpts, wsError);
|
||||
});
|
||||
connection.on(WebsocketConnectionEventType.Close, (_code: number, _desc: string) => {
|
||||
handler.onClose(this, subscriptionOpts);
|
||||
});
|
||||
connection.on(WebsocketConnectionEventType.Message, message => {
|
||||
this._handleWebSocketMessage(subscribeMessage.requestId, subscriptionOpts, message, handler);
|
||||
});
|
||||
connection.sendUTF(JSON.stringify(subscribeMessage));
|
||||
}
|
||||
});
|
||||
this._client.send(JSON.stringify(subscribeMessage));
|
||||
}
|
||||
/**
|
||||
* Close the websocket and stop receiving updates
|
||||
*/
|
||||
public close(): void {
|
||||
if (!_.isUndefined(this._connectionIfExists)) {
|
||||
this._connectionIfExists.close();
|
||||
}
|
||||
if (!_.isUndefined(this._heartbeatTimerIfExists)) {
|
||||
clearInterval(this._heartbeatTimerIfExists);
|
||||
}
|
||||
this._client.close();
|
||||
}
|
||||
private _getConnection(callback: (error?: Error, connection?: WebSocket.connection) => void): void {
|
||||
if (!_.isUndefined(this._connectionIfExists) && this._connectionIfExists.connected) {
|
||||
callback(undefined, this._connectionIfExists);
|
||||
} else {
|
||||
this._client.on(WebsocketClientEventType.Connect, connection => {
|
||||
this._connectionIfExists = connection;
|
||||
if (this._heartbeatIntervalMs >= MINIMUM_HEARTBEAT_INTERVAL_MS) {
|
||||
this._heartbeatTimerIfExists = setInterval(() => {
|
||||
connection.ping('');
|
||||
}, this._heartbeatIntervalMs);
|
||||
} else {
|
||||
callback(
|
||||
new Error(
|
||||
`Heartbeat interval is ${
|
||||
this._heartbeatIntervalMs
|
||||
}ms which is less than the required minimum of ${MINIMUM_HEARTBEAT_INTERVAL_MS}ms`,
|
||||
),
|
||||
undefined,
|
||||
private _handleWebSocketMessage(message: any): void {
|
||||
if (_.isUndefined(message.data)) {
|
||||
this._handler.onError(this, new Error(`Message does not contain data. Url: ${this._client.url}`));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const data = message.data;
|
||||
const parserResult = orderbookChannelMessageParser.parse(data);
|
||||
const subscriptionOpts = this._subscriptionOptsList[parserResult.requestId];
|
||||
if (_.isUndefined(subscriptionOpts)) {
|
||||
this._handler.onError(
|
||||
this,
|
||||
new Error(`Message has unknown requestId. Url: ${this._client.url} Message: ${data}`),
|
||||
);
|
||||
return;
|
||||
}
|
||||
switch (parserResult.type) {
|
||||
case OrderbookChannelMessageTypes.Snapshot: {
|
||||
this._handler.onSnapshot(this, subscriptionOpts, parserResult.payload);
|
||||
break;
|
||||
}
|
||||
case OrderbookChannelMessageTypes.Update: {
|
||||
this._handler.onUpdate(this, subscriptionOpts, parserResult.payload);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
this._handler.onError(
|
||||
this,
|
||||
new Error(`Message has unknown type parameter. Url: ${this._client.url} Message: ${data}`),
|
||||
subscriptionOpts,
|
||||
);
|
||||
}
|
||||
callback(undefined, this._connectionIfExists);
|
||||
});
|
||||
this._client.on(WebsocketClientEventType.ConnectFailed, error => {
|
||||
callback(error, undefined);
|
||||
});
|
||||
this._client.connect(this._apiEndpointUrl);
|
||||
}
|
||||
}
|
||||
private _handleWebSocketMessage(
|
||||
requestId: number,
|
||||
subscriptionOpts: OrderbookChannelSubscriptionOpts,
|
||||
message: WebSocket.IMessage,
|
||||
handler: OrderbookChannelHandler,
|
||||
): void {
|
||||
if (!_.isUndefined(message.utf8Data)) {
|
||||
try {
|
||||
const utf8Data = message.utf8Data;
|
||||
const parserResult = orderbookChannelMessageParser.parse(utf8Data);
|
||||
if (parserResult.requestId === requestId) {
|
||||
switch (parserResult.type) {
|
||||
case OrderbookChannelMessageTypes.Snapshot: {
|
||||
handler.onSnapshot(this, subscriptionOpts, parserResult.payload);
|
||||
break;
|
||||
}
|
||||
case OrderbookChannelMessageTypes.Update: {
|
||||
handler.onUpdate(this, subscriptionOpts, parserResult.payload);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
handler.onError(
|
||||
this,
|
||||
subscriptionOpts,
|
||||
new Error(`Message has missing a type parameter: ${utf8Data}`),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
handler.onError(this, subscriptionOpts, error);
|
||||
}
|
||||
} else {
|
||||
handler.onError(this, subscriptionOpts, new Error(`Message does not contain utf8Data`));
|
||||
} catch (error) {
|
||||
this._handler.onError(this, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
45
packages/connect/test/orderbook_channel_factory_test.ts
Normal file
45
packages/connect/test/orderbook_channel_factory_test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
|
||||
import { orderbookChannelFactory } from '../src/orderbook_channel_factory';
|
||||
|
||||
chai.config.includeStack = true;
|
||||
chai.use(dirtyChai);
|
||||
const expect = chai.expect;
|
||||
const emptyOrderbookChannelHandler = {
|
||||
onSnapshot: () => {
|
||||
_.noop();
|
||||
},
|
||||
onUpdate: () => {
|
||||
_.noop();
|
||||
},
|
||||
onError: () => {
|
||||
_.noop();
|
||||
},
|
||||
onClose: () => {
|
||||
_.noop();
|
||||
},
|
||||
};
|
||||
|
||||
describe('orderbookChannelFactory', () => {
|
||||
const websocketUrl = 'ws://localhost:8080';
|
||||
describe('#createWebSocketOrderbookChannelAsync', () => {
|
||||
it('throws when input is not a url', () => {
|
||||
const badUrlInput = 54;
|
||||
expect(
|
||||
orderbookChannelFactory.createWebSocketOrderbookChannelAsync(
|
||||
badUrlInput as any,
|
||||
emptyOrderbookChannelHandler,
|
||||
),
|
||||
).to.be.rejected();
|
||||
});
|
||||
it('throws when handler has the incorrect members', () => {
|
||||
const badHandlerInput = {};
|
||||
expect(
|
||||
orderbookChannelFactory.createWebSocketOrderbookChannelAsync(websocketUrl, badHandlerInput as any),
|
||||
).to.be.rejected();
|
||||
});
|
||||
});
|
||||
});
|
@@ -2,60 +2,58 @@ import * as chai from 'chai';
|
||||
import * as dirtyChai from 'dirty-chai';
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
import * as Sinon from 'sinon';
|
||||
import * as WebSocket from 'websocket';
|
||||
|
||||
import { WebSocketOrderbookChannel } from '../src/ws_orderbook_channel';
|
||||
|
||||
chai.config.includeStack = true;
|
||||
chai.use(dirtyChai);
|
||||
const expect = chai.expect;
|
||||
const emptyOrderbookChannelHandler = {
|
||||
onSnapshot: () => {
|
||||
_.noop();
|
||||
},
|
||||
onUpdate: () => {
|
||||
_.noop();
|
||||
},
|
||||
onError: () => {
|
||||
_.noop();
|
||||
},
|
||||
onClose: () => {
|
||||
_.noop();
|
||||
},
|
||||
};
|
||||
|
||||
describe('WebSocketOrderbookChannel', () => {
|
||||
const websocketUrl = 'ws://localhost:8080';
|
||||
const orderbookChannel = new WebSocketOrderbookChannel(websocketUrl);
|
||||
const openClient = new WebSocket.w3cwebsocket(websocketUrl);
|
||||
Sinon.stub(openClient, 'readyState').get(() => WebSocket.w3cwebsocket.OPEN);
|
||||
Sinon.stub(openClient, 'send').callsFake(_.noop.bind(_));
|
||||
const openOrderbookChannel = new WebSocketOrderbookChannel(openClient, emptyOrderbookChannelHandler);
|
||||
const subscriptionOpts = {
|
||||
baseTokenAddress: '0x323b5d4c32345ced77393b3530b1eed0f346429d',
|
||||
quoteTokenAddress: '0xef7fff64389b814a946f3e92105513705ca6b990',
|
||||
snapshot: true,
|
||||
limit: 100,
|
||||
};
|
||||
const emptyOrderbookChannelHandler = {
|
||||
onSnapshot: () => {
|
||||
_.noop();
|
||||
},
|
||||
onUpdate: () => {
|
||||
_.noop();
|
||||
},
|
||||
onError: () => {
|
||||
_.noop();
|
||||
},
|
||||
onClose: () => {
|
||||
_.noop();
|
||||
},
|
||||
};
|
||||
describe('#subscribe', () => {
|
||||
it('throws when subscriptionOpts does not conform to schema', () => {
|
||||
const badSubscribeCall = orderbookChannel.subscribe.bind(
|
||||
orderbookChannel,
|
||||
{},
|
||||
emptyOrderbookChannelHandler,
|
||||
);
|
||||
const badSubscribeCall = openOrderbookChannel.subscribe.bind(openOrderbookChannel, {});
|
||||
expect(badSubscribeCall).throws(
|
||||
'Expected subscriptionOpts to conform to schema /RelayerApiOrderbookChannelSubscribePayload\nEncountered: {}\nValidation errors: instance requires property "baseTokenAddress", instance requires property "quoteTokenAddress"',
|
||||
);
|
||||
});
|
||||
it('throws when handler has the incorrect members', () => {
|
||||
const badSubscribeCall = orderbookChannel.subscribe.bind(orderbookChannel, subscriptionOpts, {});
|
||||
expect(badSubscribeCall).throws(
|
||||
'Expected handler.onSnapshot to be of type function, encountered: undefined',
|
||||
);
|
||||
});
|
||||
it('does not throw when inputs are of correct types', () => {
|
||||
const goodSubscribeCall = orderbookChannel.subscribe.bind(
|
||||
orderbookChannel,
|
||||
subscriptionOpts,
|
||||
emptyOrderbookChannelHandler,
|
||||
);
|
||||
const goodSubscribeCall = openOrderbookChannel.subscribe.bind(openOrderbookChannel, subscriptionOpts);
|
||||
expect(goodSubscribeCall).to.not.throw();
|
||||
});
|
||||
it('throws when client is closed', () => {
|
||||
const closedClient = new WebSocket.w3cwebsocket(websocketUrl);
|
||||
Sinon.stub(closedClient, 'readyState').get(() => WebSocket.w3cwebsocket.CLOSED);
|
||||
const closedOrderbookChannel = new WebSocketOrderbookChannel(closedClient, emptyOrderbookChannelHandler);
|
||||
const badSubscribeCall = closedOrderbookChannel.subscribe.bind(closedOrderbookChannel, subscriptionOpts);
|
||||
expect(badSubscribeCall).throws('WebSocket connection is closed');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,9 +1,56 @@
|
||||
[
|
||||
{
|
||||
"version": "1.0.1-rc.3",
|
||||
"changes": [
|
||||
{
|
||||
"pr": 915,
|
||||
"note": "Added strict encoding/decoding checks for sendTransaction and call"
|
||||
},
|
||||
{
|
||||
"note": "Add ForwarderWrapper",
|
||||
"pr": 934
|
||||
},
|
||||
{
|
||||
"note": "Optimize orders in ForwarderWrapper",
|
||||
"pr": 936
|
||||
}
|
||||
],
|
||||
"timestamp": 1534210131
|
||||
},
|
||||
{
|
||||
"version": "1.0.1-rc.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Fixed bug caused by importing non-existent dep"
|
||||
}
|
||||
],
|
||||
"timestamp": 1532619515
|
||||
},
|
||||
{
|
||||
"version": "1.0.1-rc.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
],
|
||||
"timestamp": 1532605697
|
||||
},
|
||||
{
|
||||
"timestamp": 1532357734,
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Update blockstream to v5.0 and propogate up caught errors to active subscriptions"
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1532043000,
|
||||
"version": "1.0.0-rc.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Update blockstream to v5.0 and propogate up caught errors to active subscriptions",
|
||||
"pr": 815
|
||||
},
|
||||
{
|
||||
"note": "Update to v2 of 0x rpotocol",
|
||||
@@ -11,6 +58,15 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1531919263,
|
||||
"version": "0.1.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1529397769,
|
||||
"version": "0.0.5",
|
||||
|
@@ -1,21 +1,44 @@
|
||||
<!--
|
||||
This file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.1-rc.3 - _August 13, 2018_
|
||||
|
||||
* Added strict encoding/decoding checks for sendTransaction and call (#915)
|
||||
* Add ForwarderWrapper (#934)
|
||||
* Optimize orders in ForwarderWrapper (#936)
|
||||
|
||||
## v1.0.1-rc.2 - _July 26, 2018_
|
||||
|
||||
* Fixed bug caused by importing non-existent dep
|
||||
|
||||
## v1.0.1-rc.1 - _July 26, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0 - _July 23, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.0-rc.1 - _July 19, 2018_
|
||||
|
||||
* Update blockstream to v5.0 and propogate up caught errors to active subscriptions (#815)
|
||||
* Update to v2 of 0x rpotocol (#822)
|
||||
|
||||
## v0.1.1 - _July 18, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.5 - _June 19, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.4 - _May 29, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v0.0.3 - _May 29, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
* Expose 'abi' ContractAbi property on all contract wrappers
|
||||
|
||||
## v0.0.2 - _May 22, 2018_
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0xproject/contract-wrappers",
|
||||
"version": "0.0.6",
|
||||
"version": "1.0.1-rc.2",
|
||||
"description": "Smart TS wrappers for 0x smart contracts",
|
||||
"keywords": [
|
||||
"0xproject",
|
||||
@@ -13,26 +13,24 @@
|
||||
"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_artifacts",
|
||||
"generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers",
|
||||
"pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 generate_contract_wrappers copy_artifacts",
|
||||
"generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers",
|
||||
"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_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
|
||||
"clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/contract_wrappers/generated",
|
||||
"update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;",
|
||||
"update_artifacts_v2": "for i in ${npm_package_config_contracts_v2}; do copyfiles -u 4 ../migrations/artifacts/2.0.0/$i.json src/artifacts; done;",
|
||||
"copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts",
|
||||
"clean": "shx rm -rf _bundles lib test_temp scripts test/artifacts src/contract_wrappers/generated src/artifacts",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit",
|
||||
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
|
||||
},
|
||||
"config": {
|
||||
"postpublish": {
|
||||
"assets": [
|
||||
"packages/contract-wrappers/_bundles/index.js",
|
||||
"packages/contract-wrappers/_bundles/index.min.js"
|
||||
]
|
||||
}
|
||||
"contracts_v2_beta": "Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken Forwarder",
|
||||
"contracts_v2": "DummyERC20Token DummyERC721Token"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -43,13 +41,13 @@
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@0xproject/abi-gen": "^0.3.2",
|
||||
"@0xproject/dev-utils": "^0.4.4",
|
||||
"@0xproject/migrations": "^0.0.8",
|
||||
"@0xproject/monorepo-scripts": "^0.2.1",
|
||||
"@0xproject/sol-compiler": "^0.5.2",
|
||||
"@0xproject/subproviders": "^0.10.4",
|
||||
"@0xproject/tslint-config": "^0.4.20",
|
||||
"@0xproject/abi-gen": "^1.0.4",
|
||||
"@0xproject/dev-utils": "^1.0.3",
|
||||
"@0xproject/migrations": "^1.0.3",
|
||||
"@0xproject/monorepo-scripts": "^1.0.4",
|
||||
"@0xproject/sol-compiler": "^1.0.4",
|
||||
"@0xproject/subproviders": "^1.0.4",
|
||||
"@0xproject/tslint-config": "^1.0.4",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^8.0.53",
|
||||
@@ -62,33 +60,33 @@
|
||||
"copyfiles": "^1.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.0.1",
|
||||
"mocha": "^4.1.0",
|
||||
"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",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "2.9.2",
|
||||
"web3-provider-engine": "14.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0xproject/assert": "^0.3.0",
|
||||
"@0xproject/base-contract": "^0.3.4",
|
||||
"@0xproject/order-utils": "^1.0.0",
|
||||
"@0xproject/typescript-typings": "^0.4.1",
|
||||
"@0xproject/utils": "^0.7.1",
|
||||
"@0xproject/web3-wrapper": "^0.7.1",
|
||||
"@0xproject/fill-scenarios": "^1.0.0",
|
||||
"@0xproject/json-schemas": "^1.0.0",
|
||||
"@0xproject/types": "^1.0.0",
|
||||
"ethereum-types": "^0.0.2",
|
||||
"@0xproject/assert": "^1.0.4",
|
||||
"@0xproject/base-contract": "^1.0.4",
|
||||
"@0xproject/fill-scenarios": "^1.0.1-rc.2",
|
||||
"@0xproject/json-schemas": "^1.0.1-rc.3",
|
||||
"@0xproject/order-utils": "^1.0.1-rc.2",
|
||||
"@0xproject/types": "^1.0.1-rc.3",
|
||||
"@0xproject/typescript-typings": "^1.0.3",
|
||||
"@0xproject/utils": "^1.0.4",
|
||||
"@0xproject/web3-wrapper": "^1.1.2",
|
||||
"ethereum-types": "^1.0.3",
|
||||
"ethereumjs-blockstream": "5.0.0",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"ethers": "3.0.22",
|
||||
"js-sha3": "^0.7.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
@@ -7,6 +7,7 @@ import * as ERC20Token from './artifacts/ERC20Token.json';
|
||||
import * as ERC721Proxy from './artifacts/ERC721Proxy.json';
|
||||
import * as ERC721Token from './artifacts/ERC721Token.json';
|
||||
import * as Exchange from './artifacts/Exchange.json';
|
||||
import * as Forwarder from './artifacts/Forwarder.json';
|
||||
import * as EtherToken from './artifacts/WETH9.json';
|
||||
import * as ZRXToken from './artifacts/ZRXToken.json';
|
||||
|
||||
@@ -20,4 +21,5 @@ export const artifacts = {
|
||||
EtherToken: (EtherToken as any) as ContractArtifact,
|
||||
ERC20Proxy: (ERC20Proxy as any) as ContractArtifact,
|
||||
ERC721Proxy: (ERC721Proxy as any) as ContractArtifact,
|
||||
Forwarder: (Forwarder as any) as ContractArtifact,
|
||||
};
|
||||
|
@@ -1,306 +0,0 @@
|
||||
{
|
||||
"schemaVersion": "2.0.0",
|
||||
"contractName": "DummyERC20Token",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"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,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "setBalance",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "_decimals",
|
||||
"type": "uint8"
|
||||
},
|
||||
{
|
||||
"name": "_totalSupply",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,368 +0,0 @@
|
||||
{
|
||||
"schemaVersion": "2.0.0",
|
||||
"contractName": "DummyERC721Token",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getApproved",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "mint",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "safeTransferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "exists",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ownerOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_approved",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "setApprovalForAll",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "_data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "safeTransferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_operator",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isApprovedForAll",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_approved",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_operator",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_approved",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "ApprovalForAll",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,210 +0,0 @@
|
||||
{
|
||||
"contractName": "ERC20Proxy",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "authorities",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeAuthorizedAddressAtIndex",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "assetData",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getProxyId",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "authorized",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getAuthorizedAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AuthorizedAddressAdded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AuthorizedAddressRemoved",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
},
|
||||
"networks": {
|
||||
"50": { "address": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48" }
|
||||
}
|
||||
}
|
@@ -1,174 +0,0 @@
|
||||
{
|
||||
"contractName": "ERC20Token",
|
||||
"compilerOutput": {
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,210 +0,0 @@
|
||||
{
|
||||
"contractName": "ERC20Proxy",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "addAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "authorities",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "removeAuthorizedAddress",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "owner",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "index",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "removeAuthorizedAddressAtIndex",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "assetData",
|
||||
"type": "bytes"
|
||||
},
|
||||
{
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getProxyId",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bytes4"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "authorized",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "getAuthorizedAddresses",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address[]"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "newOwner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "transferOwnership",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AuthorizedAddressAdded",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "target",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "caller",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "AuthorizedAddressRemoved",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
},
|
||||
"networks": {
|
||||
"50": { "address": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401" }
|
||||
}
|
||||
}
|
@@ -1,322 +0,0 @@
|
||||
{
|
||||
"schemaVersion": "2.0.0",
|
||||
"contractName": "ERC721Token",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "getApproved",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "safeTransferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "exists",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "ownerOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_approved",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "setApprovalForAll",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
},
|
||||
{
|
||||
"name": "_data",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "safeTransferFrom",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_operator",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "isApprovedForAll",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_name",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "_symbol",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_approved",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_tokenId",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "_operator",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "_approved",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"name": "ApprovalForAll",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,301 +0,0 @@
|
||||
{
|
||||
"contractName": "WETH9",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "guy",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "wad",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "src",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "dst",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "wad",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "wad",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "withdraw",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "dst",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "wad",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [],
|
||||
"name": "deposit",
|
||||
"outputs": [],
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"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": "_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": 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": "0x0b1ba0af832d7c05fd64161e0db78e85978e8082"
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"contractName": "ZRXToken",
|
||||
"compilerOutput": {
|
||||
"abi": []
|
||||
},
|
||||
"networks": {
|
||||
"1": {
|
||||
"address": "0xe41d2489571d322189246dafa5ebde1f4699f498"
|
||||
},
|
||||
"3": {
|
||||
"address": "0xa8e9fa8f91e5ae138c74648c9c304f1c75003a8d"
|
||||
},
|
||||
"4": {
|
||||
"address": "0x00f58d6d585f84b2d7267940cede30ce2fe6eae8"
|
||||
},
|
||||
"42": {
|
||||
"address": "0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570"
|
||||
},
|
||||
"50": {
|
||||
"address": "0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c"
|
||||
}
|
||||
}
|
||||
}
|
@@ -11,6 +11,7 @@ import { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
|
||||
import { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper';
|
||||
import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
|
||||
import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
|
||||
import { ForwarderWrapper } from './contract_wrappers/forwarder_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';
|
||||
@@ -47,6 +48,11 @@ export class ContractWrappers {
|
||||
* erc721Proxy smart contract.
|
||||
*/
|
||||
public erc721Proxy: ERC721ProxyWrapper;
|
||||
/**
|
||||
* An instance of the ForwarderWrapper class containing methods for interacting with any Forwarder smart contract.
|
||||
*/
|
||||
public forwarder: ForwarderWrapper;
|
||||
|
||||
private _web3Wrapper: Web3Wrapper;
|
||||
/**
|
||||
* Instantiates a new ContractWrappers instance.
|
||||
@@ -104,6 +110,12 @@ export class ContractWrappers {
|
||||
config.zrxContractAddress,
|
||||
blockPollingIntervalMs,
|
||||
);
|
||||
this.forwarder = new ForwarderWrapper(
|
||||
this._web3Wrapper,
|
||||
config.networkId,
|
||||
config.forwarderContractAddress,
|
||||
config.zrxContractAddress,
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Sets a new web3 provider for 0x.js. Updating the provider will stop all
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ContractArtifact } from '@0xproject/sol-compiler';
|
||||
import { AbiDecoder, intervalUtils } from '@0xproject/utils';
|
||||
import { AbiDecoder, intervalUtils, logUtils } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { BlockParamLiteral, ContractAbi, FilterObject, LogEntry, LogWithDecodedArgs, RawLog } from 'ethereum-types';
|
||||
import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream';
|
||||
@@ -41,6 +41,13 @@ export abstract class ContractWrapper {
|
||||
};
|
||||
private _onLogAddedSubscriptionToken: string | undefined;
|
||||
private _onLogRemovedSubscriptionToken: string | undefined;
|
||||
private static _onBlockAndLogStreamerError(isVerbose: boolean, err: Error): void {
|
||||
// Since Blockstream errors are all recoverable, we simply log them if the verbose
|
||||
// config is passed in.
|
||||
if (isVerbose) {
|
||||
logUtils.warn(err);
|
||||
}
|
||||
}
|
||||
constructor(web3Wrapper: Web3Wrapper, networkId: number, blockPollingIntervalMs?: number) {
|
||||
this._web3Wrapper = web3Wrapper;
|
||||
this._networkId = networkId;
|
||||
@@ -79,10 +86,11 @@ export abstract class ContractWrapper {
|
||||
indexFilterValues: IndexedFilterValues,
|
||||
abi: ContractAbi,
|
||||
callback: EventCallback<ArgsType>,
|
||||
isVerbose: boolean = false,
|
||||
): string {
|
||||
const filter = filterUtils.getFilter(address, eventName, indexFilterValues, abi);
|
||||
if (_.isUndefined(this._blockAndLogStreamerIfExists)) {
|
||||
this._startBlockAndLogStream();
|
||||
this._startBlockAndLogStream(isVerbose);
|
||||
}
|
||||
const filterToken = filterUtils.generateUUID();
|
||||
this._filters[filterToken] = filter;
|
||||
@@ -151,21 +159,21 @@ export abstract class ContractWrapper {
|
||||
}
|
||||
});
|
||||
}
|
||||
private _startBlockAndLogStream(): void {
|
||||
private _startBlockAndLogStream(isVerbose: boolean): void {
|
||||
if (!_.isUndefined(this._blockAndLogStreamerIfExists)) {
|
||||
throw new Error(ContractWrappersError.SubscriptionAlreadyPresent);
|
||||
}
|
||||
this._blockAndLogStreamerIfExists = new BlockAndLogStreamer(
|
||||
this._web3Wrapper.getBlockAsync.bind(this._web3Wrapper),
|
||||
this._web3Wrapper.getLogsAsync.bind(this._web3Wrapper),
|
||||
this._onBlockAndLogStreamerError.bind(this),
|
||||
ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose),
|
||||
);
|
||||
const catchAllLogFilter = {};
|
||||
this._blockAndLogStreamerIfExists.addLogFilter(catchAllLogFilter);
|
||||
this._blockAndLogStreamIntervalIfExists = intervalUtils.setAsyncExcludingInterval(
|
||||
this._reconcileBlockAsync.bind(this),
|
||||
this._blockPollingIntervalMs,
|
||||
this._onReconcileBlockError.bind(this),
|
||||
ContractWrapper._onBlockAndLogStreamerError.bind(this, isVerbose),
|
||||
);
|
||||
let isRemoved = false;
|
||||
this._onLogAddedSubscriptionToken = this._blockAndLogStreamerIfExists.subscribeToOnLogAdded(
|
||||
@@ -176,20 +184,10 @@ export abstract class ContractWrapper {
|
||||
this._onLogStateChanged.bind(this, isRemoved),
|
||||
);
|
||||
}
|
||||
private _onBlockAndLogStreamerError(err: Error): void {
|
||||
// Propogate all Blockstream subscriber errors to all
|
||||
// top-level subscriptions
|
||||
const filterCallbacks = _.values(this._filterCallbacks);
|
||||
_.each(filterCallbacks, filterCallback => {
|
||||
filterCallback(err);
|
||||
});
|
||||
}
|
||||
private _onReconcileBlockError(err: Error): void {
|
||||
const filterTokens = _.keys(this._filterCallbacks);
|
||||
_.each(filterTokens, filterToken => {
|
||||
this._unsubscribe(filterToken, err);
|
||||
});
|
||||
}
|
||||
// HACK: This should be a package-scoped method (which doesn't exist in TS)
|
||||
// We don't want this method available in the public interface for all classes
|
||||
// who inherit from ContractWrapper, and it is only used by the internal implementation
|
||||
// of those higher classes.
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
private _setNetworkId(networkId: number): void {
|
||||
this._networkId = networkId;
|
||||
|
@@ -347,6 +347,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
|
||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
|
||||
* @param callback Callback that gets called when a log is added/removed
|
||||
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
|
||||
* @return Subscription token used later to unsubscribe
|
||||
*/
|
||||
public subscribe<ArgsType extends ERC20TokenEventArgs>(
|
||||
@@ -354,6 +355,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
|
||||
eventName: ERC20TokenEvents,
|
||||
indexFilterValues: IndexedFilterValues,
|
||||
callback: EventCallback<ArgsType>,
|
||||
isVerbose: boolean = false,
|
||||
): string {
|
||||
assert.isETHAddressHex('tokenAddress', tokenAddress);
|
||||
assert.doesBelongToStringEnum('eventName', eventName, ERC20TokenEvents);
|
||||
@@ -366,6 +368,7 @@ export class ERC20TokenWrapper extends ContractWrapper {
|
||||
indexFilterValues,
|
||||
artifacts.ERC20Token.compilerOutput.abi,
|
||||
callback,
|
||||
isVerbose,
|
||||
);
|
||||
return subscriptionToken;
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { ContractAbi, LogWithDecodedArgs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from '../../test/utils/constants';
|
||||
import { artifacts } from '../artifacts';
|
||||
import { methodOptsSchema } from '../schemas/method_opts_schema';
|
||||
import { txOptsSchema } from '../schemas/tx_opts_schema';
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
TransactionOpts,
|
||||
} from '../types';
|
||||
import { assert } from '../utils/assert';
|
||||
import { constants } from '../utils/constants';
|
||||
|
||||
import { ContractWrapper } from './contract_wrapper';
|
||||
import { ERC721ProxyWrapper } from './erc721_proxy_wrapper';
|
||||
@@ -342,15 +342,17 @@ export class ERC721TokenWrapper extends ContractWrapper {
|
||||
const normalizedSenderAddress = senderAddress.toLowerCase();
|
||||
const tokenContract = await this._getTokenContractAsync(normalizedTokenAddress);
|
||||
const ownerAddress = await this.getOwnerOfAsync(tokenAddress, tokenId);
|
||||
const isApprovedForAll = await this.isApprovedForAllAsync(
|
||||
normalizedTokenAddress,
|
||||
ownerAddress,
|
||||
normalizedSenderAddress,
|
||||
);
|
||||
if (!isApprovedForAll) {
|
||||
const approvedAddress = await this.getApprovedIfExistsAsync(normalizedTokenAddress, tokenId);
|
||||
if (approvedAddress !== senderAddress) {
|
||||
throw new Error(ContractWrappersError.ERC721NoApproval);
|
||||
if (normalizedSenderAddress !== ownerAddress) {
|
||||
const isApprovedForAll = await this.isApprovedForAllAsync(
|
||||
normalizedTokenAddress,
|
||||
ownerAddress,
|
||||
normalizedSenderAddress,
|
||||
);
|
||||
if (!isApprovedForAll) {
|
||||
const approvedAddress = await this.getApprovedIfExistsAsync(normalizedTokenAddress, tokenId);
|
||||
if (approvedAddress !== normalizedSenderAddress) {
|
||||
throw new Error(ContractWrappersError.ERC721NoApproval);
|
||||
}
|
||||
}
|
||||
}
|
||||
const txHash = await tokenContract.transferFrom.sendTransactionAsync(
|
||||
@@ -372,6 +374,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
|
||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
|
||||
* @param callback Callback that gets called when a log is added/removed
|
||||
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
|
||||
* @return Subscription token used later to unsubscribe
|
||||
*/
|
||||
public subscribe<ArgsType extends ERC721TokenEventArgs>(
|
||||
@@ -379,6 +382,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
|
||||
eventName: ERC721TokenEvents,
|
||||
indexFilterValues: IndexedFilterValues,
|
||||
callback: EventCallback<ArgsType>,
|
||||
isVerbose: boolean = false,
|
||||
): string {
|
||||
assert.isETHAddressHex('tokenAddress', tokenAddress);
|
||||
assert.doesBelongToStringEnum('eventName', eventName, ERC721TokenEvents);
|
||||
@@ -391,6 +395,7 @@ export class ERC721TokenWrapper extends ContractWrapper {
|
||||
indexFilterValues,
|
||||
artifacts.ERC721Token.compilerOutput.abi,
|
||||
callback,
|
||||
isVerbose,
|
||||
);
|
||||
return subscriptionToken;
|
||||
}
|
||||
|
@@ -146,6 +146,7 @@ export class EtherTokenWrapper extends ContractWrapper {
|
||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||
* the value is the value you are interested in. E.g `{_owner: aUserAddressHex}`
|
||||
* @param callback Callback that gets called when a log is added/removed
|
||||
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
|
||||
* @return Subscription token used later to unsubscribe
|
||||
*/
|
||||
public subscribe<ArgsType extends WETH9EventArgs>(
|
||||
@@ -153,6 +154,7 @@ export class EtherTokenWrapper extends ContractWrapper {
|
||||
eventName: WETH9Events,
|
||||
indexFilterValues: IndexedFilterValues,
|
||||
callback: EventCallback<ArgsType>,
|
||||
isVerbose: boolean = false,
|
||||
): string {
|
||||
assert.isETHAddressHex('etherTokenAddress', etherTokenAddress);
|
||||
const normalizedEtherTokenAddress = etherTokenAddress.toLowerCase();
|
||||
@@ -165,6 +167,7 @@ export class EtherTokenWrapper extends ContractWrapper {
|
||||
indexFilterValues,
|
||||
artifacts.EtherToken.compilerOutput.abi,
|
||||
callback,
|
||||
isVerbose,
|
||||
);
|
||||
return subscriptionToken;
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { assetDataUtils } from '@0xproject/order-utils';
|
||||
import { AssetProxyId, Order, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
@@ -868,15 +869,35 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
*/
|
||||
@decorators.asyncZeroExErrorHandler
|
||||
public async getOrderInfoAsync(order: Order | SignedOrder, methodOpts: MethodOpts = {}): Promise<OrderInfo> {
|
||||
assert.doesConformToSchema('order', order, schemas.orderSchema);
|
||||
if (!_.isUndefined(methodOpts)) {
|
||||
assert.doesConformToSchema('methodOpts', methodOpts, methodOptsSchema);
|
||||
}
|
||||
const exchangeInstance = await this._getExchangeContractAsync();
|
||||
|
||||
const txData = {};
|
||||
const orderInfo = await exchangeInstance.getOrderInfo.callAsync(order, txData, methodOpts.defaultBlock);
|
||||
return orderInfo;
|
||||
}
|
||||
/**
|
||||
* Get order info for multiple orders
|
||||
* @param orders Orders
|
||||
* @param methodOpts Optional arguments this method accepts.
|
||||
* @returns Array of Order infos
|
||||
*/
|
||||
@decorators.asyncZeroExErrorHandler
|
||||
public async getOrdersInfoAsync(
|
||||
orders: Array<Order | SignedOrder>,
|
||||
methodOpts: MethodOpts = {},
|
||||
): Promise<OrderInfo[]> {
|
||||
assert.doesConformToSchema('orders', orders, schemas.ordersSchema);
|
||||
if (!_.isUndefined(methodOpts)) {
|
||||
assert.doesConformToSchema('methodOpts', methodOpts, methodOptsSchema);
|
||||
}
|
||||
const exchangeInstance = await this._getExchangeContractAsync();
|
||||
const txData = {};
|
||||
const ordersInfo = await exchangeInstance.getOrdersInfo.callAsync(orders, txData, methodOpts.defaultBlock);
|
||||
return ordersInfo;
|
||||
}
|
||||
/**
|
||||
* Cancel a given order.
|
||||
* @param order An object that conforms to the Order or SignedOrder interface. The order you would like to cancel.
|
||||
@@ -988,12 +1009,14 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
* @param indexFilterValues An object where the keys are indexed args returned by the event and
|
||||
* the value is the value you are interested in. E.g `{maker: aUserAddressHex}`
|
||||
* @param callback Callback that gets called when a log is added/removed
|
||||
* @param isVerbose Enable verbose subscription warnings (e.g recoverable network issues encountered)
|
||||
* @return Subscription token used later to unsubscribe
|
||||
*/
|
||||
public subscribe<ArgsType extends ExchangeEventArgs>(
|
||||
eventName: ExchangeEvents,
|
||||
indexFilterValues: IndexedFilterValues,
|
||||
callback: EventCallback<ArgsType>,
|
||||
isVerbose: boolean = false,
|
||||
): string {
|
||||
assert.doesBelongToStringEnum('eventName', eventName, ExchangeEvents);
|
||||
assert.doesConformToSchema('indexFilterValues', indexFilterValues, schemas.indexFilterValuesSchema);
|
||||
@@ -1005,6 +1028,7 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
indexFilterValues,
|
||||
artifacts.Exchange.compilerOutput.abi,
|
||||
callback,
|
||||
isVerbose,
|
||||
);
|
||||
return subscriptionToken;
|
||||
}
|
||||
@@ -1068,9 +1092,9 @@ export class ExchangeWrapper extends ContractWrapper {
|
||||
* Returns the ZRX asset data used by the exchange contract.
|
||||
* @return ZRX asset data
|
||||
*/
|
||||
public async getZRXAssetDataAsync(): Promise<string> {
|
||||
const exchangeInstance = await this._getExchangeContractAsync();
|
||||
const zrxAssetData = exchangeInstance.ZRX_ASSET_DATA.callAsync();
|
||||
public getZRXAssetData(): string {
|
||||
const zrxTokenAddress = this.getZRXTokenAddress();
|
||||
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress);
|
||||
return zrxAssetData;
|
||||
}
|
||||
// tslint:disable:no-unused-variable
|
||||
|
@@ -0,0 +1,220 @@
|
||||
import { schemas } from '@0xproject/json-schemas';
|
||||
import { AssetProxyId, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { ContractAbi } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { artifacts } from '../artifacts';
|
||||
import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
|
||||
import { txOptsSchema } from '../schemas/tx_opts_schema';
|
||||
import { TransactionOpts } from '../types';
|
||||
import { assert } from '../utils/assert';
|
||||
import { calldataOptimizationUtils } from '../utils/calldata_optimization_utils';
|
||||
import { constants } from '../utils/constants';
|
||||
|
||||
import { ContractWrapper } from './contract_wrapper';
|
||||
import { ForwarderContract } from './generated/forwarder';
|
||||
|
||||
/**
|
||||
* This class includes the functionality related to interacting with the Forwarder contract.
|
||||
*/
|
||||
export class ForwarderWrapper extends ContractWrapper {
|
||||
public abi: ContractAbi = artifacts.Forwarder.compilerOutput.abi;
|
||||
private _forwarderContractIfExists?: ForwarderContract;
|
||||
private _contractAddressIfExists?: string;
|
||||
private _zrxContractAddressIfExists?: string;
|
||||
constructor(
|
||||
web3Wrapper: Web3Wrapper,
|
||||
networkId: number,
|
||||
contractAddressIfExists?: string,
|
||||
zrxContractAddressIfExists?: string,
|
||||
) {
|
||||
super(web3Wrapper, networkId);
|
||||
this._contractAddressIfExists = contractAddressIfExists;
|
||||
this._zrxContractAddressIfExists = zrxContractAddressIfExists;
|
||||
}
|
||||
/**
|
||||
* Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
|
||||
* Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
|
||||
* 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
|
||||
* Any ETH not spent will be refunded to sender.
|
||||
* @param signedOrders An array of objects that conform to the SignedOrder interface. All orders must specify the same makerAsset.
|
||||
* All orders must specify WETH as the takerAsset
|
||||
* @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied
|
||||
* Provider provided at instantiation.
|
||||
* @param ethAmount The amount of eth to send with the transaction (in wei).
|
||||
* @param signedFeeOrders An array of objects that conform to the SignedOrder interface. All orders must specify ZRX as makerAsset and WETH as takerAsset.
|
||||
* Used to purchase ZRX for primary order fees.
|
||||
* @param feePercentage The percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
|
||||
* Defaults to 0.
|
||||
* @param feeRecipientAddress The address that will receive ETH when signedFeeOrders are filled.
|
||||
* @param txOpts Transaction parameters.
|
||||
* @return Transaction hash.
|
||||
*/
|
||||
public async marketSellOrdersWithEthAsync(
|
||||
signedOrders: SignedOrder[],
|
||||
takerAddress: string,
|
||||
ethAmount: BigNumber,
|
||||
signedFeeOrders: SignedOrder[] = [],
|
||||
feePercentage: BigNumber = constants.ZERO_AMOUNT,
|
||||
feeRecipientAddress: string = constants.NULL_ADDRESS,
|
||||
txOpts: TransactionOpts = {},
|
||||
): Promise<string> {
|
||||
// type assertions
|
||||
assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema);
|
||||
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
|
||||
assert.isBigNumber('ethAmount', ethAmount);
|
||||
assert.doesConformToSchema('signedFeeOrders', signedFeeOrders, schemas.signedOrdersSchema);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isETHAddressHex('feeRecipientAddress', feeRecipientAddress);
|
||||
assert.doesConformToSchema('txOpts', txOpts, txOptsSchema);
|
||||
// other assertions
|
||||
assert.ordersCanBeUsedForForwarderContract(signedOrders, this.getEtherTokenAddress());
|
||||
assert.feeOrdersCanBeUsedForForwarderContract(
|
||||
signedFeeOrders,
|
||||
this.getZRXTokenAddress(),
|
||||
this.getEtherTokenAddress(),
|
||||
);
|
||||
// lowercase input addresses
|
||||
const normalizedTakerAddress = takerAddress.toLowerCase();
|
||||
const normalizedFeeRecipientAddress = feeRecipientAddress.toLowerCase();
|
||||
// optimize orders
|
||||
const optimizedMarketOrders = calldataOptimizationUtils.optimizeForwarderOrders(signedOrders);
|
||||
const optimizedFeeOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(signedFeeOrders);
|
||||
// send transaction
|
||||
const forwarderContractInstance = await this._getForwarderContractAsync();
|
||||
const txHash = await forwarderContractInstance.marketSellOrdersWithEth.sendTransactionAsync(
|
||||
optimizedMarketOrders,
|
||||
_.map(optimizedMarketOrders, order => order.signature),
|
||||
optimizedFeeOrders,
|
||||
_.map(optimizedFeeOrders, order => order.signature),
|
||||
feePercentage,
|
||||
feeRecipientAddress,
|
||||
{
|
||||
value: ethAmount,
|
||||
from: normalizedTakerAddress,
|
||||
gas: txOpts.gasLimit,
|
||||
gasPrice: txOpts.gasPrice,
|
||||
},
|
||||
);
|
||||
return txHash;
|
||||
}
|
||||
/**
|
||||
* Attempt to purchase makerAssetFillAmount of makerAsset by selling ethAmount provided with transaction.
|
||||
* Any ZRX required to pay fees for primary orders will automatically be purchased by the contract.
|
||||
* Any ETH not spent will be refunded to sender.
|
||||
* @param signedOrders An array of objects that conform to the SignedOrder interface. All orders must specify the same makerAsset.
|
||||
* All orders must specify WETH as the takerAsset
|
||||
* @param makerAssetFillAmount The amount of the order (in taker asset baseUnits) that you wish to fill.
|
||||
* @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied
|
||||
* Provider provided at instantiation.
|
||||
* @param ethAmount The amount of eth to send with the transaction (in wei).
|
||||
* @param signedFeeOrders An array of objects that conform to the SignedOrder interface. All orders must specify ZRX as makerAsset and WETH as takerAsset.
|
||||
* Used to purchase ZRX for primary order fees.
|
||||
* @param feePercentage The percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
|
||||
* Defaults to 0.
|
||||
* @param feeRecipientAddress The address that will receive ETH when signedFeeOrders are filled.
|
||||
* @param txOpts Transaction parameters.
|
||||
* @return Transaction hash.
|
||||
*/
|
||||
public async marketBuyOrdersWithEthAsync(
|
||||
signedOrders: SignedOrder[],
|
||||
makerAssetFillAmount: BigNumber,
|
||||
takerAddress: string,
|
||||
ethAmount: BigNumber,
|
||||
signedFeeOrders: SignedOrder[] = [],
|
||||
feePercentage: BigNumber = constants.ZERO_AMOUNT,
|
||||
feeRecipientAddress: string = constants.NULL_ADDRESS,
|
||||
txOpts: TransactionOpts = {},
|
||||
): Promise<string> {
|
||||
// type assertions
|
||||
assert.doesConformToSchema('signedOrders', signedOrders, schemas.signedOrdersSchema);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
|
||||
assert.isBigNumber('ethAmount', ethAmount);
|
||||
assert.doesConformToSchema('signedFeeOrders', signedFeeOrders, schemas.signedOrdersSchema);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isETHAddressHex('feeRecipientAddress', feeRecipientAddress);
|
||||
assert.doesConformToSchema('txOpts', txOpts, txOptsSchema);
|
||||
// other assertions
|
||||
assert.ordersCanBeUsedForForwarderContract(signedOrders, this.getEtherTokenAddress());
|
||||
assert.feeOrdersCanBeUsedForForwarderContract(
|
||||
signedFeeOrders,
|
||||
this.getZRXTokenAddress(),
|
||||
this.getEtherTokenAddress(),
|
||||
);
|
||||
// lowercase input addresses
|
||||
const normalizedTakerAddress = takerAddress.toLowerCase();
|
||||
const normalizedFeeRecipientAddress = feeRecipientAddress.toLowerCase();
|
||||
// optimize orders
|
||||
const optimizedMarketOrders = calldataOptimizationUtils.optimizeForwarderOrders(signedOrders);
|
||||
const optimizedFeeOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(signedFeeOrders);
|
||||
// send transaction
|
||||
const forwarderContractInstance = await this._getForwarderContractAsync();
|
||||
const txHash = await forwarderContractInstance.marketBuyOrdersWithEth.sendTransactionAsync(
|
||||
optimizedMarketOrders,
|
||||
makerAssetFillAmount,
|
||||
_.map(optimizedMarketOrders, order => order.signature),
|
||||
optimizedFeeOrders,
|
||||
_.map(optimizedFeeOrders, order => order.signature),
|
||||
feePercentage,
|
||||
feeRecipientAddress,
|
||||
{
|
||||
value: ethAmount,
|
||||
from: normalizedTakerAddress,
|
||||
gas: txOpts.gasLimit,
|
||||
gasPrice: txOpts.gasPrice,
|
||||
},
|
||||
);
|
||||
return txHash;
|
||||
}
|
||||
/**
|
||||
* Retrieves the Ethereum address of the Forwarder contract deployed on the network
|
||||
* that the user-passed web3 provider is connected to.
|
||||
* @returns The Ethereum address of the Forwarder contract being used.
|
||||
*/
|
||||
public getContractAddress(): string {
|
||||
const contractAddress = this._getContractAddress(artifacts.Forwarder, this._contractAddressIfExists);
|
||||
return contractAddress;
|
||||
}
|
||||
/**
|
||||
* Returns the ZRX token address used by the forwarder contract.
|
||||
* @return Address of ZRX token
|
||||
*/
|
||||
public getZRXTokenAddress(): string {
|
||||
const contractAddress = this._getContractAddress(artifacts.ZRXToken, this._zrxContractAddressIfExists);
|
||||
return contractAddress;
|
||||
}
|
||||
/**
|
||||
* Returns the Ether token address used by the forwarder contract.
|
||||
* @return Address of Ether token
|
||||
*/
|
||||
public getEtherTokenAddress(): string {
|
||||
const contractAddress = this._getContractAddress(artifacts.EtherToken);
|
||||
return contractAddress;
|
||||
}
|
||||
// HACK: We don't want this method to be visible to the other units within that package but not to the end user.
|
||||
// TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused.
|
||||
// tslint:disable-next-line:no-unused-variable
|
||||
private _invalidateContractInstance(): void {
|
||||
delete this._forwarderContractIfExists;
|
||||
}
|
||||
private async _getForwarderContractAsync(): Promise<ForwarderContract> {
|
||||
if (!_.isUndefined(this._forwarderContractIfExists)) {
|
||||
return this._forwarderContractIfExists;
|
||||
}
|
||||
const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(
|
||||
artifacts.Forwarder,
|
||||
this._contractAddressIfExists,
|
||||
);
|
||||
const contractInstance = new ForwarderContract(
|
||||
abi,
|
||||
address,
|
||||
this._web3Wrapper.getProvider(),
|
||||
this._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
this._forwarderContractIfExists = contractInstance;
|
||||
return this._forwarderContractIfExists;
|
||||
}
|
||||
}
|
@@ -1,7 +1,11 @@
|
||||
export { ContractWrappers } from './contract_wrappers';
|
||||
export { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
|
||||
export { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper';
|
||||
export { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper';
|
||||
export { ExchangeWrapper } from './contract_wrappers/exchange_wrapper';
|
||||
export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
|
||||
export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
|
||||
export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
|
||||
|
||||
export {
|
||||
ContractWrappersError,
|
||||
@@ -23,7 +27,15 @@ export {
|
||||
OrderInfo,
|
||||
} from './types';
|
||||
|
||||
export { Order, SignedOrder, ECSignature, OrderStateValid, OrderStateInvalid, OrderState } from '@0xproject/types';
|
||||
export {
|
||||
Order,
|
||||
SignedOrder,
|
||||
ECSignature,
|
||||
OrderStateValid,
|
||||
OrderStateInvalid,
|
||||
OrderState,
|
||||
AssetProxyId,
|
||||
} from '@0xproject/types';
|
||||
|
||||
export {
|
||||
BlockParamLiteral,
|
||||
@@ -57,6 +69,7 @@ export {
|
||||
ERC721TokenApprovalForAllEventArgs,
|
||||
ERC721TokenTransferEventArgs,
|
||||
ERC721TokenEvents,
|
||||
ERC721TokenEventArgs,
|
||||
} from './contract_wrappers/generated/erc721_token';
|
||||
|
||||
export {
|
||||
|
@@ -5,11 +5,11 @@ export const contractWrappersPrivateNetworkConfigSchema = {
|
||||
type: 'number',
|
||||
minimum: 1,
|
||||
},
|
||||
gasPrice: { $ref: '/Number' },
|
||||
zrxContractAddress: { $ref: '/Address' },
|
||||
exchangeContractAddress: { $ref: '/Address' },
|
||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||
gasPrice: { $ref: '/numberSchema' },
|
||||
zrxContractAddress: { $ref: '/addressSchema' },
|
||||
exchangeContractAddress: { $ref: '/addressSchema' },
|
||||
erc20ProxyContractAddress: { $ref: '/addressSchema' },
|
||||
erc721ProxyContractAddress: { $ref: '/addressSchema' },
|
||||
blockPollingIntervalMs: { type: 'number' },
|
||||
orderWatcherConfig: {
|
||||
type: 'object',
|
||||
@@ -30,7 +30,7 @@ export const contractWrappersPrivateNetworkConfigSchema = {
|
||||
'networkId',
|
||||
'zrxContractAddress',
|
||||
'exchangeContractAddress',
|
||||
'tokenRegistryContractAddress',
|
||||
'tokenTransferProxyContractAddress',
|
||||
'erc20ProxyContractAddress',
|
||||
'erc721ProxyContractAddress',
|
||||
],
|
||||
};
|
||||
|
@@ -19,11 +19,11 @@ export const contractWrappersPublicNetworkConfigSchema = {
|
||||
networkNameToId.ganache,
|
||||
],
|
||||
},
|
||||
gasPrice: { $ref: '/Number' },
|
||||
zrxContractAddress: { $ref: '/Address' },
|
||||
exchangeContractAddress: { $ref: '/Address' },
|
||||
tokenRegistryContractAddress: { $ref: '/Address' },
|
||||
tokenTransferProxyContractAddress: { $ref: '/Address' },
|
||||
gasPrice: { $ref: '/numberSchema' },
|
||||
zrxContractAddress: { $ref: '/addressSchema' },
|
||||
exchangeContractAddress: { $ref: '/addressSchema' },
|
||||
erc20ProxyContractAddress: { $ref: '/addressSchema' },
|
||||
erc721ProxyContractAddress: { $ref: '/addressSchema' },
|
||||
blockPollingIntervalMs: { type: 'number' },
|
||||
orderWatcherConfig: {
|
||||
type: 'object',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
export const methodOptsSchema = {
|
||||
id: '/MethodOpts',
|
||||
properties: {
|
||||
defaultBlock: { $ref: '/BlockParam' },
|
||||
defaultBlock: { $ref: '/blockParamSchema' },
|
||||
},
|
||||
type: 'object',
|
||||
};
|
||||
|
@@ -1,7 +1,7 @@
|
||||
export const txOptsSchema = {
|
||||
id: '/TxOpts',
|
||||
properties: {
|
||||
gasPrice: { $ref: '/Number' },
|
||||
gasPrice: { $ref: '/numberSchema' },
|
||||
gasLimit: { type: 'number' },
|
||||
},
|
||||
type: 'object',
|
||||
|
@@ -109,6 +109,7 @@ export type SyncMethod = (...args: any[]) => any;
|
||||
* zrxContractAddress: The address of the ZRX contract to use
|
||||
* erc20ProxyContractAddress: The address of the erc20 token transfer proxy contract to use
|
||||
* erc721ProxyContractAddress: The address of the erc721 token transfer proxy contract to use
|
||||
* forwarderContractAddress: The address of the forwarder contract to use
|
||||
* orderWatcherConfig: All the configs related to the orderWatcher
|
||||
* blockPollingIntervalMs: The interval to use for block polling in event watching methods (defaults to 1000)
|
||||
*/
|
||||
@@ -119,6 +120,7 @@ export interface ContractWrappersConfig {
|
||||
zrxContractAddress?: string;
|
||||
erc20ProxyContractAddress?: string;
|
||||
erc721ProxyContractAddress?: string;
|
||||
forwarderContractAddress?: string;
|
||||
blockPollingIntervalMs?: number;
|
||||
}
|
||||
|
||||
@@ -172,13 +174,13 @@ export enum TransferType {
|
||||
export type OnOrderStateChangeCallback = (err: Error | null, orderState?: OrderState) => void;
|
||||
|
||||
export interface OrderInfo {
|
||||
orderStatus: number;
|
||||
orderStatus: OrderStatus;
|
||||
orderHash: string;
|
||||
orderTakerAssetFilledAmount: BigNumber;
|
||||
}
|
||||
|
||||
export enum OrderStatus {
|
||||
INVALID,
|
||||
INVALID = 0,
|
||||
INVALID_MAKER_ASSET_AMOUNT,
|
||||
INVALID_TAKER_ASSET_AMOUNT,
|
||||
FILLABLE,
|
||||
|
@@ -1,11 +1,14 @@
|
||||
import { assert as sharedAssert } from '@0xproject/assert';
|
||||
// We need those two unused imports because they're actually used by sharedAssert which gets injected here
|
||||
// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here
|
||||
import { Schema } from '@0xproject/json-schemas'; // tslint:disable-line:no-unused-variable
|
||||
import { isValidSignatureAsync } from '@0xproject/order-utils';
|
||||
import { ECSignature } from '@0xproject/types'; // tslint:disable-line:no-unused-variable
|
||||
import { assetDataUtils, isValidSignatureAsync } from '@0xproject/order-utils';
|
||||
import { ECSignature, Order } from '@0xproject/types'; // tslint:disable-line:no-unused-variable
|
||||
import { BigNumber } from '@0xproject/utils'; // tslint:disable-line:no-unused-variable
|
||||
import { Web3Wrapper } from '@0xproject/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './constants';
|
||||
|
||||
export const assert = {
|
||||
...sharedAssert,
|
||||
@@ -16,12 +19,12 @@ export const assert = {
|
||||
signerAddress: string,
|
||||
): Promise<void> {
|
||||
const isValid = await isValidSignatureAsync(provider, orderHash, signature, signerAddress);
|
||||
this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
|
||||
sharedAssert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
|
||||
},
|
||||
isValidSubscriptionToken(variableName: string, subscriptionToken: string): void {
|
||||
const uuidRegex = new RegExp('^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$');
|
||||
const isValid = uuidRegex.test(subscriptionToken);
|
||||
this.assert(isValid, `Expected ${variableName} to be a valid subscription token`);
|
||||
sharedAssert.assert(isValid, `Expected ${variableName} to be a valid subscription token`);
|
||||
},
|
||||
async isSenderAddressAsync(
|
||||
variableName: string,
|
||||
@@ -35,4 +38,53 @@ export const assert = {
|
||||
`Specified ${variableName} ${senderAddressHex} isn't available through the supplied web3 provider`,
|
||||
);
|
||||
},
|
||||
ordersCanBeUsedForForwarderContract(orders: Order[], etherTokenAddress: string): void {
|
||||
sharedAssert.assert(!_.isEmpty(orders), 'Expected at least 1 signed order. Found no orders');
|
||||
assert.ordersHaveAtMostOneUniqueValueForProperty(orders, 'makerAssetData');
|
||||
assert.allTakerAssetDatasAreErc20Token(orders, etherTokenAddress);
|
||||
assert.allTakerAddressesAreNull(orders);
|
||||
},
|
||||
feeOrdersCanBeUsedForForwarderContract(orders: Order[], zrxTokenAddress: string, etherTokenAddress: string): void {
|
||||
if (!_.isEmpty(orders)) {
|
||||
assert.allMakerAssetDatasAreErc20Token(orders, zrxTokenAddress);
|
||||
assert.allTakerAssetDatasAreErc20Token(orders, etherTokenAddress);
|
||||
}
|
||||
},
|
||||
allTakerAddressesAreNull(orders: Order[]): void {
|
||||
assert.ordersHaveAtMostOneUniqueValueForProperty(orders, 'takerAddress', constants.NULL_ADDRESS);
|
||||
},
|
||||
allMakerAssetDatasAreErc20Token(orders: Order[], tokenAddress: string): void {
|
||||
assert.ordersHaveAtMostOneUniqueValueForProperty(
|
||||
orders,
|
||||
'makerAssetData',
|
||||
assetDataUtils.encodeERC20AssetData(tokenAddress),
|
||||
);
|
||||
},
|
||||
allTakerAssetDatasAreErc20Token(orders: Order[], tokenAddress: string): void {
|
||||
assert.ordersHaveAtMostOneUniqueValueForProperty(
|
||||
orders,
|
||||
'takerAssetData',
|
||||
assetDataUtils.encodeERC20AssetData(tokenAddress),
|
||||
);
|
||||
},
|
||||
/*
|
||||
* Asserts that all the orders have the same value for the provided propertyName
|
||||
* If the value parameter is provided, this asserts that all orders have the prope
|
||||
*/
|
||||
ordersHaveAtMostOneUniqueValueForProperty(orders: Order[], propertyName: string, value?: any): void {
|
||||
const allValues = _.map(orders, order => _.get(order, propertyName));
|
||||
sharedAssert.hasAtMostOneUniqueValue(
|
||||
allValues,
|
||||
`Expected all orders to have the same ${propertyName} field. Found the following ${propertyName} values: ${JSON.stringify(
|
||||
allValues,
|
||||
)}`,
|
||||
);
|
||||
if (!_.isUndefined(value)) {
|
||||
const firstValue = _.head(allValues);
|
||||
sharedAssert.assert(
|
||||
firstValue === value,
|
||||
`Expected all orders to have a ${propertyName} field with value: ${value}. Found: ${firstValue}`,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@@ -0,0 +1,44 @@
|
||||
import { SignedOrder } from '@0xproject/types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './constants';
|
||||
|
||||
export const calldataOptimizationUtils = {
|
||||
/**
|
||||
* Takes an array of orders and outputs an array of equivalent orders where all takerAssetData are '0x' and
|
||||
* all makerAssetData are '0x' except for that of the first order, which retains its original value
|
||||
* @param orders An array of SignedOrder objects
|
||||
* @returns optimized orders
|
||||
*/
|
||||
optimizeForwarderOrders(orders: SignedOrder[]): SignedOrder[] {
|
||||
const optimizedOrders = _.map(orders, (order, index) =>
|
||||
transformOrder(order, {
|
||||
makerAssetData: index === 0 ? order.makerAssetData : constants.NULL_BYTES,
|
||||
takerAssetData: constants.NULL_BYTES,
|
||||
}),
|
||||
);
|
||||
return optimizedOrders;
|
||||
},
|
||||
/**
|
||||
* Takes an array of orders and outputs an array of equivalent orders where all takerAssetData are '0x' and
|
||||
* all makerAssetData are '0x'
|
||||
* @param orders An array of SignedOrder objects
|
||||
* @returns optimized orders
|
||||
*/
|
||||
optimizeForwarderFeeOrders(orders: SignedOrder[]): SignedOrder[] {
|
||||
const optimizedOrders = _.map(orders, (order, index) =>
|
||||
transformOrder(order, {
|
||||
makerAssetData: constants.NULL_BYTES,
|
||||
takerAssetData: constants.NULL_BYTES,
|
||||
}),
|
||||
);
|
||||
return optimizedOrders;
|
||||
},
|
||||
};
|
||||
|
||||
const transformOrder = (order: SignedOrder, partialOrder: Partial<SignedOrder>) => {
|
||||
return {
|
||||
...order,
|
||||
...partialOrder,
|
||||
};
|
||||
};
|
@@ -2,6 +2,7 @@ import { BigNumber } from '@0xproject/utils';
|
||||
|
||||
export const constants = {
|
||||
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
|
||||
NULL_BYTES: '0x',
|
||||
TESTRPC_NETWORK_ID: 50,
|
||||
INVALID_JUMP_PATTERN: 'invalid JUMP at',
|
||||
REVERT: 'revert',
|
||||
@@ -10,4 +11,5 @@ export const constants = {
|
||||
// tslint:disable-next-line:custom-no-magic-numbers
|
||||
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
|
||||
DEFAULT_BLOCK_POLLING_INTERVAL: 1000,
|
||||
ZERO_AMOUNT: new BigNumber(0),
|
||||
};
|
||||
|
@@ -0,0 +1,60 @@
|
||||
import { orderFactory } from '@0xproject/order-utils';
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
import 'mocha';
|
||||
|
||||
import { assert } from '../src/utils/assert';
|
||||
import { calldataOptimizationUtils } from '../src/utils/calldata_optimization_utils';
|
||||
import { constants } from '../src/utils/constants';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
|
||||
// utility for generating a set of order objects with mostly NULL values
|
||||
// except for a specified makerAssetData and takerAssetData
|
||||
const FAKE_ORDERS_COUNT = 5;
|
||||
const generateFakeOrders = (makerAssetData: string, takerAssetData: string) =>
|
||||
_.map(_.range(FAKE_ORDERS_COUNT), index => {
|
||||
const order = orderFactory.createOrder(
|
||||
constants.NULL_ADDRESS,
|
||||
constants.ZERO_AMOUNT,
|
||||
makerAssetData,
|
||||
constants.ZERO_AMOUNT,
|
||||
takerAssetData,
|
||||
constants.NULL_ADDRESS,
|
||||
);
|
||||
return {
|
||||
...order,
|
||||
signature: 'dummy signature',
|
||||
};
|
||||
});
|
||||
|
||||
describe('calldataOptimizationUtils', () => {
|
||||
const fakeMakerAssetData = 'fakeMakerAssetData';
|
||||
const fakeTakerAssetData = 'fakeTakerAssetData';
|
||||
const orders = generateFakeOrders(fakeMakerAssetData, fakeTakerAssetData);
|
||||
describe('#optimizeForwarderOrders', () => {
|
||||
it('should make makerAssetData `0x` unless first order', () => {
|
||||
const optimizedOrders = calldataOptimizationUtils.optimizeForwarderOrders(orders);
|
||||
expect(optimizedOrders[0].makerAssetData).to.equal(fakeMakerAssetData);
|
||||
const ordersWithoutHead = _.slice(optimizedOrders, 1);
|
||||
_.forEach(ordersWithoutHead, order => expect(order.makerAssetData).to.equal(constants.NULL_BYTES));
|
||||
});
|
||||
it('should make all takerAssetData `0x`', () => {
|
||||
const optimizedOrders = calldataOptimizationUtils.optimizeForwarderOrders(orders);
|
||||
_.forEach(optimizedOrders, order => expect(order.takerAssetData).to.equal(constants.NULL_BYTES));
|
||||
});
|
||||
});
|
||||
describe('#optimizeForwarderFeeOrders', () => {
|
||||
it('should make all makerAssetData `0x`', () => {
|
||||
const optimizedOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(orders);
|
||||
_.forEach(optimizedOrders, order => expect(order.makerAssetData).to.equal(constants.NULL_BYTES));
|
||||
});
|
||||
it('should make all takerAssetData `0x`', () => {
|
||||
const optimizedOrders = calldataOptimizationUtils.optimizeForwarderFeeOrders(orders);
|
||||
_.forEach(optimizedOrders, order => expect(order.takerAssetData).to.equal(constants.NULL_BYTES));
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,11 +1,10 @@
|
||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
|
||||
import { EmptyWalletSubprovider } from '@0xproject/subproviders';
|
||||
import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
|
||||
import { DoneCallback } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import 'mocha';
|
||||
import Web3ProviderEngine = require('web3-provider-engine');
|
||||
|
||||
import {
|
||||
BlockParamLiteral,
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
|
||||
import { EmptyWalletSubprovider } from '@0xproject/subproviders';
|
||||
import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders';
|
||||
import { DoneCallback } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import { Provider } from 'ethereum-types';
|
||||
import 'mocha';
|
||||
import Web3ProviderEngine = require('web3-provider-engine');
|
||||
|
||||
import {
|
||||
BlockParamLiteral,
|
||||
|
@@ -336,15 +336,19 @@ describe('EtherTokenWrapper', () => {
|
||||
describe('#getLogsAsync', () => {
|
||||
let etherTokenAddress: string;
|
||||
let erc20ProxyAddress: string;
|
||||
const blockRange: BlockRange = {
|
||||
fromBlock: 0,
|
||||
toBlock: BlockParamLiteral.Latest,
|
||||
};
|
||||
let blockRange: BlockRange;
|
||||
let txHash: string;
|
||||
before(() => {
|
||||
before(async () => {
|
||||
addressWithETH = userAddresses[0];
|
||||
etherTokenAddress = tokenUtils.getWethTokenAddress();
|
||||
erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
|
||||
// Start the block range after all migrations to avoid unexpected logs
|
||||
const currentBlock = await web3Wrapper.getBlockNumberAsync();
|
||||
const fromBlock = currentBlock + 1;
|
||||
blockRange = {
|
||||
fromBlock,
|
||||
toBlock: BlockParamLiteral.Latest,
|
||||
};
|
||||
});
|
||||
it('should get logs with decoded args emitted by Approval', async () => {
|
||||
txHash = await contractWrappers.erc20Token.setUnlimitedProxyAllowanceAsync(
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
|
||||
import { FillScenarios } from '@0xproject/fill-scenarios';
|
||||
import { assetProxyUtils, orderHashUtils } from '@0xproject/order-utils';
|
||||
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
|
||||
import { DoneCallback, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
@@ -53,7 +53,6 @@ describe('ExchangeWrapper', () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
contractWrappers = new ContractWrappers(provider, config);
|
||||
exchangeContractAddress = contractWrappers.exchange.getContractAddress();
|
||||
const erc20ProxyAddress = contractWrappers.erc20Proxy.getContractAddress();
|
||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||
zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
|
||||
fillScenarios = new FillScenarios(
|
||||
@@ -61,13 +60,14 @@ describe('ExchangeWrapper', () => {
|
||||
userAddresses,
|
||||
zrxTokenAddress,
|
||||
exchangeContractAddress,
|
||||
erc20ProxyAddress,
|
||||
contractWrappers.erc20Proxy.getContractAddress(),
|
||||
contractWrappers.erc721Proxy.getContractAddress(),
|
||||
);
|
||||
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
|
||||
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
|
||||
[makerAssetData, takerAssetData] = [
|
||||
assetProxyUtils.encodeERC20AssetData(makerTokenAddress),
|
||||
assetProxyUtils.encodeERC20AssetData(takerTokenAddress),
|
||||
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
|
||||
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
||||
];
|
||||
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
|
||||
makerAssetData,
|
||||
@@ -264,8 +264,8 @@ describe('ExchangeWrapper', () => {
|
||||
});
|
||||
});
|
||||
describe('#getZRXAssetData', () => {
|
||||
it('should get the asset data', async () => {
|
||||
const ZRX_ASSET_DATA = await contractWrappers.exchange.getZRXAssetDataAsync();
|
||||
it('should get the asset data', () => {
|
||||
const ZRX_ASSET_DATA = contractWrappers.exchange.getZRXAssetData();
|
||||
const ASSET_DATA_HEX_LENGTH = 74;
|
||||
expect(ZRX_ASSET_DATA).to.have.length(ASSET_DATA_HEX_LENGTH);
|
||||
});
|
||||
@@ -277,6 +277,15 @@ describe('ExchangeWrapper', () => {
|
||||
expect(orderInfo.orderHash).to.be.equal(orderHash);
|
||||
});
|
||||
});
|
||||
describe('#getOrdersInfoAsync', () => {
|
||||
it('should get the orders info', async () => {
|
||||
const ordersInfo = await contractWrappers.exchange.getOrdersInfoAsync([signedOrder, anotherSignedOrder]);
|
||||
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
expect(ordersInfo[0].orderHash).to.be.equal(orderHash);
|
||||
const anotherOrderHash = orderHashUtils.getOrderHashHex(anotherSignedOrder);
|
||||
expect(ordersInfo[1].orderHash).to.be.equal(anotherOrderHash);
|
||||
});
|
||||
});
|
||||
describe('#isValidSignature', () => {
|
||||
it('should check if the signature is valid', async () => {
|
||||
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
@@ -295,7 +304,7 @@ describe('ExchangeWrapper', () => {
|
||||
});
|
||||
});
|
||||
describe('#isAllowedValidatorAsync', () => {
|
||||
it('should check if the validator is alllowed', async () => {
|
||||
it('should check if the validator is allowed', async () => {
|
||||
const signerAddress = makerAddress;
|
||||
const validatorAddress = constants.NULL_ADDRESS;
|
||||
const isAllowed = await contractWrappers.exchange.isAllowedValidatorAsync(signerAddress, validatorAddress);
|
||||
|
130
packages/contract-wrappers/test/forwarder_wrapper_test.ts
Normal file
130
packages/contract-wrappers/test/forwarder_wrapper_test.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils';
|
||||
import { FillScenarios } from '@0xproject/fill-scenarios';
|
||||
import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils';
|
||||
import { DoneCallback, SignedOrder } from '@0xproject/types';
|
||||
import { BigNumber } from '@0xproject/utils';
|
||||
import * as chai from 'chai';
|
||||
import { BlockParamLiteral } from 'ethereum-types';
|
||||
import 'mocha';
|
||||
|
||||
import {
|
||||
ContractWrappers,
|
||||
DecodedLogEvent,
|
||||
ExchangeCancelEventArgs,
|
||||
ExchangeEvents,
|
||||
ExchangeFillEventArgs,
|
||||
OrderStatus,
|
||||
} from '../src';
|
||||
|
||||
import { chaiSetup } from './utils/chai_setup';
|
||||
import { constants } from './utils/constants';
|
||||
import { tokenUtils } from './utils/token_utils';
|
||||
import { provider, web3Wrapper } from './utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
|
||||
describe('ForwarderWrapper', () => {
|
||||
const contractWrappersConfig = {
|
||||
networkId: constants.TESTRPC_NETWORK_ID,
|
||||
blockPollingIntervalMs: 0,
|
||||
};
|
||||
const fillableAmount = new BigNumber(5);
|
||||
const takerTokenFillAmount = new BigNumber(5);
|
||||
let contractWrappers: ContractWrappers;
|
||||
let fillScenarios: FillScenarios;
|
||||
let forwarderContractAddress: string;
|
||||
let exchangeContractAddress: string;
|
||||
let zrxTokenAddress: string;
|
||||
let userAddresses: string[];
|
||||
let coinbase: string;
|
||||
let makerAddress: string;
|
||||
let takerAddress: string;
|
||||
let feeRecipient: string;
|
||||
let anotherMakerAddress: string;
|
||||
let makerTokenAddress: string;
|
||||
let takerTokenAddress: string;
|
||||
let makerAssetData: string;
|
||||
let takerAssetData: string;
|
||||
let signedOrder: SignedOrder;
|
||||
let anotherSignedOrder: SignedOrder;
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
contractWrappers = new ContractWrappers(provider, contractWrappersConfig);
|
||||
forwarderContractAddress = contractWrappers.forwarder.getContractAddress();
|
||||
exchangeContractAddress = contractWrappers.exchange.getContractAddress();
|
||||
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
|
||||
zrxTokenAddress = tokenUtils.getProtocolTokenAddress();
|
||||
fillScenarios = new FillScenarios(
|
||||
provider,
|
||||
userAddresses,
|
||||
zrxTokenAddress,
|
||||
exchangeContractAddress,
|
||||
contractWrappers.erc20Proxy.getContractAddress(),
|
||||
contractWrappers.erc721Proxy.getContractAddress(),
|
||||
);
|
||||
[coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses;
|
||||
[makerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
|
||||
takerTokenAddress = tokenUtils.getWethTokenAddress();
|
||||
[makerAssetData, takerAssetData] = [
|
||||
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
|
||||
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
|
||||
];
|
||||
signedOrder = await fillScenarios.createFillableSignedOrderAsync(
|
||||
makerAssetData,
|
||||
takerAssetData,
|
||||
makerAddress,
|
||||
constants.NULL_ADDRESS,
|
||||
fillableAmount,
|
||||
);
|
||||
anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync(
|
||||
makerAssetData,
|
||||
takerAssetData,
|
||||
makerAddress,
|
||||
constants.NULL_ADDRESS,
|
||||
fillableAmount,
|
||||
);
|
||||
});
|
||||
after(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
});
|
||||
afterEach(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
describe('#marketBuyOrdersWithEthAsync', () => {
|
||||
it('should market buy orders with eth', async () => {
|
||||
const signedOrders = [signedOrder, anotherSignedOrder];
|
||||
const makerAssetFillAmount = signedOrder.makerAssetAmount.plus(anotherSignedOrder.makerAssetAmount);
|
||||
const txHash = await contractWrappers.forwarder.marketBuyOrdersWithEthAsync(
|
||||
signedOrders,
|
||||
makerAssetFillAmount,
|
||||
takerAddress,
|
||||
makerAssetFillAmount,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||
const ordersInfo = await contractWrappers.exchange.getOrdersInfoAsync([signedOrder, anotherSignedOrder]);
|
||||
expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED);
|
||||
expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED);
|
||||
});
|
||||
});
|
||||
describe('#marketSellOrdersWithEthAsync', () => {
|
||||
it('should market sell orders with eth', async () => {
|
||||
const signedOrders = [signedOrder, anotherSignedOrder];
|
||||
const makerAssetFillAmount = signedOrder.makerAssetAmount.plus(anotherSignedOrder.makerAssetAmount);
|
||||
const txHash = await contractWrappers.forwarder.marketSellOrdersWithEthAsync(
|
||||
signedOrders,
|
||||
takerAddress,
|
||||
makerAssetFillAmount,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
|
||||
const ordersInfo = await contractWrappers.exchange.getOrdersInfoAsync([signedOrder, anotherSignedOrder]);
|
||||
expect(ordersInfo[0].orderStatus).to.be.equal(OrderStatus.FULLY_FILLED);
|
||||
expect(ordersInfo[1].orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(ordersInfo[1].orderTakerAssetFilledAmount).to.be.bignumber.equal(new BigNumber(4)); // only 95% of ETH is sold
|
||||
});
|
||||
});
|
||||
});
|
@@ -7,7 +7,7 @@ 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 = 50000;
|
||||
this.timeout(mochaTestTimeoutMs);
|
||||
this.timeout(mochaTestTimeoutMs); // tslint:disable-line:no-invalid-this
|
||||
const txDefaults = {
|
||||
gas: devConstants.GAS_LIMIT,
|
||||
from: devConstants.TESTRPC_FIRST_ADDRESS,
|
||||
|
@@ -49,44 +49,6 @@ describe('SubscriptionTest', () => {
|
||||
_.each(stubs, s => s.restore());
|
||||
stubs = [];
|
||||
});
|
||||
it('Should receive the Error when an error occurs while fetching the block', (done: DoneCallback) => {
|
||||
(async () => {
|
||||
const errMsg = 'Error fetching block';
|
||||
const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg);
|
||||
stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getBlockAsync').throws(new Error(errMsg))];
|
||||
contractWrappers.erc20Token.subscribe(
|
||||
tokenAddress,
|
||||
ERC20TokenEvents.Approval,
|
||||
indexFilterValues,
|
||||
callback,
|
||||
);
|
||||
await contractWrappers.erc20Token.setAllowanceAsync(
|
||||
tokenAddress,
|
||||
coinbase,
|
||||
addressWithoutFunds,
|
||||
allowanceAmount,
|
||||
);
|
||||
})().catch(done);
|
||||
});
|
||||
it('Should receive the Error when an error occurs while reconciling the new block', (done: DoneCallback) => {
|
||||
(async () => {
|
||||
const errMsg = 'Error fetching logs';
|
||||
const callback = callbackErrorReporter.assertNodeCallbackError(done, errMsg);
|
||||
stubs = [Sinon.stub((contractWrappers as any)._web3Wrapper, 'getLogsAsync').throws(new Error(errMsg))];
|
||||
contractWrappers.erc20Token.subscribe(
|
||||
tokenAddress,
|
||||
ERC20TokenEvents.Approval,
|
||||
indexFilterValues,
|
||||
callback,
|
||||
);
|
||||
await contractWrappers.erc20Token.setAllowanceAsync(
|
||||
tokenAddress,
|
||||
coinbase,
|
||||
addressWithoutFunds,
|
||||
allowanceAmount,
|
||||
);
|
||||
})().catch(done);
|
||||
});
|
||||
it('Should allow unsubscribeAll to be called successfully after an error', (done: DoneCallback) => {
|
||||
(async () => {
|
||||
const callback = (err: Error | null, _logEvent?: DecodedLogEvent<ERC20TokenApprovalEventArgs>) =>
|
||||
|
@@ -7,6 +7,7 @@ async callAsync(
|
||||
const functionSignature = '{{this.functionSignature}}';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
) as ethers.CallDescription;
|
||||
|
@@ -11,6 +11,7 @@ public {{this.tsName}} = {
|
||||
const self = this as any as {{contractName}}Contract;
|
||||
const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs;
|
||||
[{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]);
|
||||
const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}(
|
||||
{{> params inputs=inputs}}
|
||||
).data;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user