Compare commits
885 Commits
@0x/metaco
...
@0x/contra
Author | SHA1 | Date | |
---|---|---|---|
|
2abd8fe4ee | ||
|
3c578cfda9 | ||
|
597b2f38f5 | ||
|
8906c30f37 | ||
|
5744a7f61b | ||
|
f9a6c45a03 | ||
|
f8e84260b5 | ||
|
5a45bc5e7b | ||
|
80f03ef987 | ||
|
0f8acedf02 | ||
|
3a8f3e01b6 | ||
|
f9d436cd21 | ||
|
1534505652 | ||
|
a1186f052d | ||
|
0e76d66f24 | ||
|
2b523a36c5 | ||
|
78a6d23659 | ||
|
f4dc8b12f7 | ||
|
5cff911035 | ||
|
b3fa0c8dac | ||
|
318e7d5b57 | ||
|
a939433bd2 | ||
|
42be1a429f | ||
|
96b8100a78 | ||
|
e2b0c4d116 | ||
|
b4cdb14b9b | ||
|
d37680610b | ||
|
e6c1c2a658 | ||
|
36736f82d4 | ||
|
7b72b0c762 | ||
|
184acd874e | ||
|
eec9957831 | ||
|
c46870d296 | ||
|
4200064eab | ||
|
e72742f1f7 | ||
|
253bf4df6a | ||
|
dbc4417b19 | ||
|
74bbebeb01 | ||
|
40c0eebd38 | ||
|
5d6fabf528 | ||
|
928b253c81 | ||
|
b4c7f4f57f | ||
|
fc09968062 | ||
|
89755fe3c2 | ||
|
8fd7a9e1f5 | ||
|
5e6d1779cb | ||
|
c580f4ddcb | ||
|
7be2dab9d5 | ||
|
86f1697934 | ||
|
d578b4959d | ||
|
9f5eeed309 | ||
|
14ea4ee1d3 | ||
|
6d523835ae | ||
|
02e14f88d2 | ||
|
096c4c8f2b | ||
|
d050a1bd53 | ||
|
924c2705b2 | ||
|
6c86cc8ab8 | ||
|
dc21c79f2b | ||
|
b88ff0a19f | ||
|
8d93413a5d | ||
|
a0ea0415dd | ||
|
a39e0f13be | ||
|
190d9244cc | ||
|
9d8ab43f91 | ||
|
a286228b20 | ||
|
f14603ca4d | ||
|
4e33d2b481 | ||
|
b74b4eb053 | ||
|
57dc5b6fc0 | ||
|
5febb595e9 | ||
|
1a44d86c59 | ||
|
2bea70a0a6 | ||
|
41f90c697b | ||
|
7d2b5a28e3 | ||
|
7b1471ffe8 | ||
|
8b3b4d983f | ||
|
ac971685b3 | ||
|
4034eb7655 | ||
|
ccd8d4ac30 | ||
|
84f1d1107a | ||
|
c0637a744b | ||
|
51b1de041e | ||
|
897ba6591d | ||
|
10eb819c75 | ||
|
aa4fcebdc7 | ||
|
ac166ce32e | ||
|
dcad94df4c | ||
|
a699a12161 | ||
|
179f093c26 | ||
|
6438241144 | ||
|
c185618224 | ||
|
b0e7b82dd9 | ||
|
cae0e02bc6 | ||
|
83c1b7aec5 | ||
|
78d0ab1aa2 | ||
|
21122f0137 | ||
|
c282c2fcc4 | ||
|
e6acc0416a | ||
|
ea6547cb75 | ||
|
e839e698f9 | ||
|
b7603bef19 | ||
|
fb221e4ca9 | ||
|
1f8c09779d | ||
|
f9e73d2a6f | ||
|
08eb0b91b6 | ||
|
f2c5a8e2f1 | ||
|
55ebf405a0 | ||
|
92d4c1d09e | ||
|
3454bbfd65 | ||
|
b2dd5495bc | ||
|
69d4e330cf | ||
|
9eff857416 | ||
|
37dbb4d06f | ||
|
72a30260d8 | ||
|
a365ab11d2 | ||
|
48021a227f | ||
|
0a618f6f4d | ||
|
d0b2ee7fc1 | ||
|
b411e2250a | ||
|
740b73276f | ||
|
e0348f9c04 | ||
|
2e704ac01a | ||
|
00f86ca0f7 | ||
|
549f5e4655 | ||
|
ebdc539da7 | ||
|
2f50cca480 | ||
|
0a944244cf | ||
|
9aff0dfed0 | ||
|
40ac4509ca | ||
|
4e7031e96d | ||
|
0af1bf11c8 | ||
|
d579ba1eda | ||
|
f327d7b4d9 | ||
|
04226106a2 | ||
|
a138ee7e83 | ||
|
1cc043d7a9 | ||
|
a8a6baf964 | ||
|
243a099858 | ||
|
5c29b918df | ||
|
feb715a08b | ||
|
1b4c477ddb | ||
|
8b659dbd77 | ||
|
8721d4ed7a | ||
|
14ad091e83 | ||
|
ce013489ec | ||
|
8c21a700ba | ||
|
87ffa5d7ab | ||
|
7198b441e0 | ||
|
3d211c415b | ||
|
4061731245 | ||
|
96fdb9b766 | ||
|
1aa3f9d69f | ||
|
dea89c4e22 | ||
|
c6af5131b0 | ||
|
9986717671 | ||
|
5cad2ad174 | ||
|
24fd2d9730 | ||
|
0397ff8b22 | ||
|
1a25862086 | ||
|
b771020f88 | ||
|
b42cf0c797 | ||
|
8076333795 | ||
|
b0a2c10e11 | ||
|
303bbc42f4 | ||
|
10e93bb01f | ||
|
a948305e7a | ||
|
26280e4aba | ||
|
55bbe1954b | ||
|
2cbb82eb04 | ||
|
96134003e1 | ||
|
599a3f9b96 | ||
|
688d277b30 | ||
|
329c68f610 | ||
|
6fb333f200 | ||
|
410a924495 | ||
|
53cc9e9bed | ||
|
ccad046eb6 | ||
|
954c3b9272 | ||
|
9cb89725c9 | ||
|
830d0f3b21 | ||
|
8248fbb231 | ||
|
dca2a4e9c2 | ||
|
21d4807206 | ||
|
5e22a862b7 | ||
|
bb440b683a | ||
|
d959b3e234 | ||
|
aeff948c9a | ||
|
7945d2ea62 | ||
|
af2546bc58 | ||
|
3a19faa5ff | ||
|
bbe1a843ef | ||
|
91e7485ecc | ||
|
6c00dd6f39 | ||
|
ada78d140b | ||
|
6aca4e8272 | ||
|
dd093daf91 | ||
|
9ab55ccec0 | ||
|
71a015f2aa | ||
|
b0de2a388f | ||
|
40610830da | ||
|
60bc27c616 | ||
|
2207f09ce2 | ||
|
fe523e1f3f | ||
|
9e9104578c | ||
|
4e6919a6e5 | ||
|
d71fa65359 | ||
|
75d3f24835 | ||
|
2b7f94c00f | ||
|
cd73a047ef | ||
|
57e7119c0d | ||
|
8ad114c5e5 | ||
|
340493a0b1 | ||
|
01e1e5ac3b | ||
|
cb9f7a0664 | ||
|
3e4b77757e | ||
|
110d05f645 | ||
|
36f22ba069 | ||
|
b7d804e949 | ||
|
f576f78b4a | ||
|
dfe5752411 | ||
|
b1a8a5521e | ||
|
323195f4ad | ||
|
c43ba6b3c7 | ||
|
8d0192c1eb | ||
|
ac5a3fae9b | ||
|
9e01f4c9a3 | ||
|
18489161c6 | ||
|
d63576f495 | ||
|
f0213f9a8e | ||
|
e8d0aff333 | ||
|
79f5e36edb | ||
|
a872763413 | ||
|
55ebb04f03 | ||
|
6d312f0230 | ||
|
240a8a50d3 | ||
|
672a4b93ba | ||
|
ea4155e5fa | ||
|
d12b99883b | ||
|
1498e013d0 | ||
|
a1e985a1ca | ||
|
cd44dc7beb | ||
|
db21ae3af1 | ||
|
8c146ce231 | ||
|
703cea6173 | ||
|
1ce84f9bb2 | ||
|
48bfe92740 | ||
|
e592b27f77 | ||
|
1107b84949 | ||
|
7a03df946d | ||
|
d8a3fc0be0 | ||
|
2601d16efb | ||
|
098a531de8 | ||
|
239116eec4 | ||
|
e966641d14 | ||
|
e9fe7dcf54 | ||
|
7086bd32ee | ||
|
50bfbda79a | ||
|
50df67e751 | ||
|
247266b969 | ||
|
0bffc3d10e | ||
|
a882a39937 | ||
|
6b1fea602e | ||
|
afa24aa122 | ||
|
a5eb1bcc20 | ||
|
54aaee8e42 | ||
|
7934d77def | ||
|
cb8601676d | ||
|
98d9a9c648 | ||
|
da8c27c286 | ||
|
de1c296d28 | ||
|
f076cdb832 | ||
|
a192b309f3 | ||
|
c52d48d4db | ||
|
5edc3bfd33 | ||
|
cd4241fac8 | ||
|
3662ab2524 | ||
|
57986c0e1e | ||
|
1785769916 | ||
|
c5e43f8da5 | ||
|
8a42cea978 | ||
|
8c69a8f1fb | ||
|
9194537085 | ||
|
91397bf8a5 | ||
|
a355001d13 | ||
|
a6046bd5bb | ||
|
7e4f2c6bdc | ||
|
958f4aa8e8 | ||
|
74dac18e47 | ||
|
bcb4808c96 | ||
|
754be75dbf | ||
|
5d70fe053d | ||
|
8fda11ec3a | ||
|
a5b6ce6114 | ||
|
0d3fb79c05 | ||
|
e70d897282 | ||
|
c638823373 | ||
|
f8399fee2f | ||
|
52e63effea | ||
|
a219a8c911 | ||
|
de39ec3c97 | ||
|
665a855548 | ||
|
91d2cbfa0a | ||
|
68b0f71d26 | ||
|
91c89d90a5 | ||
|
980e3cb82f | ||
|
eefb1cfe5d | ||
|
5b0746a8ef | ||
|
0faa8b3231 | ||
|
450c72035f | ||
|
5a16e78b54 | ||
|
6d0c71ef30 | ||
|
e015f470dd | ||
|
d142413745 | ||
|
e339e1182d | ||
|
9bee3eba76 | ||
|
866c946b92 | ||
|
8f9a246f48 | ||
|
4668b0732c | ||
|
f4e0f74a6d | ||
|
6f44944ffd | ||
|
074944247d | ||
|
593ed12d91 | ||
|
c0f4a35cfd | ||
|
800016b430 | ||
|
937235c4fd | ||
|
4b6ac96a8d | ||
|
502e9c7be4 | ||
|
91b0fd9517 | ||
|
6a3f295b1f | ||
|
d9b4b0e0f3 | ||
|
c342940b5d | ||
|
b19700221f | ||
|
ef041d1603 | ||
|
e47dd4a83e | ||
|
9ebe8d63c8 | ||
|
94d81bd562 | ||
|
34b2f4736e | ||
|
f8daacc19a | ||
|
d77efb611e | ||
|
de8dcf9a72 | ||
|
12d34707b7 | ||
|
ab631060a0 | ||
|
f496096ce1 | ||
|
fc2055cd93 | ||
|
ca22d87290 | ||
|
d6ba7298d4 | ||
|
ea11e8c62d | ||
|
a7fc5975c1 | ||
|
09813cb1d8 | ||
|
9e69257b0d | ||
|
e65096ee7a | ||
|
a1d4aa66bc | ||
|
6c941eebea | ||
|
f1354632a1 | ||
|
7fe27e903b | ||
|
f80768cae0 | ||
|
702dbbae54 | ||
|
fc3641b499 | ||
|
e59d47eac8 | ||
|
d99bdcf036 | ||
|
4616c51e19 | ||
|
d4c439b277 | ||
|
0af07bcf49 | ||
|
a41dfa9ae0 | ||
|
09e2157639 | ||
|
6f394128d4 | ||
|
bd03df8af0 | ||
|
ea61c7a5db | ||
|
a864328ecf | ||
|
2b87d20290 | ||
|
b68273e592 | ||
|
5c66f9117f | ||
|
64e2b91482 | ||
|
ecc417069d | ||
|
bcb2af2861 | ||
|
906bba7d75 | ||
|
b15531fe68 | ||
|
42e83ae643 | ||
|
b55f7aef7f | ||
|
04503200e5 | ||
|
2da7cadefa | ||
|
b8ea322541 | ||
|
a172ab158e | ||
|
5c13353fb2 | ||
|
d6645b8a91 | ||
|
029b8d5950 | ||
|
14c094d050 | ||
|
f196dc9e35 | ||
|
e7bdf4717d | ||
|
f479212410 | ||
|
ffb8b0a619 | ||
|
1f693ea121 | ||
|
3f545da9f8 | ||
|
f31d4ddffd | ||
|
2e79ce26cb | ||
|
ad1b5af4e5 | ||
|
feb551a02e | ||
|
a8d707b462 | ||
|
3bf5a4e83f | ||
|
50344fa24a | ||
|
bab1c92c70 | ||
|
8f73f53c95 | ||
|
9a51af46ee | ||
|
bb4d02e413 | ||
|
22ce3e2e29 | ||
|
acd364b71c | ||
|
ebaf9dd275 | ||
|
d2d89adbdd | ||
|
58a2dfbc4d | ||
|
173fc1dcef | ||
|
dd8bb6d08b | ||
|
dc7092e1eb | ||
|
c638151b73 | ||
|
978a58105c | ||
|
dcc439c2e3 | ||
|
a895dacd4e | ||
|
5a748fb4e5 | ||
|
fee67326ad | ||
|
a47901370b | ||
|
d4d917f350 | ||
|
aed8b083b5 | ||
|
e6ab6f38ba | ||
|
5934e5a57b | ||
|
29d63cdf97 | ||
|
62e6b22789 | ||
|
0ed1819143 | ||
|
406b5739be | ||
|
fbbca8e283 | ||
|
0f7abcd59b | ||
|
2164b34bf9 | ||
|
b0ebc6fa14 | ||
|
6daa79ec12 | ||
|
acd570b2b3 | ||
|
0d65c9da4a | ||
|
67dd062a2f | ||
|
0c0bcb44d3 | ||
|
b213cb3974 | ||
|
5b187935dc | ||
|
d70d07366f | ||
|
9a0bd05c4c | ||
|
666075a87e | ||
|
b28f26916f | ||
|
a2ad15be0d | ||
|
a630312074 | ||
|
bc538c71fc | ||
|
880540f4b8 | ||
|
8a8b904a29 | ||
|
ebd4dbc6c6 | ||
|
1f9ea7ed1b | ||
|
5b0d554f7b | ||
|
71c050375b | ||
|
1f22ce6061 | ||
|
3ae434c31e | ||
|
063871e549 | ||
|
2d2255e9af | ||
|
93e967c3b3 | ||
|
b71577cc52 | ||
|
27cb966991 | ||
|
457cb1dc84 | ||
|
7c733662e2 | ||
|
52474a0b8e | ||
|
2a6b358717 | ||
|
c5d252ba4a | ||
|
9b1f56c968 | ||
|
13d456fda1 | ||
|
a9e3d489d6 | ||
|
707a93e9f9 | ||
|
bb7dd23738 | ||
|
59206c387e | ||
|
20f1526c7d | ||
|
addfe85f08 | ||
|
58177060a4 | ||
|
3027e6bc0d | ||
|
41e01e9806 | ||
|
0835cf0ea2 | ||
|
1f7fbcf52c | ||
|
2802aed79c | ||
|
78498b7019 | ||
|
1ca23b35ab | ||
|
8b91727364 | ||
|
8f61f6d0f9 | ||
|
180d1ca63a | ||
|
e59669c949 | ||
|
687e6ccdd3 | ||
|
3bc45395cc | ||
|
e95aa617b6 | ||
|
637ab1076a | ||
|
a13099bde3 | ||
|
1600820dea | ||
|
993c5f4b4a | ||
|
af27dd6fe4 | ||
|
02f37fa2d9 | ||
|
2b4febe337 | ||
|
9f35096fa9 | ||
|
39fa26b2f3 | ||
|
7de7fe7823 | ||
|
5053c19599 | ||
|
f35cf03030 | ||
|
91a08b9fdd | ||
|
cef254fa8c | ||
|
e2b115a15c | ||
|
f6cf3de1c4 | ||
|
ef5ba0375a | ||
|
dfa9e435af | ||
|
fc0e7b1132 | ||
|
b99252baae | ||
|
7196046e2f | ||
|
96bcc7e332 | ||
|
d5dbd8cd68 | ||
|
bce62056d9 | ||
|
331cca37e2 | ||
|
a1cff862c9 | ||
|
79126f3b4a | ||
|
77d6594ecb | ||
|
7625935222 | ||
|
0f01e31cc3 | ||
|
1eb19ca1ec | ||
|
6222c952c3 | ||
|
b9c983b4d6 | ||
|
208ee935c8 | ||
|
ec01893e9c | ||
|
f4cc14f438 | ||
|
e5b09ba2fd | ||
|
105dcd73e4 | ||
|
63cb312c7f | ||
|
85d1dba1ef | ||
|
e1c237a8e4 | ||
|
9608d6fc71 | ||
|
7479a7db58 | ||
|
6e3378d79f | ||
|
1375d694ac | ||
|
045336042f | ||
|
0a1425d8d8 | ||
|
7daf995e0d | ||
|
8b05db3510 | ||
|
c2fd6745ee | ||
|
a747abcb73 | ||
|
92a4b09b05 | ||
|
6c76731408 | ||
|
3d88b7f289 | ||
|
d3e6f78fdb | ||
|
16ddd21a5f | ||
|
6c43fa8f72 | ||
|
8a4e5dfb68 | ||
|
f83c4c51c7 | ||
|
7a726e2740 | ||
|
5415d1589e | ||
|
3c000e70e3 | ||
|
06b2f12b10 | ||
|
1b23c430fc | ||
|
ca894935f2 | ||
|
53f8e1b3b4 | ||
|
4861e48059 | ||
|
c0b9214138 | ||
|
9266df43a4 | ||
|
dac0bee95c | ||
|
708f4e9bb8 | ||
|
0b9e9eb0e4 | ||
|
743c43f768 | ||
|
7b51eddc03 | ||
|
6f92f0a7b5 | ||
|
b773d5e592 | ||
|
a0bc97b589 | ||
|
d146e15ff3 | ||
|
037e63ab49 | ||
|
8b80d28029 | ||
|
d3739488ae | ||
|
494adedeef | ||
|
f0ed0c6a35 | ||
|
c5d6b925e4 | ||
|
856f4b473b | ||
|
b95d73d176 | ||
|
462a5face9 | ||
|
47a87e57f1 | ||
|
768c28f328 | ||
|
b50187f59c | ||
|
96a46bcb4b | ||
|
4653e4c011 | ||
|
372a242ea2 | ||
|
fb1893626f | ||
|
5fd837cc4f | ||
|
435e62a94d | ||
|
598db72523 | ||
|
4ebc561986 | ||
|
d23fd23e91 | ||
|
6e2523625f | ||
|
23274f9b48 | ||
|
7efa71eaf6 | ||
|
9c27feeff6 | ||
|
be787a0fd1 | ||
|
ee5b6ad77f | ||
|
e08fb72cf1 | ||
|
fdc4a4e5fa | ||
|
ef2c5159dd | ||
|
f0f991245c | ||
|
d3b0162dc9 | ||
|
f3d08c13eb | ||
|
10cc46779e | ||
|
80a53aedf2 | ||
|
1b96867df8 | ||
|
0192127e5d | ||
|
7610130f73 | ||
|
218c0d9f51 | ||
|
d5898a3a05 | ||
|
b055055253 | ||
|
6e3d70af56 | ||
|
ae570dba05 | ||
|
2795849dd3 | ||
|
fad48b8b6c | ||
|
685d83d6d0 | ||
|
35d8525f55 | ||
|
faf80f8595 | ||
|
9206f2d288 | ||
|
2fec7613c4 | ||
|
2f026cd1b6 | ||
|
6eec84d21b | ||
|
5f6a5e28e7 | ||
|
825911ed89 | ||
|
a72d418ddb | ||
|
cf5fd8ff42 | ||
|
994c6032bb | ||
|
271adcdb7e | ||
|
717a3bce8c | ||
|
1494a70bad | ||
|
6d565f4bff | ||
|
c6592148a7 | ||
|
6e39f11db1 | ||
|
ee86cd1dcc | ||
|
420a677828 | ||
|
9da43878b1 | ||
|
527f074e59 | ||
|
eefd9d9dd2 | ||
|
2648f5ba65 | ||
|
1b45aa5974 | ||
|
dcf19e5226 | ||
|
c5c852f54f | ||
|
7b15217694 | ||
|
8caded1d1d | ||
|
ebc3116909 | ||
|
387d7199d1 | ||
|
dc965da64e | ||
|
1d83d99d87 | ||
|
09a683557b | ||
|
99e92a346b | ||
|
9ddd45e2c6 | ||
|
0c0a1db114 | ||
|
b1474973cd | ||
|
f0f6b26c3b | ||
|
03b3b80a65 | ||
|
06cc66005c | ||
|
b0792a85a4 | ||
|
a5359df002 | ||
|
10c9d0b723 | ||
|
5c81f07d46 | ||
|
0adc8f5053 | ||
|
804de89796 | ||
|
c6ae7b8d3f | ||
|
6604e2db20 | ||
|
f46a49fd13 | ||
|
707af1ec58 | ||
|
31d1b4ba67 | ||
|
d750225554 | ||
|
93672c01af | ||
|
921d9d7ed5 | ||
|
b2e1be5cfe | ||
|
95a80a0e75 | ||
|
e2a16f3f33 | ||
|
ed91c6c874 | ||
|
70c9908249 | ||
|
ffa2f4554b | ||
|
22a3124662 | ||
|
68c15de890 | ||
|
71d15a68c1 | ||
|
35b5051148 | ||
|
3273117888 | ||
|
8ea2eb9102 | ||
|
b494a4a4db | ||
|
e0beb7fb38 | ||
|
fc123871ad | ||
|
f27fef0295 | ||
|
36974a9557 | ||
|
584dc6217d | ||
|
edf07d9b5b | ||
|
f66b695a47 | ||
|
61b3305af3 | ||
|
e2b3c98d25 | ||
|
39429dde68 | ||
|
baf69a60eb | ||
|
a90be44c9f | ||
|
fb7ac81945 | ||
|
db26ca977f | ||
|
a8803431b3 | ||
|
2821bac3a3 | ||
|
716168132a | ||
|
351e0e6f5f | ||
|
0244d04a55 | ||
|
895281989c | ||
|
21f39079c8 | ||
|
c2ebcfb023 | ||
|
15f05733be | ||
|
7741edbbcc | ||
|
1593b94aac | ||
|
4b64d8c3aa | ||
|
6124d80c89 | ||
|
48aec9ef47 | ||
|
1a7b167f63 | ||
|
b7eb2e887d | ||
|
094aabfcee | ||
|
eca63b1a58 | ||
|
f5db4be521 | ||
|
d79c754a5b | ||
|
934570d12f | ||
|
748e3c0c53 | ||
|
728617fed2 | ||
|
05d45e7146 | ||
|
d2dd5f93d2 | ||
|
ac1ffe53df | ||
|
2bda6dd719 | ||
|
cd4600b081 | ||
|
83f4fa92a5 | ||
|
7ad5dbc59d | ||
|
ba41fc9275 | ||
|
36e888c3a5 | ||
|
6939182348 | ||
|
7a38a196ad | ||
|
0c91bf1415 | ||
|
e1bc3f3f2d | ||
|
e5cfc94cd2 | ||
|
22cfdd9f0b | ||
|
0ba34f587c | ||
|
e86982bd41 | ||
|
6de499459c | ||
|
3169b72406 | ||
|
db6b2cbb05 | ||
|
a1b7f0ad83 | ||
|
b62fbd0b13 | ||
|
578a46c57f | ||
|
9ab55fd07d | ||
|
497385818b | ||
|
c30ae762bf | ||
|
953f8c119b | ||
|
6119bd3115 | ||
|
1880c7c27d | ||
|
8772d91699 | ||
|
9b725a645d | ||
|
2bfd03e64f | ||
|
e23f90b82c | ||
|
0648e270fe | ||
|
3d6711bd38 | ||
|
99541f89f7 | ||
|
4cb138ab37 | ||
|
8b8e277b75 | ||
|
94de441de7 | ||
|
43443d6057 | ||
|
4caacc78a1 | ||
|
302d172aad | ||
|
21046e4349 | ||
|
9914f7edef | ||
|
1426145946 | ||
|
6fe4aef6f7 | ||
|
3f0d94c838 | ||
|
9384c507ac | ||
|
097bfe581d | ||
|
ac942faa25 | ||
|
654c13df8a | ||
|
6e2fbcdb3e | ||
|
51dce30088 | ||
|
a4f6cd21bd | ||
|
1564415e5d | ||
|
9a53a29b1f | ||
|
83a6d7b97d | ||
|
e8be70da10 | ||
|
4d7bd15334 | ||
|
f7914af9c5 | ||
|
848193074a | ||
|
31ffa65f59 | ||
|
21ae0c46e1 | ||
|
d64bc28ba6 | ||
|
b6e6607c46 | ||
|
d8c6b36cff | ||
|
e00c41ad88 | ||
|
9c182fe6e4 | ||
|
cbcb954c30 | ||
|
42565869a4 | ||
|
85a99203d0 | ||
|
988bb398bc | ||
|
ed62271cda | ||
|
74254636b4 | ||
|
db7f74f99f | ||
|
45a1899ead | ||
|
1626e284cd | ||
|
c5d208c90e | ||
|
a3ccd42093 | ||
|
cb3e7b4120 | ||
|
7e58f21a74 | ||
|
3add465edb | ||
|
df71dba8ed | ||
|
5c4ad3505a | ||
|
37d60dc39e | ||
|
59c473dc33 | ||
|
5f9c7d8cfa | ||
|
9a6bc4f05f | ||
|
ef860c5a58 | ||
|
d19a9acd6b | ||
|
416fec7a97 | ||
|
25d0b1e6e5 | ||
|
e36fc4e6ae | ||
|
0a5364ff35 | ||
|
cabb7432b9 | ||
|
9726c375af | ||
|
f582cc327b | ||
|
7534c0f19e | ||
|
004e197863 | ||
|
ae1fb97794 | ||
|
79397d4b15 | ||
|
b7fd0ee74c | ||
|
3931202d4a | ||
|
2cf3d4ff83 | ||
|
bc14ae5d8b | ||
|
d4a8cd1f1c | ||
|
e9b298931a | ||
|
f8681a7780 | ||
|
fb3c2e1fb0 | ||
|
9adfd1f323 | ||
|
8c96720080 | ||
|
d0609d7131 | ||
|
33a156d9b5 | ||
|
20e3a22d5d | ||
|
312dfb9572 | ||
|
447b0f91f9 | ||
|
ed26f5af98 | ||
|
28d105a1af | ||
|
fd4a782bdd | ||
|
587739f8e1 | ||
|
4da574560d | ||
|
f9e0123986 | ||
|
f4cc152cfb | ||
|
29747a0487 | ||
|
b01db9141b | ||
|
71aeb7cddc | ||
|
34d86647bf | ||
|
a8863ac85e | ||
|
ca9bb45327 | ||
|
450814ad80 | ||
|
0a38bf8fd6 | ||
|
2e61050a22 | ||
|
1dd903ddcc | ||
|
61f227e123 | ||
|
633d17ffde | ||
|
20ed4fbbd4 | ||
|
39bb855a9c | ||
|
b2a26ef21a | ||
|
d895b0296f | ||
|
b45167422b | ||
|
8e81b0680f | ||
|
408bbdb52e | ||
|
f2a6feff29 | ||
|
7ccf9cd48e | ||
|
8afcba7ba1 | ||
|
2eef766aff | ||
|
fe23bf9e51 | ||
|
1aae112d0e | ||
|
504f4d9eb9 | ||
|
daf5719f08 | ||
|
e9754b4c08 | ||
|
adce627888 | ||
|
7688037fb8 | ||
|
997912a8f8 | ||
|
b961cb1952 | ||
|
e1d64def20 | ||
|
80e7e84a06 | ||
|
15105cde0f | ||
|
921ef90a14 | ||
|
1a1caa1ca2 | ||
|
af6aa2df93 | ||
|
fe1746c7ac | ||
|
d19c8ae9b1 | ||
|
84215f75e0 | ||
|
35bfd493e8 | ||
|
c8b2a975f4 | ||
|
8a64599ca5 | ||
|
9b1ec5baaa | ||
|
954fe3f549 | ||
|
4a444591c1 |
@@ -18,6 +18,7 @@ jobs:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
|
||||
- run: yarn build:ci:no_website
|
||||
- run: yarn build:ts
|
||||
- save_cache:
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -40,7 +41,12 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci contracts
|
||||
- run: yarn wsrun test:circleci @0x/contracts-multisig
|
||||
- run: yarn wsrun test:circleci @0x/contracts-utils
|
||||
- run: yarn wsrun test:circleci @0x/contracts-libs
|
||||
- run: yarn wsrun test:circleci @0x/contracts-tokens
|
||||
- run: yarn wsrun test:circleci @0x/contracts-extensions
|
||||
- run: yarn wsrun test:circleci @0x/contracts-protocol
|
||||
test-contracts-geth:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
@@ -52,7 +58,12 @@ jobs:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||
# initialized
|
||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
|
||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
|
||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
|
||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs
|
||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
|
||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions
|
||||
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol
|
||||
test-publish:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
@@ -73,6 +84,20 @@ jobs:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn test:generate_docs:circleci
|
||||
test-pipeline:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: postgres:11-alpine
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: ZEROEX_DATA_PIPELINE_TEST_DB_URL='postgresql://postgres@localhost/postgres' yarn wsrun test:circleci @0x/pipeline
|
||||
- save_cache:
|
||||
key: coverage-pipeline-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/pipeline/coverage/lcov.info
|
||||
test-rest:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
@@ -81,6 +106,7 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run: yarn wsrun test:circleci @0x/contracts-test-utils
|
||||
- run: yarn wsrun test:circleci @0x/abi-gen
|
||||
- run: yarn wsrun test:circleci @0x/assert
|
||||
- run: yarn wsrun test:circleci @0x/base-contract
|
||||
@@ -165,6 +191,9 @@ jobs:
|
||||
- image: 0xorg/ganache-cli
|
||||
command: |
|
||||
ganache-cli --gasLimit 10000000 --noVMErrorsOnRPCResponse --db /snapshot --noVMErrorsOnRPCResponse -p 8545 --networkId 50 -m "concert load couple harbor equip island argue ramp clarify fence smart topic"
|
||||
- image: 0xorg/launch-kit-ci
|
||||
command: |
|
||||
yarn start:ts -p 3000:3000
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
@@ -176,6 +205,11 @@ jobs:
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/sra_client
|
||||
python -m ensurepip
|
||||
python -m pip install -e .
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -189,10 +223,18 @@ jobs:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
coverage run setup.py test
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/sra_client
|
||||
coverage run setup.py test
|
||||
- save_cache:
|
||||
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/order_utils/.coverage
|
||||
- save_cache:
|
||||
key: coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/sra_client/.coverage
|
||||
test-rest-python:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
@@ -331,6 +373,9 @@ workflows:
|
||||
- test-contracts-geth:
|
||||
requires:
|
||||
- build
|
||||
- test-pipeline:
|
||||
requires:
|
||||
- build
|
||||
- test-rest:
|
||||
requires:
|
||||
- build
|
||||
|
39
.github/autolabeler.yml
vendored
Normal file
39
.github/autolabeler.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
python: ['python-packages']
|
||||
contracts: ['contracts']
|
||||
sol-doc: ['packages/sol-doc']
|
||||
sol-resolver: ['packages/sol-resolver']
|
||||
sra-spec: ['packages/sra-spec']
|
||||
subproviders: ['packages/subproviders']
|
||||
contract-addresses: ['packages/contract-addresses']
|
||||
migrations: ['packages/migrations']
|
||||
web3-wrapper: ['packages/web3-wrapper']
|
||||
sol-compiler: ['packages/sol-compiler']
|
||||
types: ['packages/types']
|
||||
instant: ['packages/instant']
|
||||
abi-gen-templates: ['packages/abi-gen-templates']
|
||||
abi-gen: ['packages/abi-gen']
|
||||
website: ['packages/website']
|
||||
sol-cov: ['packages/sol-cov']
|
||||
utils: ['packages/utils']
|
||||
tslint-config: ['packages/tslint-config']
|
||||
asset-buyer: ['packages/asset-buyer']
|
||||
order-watcher: ['packages/order-watcher']
|
||||
react-docs: ['packages/react-docs']
|
||||
order-utils: ['packages/order-utils']
|
||||
react-shared: ['packages/react-shared']
|
||||
assert: ['packages/assert']
|
||||
base-contract: ['packages/base-contract']
|
||||
typescript-typings: ['packages/typescript-typings']
|
||||
0x.js: ['packages/0x.js']
|
||||
abi-gen-wrappers: ['packages/abi-gen-wrappers']
|
||||
metacoin: ['packages/metacoin']
|
||||
contract-artifacts: ['packages/contract-artifacts']
|
||||
dev-utils: ['packages/dev-utils']
|
||||
contract-wrappers: ['packages/contract-wrappers']
|
||||
json-schemas: ['packages/json-schemas']
|
||||
ethereum-types: ['ethereum-types']
|
||||
connect: ['packages/connect']
|
||||
fill-scenarios: ['packages/fill-scenarios']
|
||||
dev-tools-pages: ['packages/dev-tools-pages']
|
||||
testnet-faucets: ['packages/testnet-faucets']
|
||||
monorepo-scripts: ['packages/monorepo-scripts']
|
19
.github/stale.yml
vendored
Normal file
19
.github/stale.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: >
|
||||
This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you
|
||||
for your contributions.
|
22
.gitignore
vendored
22
.gitignore
vendored
@@ -11,6 +11,10 @@ pids
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# SQLite database files
|
||||
*.db
|
||||
*.sqlite
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
@@ -79,13 +83,27 @@ packages/react-docs/example/public/bundle*
|
||||
packages/testnet-faucets/server/
|
||||
|
||||
# generated contract artifacts/
|
||||
packages/contracts/generated-artifacts/
|
||||
contracts/protocol/generated-artifacts/
|
||||
contracts/multisig/generated-artifacts/
|
||||
contracts/utils/generated-artifacts/
|
||||
contracts/libs/generated-artifacts/
|
||||
contracts/interfaces/generated-artifacts/
|
||||
contracts/tokens/generated-artifacts/
|
||||
contracts/examples/generated-artifacts/
|
||||
contracts/extensions/generated-artifacts/
|
||||
packages/sol-cov/test/fixtures/artifacts/
|
||||
packages/metacoin/artifacts/
|
||||
|
||||
# generated contract wrappers
|
||||
packages/abi-gen-wrappers/wrappers
|
||||
packages/contracts/generated-wrappers/
|
||||
contracts/protocol/generated-wrappers/
|
||||
contracts/multisig/generated-wrappers/
|
||||
contracts/utils/generated-wrappers/
|
||||
contracts/libs/generated-wrappers/
|
||||
contracts/interfaces/generated-wrappers/
|
||||
contracts/tokens/generated-wrappers/
|
||||
contracts/examples/generated-wrappers/
|
||||
contracts/extensions/generated-wrappers/
|
||||
packages/metacoin/src/contract_wrappers
|
||||
|
||||
# solc-bin in sol-compiler
|
||||
|
@@ -1,11 +1,26 @@
|
||||
lib
|
||||
.nyc_output
|
||||
/packages/contracts/generated-wrappers
|
||||
/packages/contracts/generated-artifacts
|
||||
/contracts/protocol/generated-wrappers
|
||||
/contracts/protocol/generated-artifacts
|
||||
/contracts/multisig/generated-wrappers
|
||||
/contracts/multisig/generated-artifacts
|
||||
/contracts/utils/generated-wrappers
|
||||
/contracts/utils/generated-artifacts
|
||||
/contracts/libs/generated-wrappers
|
||||
/contracts/libs/generated-artifacts
|
||||
/contracts/interfaces/generated-wrappers
|
||||
/contracts/interfaces/generated-artifacts
|
||||
/contracts/tokens/generated-wrappers
|
||||
/contracts/tokens/generated-artifacts
|
||||
/contracts/examples/generated-wrappers
|
||||
/contracts/examples/generated-artifacts
|
||||
/contracts/extensions/generated-wrappers
|
||||
/contracts/extensions/generated-artifacts
|
||||
/packages/abi-gen-wrappers/src/generated-wrappers
|
||||
/packages/contract-artifacts/artifacts
|
||||
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
|
||||
/packages/json-schemas/schemas
|
||||
/python-packages/order_utils/src/zero_ex/json_schemas/schemas
|
||||
/packages/metacoin/src/contract_wrappers
|
||||
/packages/metacoin/artifacts
|
||||
/packages/sra-spec/public/
|
||||
|
@@ -14,7 +14,7 @@ packages/website/ @BMillman19 @fragosti @fabioberger @steveklebanoff
|
||||
packages/abi-gen/ @LogvinovLeon
|
||||
packages/base-contract/ @LogvinovLeon
|
||||
packages/connect/ @fragosti
|
||||
packages/contract_templates/ @LogvinovLeon
|
||||
packages/abi-gen-templates/ @LogvinovLeon
|
||||
packages/contract-addresses/ @albrow
|
||||
packages/contract-artifacts/ @albrow
|
||||
packages/dev-utils/ @LogvinovLeon @fabioberger
|
||||
@@ -32,4 +32,4 @@ packages/web3-wrapper/ @LogvinovLeon @fabioberger
|
||||
python-packages/ @feuGeneA
|
||||
|
||||
# Protocol/smart contracts
|
||||
packages/contracts/test/ @albrow
|
||||
contracts/core/test/ @albrow
|
||||
|
@@ -1,61 +1,92 @@
|
||||
## 0x Contribution Guide
|
||||
|
||||
Thank you for your interest in contributing to 0x protocol! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
|
||||
We welcome contributions from anyone on the internet and are grateful for even the smallest contributions. This document will help get you setup to start contributing back to 0x.
|
||||
|
||||
### How to contribute
|
||||
### Getting started
|
||||
|
||||
If you'd like to contribute to 0x protocol, please fork the repo, fix, commit and send a pull request against the `development` branch for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, please check with a core dev first on [our RocketChat #dev channel](http://chat.0xproject.com) to ensure those changes are in-line with the general philosophy of the project and/or to get some early feedback which can make both your efforts easier as well as our review and merge procedures quick and simple.
|
||||
1. Fork `0xproject/0x-monorepo`
|
||||
2. Clone your fork
|
||||
3. Follow the [installation & build steps](https://github.com/0xProject/0x-monorepo#install-dependencies) in the repo's top-level README.
|
||||
4. Setup the recommended [Development Tooling](#development-tooling).
|
||||
5. Open a PR with the `[WIP]` flag against the `development` branch and describe the change you are intending to undertake in the PR description. (see [our branch naming conventions](#branch-structure))
|
||||
|
||||
We encourage a “PR early” approach so create the PR as early as possible even without the fix/feature ready, so that devs and other contributors know you have picked up the issue. These early PRs should indicate an 'in progress' status by adding the '[WIP]' prefix to the PR title. Please make sure your contributions adhere to our coding guidelines:
|
||||
Before removing the `[WIP]` tag and submitting the PR for review, make sure:
|
||||
|
||||
* Pull requests adding features or refactoring should be opened against the `development` branch
|
||||
* Pull requests fixing bugs in the latest release version should be opened again the `master` branch
|
||||
* Write [good commit messages](https://chris.beams.io/posts/git-commit/)
|
||||
* It passes our linter checks (`yarn lint`)
|
||||
* It is properly formatted with Prettier (`yarn prettier`)
|
||||
* It passes our continuous integration tests (See: [Enabling code coverage checks on your fork](#enabling-code-coverage-checks-on-your-fork) for instructions on getting the `submit-coverage` test to pass on forks)
|
||||
* You've created/updated the corresponding [CHANGELOG](#CHANGELOGs) entries.
|
||||
* Your changes have sufficient test coverage (e.g regression tests have been added for bug fixes)
|
||||
|
||||
### Code quality
|
||||
### Branch structure
|
||||
|
||||
Because 0x.js is used by multiple relayers in production and their businesses depend on it, we strive for exceptional code quality. Please follow the existing code standards and conventions. `tslint` and `prettier` (described below) will help you.
|
||||
We have two main branches:
|
||||
|
||||
If you're adding functionality, please also add tests and make sure they pass. We have an automatic coverage reporting tool, so we'll see it if they are missing ;)
|
||||
If you're adding a new public function/member, make sure you document it with Java doc-style comments. We use typedoc to generate [awesome documentation](https://0xproject.com/docs/0xjs) from the comments within our source code.
|
||||
* `master` represents the most recently released (published on npm) version of the codebase.
|
||||
* `development` represents the current development state of the codebase.
|
||||
|
||||
If the sub-package you are modifying has a `CHANGELOG.md` file, make sure to add an entry in it for the change made to the package. For published packages, only changes that modify the public interface or behavior of the package need a CHANGELOG entry.
|
||||
ALL PRs should be opened against `development`.
|
||||
|
||||
#### Enabling code coverage checks on your fork
|
||||
Branch names should be prefixed with `fix`, `feature` or `refactor`.
|
||||
|
||||
If you simply fork the repo and then create a PR sourced from it, your PR will fail its test coverage check. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for 0xProject/0x-monorepo, but when running the check against your fork the token needs to match the repo that is your fork, rather than the 0x repo.
|
||||
* e.g `fix/broken-wiki-link`
|
||||
* If the PR only edits a single package, add it's name too
|
||||
* e.g `fix/website/broken-wiki-link`
|
||||
|
||||
To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following:
|
||||
### CHANGELOGs
|
||||
|
||||
1. Log in to [coveralls.io](https://coveralls.io/), go to Add Repos, and enable your fork. Then go to the settings for that repo, and copy the Repo Token identifier.
|
||||
2. Log in to [CircleCI](https://circleci.com/login), go to Add Projects, click the Set Up Project button corresponding to your fork, and then click Start Building. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-monorepo, so you can ignore all of the instruction/explanation given on the page with the Start Building button.)
|
||||
3. In CircleCI, configure your project to add an Environment Variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the Repo Token you copied in step 1.
|
||||
At 0x we use [Semantic Versioning](http://semver.org/) for all our published packages. If a change you make corresponds to a semver bump, you must modify the package's `CHANGELOG.json` file accordingly.
|
||||
|
||||
Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper Repo Token, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance.
|
||||
Each CHANGELOG entry that corresponds to a published package will have a `timestamp`. If no entry exists without a `timestamp`, you must first create a new one:
|
||||
|
||||
### Styleguide
|
||||
```
|
||||
{
|
||||
"version": "1.0.1", <- The updated package version
|
||||
"changes": [
|
||||
{
|
||||
"note": "", <- Describe your change
|
||||
"PR": 100 <- Your PR number
|
||||
}
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) to keep our code style consistent.
|
||||
If an entry without a `timestamp` already exists, this means other changes have been introduced by other collaborators since the last publish. Add your changes to the list of notes and adjust the version if your PR introduces a greater semver change (i.e current changes required a patch bump, but your changes require a major version bump).
|
||||
|
||||
To lint your code just run: `yarn lint`
|
||||
### Development Tooling
|
||||
|
||||
We also use [Prettier](https://prettier.io/) to auto-format our code. Be sure to either add a [text editor integration](https://prettier.io/docs/en/editors.html) or a [pre-commit hook](https://prettier.io/docs/en/precommit.html) to properly format your code changes.
|
||||
We strongly recommend you use the [VSCode](https://code.visualstudio.com/) text editor since most of our code is written in Typescript and it offers amazing support for the language.
|
||||
|
||||
#### Linter
|
||||
|
||||
We use [TSLint](https://palantir.github.io/tslint/) with [custom configs](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) to keep our code-style consistent.
|
||||
|
||||
Use `yarn:lint` to lint the entire monorepo, and `PKG={PACKAGE_NAME} yarn lint` to lint a specific package.
|
||||
|
||||
If you want to change a rule, or add a custom rule, please make these changes to our [tslint-config](https://github.com/0xProject/0x-monorepo/tree/development/packages/tslint-config) package. All other packages have it as a dependency.
|
||||
|
||||
Integrate it into your text editor:
|
||||
|
||||
* VSCode: [vscode-tslint](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)
|
||||
* Atom: [linter-tslint](https://atom.io/packages/linter-tslint)
|
||||
|
||||
#### Auto-formatter
|
||||
|
||||
We use [Prettier](https://prettier.io/) to auto-format our code. Be sure to either add a [text editor integration](https://prettier.io/docs/en/editors.html) or a [pre-commit hook](https://prettier.io/docs/en/precommit.html) to properly format your code changes.
|
||||
|
||||
If using the Atom text editor, we recommend you install the following packages:
|
||||
|
||||
* [atom-typescript](https://atom.io/packages/atom-typescript)
|
||||
* [linter-tslint](https://atom.io/packages/linter-tslint)
|
||||
* [prettier-atom](https://atom.io/packages/prettier-atom)
|
||||
* [language-ethereum](https://atom.io/packages/language-ethereum)
|
||||
* VSCode: [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
* Atom: [prettier-atom](https://atom.io/packages/prettier-atom)
|
||||
|
||||
Our CI will also run TSLint and Prettier as a part of the test run when you submit your PR. Make sure that the CI tests pass for your contribution.
|
||||
## Fix `submit-coverage` CI failure
|
||||
|
||||
### Branch structure & versioning
|
||||
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-monorepo`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-monorepo`.
|
||||
|
||||
We use [semantic versioning](http://semver.org/), but before a package reaches v1.0.0 all breaking changes as well as new features will be minor version bumps.
|
||||
To facilitate this check, after creating your fork, but before creating the branch for your PR, do the following:
|
||||
|
||||
We have two main branches: `master` and `development`.
|
||||
1. Log in to [coveralls.io](https://coveralls.io/), go to `Add Repos`, and enable your fork. Then go to the settings for that repo, and copy the `Repo Token` identifier.
|
||||
2. Log in to [CircleCI](https://circleci.com/login), go to `Add Projects`, click the `Set Up Project` button corresponding to your fork, and then click `Start Building`. (Aside from step 3 below, no actual set up is needed, since it will use the `.circleci/config.yml` file in 0x-monorepo, so you can ignore all of the instruction/explanation given on the page with the `Start Building` button.)
|
||||
3. In CircleCI, configure your project to add an environment variable, with name `COVERALLS_REPO_TOKEN`, and for the value paste in the `Repo Token` you copied in step 1.
|
||||
|
||||
`master` represents the most recent released (published on npm) version.
|
||||
|
||||
`development` represents the development state and is a default branch to which you will submit a PR. We use this structure so that we can push hotfixes to the currently released version without needing to publish all the changes made towards the next release. If a hotfix is implemented on `master`, it is back-ported to `development`.
|
||||
Now, when you push to your branch, CircleCI will automatically run all of the checks in your own instance, and the coverage check will work since it has the proper `Repo Token`, and the PR will magically refer to your own checks rather than running them in the 0x CircleCI instance.
|
||||
|
@@ -46,10 +46,14 @@
|
||||
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
|
||||
| Package | Version |
|
||||
| ------------------: | :------ |
|
||||
| `0x.js` | 0.25.0 |
|
||||
| `Exchange Contract` | v1 |
|
||||
| Package | Version |
|
||||
| ------: | :------ |
|
||||
|
||||
|
||||
<!-- For example:
|
||||
| `0x.js` | 2.0.4 |
|
||||
| `Exchange Contract` | v2 |
|
||||
-->
|
||||
|
||||
| Network |
|
||||
| ------- |
|
||||
|
4
LICENSE
4
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright 2017 ZeroEx Inc.
|
||||
Copyright 2017 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
limitations under the License.
|
||||
|
@@ -21,7 +21,6 @@
|
||||
<!--- 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! -->
|
||||
|
||||
* [ ] 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.
|
||||
|
115
README.md
115
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
---
|
||||
|
||||
[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. A full description of the protocol may be found in our [whitepaper][whitepaper-url].
|
||||
[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. For more information on how it works, check out the [0x protocol specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
||||
|
||||
This repository is a monorepo including the 0x protocol smart contracts and numerous developer tools. Each public sub-package is independently published to NPM.
|
||||
|
||||
@@ -18,63 +18,74 @@ If you're developing on 0x now or are interested in using 0x infrastructure in t
|
||||
[](https://gitter.im/0xProject/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
### Published Packages
|
||||
## Packages
|
||||
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [`0x.js`](/packages/0x.js) | [](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
|
||||
| [`@0x/abi-gen`](/packages/abi-gen) | [](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
|
||||
| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using @0x/abi-gen |
|
||||
| [`@0x/assert`](/packages/assert) | [](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
|
||||
| [`@0x/asset-buyer`](/packages/asset-buyer) | [](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
|
||||
| [`@0x/base-contract`](/packages/base-contract) | [](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
|
||||
| [`@0x/connect`](/packages/connect) | [](https://www.npmjs.com/package/@0x/connect) | A Javascript library for interacting with the Standard Relayer API |
|
||||
| [`@0x/contract-addresses`](/packages/contract-addresses) | [](https://www.npmjs.com/package/@0x/contract-addresses) | Used to get known addresses of deployed 0x contracts |
|
||||
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
|
||||
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [](https://www.npmjs.com/package/@0x/contract-wrappers) | Smart TS wrappers for 0x smart contracts |
|
||||
| [`@0x/dev-utils`](/packages/dev-utils) | [](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x projects and packages |
|
||||
| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generation |
|
||||
| [`@0x/json-schemas`](/packages/json-schemas) | [](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related json schemas |
|
||||
| [`@0x/migrations`](/packages/migrations) | [](https://www.npmjs.com/package/@0x/migrations) | 0x smart contract migrations |
|
||||
| [`@0x/order-utils`](/packages/order-utils) | [](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| [`@0x/order-watcher`](/packages/order-watcher) | [](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
|
||||
| [`@0x/react-docs`](/packages/react-docs) | [](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
|
||||
| [`@0x/react-shared`](/packages/react-shared) | [](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
|
||||
| [`@0x/sol-compiler`](/packages/sol-compiler) | [](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties |
|
||||
| [`@0x/sol-cov`](/packages/sol-cov) | [](https://www.npmjs.com/package/@0x/sol-cov) | Solidity test coverage tool |
|
||||
| [`@0x/sol-doc`](/packages/sol-doc) | [](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
|
||||
| [`@0x/sol-resolver`](/packages/sol-resolver) | [](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
|
||||
| [`@0x/sra-spec`](/packages/sra-spec) | [](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the standard relayer API |
|
||||
| [`@0x/subproviders`](/packages/subproviders) | [](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g. LedgerSubprovider) |
|
||||
| [`@0x/tslint-config`](/packages/tslint-config) | [](https://www.npmjs.com/package/@0x/tslint-config) | Custom 0x development TSLint rules |
|
||||
| [`@0x/types`](/packages/types) | [](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
|
||||
| [`@0x/typescript-typings`](/packages/typescript-typings) | [](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
|
||||
| [`@0x/utils`](/packages/utils) | [](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
|
||||
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [](https://www.npmjs.com/package/@0x/web3-wrapper) | Web3 wrapper |
|
||||
Visit our [developer portal](https://0xproject.com/docs/order-utils) for a comprehensive list of core & community maintained packages. All packages maintained with this monorepo are listed below.
|
||||
|
||||
### Private Packages
|
||||
### Python Packages
|
||||
|
||||
| Package | Description |
|
||||
| -------------------------------------------------------- | ---------------------------------------------------------------- |
|
||||
| [`@0x/contracts`](/packages/contracts) | 0x solidity smart contracts & tests |
|
||||
| [`@0x/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0x/react-docs` |
|
||||
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
||||
| [`@0x/website`](/packages/website) | 0x website & Portal DApp |
|
||||
| Package | Version | Description |
|
||||
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| [`0x-order-utils`](/python-packages/order_utils) | [](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| [`0x-sra-client`](/python-packages/sra_client) | [](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
|
||||
|
||||
### Typescript/Javascript Packages
|
||||
|
||||
#### 0x-specific packages
|
||||
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| [`0x.js`](/packages/0x.js) | [](https://www.npmjs.com/package/0x.js) | An aggregate package combining many smaller utility packages for interacting with the 0x protocol |
|
||||
| [`@0x/contract-addresses`](/packages/contract-addresses) | [](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
|
||||
| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
|
||||
| [`@0x/order-utils`](/packages/order-utils) | [](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| [`@0x/json-schemas`](/packages/json-schemas) | [](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related JSON schemas |
|
||||
| [`@0x/order-watcher`](/packages/order-watcher) | [](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
|
||||
| [`@0x/migrations`](/packages/migrations) | [](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
|
||||
| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
|
||||
| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using `@0x/abi-gen` |
|
||||
| [`@0x/sra-spec`](/packages/sra-spec) | [](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the Standard Relayer API |
|
||||
| [`@0x/connect`](/packages/connect) | [](https://www.npmjs.com/package/@0x/connect) | An HTTP/WS client for interacting with the Standard Relayer API |
|
||||
| [`@0x/asset-buyer`](/packages/asset-buyer) | [](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
|
||||
|
||||
#### Ethereum tooling
|
||||
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [](https://www.npmjs.com/package/@0x/web3-wrapper) | An Ethereum JSON RPC client |
|
||||
| [`@0x/sol-compiler`](/packages/sol-compiler) | [](https://www.npmjs.com/package/@0x/sol-compiler) | A wrapper around solc-js that adds smart re-compilation, ability to compile an entire project, Solidity version specific compilation, standard input description support and much more. |
|
||||
| [`@0x/sol-cov`](/packages/sol-cov) | [](https://www.npmjs.com/package/@0x/sol-cov) | A solidity test coverage tool |
|
||||
| [`@0x/sol-resolver`](/packages/sol-resolver) | [](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
|
||||
| [`@0x/subproviders`](/packages/subproviders) | [](https://www.npmjs.com/package/@0x/subproviders) | Web3 provider middlewares (e.g. LedgerSubprovider) |
|
||||
| [`@0x/sol-doc`](/packages/sol-doc) | [](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
|
||||
|
||||
#### Utilities
|
||||
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||
| [`@0x/abi-gen`](/packages/abi-gen) | [](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
|
||||
| [`@0x/tslint-config`](/packages/tslint-config) | [](https://www.npmjs.com/package/@0x/tslint-config) | Custom TSLint rules used by the 0x core team |
|
||||
| [`@0x/types`](/packages/types) | [](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
|
||||
| [`@0x/typescript-typings`](/packages/typescript-typings) | [](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
|
||||
| [`@0x/utils`](/packages/utils) | [](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
|
||||
| [`@0x/react-docs`](/packages/react-docs) | [](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & sol-doc generated JSON |
|
||||
| [`@0x/react-shared`](/packages/react-shared) | [](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
|
||||
| [`@0x/assert`](/packages/assert) | [](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
|
||||
| [`@0x/base-contract`](/packages/base-contract) | [](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
|
||||
| [`@0x/dev-utils`](/packages/dev-utils) | [](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x packages |
|
||||
| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generator |
|
||||
|
||||
#### Private Packages
|
||||
|
||||
| Package | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------------------------------------- |
|
||||
| [`@0x/contracts`](/contracts/core) | 0x protocol solidity smart contracts & tests |
|
||||
| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
|
||||
| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
|
||||
| [`@0x/website`](/packages/website) | 0x website |
|
||||
|
||||
## Usage
|
||||
|
||||
Dedicated documentation pages:
|
||||
|
||||
* [0x.js Library](https://0xproject.com/docs/0xjs)
|
||||
* [0x Connect](https://0xproject.com/docs/connect)
|
||||
* [Smart contracts](https://0xproject.com/docs/contracts)
|
||||
* [Subproviders](https://0xproject.com/docs/subproviders)
|
||||
* [Sol Compiler](https://0xproject.com/docs/sol-compiler)
|
||||
* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
|
||||
* [JSON-schemas](https://0xproject.com/docs/json-schemas)
|
||||
* [Sol-cov](https://0xproject.com/docs/sol-cov)
|
||||
* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
|
||||
|
||||
Node version >= 6.12 is required.
|
||||
|
||||
Most of the packages require additional typings for external dependencies.
|
||||
|
48
contracts/TESTING.md
Normal file
48
contracts/TESTING.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Contracts testing options
|
||||
|
||||
## Revert stack traces
|
||||
|
||||
If you want to see helpful stack traces (incl. line number, code snippet) for smart contract reverts, run the tests with:
|
||||
|
||||
```
|
||||
yarn test:trace
|
||||
```
|
||||
|
||||
**Note:** This currently slows down the test runs and is therefore not enabled by default.
|
||||
|
||||
## Backing Ethereum node
|
||||
|
||||
By default, our tests run against an in-process [Ganache](https://github.com/trufflesuite/ganache-core) instance. In order to run the tests against [Geth](https://github.com/ethereum/go-ethereum), first follow the instructions in the README for the devnet package to start the devnet Geth node. Then run:
|
||||
|
||||
```bash
|
||||
TEST_PROVIDER=geth yarn test
|
||||
```
|
||||
|
||||
## Code coverage
|
||||
|
||||
In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
|
||||
|
||||
```
|
||||
yarn test:coverage
|
||||
```
|
||||
|
||||
## Gas profiler
|
||||
|
||||
In order to profile the gas costs for a specific smart contract call/transaction, you can run the tests in `profiler` mode.
|
||||
|
||||
**Note:** Traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling.
|
||||
|
||||
```
|
||||
TEST_PROVIDER=geth yarn test:profiler
|
||||
```
|
||||
|
||||
You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile.
|
||||
|
||||
```typescript
|
||||
import { profiler } from './utils/profiler';
|
||||
profiler.start();
|
||||
// Some call to a smart contract
|
||||
profiler.stop();
|
||||
```
|
||||
|
||||
Without explicitly starting and stopping the profiler, the profiler output will be too busy, and therefore unusable.
|
56
contracts/examples/README.md
Normal file
56
contracts/examples/README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
## Contract examples
|
||||
|
||||
Example smart contracts that interact with 0x protocol.
|
||||
|
||||
## Usage
|
||||
|
||||
Contracts can be found in the [contracts](./contracts) directory.
|
||||
This package contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
|
||||
|
||||
## Contributing
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-examples yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-examples yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
22
contracts/examples/compiler.json
Normal file
22
contracts/examples/compiler.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"artifactsDir": "./generated-artifacts",
|
||||
"contractsDir": "./contracts",
|
||||
"compilerSettings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"]
|
||||
}
|
@@ -19,8 +19,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
|
||||
|
||||
contract ExchangeWrapper {
|
@@ -18,7 +18,7 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../protocol/Exchange/interfaces/IValidator.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
|
||||
|
||||
|
||||
contract Validator is
|
@@ -18,8 +18,8 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../protocol/Exchange/interfaces/IWallet.sol";
|
||||
import "../../utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
|
||||
|
||||
contract Wallet is
|
@@ -19,9 +19,9 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../utils/Ownable/Ownable.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||
|
||||
|
||||
contract Whitelist is
|
83
contracts/examples/package.json
Normal file
83
contracts/examples/package.json
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-examples",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Smart contract examples of 0x protocol",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.19",
|
||||
"@0x/contracts-test-utils": "^1.0.2",
|
||||
"@0x/dev-utils": "^1.0.21",
|
||||
"@0x/sol-compiler": "^1.1.16",
|
||||
"@0x/sol-cov": "^2.1.16",
|
||||
"@0x/subproviders": "^2.1.8",
|
||||
"@0x/tslint-config": "^2.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-abi": "0.6.5",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solc": "^0.4.24",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.10",
|
||||
"@0x/contracts-interfaces": "^1.0.1",
|
||||
"@0x/contracts-libs": "^1.0.1",
|
||||
"@0x/contracts-multisig": "^1.0.1",
|
||||
"@0x/contracts-tokens": "^1.0.1",
|
||||
"@0x/contracts-utils": "^1.0.1",
|
||||
"@0x/order-utils": "^3.0.7",
|
||||
"@0x/types": "^1.4.1",
|
||||
"@0x/typescript-typings": "^3.0.6",
|
||||
"@0x/utils": "^2.0.8",
|
||||
"@0x/web3-wrapper": "^3.2.1",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^1.1.4",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
13
contracts/examples/src/artifacts/index.ts
Normal file
13
contracts/examples/src/artifacts/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
|
||||
import * as Validator from '../../generated-artifacts/Validator.json';
|
||||
import * as Wallet from '../../generated-artifacts/Wallet.json';
|
||||
import * as Whitelist from '../../generated-artifacts/Whitelist.json';
|
||||
|
||||
export const artifacts = {
|
||||
ExchangeWrapper: ExchangeWrapper as ContractArtifact,
|
||||
Validator: Validator as ContractArtifact,
|
||||
Wallet: Wallet as ContractArtifact,
|
||||
Whitelist: Whitelist as ContractArtifact,
|
||||
};
|
2
contracts/examples/src/index.ts
Normal file
2
contracts/examples/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './artifacts';
|
||||
export * from './wrappers';
|
4
contracts/examples/src/wrappers/index.ts
Normal file
4
contracts/examples/src/wrappers/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from '../../generated-wrappers/exchange_wrapper';
|
||||
export * from '../../generated-wrappers/validator';
|
||||
export * from '../../generated-wrappers/wallet';
|
||||
export * from '../../generated-wrappers/whitelist';
|
16
contracts/examples/tsconfig.json
Normal file
16
contracts/examples/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": [
|
||||
"./generated-artifacts/ExchangeWrapper.json",
|
||||
"./generated-artifacts/Validator.json",
|
||||
"./generated-artifacts/Wallet.json",
|
||||
"./generated-artifacts/Whitelist.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
69
contracts/extensions/README.md
Normal file
69
contracts/extensions/README.md
Normal file
@@ -0,0 +1,69 @@
|
||||
## Contract extensions
|
||||
|
||||
Smart contracts that implement extensions for the 0x protocol.
|
||||
|
||||
## Usage
|
||||
|
||||
Contract extensions of the protocol can be found in the [contracts](./contracts) directory. This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
|
||||
|
||||
## Bug bounty
|
||||
|
||||
A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
|
||||
|
||||
## Contributing
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-extensions yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-extensions yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
#### Testing options
|
||||
|
||||
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
|
22
contracts/extensions/compiler.json
Normal file
22
contracts/extensions/compiler.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"artifactsDir": "./generated-artifacts",
|
||||
"contractsDir": "./contracts",
|
||||
"compilerSettings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": ["DutchAuction", "Forwarder"]
|
||||
}
|
205
contracts/extensions/contracts/DutchAuction/DutchAuction.sol
Normal file
205
contracts/extensions/contracts/DutchAuction/DutchAuction.sol
Normal file
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||
|
||||
|
||||
contract DutchAuction is
|
||||
SafeMath
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
|
||||
// solhint-disable var-name-mixedcase
|
||||
IExchange internal EXCHANGE;
|
||||
|
||||
struct AuctionDetails {
|
||||
uint256 beginTimeSeconds; // Auction begin unix timestamp: sellOrder.makerAssetData
|
||||
uint256 endTimeSeconds; // Auction end unix timestamp: sellOrder.expiryTimeSeconds
|
||||
uint256 beginAmount; // Auction begin amount: sellOrder.makerAssetData
|
||||
uint256 endAmount; // Auction end amount: sellOrder.takerAssetAmount
|
||||
uint256 currentAmount; // Calculated amount given block.timestamp
|
||||
uint256 currentTimeSeconds; // block.timestamp
|
||||
}
|
||||
|
||||
constructor (address _exchange)
|
||||
public
|
||||
{
|
||||
EXCHANGE = IExchange(_exchange);
|
||||
}
|
||||
|
||||
/// @dev Matches the buy and sell orders at an amount given the following: the current block time, the auction
|
||||
/// start time and the auction begin amount. The sell order is a an order at the lowest amount
|
||||
/// at the end of the auction. Excess from the match is transferred to the seller.
|
||||
/// Over time the price moves from beginAmount to endAmount given the current block.timestamp.
|
||||
/// sellOrder.expiryTimeSeconds is the end time of the auction.
|
||||
/// sellOrder.takerAssetAmount is the end amount of the auction (lowest possible amount).
|
||||
/// sellOrder.makerAssetData is the ABI encoded Asset Proxy data with the following data appended
|
||||
/// buyOrder.makerAssetData is the buyers bid on the auction, must meet the amount for the current block timestamp
|
||||
/// (uint256 beginTimeSeconds, uint256 beginAmount).
|
||||
/// This function reverts in the following scenarios:
|
||||
/// * Auction has not started (auctionDetails.currentTimeSeconds < auctionDetails.beginTimeSeconds)
|
||||
/// * Auction has expired (auctionDetails.endTimeSeconds < auctionDetails.currentTimeSeconds)
|
||||
/// * Amount is invalid: Buy order amount is too low (buyOrder.makerAssetAmount < auctionDetails.currentAmount)
|
||||
/// * Amount is invalid: Invalid begin amount (auctionDetails.beginAmount > auctionDetails.endAmount)
|
||||
/// * Any failure in the 0x Match Orders
|
||||
/// @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
|
||||
/// @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
|
||||
/// @param buySignature Proof that order was created by the buyer.
|
||||
/// @param sellSignature Proof that order was created by the seller.
|
||||
/// @return matchedFillResults amounts filled and fees paid by maker and taker of matched orders.
|
||||
function matchOrders(
|
||||
LibOrder.Order memory buyOrder,
|
||||
LibOrder.Order memory sellOrder,
|
||||
bytes memory buySignature,
|
||||
bytes memory sellSignature
|
||||
)
|
||||
public
|
||||
returns (LibFillResults.MatchedFillResults memory matchedFillResults)
|
||||
{
|
||||
AuctionDetails memory auctionDetails = getAuctionDetails(sellOrder);
|
||||
// Ensure the auction has not yet started
|
||||
require(
|
||||
auctionDetails.currentTimeSeconds >= auctionDetails.beginTimeSeconds,
|
||||
"AUCTION_NOT_STARTED"
|
||||
);
|
||||
// Ensure the auction has not expired. This will fail later in 0x but we can save gas by failing early
|
||||
require(
|
||||
sellOrder.expirationTimeSeconds > auctionDetails.currentTimeSeconds,
|
||||
"AUCTION_EXPIRED"
|
||||
);
|
||||
// Validate the buyer amount is greater than the current auction amount
|
||||
require(
|
||||
buyOrder.makerAssetAmount >= auctionDetails.currentAmount,
|
||||
"INVALID_AMOUNT"
|
||||
);
|
||||
// Match orders, maximally filling `buyOrder`
|
||||
matchedFillResults = EXCHANGE.matchOrders(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
);
|
||||
// The difference in sellOrder.takerAssetAmount and current amount is given as spread to the matcher
|
||||
// This may include additional spread from the buyOrder.makerAssetAmount and the currentAmount.
|
||||
// e.g currentAmount is 30, sellOrder.takerAssetAmount is 10 and buyOrder.makerAssetamount is 40.
|
||||
// 10 (40-30) is returned to the buyer, 20 (30-10) sent to the seller and 10 has previously
|
||||
// been transferred to the seller during matchOrders
|
||||
uint256 leftMakerAssetSpreadAmount = matchedFillResults.leftMakerAssetSpreadAmount;
|
||||
if (leftMakerAssetSpreadAmount > 0) {
|
||||
// ERC20 Asset data itself is encoded as follows:
|
||||
//
|
||||
// | Area | Offset | Length | Contents |
|
||||
// |----------|--------|---------|-------------------------------------|
|
||||
// | Header | 0 | 4 | function selector |
|
||||
// | Params | | 1 * 32 | function parameters: |
|
||||
// | | 4 | 12 | 1. token address padding |
|
||||
// | | 16 | 20 | 2. token address |
|
||||
bytes memory assetData = sellOrder.takerAssetData;
|
||||
address token = assetData.readAddress(16);
|
||||
// Calculate the excess from the buy order. This can occur if the buyer sends in a higher
|
||||
// amount than the calculated current amount
|
||||
uint256 buyerExcessAmount = safeSub(buyOrder.makerAssetAmount, auctionDetails.currentAmount);
|
||||
uint256 sellerExcessAmount = safeSub(leftMakerAssetSpreadAmount, buyerExcessAmount);
|
||||
// Return the difference between auctionDetails.currentAmount and sellOrder.takerAssetAmount
|
||||
// to the seller
|
||||
if (sellerExcessAmount > 0) {
|
||||
IERC20Token(token).transfer(sellOrder.makerAddress, sellerExcessAmount);
|
||||
}
|
||||
// Return the difference between buyOrder.makerAssetAmount and auctionDetails.currentAmount
|
||||
// to the buyer
|
||||
if (buyerExcessAmount > 0) {
|
||||
IERC20Token(token).transfer(buyOrder.makerAddress, buyerExcessAmount);
|
||||
}
|
||||
}
|
||||
return matchedFillResults;
|
||||
}
|
||||
|
||||
/// @dev Calculates the Auction Details for the given order
|
||||
/// @param order The sell order
|
||||
/// @return AuctionDetails
|
||||
function getAuctionDetails(
|
||||
LibOrder.Order memory order
|
||||
)
|
||||
public
|
||||
returns (AuctionDetails memory auctionDetails)
|
||||
{
|
||||
uint256 makerAssetDataLength = order.makerAssetData.length;
|
||||
// It is unknown the encoded data of makerAssetData, we assume the last 64 bytes
|
||||
// are the Auction Details encoding.
|
||||
// Auction Details is encoded as follows:
|
||||
//
|
||||
// | Area | Offset | Length | Contents |
|
||||
// |----------|--------|---------|-------------------------------------|
|
||||
// | Params | | 2 * 32 | parameters: |
|
||||
// | | -64 | 32 | 1. auction begin unix timestamp |
|
||||
// | | -32 | 32 | 2. auction begin begin amount |
|
||||
// ERC20 asset data length is 4+32, 64 for auction details results in min length 100
|
||||
require(
|
||||
makerAssetDataLength >= 100,
|
||||
"INVALID_ASSET_DATA"
|
||||
);
|
||||
uint256 auctionBeginTimeSeconds = order.makerAssetData.readUint256(makerAssetDataLength - 64);
|
||||
uint256 auctionBeginAmount = order.makerAssetData.readUint256(makerAssetDataLength - 32);
|
||||
// Ensure the auction has a valid begin time
|
||||
require(
|
||||
order.expirationTimeSeconds > auctionBeginTimeSeconds,
|
||||
"INVALID_BEGIN_TIME"
|
||||
);
|
||||
uint256 auctionDurationSeconds = order.expirationTimeSeconds-auctionBeginTimeSeconds;
|
||||
// Ensure the auction goes from high to low
|
||||
uint256 minAmount = order.takerAssetAmount;
|
||||
require(
|
||||
auctionBeginAmount > minAmount,
|
||||
"INVALID_AMOUNT"
|
||||
);
|
||||
uint256 amountDelta = auctionBeginAmount-minAmount;
|
||||
// solhint-disable-next-line not-rely-on-time
|
||||
uint256 timestamp = block.timestamp;
|
||||
auctionDetails.beginTimeSeconds = auctionBeginTimeSeconds;
|
||||
auctionDetails.endTimeSeconds = order.expirationTimeSeconds;
|
||||
auctionDetails.beginAmount = auctionBeginAmount;
|
||||
auctionDetails.endAmount = minAmount;
|
||||
auctionDetails.currentTimeSeconds = timestamp;
|
||||
|
||||
uint256 remainingDurationSeconds = order.expirationTimeSeconds-timestamp;
|
||||
if (timestamp < auctionBeginTimeSeconds) {
|
||||
// If the auction has not yet begun the current amount is the auctionBeginAmount
|
||||
auctionDetails.currentAmount = auctionBeginAmount;
|
||||
} else if (timestamp >= order.expirationTimeSeconds) {
|
||||
// If the auction has ended the current amount is the minAmount.
|
||||
// Auction end time is guaranteed by 0x Exchange due to the order expiration
|
||||
auctionDetails.currentAmount = minAmount;
|
||||
} else {
|
||||
auctionDetails.currentAmount = safeAdd(
|
||||
minAmount,
|
||||
safeDiv(
|
||||
safeMul(remainingDurationSeconds, amountDelta),
|
||||
auctionDurationSeconds
|
||||
)
|
||||
);
|
||||
}
|
||||
return auctionDetails;
|
||||
}
|
||||
}
|
@@ -18,10 +18,10 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../utils/LibBytes/LibBytes.sol";
|
||||
import "../../utils/Ownable/Ownable.sol";
|
||||
import "../../tokens/ERC20Token/IERC20Token.sol";
|
||||
import "../../tokens/ERC721Token/IERC721Token.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||
import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
|
||||
import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./mixins/MAssets.sol";
|
||||
|
@@ -21,10 +21,10 @@ pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./mixins/MExchangeWrapper.sol";
|
||||
import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
|
||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||
|
||||
|
||||
contract MixinExchangeWrapper is
|
@@ -24,10 +24,10 @@ import "./mixins/MWeth.sol";
|
||||
import "./mixins/MAssets.sol";
|
||||
import "./mixins/MExchangeWrapper.sol";
|
||||
import "./interfaces/IForwarderCore.sol";
|
||||
import "../../utils/LibBytes/LibBytes.sol";
|
||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||
|
||||
|
||||
contract MixinForwarderCore is
|
@@ -18,7 +18,7 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./mixins/MWeth.sol";
|
||||
|
@@ -19,8 +19,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../../protocol/Exchange/libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
|
||||
|
||||
contract IForwarderCore {
|
@@ -18,10 +18,10 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../../utils/LibBytes/LibBytes.sol";
|
||||
import "../../../protocol/Exchange/interfaces/IExchange.sol";
|
||||
import "../../../tokens/EtherToken/IEtherToken.sol";
|
||||
import "../../../tokens/ERC20Token/IERC20Token.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
|
||||
import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
|
||||
|
||||
|
||||
contract LibConstants {
|
@@ -19,8 +19,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../../protocol/Exchange/libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
|
||||
|
||||
contract MExchangeWrapper {
|
94
contracts/extensions/package.json
Normal file
94
contracts/extensions/package.json
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-extensions",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Smart contract extensions of 0x protocol",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(DutchAuction|Forwarder).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.19",
|
||||
"@0x/contracts-test-utils": "^1.0.2",
|
||||
"@0x/dev-utils": "^1.0.21",
|
||||
"@0x/sol-compiler": "^1.1.16",
|
||||
"@0x/sol-cov": "^2.1.16",
|
||||
"@0x/subproviders": "^2.1.8",
|
||||
"@0x/tslint-config": "^2.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-abi": "0.6.5",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solc": "^0.4.24",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.10",
|
||||
"@0x/contracts-interfaces": "^1.0.1",
|
||||
"@0x/contracts-libs": "^1.0.1",
|
||||
"@0x/contracts-protocol": "^2.1.58",
|
||||
"@0x/contracts-tokens": "^1.0.1",
|
||||
"@0x/contracts-utils": "^1.0.1",
|
||||
"@0x/order-utils": "^3.0.7",
|
||||
"@0x/types": "^1.4.1",
|
||||
"@0x/typescript-typings": "^3.0.6",
|
||||
"@0x/utils": "^2.0.8",
|
||||
"@0x/web3-wrapper": "^3.2.1",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^1.1.4",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
9
contracts/extensions/src/artifacts/index.ts
Normal file
9
contracts/extensions/src/artifacts/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
|
||||
import * as Forwarder from '../../generated-artifacts/Forwarder.json';
|
||||
|
||||
export const artifacts = {
|
||||
DutchAuction: DutchAuction as ContractArtifact,
|
||||
Forwarder: Forwarder as ContractArtifact,
|
||||
};
|
2
contracts/extensions/src/index.ts
Normal file
2
contracts/extensions/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './artifacts';
|
||||
export * from './wrappers';
|
2
contracts/extensions/src/wrappers/index.ts
Normal file
2
contracts/extensions/src/wrappers/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from '../../generated-wrappers/dutch_auction';
|
||||
export * from '../../generated-wrappers/forwarder';
|
458
contracts/extensions/test/extensions/dutch_auction.ts
Normal file
458
contracts/extensions/test/extensions/dutch_auction.ts
Normal file
@@ -0,0 +1,458 @@
|
||||
import {
|
||||
artifacts as protocolArtifacts,
|
||||
ERC20Wrapper,
|
||||
ERC721Wrapper,
|
||||
ExchangeContract,
|
||||
ExchangeWrapper,
|
||||
} from '@0x/contracts-protocol';
|
||||
import {
|
||||
chaiSetup,
|
||||
constants,
|
||||
ContractName,
|
||||
ERC20BalancesByOwner,
|
||||
expectTransactionFailedAsync,
|
||||
getLatestBlockTimestampAsync,
|
||||
OrderFactory,
|
||||
provider,
|
||||
txDefaults,
|
||||
web3Wrapper,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import {
|
||||
artifacts as tokensArtifacts,
|
||||
DummyERC20TokenContract,
|
||||
DummyERC721TokenContract,
|
||||
WETH9Contract,
|
||||
} from '@0x/contracts-tokens';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||
import { RevertReason, SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as chai from 'chai';
|
||||
import ethAbi = require('ethereumjs-abi');
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
const DECIMALS_DEFAULT = 18;
|
||||
|
||||
describe(ContractName.DutchAuction, () => {
|
||||
let makerAddress: string;
|
||||
let owner: string;
|
||||
let takerAddress: string;
|
||||
let feeRecipientAddress: string;
|
||||
let defaultMakerAssetAddress: string;
|
||||
|
||||
let zrxToken: DummyERC20TokenContract;
|
||||
let erc20TokenA: DummyERC20TokenContract;
|
||||
let erc721Token: DummyERC721TokenContract;
|
||||
let dutchAuctionContract: DutchAuctionContract;
|
||||
let wethContract: WETH9Contract;
|
||||
|
||||
let sellerOrderFactory: OrderFactory;
|
||||
let buyerOrderFactory: OrderFactory;
|
||||
let erc20Wrapper: ERC20Wrapper;
|
||||
let erc20Balances: ERC20BalancesByOwner;
|
||||
let currentBlockTimestamp: number;
|
||||
let auctionBeginTimeSeconds: BigNumber;
|
||||
let auctionEndTimeSeconds: BigNumber;
|
||||
let auctionBeginAmount: BigNumber;
|
||||
let auctionEndAmount: BigNumber;
|
||||
let sellOrder: SignedOrder;
|
||||
let buyOrder: SignedOrder;
|
||||
let erc721MakerAssetIds: BigNumber[];
|
||||
const tenMinutesInSeconds = 10 * 60;
|
||||
|
||||
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
|
||||
return ethUtil.bufferToHex(
|
||||
Buffer.concat([
|
||||
ethUtil.toBuffer(makerAssetData),
|
||||
ethUtil.toBuffer(
|
||||
(ethAbi as any).rawEncode(
|
||||
['uint256', 'uint256'],
|
||||
[beginTimeSeconds.toString(), beginAmount.toString()],
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
|
||||
|
||||
erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
|
||||
|
||||
const numDummyErc20ToDeploy = 2;
|
||||
[erc20TokenA, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
|
||||
numDummyErc20ToDeploy,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
);
|
||||
const erc20Proxy = await erc20Wrapper.deployProxyAsync();
|
||||
await erc20Wrapper.setBalancesAndAllowancesAsync();
|
||||
|
||||
const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
|
||||
[erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
|
||||
const erc721Proxy = await erc721Wrapper.deployProxyAsync();
|
||||
await erc721Wrapper.setBalancesAndAllowancesAsync();
|
||||
const erc721Balances = await erc721Wrapper.getBalancesAsync();
|
||||
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
|
||||
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults);
|
||||
erc20Wrapper.addDummyTokenContract(wethContract as any);
|
||||
|
||||
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
|
||||
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
zrxAssetData,
|
||||
);
|
||||
const exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
|
||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
||||
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
|
||||
|
||||
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
||||
from: owner,
|
||||
});
|
||||
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
|
||||
from: owner,
|
||||
});
|
||||
|
||||
const dutchAuctionInstance = await DutchAuctionContract.deployFrom0xArtifactAsync(
|
||||
artifacts.DutchAuction,
|
||||
provider,
|
||||
txDefaults,
|
||||
exchangeInstance.address,
|
||||
);
|
||||
dutchAuctionContract = new DutchAuctionContract(
|
||||
dutchAuctionInstance.abi,
|
||||
dutchAuctionInstance.address,
|
||||
provider,
|
||||
);
|
||||
|
||||
defaultMakerAssetAddress = erc20TokenA.address;
|
||||
const defaultTakerAssetAddress = wethContract.address;
|
||||
|
||||
// Set up taker WETH balance and allowance
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await wethContract.deposit.sendTransactionAsync({
|
||||
from: takerAddress,
|
||||
value: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), DECIMALS_DEFAULT),
|
||||
}),
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await wethContract.approve.sendTransactionAsync(
|
||||
erc20Proxy.address,
|
||||
constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
|
||||
{ from: takerAddress },
|
||||
),
|
||||
);
|
||||
web3Wrapper.abiDecoder.addABI(exchangeInstance.abi);
|
||||
web3Wrapper.abiDecoder.addABI(zrxToken.abi);
|
||||
erc20Wrapper.addTokenOwnerAddress(dutchAuctionContract.address);
|
||||
|
||||
currentBlockTimestamp = await getLatestBlockTimestampAsync();
|
||||
// Default auction begins 10 minutes ago
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp).minus(tenMinutesInSeconds);
|
||||
// Default auction ends 10 from now
|
||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds);
|
||||
auctionBeginAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10), DECIMALS_DEFAULT);
|
||||
auctionEndAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT);
|
||||
|
||||
// Default sell order and buy order are exact mirrors
|
||||
const sellerDefaultOrderParams = {
|
||||
salt: generatePseudoRandomSalt(),
|
||||
exchangeAddress: exchangeInstance.address,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
// taker address or sender address should be set to the ducth auction contract
|
||||
takerAddress: dutchAuctionContract.address,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), DECIMALS_DEFAULT),
|
||||
takerAssetAmount: auctionEndAmount,
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
};
|
||||
// Default buy order is for the auction begin price
|
||||
const buyerDefaultOrderParams = {
|
||||
...sellerDefaultOrderParams,
|
||||
makerAddress: takerAddress,
|
||||
makerAssetData: sellerDefaultOrderParams.takerAssetData,
|
||||
takerAssetData: sellerDefaultOrderParams.makerAssetData,
|
||||
makerAssetAmount: auctionBeginAmount,
|
||||
takerAssetAmount: sellerDefaultOrderParams.makerAssetAmount,
|
||||
};
|
||||
const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
|
||||
sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams);
|
||||
buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams);
|
||||
});
|
||||
after(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
erc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync();
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync();
|
||||
});
|
||||
afterEach(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
describe('matchOrders', () => {
|
||||
it('should be worth the begin price at the begining of the auction', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
});
|
||||
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
});
|
||||
it('should be be worth the end price at the end of the auction', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
});
|
||||
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount);
|
||||
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
});
|
||||
it('should match orders at current amount and send excess to buyer', async () => {
|
||||
const beforeAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetAmount: beforeAuctionDetails.currentAmount.times(2),
|
||||
});
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal(
|
||||
constants.ZERO_AMOUNT,
|
||||
);
|
||||
// HACK gte used here due to a bug in ganache where the timestamp can change
|
||||
// between multiple calls to the same block. Which can move the amount in our case
|
||||
// ref: https://github.com/trufflesuite/ganache-core/issues/111
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
);
|
||||
expect(newBalances[takerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[takerAddress][wethContract.address].minus(beforeAuctionDetails.currentAmount),
|
||||
);
|
||||
});
|
||||
it('maker fees on sellOrder are paid to the fee receipient', async () => {
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerFee: new BigNumber(1),
|
||||
});
|
||||
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
);
|
||||
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
|
||||
erc20Balances[feeRecipientAddress][zrxToken.address].plus(sellOrder.makerFee),
|
||||
);
|
||||
});
|
||||
it('maker fees on buyOrder are paid to the fee receipient', async () => {
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
makerFee: new BigNumber(1),
|
||||
});
|
||||
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
);
|
||||
expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
|
||||
erc20Balances[feeRecipientAddress][zrxToken.address].plus(buyOrder.makerFee),
|
||||
);
|
||||
});
|
||||
it('should revert when auction expires', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
RevertReason.AuctionExpired,
|
||||
);
|
||||
});
|
||||
it('cannot be filled for less than the current price', async () => {
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetAmount: sellOrder.takerAssetAmount,
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
RevertReason.AuctionInvalidAmount,
|
||||
);
|
||||
});
|
||||
it('auction begin amount must be higher than final amount ', async () => {
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
takerAssetAmount: auctionBeginAmount.plus(1),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
RevertReason.AuctionInvalidAmount,
|
||||
);
|
||||
});
|
||||
it('begin time is less than end time', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
RevertReason.AuctionInvalidBeginTime,
|
||||
);
|
||||
});
|
||||
it('asset data contains auction parameters', async () => {
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
RevertReason.InvalidAssetData,
|
||||
);
|
||||
});
|
||||
describe('ERC721', () => {
|
||||
it('should match orders when ERC721', async () => {
|
||||
const makerAssetId = erc721MakerAssetIds[0];
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetAmount: new BigNumber(1),
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
});
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
takerAssetAmount: new BigNumber(1),
|
||||
takerAssetData: sellOrder.makerAssetData,
|
||||
});
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
// HACK gte used here due to a bug in ganache where the timestamp can change
|
||||
// between multiple calls to the same block. Which can move the amount in our case
|
||||
// ref: https://github.com/trufflesuite/ganache-core/issues/111
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
);
|
||||
const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
|
||||
expect(newOwner).to.be.bignumber.equal(takerAddress);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
@@ -1,3 +1,29 @@
|
||||
import {
|
||||
artifacts as protocolArtifacts,
|
||||
ERC20Wrapper,
|
||||
ERC721Wrapper,
|
||||
ExchangeContract,
|
||||
ExchangeWrapper,
|
||||
} from '@0x/contracts-protocol';
|
||||
import {
|
||||
chaiSetup,
|
||||
constants,
|
||||
ContractName,
|
||||
ERC20BalancesByOwner,
|
||||
expectContractCreationFailedAsync,
|
||||
expectTransactionFailedAsync,
|
||||
OrderFactory,
|
||||
provider,
|
||||
sendTransactionResult,
|
||||
txDefaults,
|
||||
web3Wrapper,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import {
|
||||
artifacts as tokenArtifacts,
|
||||
DummyERC20TokenContract,
|
||||
DummyERC721TokenContract,
|
||||
WETH9Contract,
|
||||
} from '@0x/contracts-tokens';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { assetDataUtils } from '@0x/order-utils';
|
||||
import { RevertReason, SignedOrder } from '@0x/types';
|
||||
@@ -6,26 +32,10 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as chai from 'chai';
|
||||
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
|
||||
import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
|
||||
import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
|
||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
||||
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
import {
|
||||
expectContractCreationFailedAsync,
|
||||
expectTransactionFailedAsync,
|
||||
sendTransactionResult,
|
||||
} from '../utils/assertions';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
import { constants } from '../utils/constants';
|
||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||
|
||||
import { ForwarderWrapper } from '../utils/forwarder_wrapper';
|
||||
import { OrderFactory } from '../utils/order_factory';
|
||||
import { ContractName, ERC20BalancesByOwner } from '../utils/types';
|
||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -91,14 +101,14 @@ describe(ContractName.Forwarder, () => {
|
||||
const erc721Balances = await erc721Wrapper.getBalancesAsync();
|
||||
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
|
||||
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
|
||||
wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults);
|
||||
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
|
||||
erc20Wrapper.addDummyTokenContract(weth);
|
||||
|
||||
wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
|
||||
zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
|
||||
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
zrxAssetData,
|
||||
@@ -169,7 +179,7 @@ describe(ContractName.Forwarder, () => {
|
||||
describe('constructor', () => {
|
||||
it('should revert if assetProxy is unregistered', async () => {
|
||||
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
zrxAssetData,
|
17
contracts/extensions/test/global_hooks.ts
Normal file
17
contracts/extensions/test/global_hooks.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||
before('start web3 provider', () => {
|
||||
provider.start();
|
||||
});
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
provider.stop();
|
||||
});
|
@@ -1,3 +1,6 @@
|
||||
import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
|
||||
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
|
||||
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
@@ -5,11 +8,7 @@ import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethe
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
||||
|
||||
import { constants } from './constants';
|
||||
import { formatters } from './formatters';
|
||||
import { LogDecoder } from './log_decoder';
|
||||
import { MarketSellOrders } from './types';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
export class ForwarderWrapper {
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
@@ -61,7 +60,11 @@ export class ForwarderWrapper {
|
||||
constructor(contractInstance: ForwarderContract, provider: Provider) {
|
||||
this._forwarderContract = contractInstance;
|
||||
this._web3Wrapper = new Web3Wrapper(provider);
|
||||
this._logDecoder = new LogDecoder(this._web3Wrapper);
|
||||
this._logDecoder = new LogDecoder(this._web3Wrapper, {
|
||||
...artifacts,
|
||||
...tokensArtifacts,
|
||||
...protocolArtifacts,
|
||||
});
|
||||
}
|
||||
public async marketSellOrdersWithEthAsync(
|
||||
orders: SignedOrder[],
|
11
contracts/extensions/tsconfig.json
Normal file
11
contracts/extensions/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": ["./generated-artifacts/DutchAuction.json", "./generated-artifacts/Forwarder.json"],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
6
contracts/extensions/tslint.json
Normal file
6
contracts/extensions/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
72
contracts/interfaces/README.md
Normal file
72
contracts/interfaces/README.md
Normal file
@@ -0,0 +1,72 @@
|
||||
## Contract interfaces
|
||||
|
||||
Smart contract interfaces of the 0x protocol.
|
||||
|
||||
## Usage
|
||||
|
||||
Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
||||
|
||||
* [protocol](./contracts/protocol)
|
||||
* This directory contains the contract interfaces that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
|
||||
|
||||
## Bug bounty
|
||||
|
||||
A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
|
||||
|
||||
## Contributing
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-interfaces yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-interfaces yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
#### Testing options
|
||||
|
||||
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
|
35
contracts/interfaces/compiler.json
Normal file
35
contracts/interfaces/compiler.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"artifactsDir": "./generated-artifacts",
|
||||
"contractsDir": "./contracts",
|
||||
"compilerSettings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": [
|
||||
"IAssetData",
|
||||
"IAssetProxy",
|
||||
"IAuthorizable",
|
||||
"IAssetProxyDispatcher",
|
||||
"IExchange",
|
||||
"IExchangeCore",
|
||||
"IMatchOrders",
|
||||
"ISignatureValidator",
|
||||
"ITransactions",
|
||||
"IValidator",
|
||||
"IWallet",
|
||||
"IWrapperFunctions"
|
||||
]
|
||||
}
|
@@ -18,6 +18,7 @@
|
||||
|
||||
// solhint-disable
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
|
||||
// @dev Interface of the asset proxy's assetData.
|
||||
@@ -26,15 +27,18 @@ pragma solidity 0.4.24;
|
||||
interface IAssetData {
|
||||
|
||||
function ERC20Token(address tokenContract)
|
||||
external
|
||||
pure;
|
||||
external;
|
||||
|
||||
function ERC721Token(
|
||||
address tokenContract,
|
||||
uint256 tokenId,
|
||||
bytes receiverData
|
||||
uint256 tokenId
|
||||
)
|
||||
external
|
||||
pure;
|
||||
external;
|
||||
|
||||
function MultiAsset(
|
||||
uint256[] amounts,
|
||||
bytes[] nestedAssetData
|
||||
)
|
||||
external;
|
||||
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../../utils/Ownable/IOwnable.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
|
||||
|
||||
|
||||
contract IAuthorizable is
|
@@ -19,8 +19,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../libs/LibOrder.sol";
|
||||
import "../libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
|
||||
|
||||
contract IExchangeCore {
|
@@ -18,8 +18,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../libs/LibOrder.sol";
|
||||
import "../libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
|
||||
|
||||
contract IMatchOrders {
|
@@ -19,8 +19,8 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../libs/LibOrder.sol";
|
||||
import "../libs/LibFillResults.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
|
||||
|
||||
contract IWrapperFunctions {
|
57
contracts/interfaces/package.json
Normal file
57
contracts/interfaces/package.json
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-interfaces",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Smart contract interfaces of 0x protocol",
|
||||
"main": "lib/src/index.js",
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(IAssetData|IAssetProxy|IAuthorizable|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IValidator|IWallet|IWrapperFunctions).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.19",
|
||||
"@0x/sol-compiler": "^1.1.16",
|
||||
"@0x/tslint-config": "^2.0.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.10",
|
||||
"@0x/contracts-libs": "^1.0.1",
|
||||
"@0x/contracts-utils": "^1.0.1",
|
||||
"@0x/types": "^1.4.1",
|
||||
"@0x/typescript-typings": "^3.0.6",
|
||||
"@0x/utils": "^2.0.8",
|
||||
"@0x/web3-wrapper": "^3.2.1",
|
||||
"ethereum-types": "^1.1.4",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
29
contracts/interfaces/src/artifacts/index.ts
Normal file
29
contracts/interfaces/src/artifacts/index.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as IAssetData from '../../generated-artifacts/IAssetData.json';
|
||||
import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
|
||||
import * as IAssetProxyDispatcher from '../../generated-artifacts/IAssetProxyDispatcher.json';
|
||||
import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
|
||||
import * as IExchange from '../../generated-artifacts/IExchange.json';
|
||||
import * as IExchangeCore from '../../generated-artifacts/IExchangeCore.json';
|
||||
import * as IMatchOrders from '../../generated-artifacts/IMatchOrders.json';
|
||||
import * as ISignatureValidator from '../../generated-artifacts/ISignatureValidator.json';
|
||||
import * as ITransactions from '../../generated-artifacts/ITransactions.json';
|
||||
import * as IValidator from '../../generated-artifacts/IValidator.json';
|
||||
import * as IWallet from '../../generated-artifacts/IWallet.json';
|
||||
import * as IWrapperFunctions from '../../generated-artifacts/IWrapperFunctions.json';
|
||||
|
||||
export const artifacts = {
|
||||
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
|
||||
IAuthorizable: IAuthorizable as ContractArtifact,
|
||||
IExchange: IExchange as ContractArtifact,
|
||||
IExchangeCore: IExchangeCore as ContractArtifact,
|
||||
IMatchOrders: IMatchOrders as ContractArtifact,
|
||||
ISignatureValidator: ISignatureValidator as ContractArtifact,
|
||||
ITransactions: ITransactions as ContractArtifact,
|
||||
IWrapperFunctions: IWrapperFunctions as ContractArtifact,
|
||||
IAssetData: IAssetData as ContractArtifact,
|
||||
IAssetProxy: IAssetProxy as ContractArtifact,
|
||||
IValidator: IValidator as ContractArtifact,
|
||||
IWallet: IWallet as ContractArtifact,
|
||||
};
|
2
contracts/interfaces/src/index.ts
Normal file
2
contracts/interfaces/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './artifacts';
|
||||
export * from './wrappers';
|
12
contracts/interfaces/src/wrappers/index.ts
Normal file
12
contracts/interfaces/src/wrappers/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export * from '../../generated-wrappers/i_asset_data';
|
||||
export * from '../../generated-wrappers/i_asset_proxy';
|
||||
export * from '../../generated-wrappers/i_asset_proxy_dispatcher';
|
||||
export * from '../../generated-wrappers/i_exchange';
|
||||
export * from '../../generated-wrappers/i_exchange_core';
|
||||
export * from '../../generated-wrappers/i_match_orders';
|
||||
export * from '../../generated-wrappers/i_signature_validator';
|
||||
export * from '../../generated-wrappers/i_transactions';
|
||||
export * from '../../generated-wrappers/i_authorizable';
|
||||
export * from '../../generated-wrappers/i_wrapper_functions';
|
||||
export * from '../../generated-wrappers/i_validator';
|
||||
export * from '../../generated-wrappers/i_wallet';
|
24
contracts/interfaces/tsconfig.json
Normal file
24
contracts/interfaces/tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*", "./generated-wrappers/**/*"],
|
||||
"files": [
|
||||
"./generated-artifacts/IAssetData.json",
|
||||
"./generated-artifacts/IAssetProxy.json",
|
||||
"./generated-artifacts/IAuthorizable.json",
|
||||
"./generated-artifacts/IAssetProxyDispatcher.json",
|
||||
"./generated-artifacts/IExchange.json",
|
||||
"./generated-artifacts/IExchangeCore.json",
|
||||
"./generated-artifacts/IMatchOrders.json",
|
||||
"./generated-artifacts/ISignatureValidator.json",
|
||||
"./generated-artifacts/ITransactions.json",
|
||||
"./generated-artifacts/IValidator.json",
|
||||
"./generated-artifacts/IWallet.json",
|
||||
"./generated-artifacts/IWrapperFunctions.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
6
contracts/interfaces/tslint.json
Normal file
6
contracts/interfaces/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
70
contracts/libs/README.md
Normal file
70
contracts/libs/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
## Contracts libs
|
||||
|
||||
Smart contracts libs used in the 0x protocol.
|
||||
|
||||
## Usage
|
||||
|
||||
Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
||||
|
||||
* [libs](./contracts/protocol)
|
||||
* This directory contains the libs.
|
||||
* [test](./contracts/test)
|
||||
* This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
|
||||
|
||||
## Contributing
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-libs yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-libs yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
#### Testing options
|
||||
|
||||
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
|
22
contracts/libs/compiler.json
Normal file
22
contracts/libs/compiler.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"artifactsDir": "./generated-artifacts",
|
||||
"contractsDir": "./contracts",
|
||||
"compilerSettings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": ["TestLibs", "LibOrder", "LibMath", "LibFillResults", "LibAbiEncoder", "LibEIP712"]
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../../utils/SafeMath/SafeMath.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||
|
||||
|
||||
contract LibFillResults is
|
@@ -18,7 +18,7 @@
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
import "../../../utils/SafeMath/SafeMath.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||
|
||||
|
||||
contract LibMath is
|
@@ -19,10 +19,10 @@
|
||||
pragma solidity 0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
||||
import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
|
||||
import "../../libs/LibMath.sol";
|
||||
import "../../libs/LibOrder.sol";
|
||||
import "../../libs/LibFillResults.sol";
|
||||
import "../../libs/LibAbiEncoder.sol";
|
||||
|
||||
|
||||
contract TestLibs is
|
91
contracts/libs/package.json
Normal file
91
contracts/libs/package.json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-libs",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Smart contract libs of 0x protocol",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(LibMath|LibOrder|LibFillResults|LibAbiEncoder|TestLibs|LibEIP712).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.19",
|
||||
"@0x/contracts-test-utils": "^1.0.2",
|
||||
"@0x/dev-utils": "^1.0.21",
|
||||
"@0x/sol-compiler": "^1.1.16",
|
||||
"@0x/sol-cov": "^2.1.16",
|
||||
"@0x/subproviders": "^2.1.8",
|
||||
"@0x/tslint-config": "^2.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"ethereumjs-abi": "0.6.5",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solc": "^0.4.24",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.10",
|
||||
"@0x/contracts-multisig": "^1.0.1",
|
||||
"@0x/contracts-utils": "^1.0.1",
|
||||
"@0x/order-utils": "^3.0.7",
|
||||
"@0x/types": "^1.4.1",
|
||||
"@0x/typescript-typings": "^3.0.6",
|
||||
"@0x/utils": "^2.0.8",
|
||||
"@0x/web3-wrapper": "^3.2.1",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^1.1.4",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
17
contracts/libs/src/artifacts/index.ts
Normal file
17
contracts/libs/src/artifacts/index.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as LibAbiEncoder from '../../generated-artifacts/LibAbiEncoder.json';
|
||||
import * as LibEIP721 from '../../generated-artifacts/LibEIP712.json';
|
||||
import * as LibFillResults from '../../generated-artifacts/LibFillResults.json';
|
||||
import * as LibMath from '../../generated-artifacts/LibMath.json';
|
||||
import * as LibOrder from '../../generated-artifacts/LibOrder.json';
|
||||
import * as TestLibs from '../../generated-artifacts/TestLibs.json';
|
||||
|
||||
export const artifacts = {
|
||||
TestLibs: TestLibs as ContractArtifact,
|
||||
LibAbiEncoder: LibAbiEncoder as ContractArtifact,
|
||||
LibFillResults: LibFillResults as ContractArtifact,
|
||||
LibMath: LibMath as ContractArtifact,
|
||||
LibOrder: LibOrder as ContractArtifact,
|
||||
LibEIP721: LibEIP721 as ContractArtifact,
|
||||
};
|
2
contracts/libs/src/index.ts
Normal file
2
contracts/libs/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './artifacts';
|
||||
export * from './wrappers';
|
6
contracts/libs/src/wrappers/index.ts
Normal file
6
contracts/libs/src/wrappers/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from '../../generated-wrappers/test_libs';
|
||||
export * from '../../generated-wrappers/lib_abi_encoder';
|
||||
export * from '../../generated-wrappers/lib_fill_results';
|
||||
export * from '../../generated-wrappers/lib_math';
|
||||
export * from '../../generated-wrappers/lib_order';
|
||||
export * from '../../generated-wrappers/lib_e_i_p712';
|
@@ -1,17 +1,20 @@
|
||||
import {
|
||||
addressUtils,
|
||||
chaiSetup,
|
||||
constants,
|
||||
OrderFactory,
|
||||
provider,
|
||||
txDefaults,
|
||||
web3Wrapper,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||
import { SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
|
||||
import { TestConstantsContract } from '../../generated-wrappers/test_constants';
|
||||
import { TestLibsContract } from '../../generated-wrappers/test_libs';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
import { addressUtils } from '../utils/address_utils';
|
||||
import { chaiSetup } from '../utils/chai_setup';
|
||||
import { constants } from '../utils/constants';
|
||||
import { OrderFactory } from '../utils/order_factory';
|
||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -22,7 +25,6 @@ describe('Exchange libs', () => {
|
||||
let signedOrder: SignedOrder;
|
||||
let orderFactory: OrderFactory;
|
||||
let libs: TestLibsContract;
|
||||
let testConstants: TestConstantsContract;
|
||||
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
@@ -34,11 +36,6 @@ describe('Exchange libs', () => {
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
const makerAddress = accounts[0];
|
||||
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
||||
testConstants = await TestConstantsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestConstants,
|
||||
provider,
|
||||
txDefaults,
|
||||
);
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
@@ -58,15 +55,6 @@ describe('Exchange libs', () => {
|
||||
afterEach(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
|
||||
describe('LibConstants', () => {
|
||||
describe('ZRX_ASSET_DATA', () => {
|
||||
it('should have the correct ZRX_ASSET_DATA', async () => {
|
||||
const isValid = await testConstants.assertValidZrxAssetData.callAsync();
|
||||
expect(isValid).to.be.equal(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
// Note(albrow): These tests are designed to be supplemental to the
|
||||
// combinatorial tests in test/exchange/internal. They test specific edge
|
||||
// cases that are not covered by the combinatorial tests.
|
17
contracts/libs/test/global_hooks.ts
Normal file
17
contracts/libs/test/global_hooks.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||
before('start web3 provider', () => {
|
||||
provider.start();
|
||||
});
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
provider.stop();
|
||||
});
|
18
contracts/libs/tsconfig.json
Normal file
18
contracts/libs/tsconfig.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "../../tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib",
|
||||
"rootDir": ".",
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": [
|
||||
"./generated-artifacts/TestLibs.json",
|
||||
"./generated-artifacts/LibOrder.json",
|
||||
"./generated-artifacts/LibFillResults.json",
|
||||
"./generated-artifacts/LibAbiEncoder.json",
|
||||
"./generated-artifacts/LibEIP712.json",
|
||||
"./generated-artifacts/LibMath.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
6
contracts/libs/tslint.json
Normal file
6
contracts/libs/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": ["@0x/tslint-config"],
|
||||
"rules": {
|
||||
"custom-no-magic-numbers": false
|
||||
}
|
||||
}
|
1
contracts/multisig/CHANGELOG.json
Normal file
1
contracts/multisig/CHANGELOG.json
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
70
contracts/multisig/README.md
Normal file
70
contracts/multisig/README.md
Normal file
@@ -0,0 +1,70 @@
|
||||
## MultisSig Contracts
|
||||
|
||||
MultiSig smart contracts
|
||||
|
||||
## Usage
|
||||
|
||||
Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
||||
|
||||
* [multisig](./contracts/multisig)
|
||||
* This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
|
||||
* [test](./contracts/test)
|
||||
* This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
|
||||
|
||||
## Contributing
|
||||
|
||||
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
|
||||
|
||||
For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
|
||||
|
||||
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
|
||||
|
||||
### Install Dependencies
|
||||
|
||||
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
|
||||
|
||||
```bash
|
||||
yarn config set workspaces-experimental true
|
||||
```
|
||||
|
||||
Then install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-multisig yarn build
|
||||
```
|
||||
|
||||
Or continuously rebuild on change:
|
||||
|
||||
```bash
|
||||
PKG=@0x/contracts-multisig yarn watch
|
||||
```
|
||||
|
||||
### Clean
|
||||
|
||||
```bash
|
||||
yarn clean
|
||||
```
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
yarn lint
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
#### Testing options
|
||||
|
||||
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
|
22
contracts/multisig/compiler.json
Normal file
22
contracts/multisig/compiler.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"artifactsDir": "./generated-artifacts",
|
||||
"contractsDir": "./contracts",
|
||||
"compilerSettings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": ["MultiSigWallet", "MultiSigWalletWithTimeLock", "TestRejectEther"]
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract TestRejectEther {}
|
86
contracts/multisig/package.json
Normal file
86
contracts/multisig/package.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-multisig",
|
||||
"version": "1.0.1",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
"description": "Multisig contracts used by 0x protocol",
|
||||
"main": "lib/src/index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"test": "yarn run_mocha",
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../packages/abi-gen-templates/contract.handlebars --partials '../../packages/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
"coverage:report:text": "istanbul report text",
|
||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||
"coverage:report:lcov": "istanbul report lcov",
|
||||
"test:circleci": "yarn test",
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.19",
|
||||
"@0x/contracts-test-utils": "^1.0.2",
|
||||
"@0x/dev-utils": "^1.0.21",
|
||||
"@0x/sol-compiler": "^1.1.16",
|
||||
"@0x/sol-cov": "^2.1.16",
|
||||
"@0x/subproviders": "^2.1.8",
|
||||
"@0x/tslint-config": "^2.0.0",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/ethereumjs-abi": "^0.6.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
"@types/yargs": "^10.0.0",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^2.0.1",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solc": "^0.4.24",
|
||||
"solhint": "^1.4.1",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.1",
|
||||
"yargs": "^10.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^3.0.10",
|
||||
"@0x/order-utils": "^3.0.7",
|
||||
"@0x/types": "^1.4.1",
|
||||
"@0x/typescript-typings": "^3.0.6",
|
||||
"@0x/utils": "^2.0.8",
|
||||
"@0x/web3-wrapper": "^3.2.1",
|
||||
"ethereum-types": "^1.1.4",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
11
contracts/multisig/src/artifacts/index.ts
Normal file
11
contracts/multisig/src/artifacts/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as MultiSigWallet from '../../generated-artifacts/MultiSigWallet.json';
|
||||
import * as MultiSigWalletWithTimeLock from '../../generated-artifacts/MultiSigWalletWithTimeLock.json';
|
||||
import * as TestRejectEther from '../../generated-artifacts/TestRejectEther.json';
|
||||
|
||||
export const artifacts = {
|
||||
TestRejectEther: TestRejectEther as ContractArtifact,
|
||||
MultiSigWallet: MultiSigWallet as ContractArtifact,
|
||||
MultiSigWalletWithTimeLock: MultiSigWalletWithTimeLock as ContractArtifact,
|
||||
};
|
2
contracts/multisig/src/wrappers/index.ts
Normal file
2
contracts/multisig/src/wrappers/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from '../../generated-wrappers/multi_sig_wallet';
|
||||
export * from '../../generated-wrappers/multi_sig_wallet_with_time_lock';
|
19
contracts/multisig/test/global_hooks.ts
Normal file
19
contracts/multisig/test/global_hooks.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { env, EnvVars } from '@0x/dev-utils';
|
||||
|
||||
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||
|
||||
before('start web3 provider engine', () => {
|
||||
provider.start();
|
||||
});
|
||||
|
||||
after('generate coverage report', async () => {
|
||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
await coverageSubprovider.writeCoverageAsync();
|
||||
}
|
||||
if (env.parseBoolean(EnvVars.SolidityProfiler)) {
|
||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||
await profilerSubprovider.writeProfilerOutputAsync();
|
||||
}
|
||||
provider.stop();
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user