Compare commits
1467 Commits
ethereum-t
...
@0x/contra
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f570f80674 | ||
|
|
dbae6ec165 | ||
|
|
18084588ea | ||
|
|
64d99dc07c | ||
|
|
63a63543be | ||
|
|
75a4bbc5f2 | ||
|
|
c2ec4174b7 | ||
|
|
7ea274b731 | ||
|
|
d9675ad6d3 | ||
|
|
a8e32d8c87 | ||
|
|
16a2cf7be6 | ||
|
|
b4621f6a69 | ||
|
|
c859788fde | ||
|
|
1c25d8e997 | ||
|
|
fc89b97818 | ||
|
|
b0817854e8 | ||
|
|
1907ecc02e | ||
|
|
cf2dee60dc | ||
|
|
80aa2884a3 | ||
|
|
3a28eb1c6a | ||
|
|
82a44559f6 | ||
|
|
892be49b98 | ||
|
|
1cbc03ae43 | ||
|
|
1c9a49cd08 | ||
|
|
4f53335db0 | ||
|
|
0b87aec9c6 | ||
|
|
6892f929fb | ||
|
|
f39c03191c | ||
|
|
05adb38a09 | ||
|
|
f73c68ee61 | ||
|
|
33f3405226 | ||
|
|
86caa4a0bb | ||
|
|
6d832deb62 | ||
|
|
0b6c9c8468 | ||
|
|
d1fd4421be | ||
|
|
b06f8239e1 | ||
|
|
7991de9ed0 | ||
|
|
e9a82905e3 | ||
|
|
f8684d6a77 | ||
|
|
e4551c8f60 | ||
|
|
2f1454e90e | ||
|
|
b89f986949 | ||
|
|
285fb3dead | ||
|
|
923234eed1 | ||
|
|
83b46cbf71 | ||
|
|
4689309857 | ||
|
|
02543fdd0c | ||
|
|
1f7179b178 | ||
|
|
e14f1646d6 | ||
|
|
caba2faa92 | ||
|
|
ed3b89f005 | ||
|
|
1c279f97ce | ||
|
|
b41bcd80ef | ||
|
|
45d70dd30b | ||
|
|
4b9648c7c9 | ||
|
|
092a851bb3 | ||
|
|
bd71f4a480 | ||
|
|
bf183af9a4 | ||
|
|
2b8f0d887a | ||
|
|
2581bc93e5 | ||
|
|
8b62783f48 | ||
|
|
2345a3bdfe | ||
|
|
ab5cd8f938 | ||
|
|
b108b1119a | ||
|
|
b5420fde52 | ||
|
|
dc58c60841 | ||
|
|
043fb3f460 | ||
|
|
34cce04c43 | ||
|
|
6aae0c5b78 | ||
|
|
c15406173a | ||
|
|
e3b3f82c8c | ||
|
|
007a2d7deb | ||
|
|
5da40ab45e | ||
|
|
54a1fd87db | ||
|
|
797d7c7878 | ||
|
|
507c47c42c | ||
|
|
7fcdfe5de5 | ||
|
|
22b1c48c89 | ||
|
|
2197a531e3 | ||
|
|
4799b68972 | ||
|
|
500d8fc86b | ||
|
|
89c5d657a7 | ||
|
|
bc44774116 | ||
|
|
943c378309 | ||
|
|
cf3787edbb | ||
|
|
89429c54a7 | ||
|
|
bb992458a3 | ||
|
|
66add14ca5 | ||
|
|
0b38513c3f | ||
|
|
d9ac5b611a | ||
|
|
e1b99b5e2f | ||
|
|
7af0818dff | ||
|
|
296b3d6311 | ||
|
|
4d03c3035c | ||
|
|
27c4d2522b | ||
|
|
4dbd3ea902 | ||
|
|
2cf57a48dd | ||
|
|
a091b2c19d | ||
|
|
89e398fa39 | ||
|
|
a5b7a35160 | ||
|
|
53fc860d61 | ||
|
|
749312c0e8 | ||
|
|
ffd14ab2f2 | ||
|
|
bf332d578c | ||
|
|
6c22594882 | ||
|
|
b8e3829fdb | ||
|
|
c317a69e7e | ||
|
|
4c60d59123 | ||
|
|
cee2954245 | ||
|
|
a8d9263062 | ||
|
|
7ae9e79235 | ||
|
|
15c9479ebe | ||
|
|
03dea585b4 | ||
|
|
d7df402c42 | ||
|
|
052ed21e9c | ||
|
|
36504646f9 | ||
|
|
60cdbbccae | ||
|
|
420333e3c3 | ||
|
|
b639843115 | ||
|
|
7a114a6ef1 | ||
|
|
686f27a96f | ||
|
|
6487fae113 | ||
|
|
87c287a5e2 | ||
|
|
e39ef60775 | ||
|
|
fb3605026e | ||
|
|
5b8c9122a2 | ||
|
|
08d0ff48c3 | ||
|
|
aa5af04447 | ||
|
|
39786c3ad5 | ||
|
|
5b7eff217e | ||
|
|
0a6ead90d9 | ||
|
|
7f2727236d | ||
|
|
d6644ed035 | ||
|
|
a2eede2ec9 | ||
|
|
2fa4ed1fb7 | ||
|
|
3733a29ee2 | ||
|
|
62b5eef4a0 | ||
|
|
377d6367e0 | ||
|
|
a3b364dbdf | ||
|
|
ea14913b41 | ||
|
|
5dd55491b8 | ||
|
|
28aa12691e | ||
|
|
5868c91cfb | ||
|
|
fd034cc1e4 | ||
|
|
c1bf2754a8 | ||
|
|
c388e6d2b8 | ||
|
|
622fa951ca | ||
|
|
d00dd07435 | ||
|
|
27fc640a9e | ||
|
|
4689f20b86 | ||
|
|
de927d7207 | ||
|
|
93121892d6 | ||
|
|
16fc2c3776 | ||
|
|
c3a7cbc57d | ||
|
|
0cfeea7c8c | ||
|
|
82f29c395a | ||
|
|
e2df4b355b | ||
|
|
03248244ff | ||
|
|
74ed0f4134 | ||
|
|
f05d2906e8 | ||
|
|
5e39eae84e | ||
|
|
0ea8669552 | ||
|
|
2c974b5f3f | ||
|
|
1631031fa7 | ||
|
|
0bcb81d3a9 | ||
|
|
f412c36e23 | ||
|
|
eae255b0ff | ||
|
|
1f0f2076a9 | ||
|
|
0ac36cef28 | ||
|
|
04db7f0fae | ||
|
|
e39ae0350b | ||
|
|
d0a0673694 | ||
|
|
3c62815fe3 | ||
|
|
37b6858869 | ||
|
|
641685a41e | ||
|
|
7ad23ef6dc | ||
|
|
5f2a7cb78f | ||
|
|
edb989fbf3 | ||
|
|
ff0093460d | ||
|
|
a00e416a19 | ||
|
|
77a2ca1ddc | ||
|
|
61a3368826 | ||
|
|
55e3774480 | ||
|
|
c6ab380685 | ||
|
|
d6467d707f | ||
|
|
0893614859 | ||
|
|
dc940d692f | ||
|
|
e83a108c52 | ||
|
|
bbd4828340 | ||
|
|
6de3a33f36 | ||
|
|
06139cbfe5 | ||
|
|
cb1bfa0f97 | ||
|
|
b249a50d8f | ||
|
|
0432212a34 | ||
|
|
7203ca90cf | ||
|
|
5da748a062 | ||
|
|
09afee55ed | ||
|
|
43b648e7dc | ||
|
|
89fcbec43b | ||
|
|
c850046ea0 | ||
|
|
7dda953bc9 | ||
|
|
b8f3fa9c8c | ||
|
|
42e04012df | ||
|
|
17f0878707 | ||
|
|
e4bb6a4652 | ||
|
|
3cdb85606a | ||
|
|
fd37e88bdb | ||
|
|
24564b986d | ||
|
|
a91bc415ed | ||
|
|
ccdb81ac40 | ||
|
|
d7f9e3f0a0 | ||
|
|
5720589515 | ||
|
|
70508f52a1 | ||
|
|
b90c3196a3 | ||
|
|
1dda10b4f3 | ||
|
|
0fba0b1a1b | ||
|
|
df4f3d9eac | ||
|
|
de4916ccb8 | ||
|
|
b797a45d4a | ||
|
|
eeb07d76fc | ||
|
|
0abace337c | ||
|
|
c6ff77bdd8 | ||
|
|
492e0ae345 | ||
|
|
8549252a2c | ||
|
|
aae32037da | ||
|
|
46359c098b | ||
|
|
fc71d87d2b | ||
|
|
67dfe6030c | ||
|
|
19e93440b3 | ||
|
|
0cb5209266 | ||
|
|
1553b366da | ||
|
|
d957cd5344 | ||
|
|
354f7053dc | ||
|
|
4d5fcf8985 | ||
|
|
80f1fe1373 | ||
|
|
571bc736e5 | ||
|
|
99016cc5a6 | ||
|
|
71c9b2f718 | ||
|
|
79863d830e | ||
|
|
59ec243c26 | ||
|
|
5e8da70eae | ||
|
|
99b6ca5b4f | ||
|
|
4e4de07e69 | ||
|
|
1b65efb38c | ||
|
|
ed0e6181bd | ||
|
|
f1a7efc97e | ||
|
|
442de09bbe | ||
|
|
76dde294f1 | ||
|
|
4dded13259 | ||
|
|
c82393d763 | ||
|
|
2111ea159e | ||
|
|
c1150824dc | ||
|
|
edb3a61387 | ||
|
|
89f67b9bec | ||
|
|
9131ca1562 | ||
|
|
92d45a19d1 | ||
|
|
65af195054 | ||
|
|
9f47f90c6e | ||
|
|
472f89bd3d | ||
|
|
c62d862967 | ||
|
|
1ceb3c9664 | ||
|
|
4252a760f0 | ||
|
|
5721b25c3a | ||
|
|
586a8ba8e7 | ||
|
|
1ddf1087dd | ||
|
|
72a56db5ab | ||
|
|
646e856b51 | ||
|
|
e62e61bf71 | ||
|
|
a3eab71908 | ||
|
|
dbbd0c5c92 | ||
|
|
dc6d6024dc | ||
|
|
9d5d0dbe14 | ||
|
|
febf3489ba | ||
|
|
cfb200e793 | ||
|
|
2b7875571d | ||
|
|
0a1701eac9 | ||
|
|
bcd20081d3 | ||
|
|
f17fe381bf | ||
|
|
26977f6408 | ||
|
|
c8c8219c05 | ||
|
|
92150b78fc | ||
|
|
e144ebbb93 | ||
|
|
c31f527116 | ||
|
|
e68c67a01d | ||
|
|
ea781b8850 | ||
|
|
ba7c8d9244 | ||
|
|
a67b34700e | ||
|
|
abdf91c691 | ||
|
|
9b540fd8e5 | ||
|
|
5ec1ae5f7f | ||
|
|
bed5b275e4 | ||
|
|
56af9b2aab | ||
|
|
01e7850cd3 | ||
|
|
b399aa25aa | ||
|
|
0a84ee7488 | ||
|
|
7c7085c932 | ||
|
|
bbe9862aa6 | ||
|
|
7e12ae1bfc | ||
|
|
080c6d3146 | ||
|
|
2effc3e267 | ||
|
|
970e670467 | ||
|
|
36240de897 | ||
|
|
e4e1c82ad2 | ||
|
|
9b521aeef5 | ||
|
|
1fa93fc8ce | ||
|
|
12177270df | ||
|
|
d20ed2247f | ||
|
|
f7fd9789ba | ||
|
|
75ba724c28 | ||
|
|
bc3093e635 | ||
|
|
5d3d596909 | ||
|
|
5b4d4d5537 | ||
|
|
521679c87c | ||
|
|
2a9e03b61e | ||
|
|
fb003903c7 | ||
|
|
fbfb6eb45e | ||
|
|
58be23ac97 | ||
|
|
90fcf59a32 | ||
|
|
e74b24bbdb | ||
|
|
6b5b8fe8e0 | ||
|
|
0a5ecec3e2 | ||
|
|
b6f4c5c7da | ||
|
|
a6ec2a8c54 | ||
|
|
2fa8b8d1d0 | ||
|
|
b786836db6 | ||
|
|
8e5f0f9c5c | ||
|
|
99e32869e6 | ||
|
|
04729c44b4 | ||
|
|
2a2260de45 | ||
|
|
a7c3996627 | ||
|
|
6dbcdad1ff | ||
|
|
f94bdc496a | ||
|
|
97369c969c | ||
|
|
72e68c43e3 | ||
|
|
473537e6e7 | ||
|
|
ca3e0b26c6 | ||
|
|
2716374b25 | ||
|
|
ace968a4fc | ||
|
|
e6f3693813 | ||
|
|
531ed54961 | ||
|
|
5eb316f5d8 | ||
|
|
97e21106e5 | ||
|
|
6e4cb0246c | ||
|
|
125a940560 | ||
|
|
a7f847bf3e | ||
|
|
b3978b641c | ||
|
|
94dc272335 | ||
|
|
d456710441 | ||
|
|
e886ef8c4b | ||
|
|
86a9375d04 | ||
|
|
f832e035da | ||
|
|
5656605355 | ||
|
|
5c4a992b87 | ||
|
|
0abf1c71f6 | ||
|
|
85be2fbf19 | ||
|
|
69de1d05ef | ||
|
|
237014e823 | ||
|
|
85a8c6160f | ||
|
|
e2535027e9 | ||
|
|
87d157b805 | ||
|
|
56d48758d3 | ||
|
|
abfb358250 | ||
|
|
657b698e1e | ||
|
|
8ddf925a8f | ||
|
|
c8eaa63cce | ||
|
|
b2edd84b0e | ||
|
|
bc27ee0deb | ||
|
|
c5632490f2 | ||
|
|
89ea7b2a2d | ||
|
|
b3bcd726b8 | ||
|
|
293dadc22a | ||
|
|
040b402b6d | ||
|
|
5c24596d81 | ||
|
|
552007cafb | ||
|
|
d2ef88f638 | ||
|
|
bce7ae78bc | ||
|
|
90ee70db23 | ||
|
|
84c8b83694 | ||
|
|
112724d881 | ||
|
|
e2510ed28f | ||
|
|
768e1d541c | ||
|
|
a650d695ce | ||
|
|
0eef07307e | ||
|
|
d69b3a0244 | ||
|
|
fa5acd07b0 | ||
|
|
fa612fe173 | ||
|
|
e10b30886f | ||
|
|
441b5ac6f1 | ||
|
|
96a8762704 | ||
|
|
09eac39040 | ||
|
|
b96236cdb3 | ||
|
|
f6525efe95 | ||
|
|
9728267eac | ||
|
|
f097259266 | ||
|
|
38346a9aae | ||
|
|
ca0ab38521 | ||
|
|
d2a4fd5706 | ||
|
|
afe200c4e1 | ||
|
|
00f5b94d0a | ||
|
|
1de92659ee | ||
|
|
25722d8154 | ||
|
|
bb4ce9b3ad | ||
|
|
b524ac7af2 | ||
|
|
dea6f35b04 | ||
|
|
f3a2e3b6f3 | ||
|
|
f91781a060 | ||
|
|
22fd23643c | ||
|
|
a1266a3341 | ||
|
|
34ff7fae9c | ||
|
|
d45c13bfa8 | ||
|
|
dccca95c2c | ||
|
|
fc684ad063 | ||
|
|
6a0f5f39ee | ||
|
|
4417c76b13 | ||
|
|
8799f9bb90 | ||
|
|
6d673ac942 | ||
|
|
8d6219296a | ||
|
|
cb9ec18f96 | ||
|
|
1883f4d272 | ||
|
|
93b9c251ed | ||
|
|
3ad72d96f4 | ||
|
|
4f977aa51d | ||
|
|
a2df428afb | ||
|
|
e45a0ffdbf | ||
|
|
51355209a2 | ||
|
|
4b0d01ad72 | ||
|
|
a655f4b193 | ||
|
|
7af2c751dc | ||
|
|
d882133e44 | ||
|
|
7e7880aea0 | ||
|
|
18f028fb08 | ||
|
|
14c97b3ec3 | ||
|
|
58a382d9b6 | ||
|
|
2be9b1ff08 | ||
|
|
1cdd82178f | ||
|
|
dbf1de2e69 | ||
|
|
ba986432ec | ||
|
|
3bb147b0f1 | ||
|
|
0556defa58 | ||
|
|
4217d0cd7d | ||
|
|
5863a29a91 | ||
|
|
df0de07184 | ||
|
|
28a5ed6a9a | ||
|
|
c040ad0850 | ||
|
|
8007ef6c0b | ||
|
|
a332c5e5c2 | ||
|
|
bab7569ed9 | ||
|
|
16bd0ce7ec | ||
|
|
61a906e9e7 | ||
|
|
8c9d48477d | ||
|
|
9f68ac7bbe | ||
|
|
4e341582ae | ||
|
|
37a1271af2 | ||
|
|
743c4c36eb | ||
|
|
3f7bd24250 | ||
|
|
33e41dd500 | ||
|
|
989b5b0a98 | ||
|
|
a4ab038aa8 | ||
|
|
e81f92bffa | ||
|
|
003075a8a5 | ||
|
|
b4aca370de | ||
|
|
c854c99f20 | ||
|
|
0e0e05e0e0 | ||
|
|
88595718c3 | ||
|
|
f104d91595 | ||
|
|
07c1a0121f | ||
|
|
67521da5c1 | ||
|
|
9bd71aeeff | ||
|
|
59d7efa78a | ||
|
|
102b7154e0 | ||
|
|
abbb6793cc | ||
|
|
7b117081d3 | ||
|
|
342ecae34d | ||
|
|
b40551e2df | ||
|
|
ffa57c3703 | ||
|
|
630ecb98e1 | ||
|
|
ae27695d25 | ||
|
|
45d8b522f4 | ||
|
|
aa5c2c249d | ||
|
|
1ae9eedf9f | ||
|
|
622b9f662e | ||
|
|
e295eeb893 | ||
|
|
67df5a433d | ||
|
|
18e55830b5 | ||
|
|
7664f6a4fd | ||
|
|
cf553f2afe | ||
|
|
6cc0e6d55c | ||
|
|
a6628cd363 | ||
|
|
6271133350 | ||
|
|
55589698cf | ||
|
|
ee0a226c43 | ||
|
|
d760b355ec | ||
|
|
4c9bdcd787 | ||
|
|
b7a8c871d2 | ||
|
|
230236d4d7 | ||
|
|
2372925347 | ||
|
|
df48539d41 | ||
|
|
90a1947c88 | ||
|
|
44d9cc53b8 | ||
|
|
293e099cb3 | ||
|
|
e34aa4d859 | ||
|
|
50110b3725 | ||
|
|
e5815538e4 | ||
|
|
4fbc544b16 | ||
|
|
0aa7cbac92 | ||
|
|
8b24b7c57c | ||
|
|
ed4573fe2c | ||
|
|
7468be8f17 | ||
|
|
0dcada8e06 | ||
|
|
b255edc577 | ||
|
|
4ac1db1247 | ||
|
|
2c24cff950 | ||
|
|
2107285a00 | ||
|
|
095cec4342 | ||
|
|
53529439c5 | ||
|
|
3cf9cf98dc | ||
|
|
43cc7b6626 | ||
|
|
5defa94902 | ||
|
|
e0116da559 | ||
|
|
c385627030 | ||
|
|
031eb8d6a0 | ||
|
|
c5f85a365b | ||
|
|
a6fa15c94a | ||
|
|
14767f1a51 | ||
|
|
d34d8cac5d | ||
|
|
1e0aa55368 | ||
|
|
bb691aa4ed | ||
|
|
64e84a3510 | ||
|
|
62f5c58d83 | ||
|
|
4cf3172c90 | ||
|
|
8452c05952 | ||
|
|
8925317c95 | ||
|
|
248a3998cf | ||
|
|
be3142a96a | ||
|
|
4626921bb6 | ||
|
|
2593f1b8d7 | ||
|
|
4e80c395b1 | ||
|
|
1f59c99532 | ||
|
|
a77e5a1a12 | ||
|
|
35f7dd71e9 | ||
|
|
c4036d7d0f | ||
|
|
6e0d622a15 | ||
|
|
0e8f0d1d53 | ||
|
|
c126d01fe3 | ||
|
|
6d66476d35 | ||
|
|
039b95c8c1 | ||
|
|
30ccddf0d5 | ||
|
|
024e503657 | ||
|
|
37e5a8a8b7 | ||
|
|
592c171557 | ||
|
|
9df0ae90bc | ||
|
|
33e06fdf40 | ||
|
|
cce07acf9a | ||
|
|
d32f77ebb9 | ||
|
|
35cb769456 | ||
|
|
9fdd6e56a7 | ||
|
|
2a0ba501e0 | ||
|
|
90d4a2b590 | ||
|
|
f7581d60da | ||
|
|
2cc03216bd | ||
|
|
cd4e679db7 | ||
|
|
28713bdb38 | ||
|
|
c0b469fdd9 | ||
|
|
47db165afc | ||
|
|
f95401ad33 | ||
|
|
5209729eb1 | ||
|
|
31bbb0696c | ||
|
|
6ab8415198 | ||
|
|
5a6b538a13 | ||
|
|
42e63b32e3 | ||
|
|
072c80f475 | ||
|
|
fb623cf63b | ||
|
|
5e4defefb0 | ||
|
|
8d76053210 | ||
|
|
b7d8362fb1 | ||
|
|
73e8563413 | ||
|
|
312d864936 | ||
|
|
67caa377a4 | ||
|
|
8234bd5409 | ||
|
|
3b8598b54b | ||
|
|
934d3b5d79 | ||
|
|
5932589776 | ||
|
|
19e65965c8 | ||
|
|
8490c31fb7 | ||
|
|
f242c4206f | ||
|
|
88240f6401 | ||
|
|
7065a098e3 | ||
|
|
6fc80cd776 | ||
|
|
4611c65aa3 | ||
|
|
d6866a6dae | ||
|
|
68be8ef861 | ||
|
|
0c298b7be4 | ||
|
|
6eb8256555 | ||
|
|
240e3558fa | ||
|
|
8988650c8b | ||
|
|
28bad6567b | ||
|
|
1be948bd55 | ||
|
|
c2b355c25e | ||
|
|
d12e881e62 | ||
|
|
85edc297f6 | ||
|
|
96d89ddade | ||
|
|
5b4b4123e5 | ||
|
|
2a577e0475 | ||
|
|
6382f98608 | ||
|
|
a12b9e82f6 | ||
|
|
5d0e715d9a | ||
|
|
896c8d17c1 | ||
|
|
ee4185ab46 | ||
|
|
7661cfc85e | ||
|
|
f510f9df99 | ||
|
|
7cafe396de | ||
|
|
6bb2ef9238 | ||
|
|
737d1dc54d | ||
|
|
aa9aa1f58a | ||
|
|
9b4d1a1e38 | ||
|
|
c6815bddac | ||
|
|
2e2e157fc8 | ||
|
|
6639201fdb | ||
|
|
57ac2f28a4 | ||
|
|
8c5ff663a9 | ||
|
|
67422db4bd | ||
|
|
219902a169 | ||
|
|
ab10119c5a | ||
|
|
5981823ac1 | ||
|
|
69054d85e8 | ||
|
|
3e596f6a8c | ||
|
|
c3884dfa32 | ||
|
|
a3d93d17cd | ||
|
|
c6c45095a8 | ||
|
|
7d5388edee | ||
|
|
51b1cab72a | ||
|
|
e3dcb7107b | ||
|
|
f7ceb4cf58 | ||
|
|
e53f28c570 | ||
|
|
5c083ba16b | ||
|
|
4d5bfb5cc2 | ||
|
|
2adeed38d8 | ||
|
|
21a193e516 | ||
|
|
926fcb296f | ||
|
|
f6f441cbe6 | ||
|
|
b9fa158092 | ||
|
|
210840444d | ||
|
|
d92e143a7e | ||
|
|
087469f1f3 | ||
|
|
b6c8126589 | ||
|
|
8570616d97 | ||
|
|
373ebdbe38 | ||
|
|
a1410409ff | ||
|
|
32eab3acff | ||
|
|
d9b5884834 | ||
|
|
76a4468b85 | ||
|
|
361dc29338 | ||
|
|
dbdd2fb7d0 | ||
|
|
b07892bb48 | ||
|
|
6d45beccad | ||
|
|
f0581285d0 | ||
|
|
04d4e797aa | ||
|
|
ceddc01985 | ||
|
|
1955c846f2 | ||
|
|
1efde6f59b | ||
|
|
6af0cf87e1 | ||
|
|
101fd78cb2 | ||
|
|
91d432aa56 | ||
|
|
dde2baf204 | ||
|
|
96cb278cae | ||
|
|
51777ed61d | ||
|
|
2b4c557a3f | ||
|
|
84321c41f3 | ||
|
|
f9dfecaf13 | ||
|
|
d1f73da675 | ||
|
|
94c7bf47db | ||
|
|
4e8d653f1f | ||
|
|
c5b63ca441 | ||
|
|
ea668d1376 | ||
|
|
086c70bcdc | ||
|
|
461c7efc26 | ||
|
|
c145349af0 | ||
|
|
df445eb53c | ||
|
|
eadad19cb5 | ||
|
|
d410c44b07 | ||
|
|
9fa9a30c4d | ||
|
|
bdc8f9aa2a | ||
|
|
6db28c5300 | ||
|
|
0dc9fc4ef7 | ||
|
|
41ec26c927 | ||
|
|
51def6ee6b | ||
|
|
377b87071a | ||
|
|
1782418f92 | ||
|
|
f3f78f63ec | ||
|
|
a2cb815454 | ||
|
|
ef200b1ce6 | ||
|
|
f6c173a97e | ||
|
|
ef403108fb | ||
|
|
8a06dccbbf | ||
|
|
4590d07e7f | ||
|
|
ba89429aec | ||
|
|
ee38031696 | ||
|
|
8948029dd7 | ||
|
|
e78ddd4d5a | ||
|
|
f179dc3ca7 | ||
|
|
166a6c85fd | ||
|
|
c7c07a7c01 | ||
|
|
f083cafcc7 | ||
|
|
fab3a90d5a | ||
|
|
a04c54b4d8 | ||
|
|
388c7afb50 | ||
|
|
51f2711796 | ||
|
|
907aa7a844 | ||
|
|
9695be13c3 | ||
|
|
f452fc5bc7 | ||
|
|
106df4cdaf | ||
|
|
ed6d83c0a7 | ||
|
|
66480ccb1e | ||
|
|
7a10f03496 | ||
|
|
64c168eafc | ||
|
|
44e516ac65 | ||
|
|
d018f6d9cc | ||
|
|
d5e15b05fb | ||
|
|
59fad5845c | ||
|
|
545101f7a5 | ||
|
|
2abd8fe4ee | ||
|
|
3c578cfda9 | ||
|
|
6878705676 | ||
|
|
597b2f38f5 | ||
|
|
9697d66b66 | ||
|
|
8906c30f37 | ||
|
|
9cd859a68a | ||
|
|
33c6e40b70 | ||
|
|
5744a7f61b | ||
|
|
f9a6c45a03 | ||
|
|
f8e84260b5 | ||
|
|
5a45bc5e7b | ||
|
|
80f03ef987 | ||
|
|
e48887bc6f | ||
|
|
52272cd290 | ||
|
|
ac1786585e | ||
|
|
f4a95c295c | ||
|
|
142d29ba57 | ||
|
|
d84c740274 | ||
|
|
1c413e632b | ||
|
|
9a1d2c055e | ||
|
|
803086da57 | ||
|
|
2a242e357f | ||
|
|
1647400a49 | ||
|
|
41a8dd3e28 | ||
|
|
81690d1ce5 | ||
|
|
f846e2f6e0 | ||
|
|
bfc8a3ccee | ||
|
|
daf334a588 | ||
|
|
4d0c59649e | ||
|
|
a1737f8d93 | ||
|
|
455f244ec5 | ||
|
|
6f7e27bd7f | ||
|
|
ea57367473 | ||
|
|
088c471b78 | ||
|
|
9fda63cf74 | ||
|
|
4cf900631c | ||
|
|
fed79b2fde | ||
|
|
d2e29fb081 | ||
|
|
b4b1d54e49 | ||
|
|
a852a4077d | ||
|
|
1c0bf710a4 | ||
|
|
f4e9103b6f | ||
|
|
f8e95ae483 | ||
|
|
70df5a0a17 | ||
|
|
79dac62646 | ||
|
|
5bd185e831 | ||
|
|
687749460d | ||
|
|
193cd67d6b | ||
|
|
8d54772389 | ||
|
|
0f8acedf02 | ||
|
|
ddf3bb7c04 | ||
|
|
3a8f3e01b6 | ||
|
|
167a3fbc11 | ||
|
|
f9d436cd21 | ||
|
|
2e7d363f2c | ||
|
|
1534505652 | ||
|
|
9e5e1f568b | ||
|
|
65579c0236 | ||
|
|
be045dad9b | ||
|
|
885c22676b | ||
|
|
a1186f052d | ||
|
|
0e76d66f24 | ||
|
|
2b523a36c5 | ||
|
|
723dd2bcde | ||
|
|
a900593c88 | ||
|
|
756dc1e95e | ||
|
|
68faaaba5f | ||
|
|
48fdb567cb | ||
|
|
bd5a0616c4 | ||
|
|
0690e68a83 | ||
|
|
fb99b5ce9d | ||
|
|
aa8dfa88e1 | ||
|
|
99941972a3 | ||
|
|
8a5609718a | ||
|
|
aeefdeaef7 | ||
|
|
7b4e536e86 | ||
|
|
52f733626e | ||
|
|
c8c68fb75a | ||
|
|
1364880812 | ||
|
|
ddc1f34c30 | ||
|
|
cdca07d829 | ||
|
|
59b7e25389 | ||
|
|
87ab8f036c | ||
|
|
b151b6fe69 | ||
|
|
8f911206f7 | ||
|
|
3496725db6 | ||
|
|
ed588decc6 | ||
|
|
50e0336018 | ||
|
|
d07e6cb1d6 | ||
|
|
ca86f18e7d | ||
|
|
72e94b3307 | ||
|
|
7c33c91d59 | ||
|
|
0f1197c14b | ||
|
|
4858c0c484 | ||
|
|
5865b4848d | ||
|
|
c9af7dc9e5 | ||
|
|
6e023e6ea3 | ||
|
|
9176e1f53b | ||
|
|
0dbe2a91a8 | ||
|
|
8afac3a92c | ||
|
|
07a0170f34 | ||
|
|
1dc67b2874 | ||
|
|
f09e577885 | ||
|
|
2c58b8a886 | ||
|
|
cb53cd05e6 | ||
|
|
982d59d45d | ||
|
|
b76a14d51d | ||
|
|
e8231767ec | ||
|
|
2b7dabeb6e | ||
|
|
dde3a0366b | ||
|
|
8e071db074 | ||
|
|
93422eab55 | ||
|
|
74e07b63de | ||
|
|
7dd0b3a5da | ||
|
|
b59f20482e | ||
|
|
98aa7a2c54 | ||
|
|
7527c61af5 | ||
|
|
bc6492e352 | ||
|
|
5c4a2461b8 | ||
|
|
183edee4ac | ||
|
|
c513082071 | ||
|
|
23a6dfac3c | ||
|
|
e368106932 | ||
|
|
785981ce58 | ||
|
|
60bbb9b520 | ||
|
|
fb81570678 | ||
|
|
56b82bbc8b | ||
|
|
05217bb1a2 | ||
|
|
075fa315e7 | ||
|
|
fc5f0c9863 | ||
|
|
13e89d027c | ||
|
|
ea8f35b743 | ||
|
|
9365a3bc75 | ||
|
|
363095f2fe | ||
|
|
b57b6c04cc | ||
|
|
e1d77d6e10 | ||
|
|
da51f6e56f | ||
|
|
5d0f82c3c6 | ||
|
|
1878a0c4b0 | ||
|
|
b538fabdef | ||
|
|
01716e0d51 | ||
|
|
7cd3f3cead | ||
|
|
9d9b5edc9c | ||
|
|
09a0ca659e | ||
|
|
1d189d112e | ||
|
|
829b7cb712 | ||
|
|
fb8267d85e | ||
|
|
d842078997 | ||
|
|
7f574949a4 | ||
|
|
caeb59a9ae | ||
|
|
ea95de7d9d | ||
|
|
52f2ee6e79 | ||
|
|
ad3d20b342 | ||
|
|
4fa4f13813 | ||
|
|
f5f01c0c3e | ||
|
|
3b9e8e669f | ||
|
|
99d90bb665 | ||
|
|
9d8c423b98 | ||
|
|
d24b2a5a69 | ||
|
|
aa63632fff | ||
|
|
d86f5c4fbd | ||
|
|
0a69752d20 | ||
|
|
f6ebdd1a3f | ||
|
|
e2f222b08f | ||
|
|
50924d62cb | ||
|
|
da5e8b09d9 | ||
|
|
fff1e2cfa7 | ||
|
|
1544e5ed9f | ||
|
|
4912affbe8 | ||
|
|
c52ab47185 | ||
|
|
f082a3f768 | ||
|
|
27c229a146 | ||
|
|
43c2b81604 | ||
|
|
2a133f2c55 | ||
|
|
4570bc2729 | ||
|
|
8702a35467 | ||
|
|
07f80500fa | ||
|
|
97fc4257a0 | ||
|
|
25f1b7701f | ||
|
|
6b889aeeed | ||
|
|
8e0dcb204f | ||
|
|
0dc000183a | ||
|
|
90e1028d2f | ||
|
|
ed3737c1f1 | ||
|
|
c9dc69bed6 | ||
|
|
cd7e41bd5b | ||
|
|
c46d2f8f9d | ||
|
|
eb1317a59a | ||
|
|
98325e1cfb | ||
|
|
356b7df534 | ||
|
|
2340813149 | ||
|
|
8923817b2f | ||
|
|
7aacf1f5a4 | ||
|
|
405667fa83 | ||
|
|
0a3162915f | ||
|
|
8bcbb64a01 | ||
|
|
ceafe5ed84 | ||
|
|
f788fea095 | ||
|
|
88094002d3 | ||
|
|
e57a5a6f82 | ||
|
|
d1ceb2e561 | ||
|
|
ec2bb616e1 | ||
|
|
bf56a2c7c4 | ||
|
|
52b9f4ef3b | ||
|
|
7845fdbd9c | ||
|
|
6d2da94f8a | ||
|
|
20deb01e01 | ||
|
|
3d9fc6c865 | ||
|
|
1d5473eece | ||
|
|
4b4db3802a | ||
|
|
5eeb848974 | ||
|
|
5df789bd05 | ||
|
|
74959cf354 | ||
|
|
39ceff3d6e | ||
|
|
fa501e9c93 | ||
|
|
94c90cc49a | ||
|
|
d8e03b87d6 | ||
|
|
f06c17cccc | ||
|
|
ffff1d5fff | ||
|
|
fa389f18cd | ||
|
|
7d5aeacb1c | ||
|
|
0df51c37d1 | ||
|
|
bb2581612a | ||
|
|
3844ce9b60 | ||
|
|
0c5fa5892c | ||
|
|
b04a9b9296 | ||
|
|
2bf831132a | ||
|
|
6e62b108a9 | ||
|
|
6262e06afd | ||
|
|
b1f4bb722d | ||
|
|
c5db8f25d3 | ||
|
|
965b1ff32f | ||
|
|
7f7403cf72 | ||
|
|
088ca6ce7c | ||
|
|
5df160ffb9 | ||
|
|
80efe70247 | ||
|
|
6c4c666d9b | ||
|
|
1175a18ccc | ||
|
|
19f662c196 | ||
|
|
78a6d23659 | ||
|
|
f4dc8b12f7 | ||
|
|
5cff911035 | ||
|
|
b3fa0c8dac | ||
|
|
5f7ed71937 | ||
|
|
b1a73f5c74 | ||
|
|
318e7d5b57 | ||
|
|
a939433bd2 | ||
|
|
42be1a429f | ||
|
|
ee7d6fb3af | ||
|
|
286474ca76 | ||
|
|
5cbe04acab | ||
|
|
585c789124 | ||
|
|
8a761ce2bc | ||
|
|
bc8981cbb2 | ||
|
|
26c9cd3cb2 | ||
|
|
25f66f96b6 | ||
|
|
0948ed7a87 | ||
|
|
bc64c9566c | ||
|
|
d068956b69 | ||
|
|
1e5bc143be | ||
|
|
ec72a4b68c | ||
|
|
1f4af537c0 | ||
|
|
91c4191985 | ||
|
|
1d6e66d937 | ||
|
|
79d31895fb | ||
|
|
1d4d254496 | ||
|
|
528d882ec4 | ||
|
|
2471d4098f | ||
|
|
33b36eaf07 | ||
|
|
27bf0d8a16 | ||
|
|
b5372ade3c | ||
|
|
1b7c9b0775 | ||
|
|
a4d9434290 | ||
|
|
e001988dbe | ||
|
|
54c9709bf0 | ||
|
|
cc0fb833fe | ||
|
|
96ebad7568 | ||
|
|
3fb74be4ba | ||
|
|
86acca5e1c | ||
|
|
cb2b45bf04 | ||
|
|
3652b8270a | ||
|
|
0a05ef36a6 | ||
|
|
11c864e20d | ||
|
|
c46870d296 | ||
|
|
6e54514013 | ||
|
|
e18be3160e | ||
|
|
6ef5f28f81 | ||
|
|
beffcd990c | ||
|
|
c622498e50 | ||
|
|
a0ea0415dd | ||
|
|
d56df4fdaf | ||
|
|
7226944dfd | ||
|
|
7aee687e6b | ||
|
|
4138c580bc | ||
|
|
a3f12cd4de | ||
|
|
a208cba4e8 | ||
|
|
8d0b6702c0 | ||
|
|
9abd1b79e1 | ||
|
|
bd725eee86 | ||
|
|
88c18bd2e6 | ||
|
|
9dc32c2bca | ||
|
|
bdd287559c | ||
|
|
194f785939 | ||
|
|
086568bddf | ||
|
|
3506c0e501 | ||
|
|
93eb31f7a0 | ||
|
|
934117bfe4 | ||
|
|
7c33f94836 | ||
|
|
74d0eb40c5 | ||
|
|
23987c0fa1 | ||
|
|
cc1b71651d | ||
|
|
5e1892f383 | ||
|
|
93d1f2255e | ||
|
|
727ced0684 | ||
|
|
0ff13edb58 | ||
|
|
0341ced3f3 | ||
|
|
4f6c95b0ca | ||
|
|
c4ee6836fa | ||
|
|
55ed406746 | ||
|
|
f93e77e77c | ||
|
|
3ac6da7db1 | ||
|
|
3e93442a43 | ||
|
|
a617c801bc | ||
|
|
7d9ab27b9d | ||
|
|
c686c241c0 | ||
|
|
a1889e2a23 | ||
|
|
37a1483359 | ||
|
|
80811c9cca | ||
|
|
14d342c3e0 | ||
|
|
394105b860 | ||
|
|
1752aa63da | ||
|
|
9636fd1b76 | ||
|
|
16f69ad718 | ||
|
|
03ca825639 | ||
|
|
c995586063 | ||
|
|
8dd738629a | ||
|
|
701ea77a79 | ||
|
|
b68f3eb772 | ||
|
|
47e8bc8e43 | ||
|
|
eb137cf576 | ||
|
|
f88ff698a4 | ||
|
|
49a1f84e16 | ||
|
|
23675b4901 | ||
|
|
950c56d7b8 | ||
|
|
4b166828b8 | ||
|
|
c1698aa634 | ||
|
|
ae6f7cc454 | ||
|
|
506c736d4f | ||
|
|
0dbb866918 | ||
|
|
e82f807d7c | ||
|
|
b586ecdf92 | ||
|
|
ff8029402d | ||
|
|
92361ae811 | ||
|
|
cba8dc8a75 | ||
|
|
ef1e5eacbd | ||
|
|
7ba47c47bb | ||
|
|
f8f3a3b3cc | ||
|
|
b6e79fd9e0 | ||
|
|
b39f511755 | ||
|
|
43d1f61d28 | ||
|
|
37e3f481dd | ||
|
|
5acf053f8b | ||
|
|
b3038787ea | ||
|
|
b9305f6ab7 | ||
|
|
21cbf05362 | ||
|
|
a3718803a0 | ||
|
|
6742142ca5 | ||
|
|
b7e06a2282 | ||
|
|
4c65bbbb8f | ||
|
|
105da3f814 | ||
|
|
4a5b72a5ab | ||
|
|
2d6c46b83c | ||
|
|
6f5787b2c4 | ||
|
|
f96711bac3 | ||
|
|
ddd246a945 | ||
|
|
d14d38dabd | ||
|
|
3ca876c574 | ||
|
|
6d2f4b91a9 | ||
|
|
6739261a7e | ||
|
|
72c45d9ea9 | ||
|
|
75df8a0e8b | ||
|
|
f3c28afedd | ||
|
|
80ab797d3a | ||
|
|
d6dff5f86a | ||
|
|
4a715c30fd | ||
|
|
65bb8bdb5e | ||
|
|
5237e9c2ed | ||
|
|
6bab2f70b9 | ||
|
|
a0a41b1b5d | ||
|
|
f07dc5ae6d | ||
|
|
8cb6c2b51b | ||
|
|
1f87bd8cf6 | ||
|
|
a2aeca7b66 | ||
|
|
e394c4fe1d | ||
|
|
5c655eeda7 | ||
|
|
d932448563 | ||
|
|
7f782b6af0 | ||
|
|
a3f4264790 | ||
|
|
b818a62d74 | ||
|
|
e69cdfb7b5 | ||
|
|
45da317e15 | ||
|
|
c21cf55b86 | ||
|
|
2dfdc19c9e | ||
|
|
012134001a | ||
|
|
0f869b0545 | ||
|
|
774971c98c | ||
|
|
25b6e7092f | ||
|
|
62412b8551 | ||
|
|
374d513090 | ||
|
|
a72463dbdb | ||
|
|
b159d4e0ec | ||
|
|
1402a3dfae | ||
|
|
64865bc10f | ||
|
|
ef00ac6f51 | ||
|
|
7a7c66b0ec | ||
|
|
0166c29625 | ||
|
|
9c35d53694 | ||
|
|
8701f9a7b0 | ||
|
|
427c2cd164 | ||
|
|
8c0dfc1936 | ||
|
|
392e89fcbb | ||
|
|
44c1947740 | ||
|
|
5719eb28f7 | ||
|
|
ce7027d11f | ||
|
|
3ba98e2192 | ||
|
|
1ae3592e45 | ||
|
|
dc04d025af | ||
|
|
5262d3b1f2 | ||
|
|
7d9afce13b | ||
|
|
c99b71f354 | ||
|
|
0133bec07d | ||
|
|
bd7bde9bb0 | ||
|
|
a6e5d126c3 | ||
|
|
8e7ea4695b | ||
|
|
cc5ea80aa3 | ||
|
|
d1026a64ba | ||
|
|
dda44500c5 | ||
|
|
7b81bd831f | ||
|
|
44312478fa | ||
|
|
92f56c63ac | ||
|
|
3d69063bf6 | ||
|
|
4e03c754e7 | ||
|
|
87eaa91410 | ||
|
|
8f5c92b143 | ||
|
|
77cc1a95bb | ||
|
|
27cb0386a3 | ||
|
|
42d6284cf7 | ||
|
|
893e9f2731 | ||
|
|
7a6339ae38 | ||
|
|
fbb27b1fb2 | ||
|
|
7f8dc8bb1b | ||
|
|
c47b42d7c1 | ||
|
|
3bdcf7857f | ||
|
|
80a25e4b38 | ||
|
|
4d7e5b4e5d | ||
|
|
659ae0dcca | ||
|
|
7a52168cd8 | ||
|
|
566953d5e1 | ||
|
|
a849af8a48 | ||
|
|
cc235aac38 | ||
|
|
ec24bf8401 | ||
|
|
9ebb096025 | ||
|
|
f8b925c9ad | ||
|
|
a20d547814 | ||
|
|
3dcb874e08 | ||
|
|
6b952c4236 | ||
|
|
9e1a94266e | ||
|
|
a9895c55f9 | ||
|
|
682b0dd8f4 | ||
|
|
00dbddc1aa | ||
|
|
b552c2bd0c | ||
|
|
ae9614ba36 | ||
|
|
871ec6cfbc | ||
|
|
3c7dca37f5 | ||
|
|
8acb25f577 | ||
|
|
eec40080a0 | ||
|
|
4da419cf75 | ||
|
|
5bf7b9b8f3 | ||
|
|
950dae0437 | ||
|
|
05ef537de0 | ||
|
|
68d7ce1968 | ||
|
|
59eca8d748 | ||
|
|
06304b30c9 | ||
|
|
03962352df | ||
|
|
1c03c9168b | ||
|
|
b6be92e40b | ||
|
|
06d4abf1ba | ||
|
|
9349e50bb4 | ||
|
|
bf672272ce | ||
|
|
b9fbb3a725 | ||
|
|
64d52e2113 | ||
|
|
e0475ce84e | ||
|
|
64c5181c14 | ||
|
|
6f333f2b55 | ||
|
|
7f77347ea4 | ||
|
|
9ed30fbcca | ||
|
|
1fab30ef80 | ||
|
|
62eba1e820 | ||
|
|
78703ab370 | ||
|
|
435d9e47e3 | ||
|
|
5c12e664a9 | ||
|
|
46422ff783 | ||
|
|
3a13286585 | ||
|
|
c98c8b1ded | ||
|
|
de0b5772bf | ||
|
|
dbf62ae205 | ||
|
|
7962e4050c | ||
|
|
6bf9889429 | ||
|
|
7f8b9ef1f7 | ||
|
|
e91fffd005 | ||
|
|
7314fd7252 | ||
|
|
247a69aaec | ||
|
|
d78ac3f157 | ||
|
|
315584ef51 | ||
|
|
57e539ed41 | ||
|
|
db1babd5be | ||
|
|
bb63c5c86f | ||
|
|
82d6f2150b | ||
|
|
5f177108d1 | ||
|
|
46aa446a61 | ||
|
|
0883f7087b | ||
|
|
e782262572 | ||
|
|
2ba14d656e | ||
|
|
0c2848c418 | ||
|
|
47ef28f88f | ||
|
|
e81bd1b7f0 | ||
|
|
929eb45699 | ||
|
|
4456ba0f6a | ||
|
|
d6329a83d5 | ||
|
|
203baa4541 | ||
|
|
e13406cbf4 | ||
|
|
df213ac0d5 | ||
|
|
4d7db045e9 | ||
|
|
849b744185 | ||
|
|
7161e8fed9 | ||
|
|
1105d76861 | ||
|
|
9b6d738ab1 | ||
|
|
d586c1f67a | ||
|
|
fff4dd7e94 | ||
|
|
c2d9585150 | ||
|
|
3586dde480 | ||
|
|
d6b92e5786 | ||
|
|
ab24dcc290 | ||
|
|
189920eab9 | ||
|
|
83499176d9 | ||
|
|
5294c31997 | ||
|
|
b461147389 | ||
|
|
1d0d4ca147 | ||
|
|
2103d5c3ed | ||
|
|
a21bca7cf4 | ||
|
|
200da7d22c | ||
|
|
a114cf5c2e | ||
|
|
4bc5881e9a | ||
|
|
a9d413728e | ||
|
|
e10d34cdfc | ||
|
|
96b9ffc847 | ||
|
|
9d850cea14 | ||
|
|
0e7329bcec | ||
|
|
b564f090f9 | ||
|
|
ec099dd009 | ||
|
|
0577a0dbc5 | ||
|
|
1bba985124 | ||
|
|
8bcb5b00ba | ||
|
|
d0fa615f32 | ||
|
|
ef6cffd9d9 | ||
|
|
aa4234a38c | ||
|
|
9b794c00ea | ||
|
|
03289293c3 | ||
|
|
0736ba7159 | ||
|
|
44ac385e8b | ||
|
|
512b483b6f | ||
|
|
5a9755da9b | ||
|
|
be39c5ba99 | ||
|
|
0c5b645e86 | ||
|
|
23bfad6c40 | ||
|
|
850c441c70 | ||
|
|
dc434bdff0 | ||
|
|
0afd490aec | ||
|
|
c8520c45cb | ||
|
|
ec6b47ded0 | ||
|
|
36d94b894a | ||
|
|
a18a11da92 | ||
|
|
4bad973877 | ||
|
|
38e12c2405 | ||
|
|
f9a7cc94e1 | ||
|
|
3382077768 | ||
|
|
b9cbc87882 | ||
|
|
d05d5ac10d | ||
|
|
a1fe30e210 | ||
|
|
56ca19dc9b | ||
|
|
969674a5ce | ||
|
|
d2a418b368 | ||
|
|
081859f334 | ||
|
|
1cc06dd9e6 | ||
|
|
d642082058 | ||
|
|
d3aebd0b79 | ||
|
|
7b90f095ff | ||
|
|
df6c1ae059 | ||
|
|
5578c70cd6 | ||
|
|
3e2c93f5a0 | ||
|
|
471a4e981a | ||
|
|
6b4112527f | ||
|
|
3a9f8a7296 | ||
|
|
bbb3e5afcc | ||
|
|
9b0020a884 | ||
|
|
ec12e46e3f | ||
|
|
21d9783ef8 | ||
|
|
89ce87f9f1 | ||
|
|
592e1a3e6f | ||
|
|
99176c2d54 | ||
|
|
ad0083dfa0 | ||
|
|
6919409c2b | ||
|
|
f360b2edd6 | ||
|
|
339ec3e8eb | ||
|
|
b0c22a222e | ||
|
|
ea18050589 | ||
|
|
117726c6d8 | ||
|
|
31d07fdac8 | ||
|
|
881655bb57 | ||
|
|
38949f7ea4 | ||
|
|
8d3e6f77b7 | ||
|
|
5865d1f62c | ||
|
|
e2607980eb | ||
|
|
f519f5744e | ||
|
|
fa24ec1a04 | ||
|
|
6e1014a647 | ||
|
|
0b46f44ad3 | ||
|
|
b811b51af9 | ||
|
|
b88e2c5483 | ||
|
|
cd333e0977 | ||
|
|
62706d83c4 | ||
|
|
284252e7a4 | ||
|
|
3ad857be6c | ||
|
|
7fec2f630c | ||
|
|
c081081448 | ||
|
|
54bd7df900 | ||
|
|
5afef5fe82 | ||
|
|
0c222f9890 | ||
|
|
e43988aa44 | ||
|
|
ee91f56bbe | ||
|
|
52b49fee24 | ||
|
|
31f096248d | ||
|
|
d91c41b29c | ||
|
|
c27a2b64ef | ||
|
|
fdaffb67e8 | ||
|
|
d32bf15b69 | ||
|
|
7536648f7a | ||
|
|
eb2fa8e4af | ||
|
|
5d3d2736f5 | ||
|
|
0574794496 | ||
|
|
3a23e795ac | ||
|
|
2dfca078fd | ||
|
|
9006e8fced | ||
|
|
6b8f8580d8 | ||
|
|
eb9d802146 | ||
|
|
6b11ca6c1d | ||
|
|
4c8178fc30 | ||
|
|
4616d6f59d | ||
|
|
5cb944fe1b | ||
|
|
50c4909f22 | ||
|
|
dd8b9bf987 | ||
|
|
0e3cd82348 | ||
|
|
3d4041ecd3 | ||
|
|
89e439c521 | ||
|
|
0f97771d5a | ||
|
|
74f0515370 | ||
|
|
f17c7e4a22 | ||
|
|
5fe98c816d | ||
|
|
f75cfd8aa4 | ||
|
|
7577d96671 | ||
|
|
58f5b6d0ad | ||
|
|
a11348ce6b | ||
|
|
a4825d8748 | ||
|
|
e3c0363db1 | ||
|
|
3fdc6e5e47 | ||
|
|
2ef8204ab4 | ||
|
|
72b4ee76fb | ||
|
|
3901380ffb | ||
|
|
fb24a18f3f | ||
|
|
1899493ca8 | ||
|
|
1581ced6ec | ||
|
|
5e8f53c7b7 | ||
|
|
370d15ed1d | ||
|
|
43b792f307 | ||
|
|
b844126516 | ||
|
|
43e55a963b | ||
|
|
9cf055c159 | ||
|
|
16b5157078 | ||
|
|
1ae9f68db8 | ||
|
|
e5d3e3b33a | ||
|
|
1c8ea1336e | ||
|
|
a4de585feb | ||
|
|
e624759bc7 | ||
|
|
0836ab370e | ||
|
|
66848ef80f | ||
|
|
f0b9365ca9 | ||
|
|
614ca51cb1 | ||
|
|
f31f9eb24e | ||
|
|
bc029df082 | ||
|
|
63b53acd48 | ||
|
|
50eee9a657 | ||
|
|
917952bc2a | ||
|
|
00afb2440d | ||
|
|
8cf720986e | ||
|
|
97c54f84f0 | ||
|
|
e485a98143 | ||
|
|
1e29f2875d | ||
|
|
61cd36cc96 | ||
|
|
a9b4c1cba8 | ||
|
|
5187017f21 | ||
|
|
73ea2dac6d | ||
|
|
e9232bf070 | ||
|
|
ee3538262d | ||
|
|
47b281b754 | ||
|
|
dfa03feb43 | ||
|
|
49beb6b7a3 | ||
|
|
6066db8f42 | ||
|
|
68c1818139 | ||
|
|
12087b6b70 | ||
|
|
15a3c234c5 | ||
|
|
bf7443c985 | ||
|
|
6c39d498c2 | ||
|
|
cacb8acf76 | ||
|
|
c1082b9b08 | ||
|
|
d3c5c68296 | ||
|
|
39fd3fd866 | ||
|
|
7ed95d3954 | ||
|
|
4dc91c86ae | ||
|
|
7d7f54c751 | ||
|
|
580e574c84 | ||
|
|
736e1717fa | ||
|
|
d6ac1a4f78 | ||
|
|
8a7c61c6f4 | ||
|
|
9a024fdacf | ||
|
|
135a623b1f | ||
|
|
ba0b9b259f | ||
|
|
45a24738b5 | ||
|
|
585ca203b0 | ||
|
|
561f441a5b | ||
|
|
30f7f83573 | ||
|
|
97646571a1 | ||
|
|
ac60d45969 | ||
|
|
afa52e280c | ||
|
|
c57c9752a2 | ||
|
|
b158a6d722 | ||
|
|
c616b53c9c |
@@ -4,7 +4,7 @@ jobs:
|
||||
build:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
environment:
|
||||
CONTRACTS_COMMIT_HASH: '9ed05f5'
|
||||
working_directory: ~/repo
|
||||
@@ -16,8 +16,9 @@ jobs:
|
||||
command: sudo npm install --global yarn@1.9.4
|
||||
- run:
|
||||
name: yarn
|
||||
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
|
||||
command: yarn --frozen-lockfile --ignore-engines install
|
||||
- run: yarn build:ci:no_website
|
||||
- run: yarn build:ts
|
||||
- save_cache:
|
||||
key: repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -25,7 +26,7 @@ jobs:
|
||||
build-website:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
- run: cd packages/website && yarn build:prod
|
||||
test-contracts-ganache:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -48,7 +49,7 @@ jobs:
|
||||
- run: yarn wsrun test:circleci @0x/contracts-protocol
|
||||
test-contracts-geth:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
- image: 0xorg/devnet
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
@@ -66,7 +67,7 @@ jobs:
|
||||
test-publish:
|
||||
resource_class: medium+
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
- image: 0xorg/verdaccio
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
@@ -76,7 +77,7 @@ jobs:
|
||||
- run: yarn test:publish:circleci
|
||||
test-doc-generation:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -99,7 +100,7 @@ jobs:
|
||||
- ~/repo/packages/pipeline/coverage/lcov.info
|
||||
test-rest:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -117,7 +118,7 @@ jobs:
|
||||
- run: yarn wsrun test:circleci @0x/order-utils
|
||||
- run: yarn wsrun test:circleci @0x/order-watcher
|
||||
- run: yarn wsrun test:circleci @0x/sol-compiler
|
||||
- run: yarn wsrun test:circleci @0x/sol-cov
|
||||
- run: yarn wsrun test:circleci @0x/sol-tracing-utils
|
||||
- run: yarn wsrun test:circleci @0x/sol-doc
|
||||
- run: yarn wsrun test:circleci @0x/subproviders
|
||||
- run: yarn wsrun test:circleci @0x/web3-wrapper
|
||||
@@ -168,9 +169,9 @@ jobs:
|
||||
paths:
|
||||
- ~/repo/packages/sol-compiler/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
key: coverage-sol-tracing-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/packages/sol-cov/coverage/lcov.info
|
||||
- ~/repo/packages/sol-tracing-utils/coverage/lcov.info
|
||||
- save_cache:
|
||||
key: coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -187,9 +188,10 @@ jobs:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/python
|
||||
- image: 0xorg/ganache-cli
|
||||
- image: 0xorg/ganache-cli:2.2.2
|
||||
- image: 0xorg/launch-kit-ci
|
||||
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"
|
||||
yarn start:ts -p 3000:3000
|
||||
steps:
|
||||
- checkout
|
||||
- run: sudo chown -R circleci:circleci /usr/local/bin
|
||||
@@ -198,26 +200,42 @@ jobs:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
cd python-packages
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
./install
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- '/usr/local/bin'
|
||||
- '/usr/local/lib/python3.7/site-packages'
|
||||
- '.eggs'
|
||||
- '.mypy_cache'
|
||||
- '.pytest_cache'
|
||||
- '.tox'
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
coverage run setup.py test
|
||||
cd python-packages
|
||||
./cmd_pkgs_in_dep_order.py coverage run setup.py test
|
||||
- save_cache:
|
||||
key: coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/contract_addresses/.coverage
|
||||
- save_cache:
|
||||
key: coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/contract_artifacts/.coverage
|
||||
- save_cache:
|
||||
key: coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/contract_demo/.coverage
|
||||
- save_cache:
|
||||
key: coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/repo/python-packages/json_schemas/.coverage
|
||||
- save_cache:
|
||||
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- ~/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:
|
||||
@@ -232,7 +250,7 @@ jobs:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
python -m pip install .
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
@@ -258,22 +276,14 @@ jobs:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python -m ensurepip
|
||||
python -m pip install -e .[dev]
|
||||
- save_cache:
|
||||
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
|
||||
paths:
|
||||
- '/usr/local/bin'
|
||||
- '/usr/local/lib/python3.7/site-packages'
|
||||
- run:
|
||||
command: |
|
||||
cd python-packages/order_utils
|
||||
python setup.py lint
|
||||
cd python-packages
|
||||
./install
|
||||
./lint
|
||||
static-tests:
|
||||
working_directory: ~/repo
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
@@ -284,7 +294,7 @@ jobs:
|
||||
- run: yarn bundlewatch
|
||||
submit-coverage:
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
- image: circleci/node:9-browsers
|
||||
working_directory: ~/repo
|
||||
steps:
|
||||
- restore_cache:
|
||||
@@ -325,7 +335,7 @@ jobs:
|
||||
- coverage-sol-compiler-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-cov-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- coverage-sol-tracing-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-sol-doc-{{ .Environment.CIRCLE_SHA1 }}
|
||||
@@ -338,6 +348,21 @@ jobs:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
|
||||
@@ -375,7 +400,9 @@ workflows:
|
||||
requires:
|
||||
- test-rest
|
||||
- test-python
|
||||
- static-tests-python:
|
||||
requires:
|
||||
- test-python
|
||||
- test-python
|
||||
- static-tests-python
|
||||
# skip python tox run for now, as we don't yet have multiple test environments to support.
|
||||
#- test-rest-python
|
||||
|
||||
5
.github/autolabeler.yml
vendored
5
.github/autolabeler.yml
vendored
@@ -13,7 +13,10 @@ instant: ['packages/instant']
|
||||
abi-gen-templates: ['packages/abi-gen-templates']
|
||||
abi-gen: ['packages/abi-gen']
|
||||
website: ['packages/website']
|
||||
sol-cov: ['packages/sol-cov']
|
||||
sol-coverage: ['packages/sol-coverage']
|
||||
sol-profiler: ['packages/sol-profiler']
|
||||
sol-trace: ['packages/sol-trace']
|
||||
sol-tracing-utils: ['packages/sol-tracing-utils']
|
||||
utils: ['packages/utils']
|
||||
tslint-config: ['packages/tslint-config']
|
||||
asset-buyer: ['packages/asset-buyer']
|
||||
|
||||
2
.github/stale.yml
vendored
2
.github/stale.yml
vendored
@@ -1,7 +1,7 @@
|
||||
# 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
|
||||
daysUntilClose: 30
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -91,7 +91,7 @@ contracts/interfaces/generated-artifacts/
|
||||
contracts/tokens/generated-artifacts/
|
||||
contracts/examples/generated-artifacts/
|
||||
contracts/extensions/generated-artifacts/
|
||||
packages/sol-cov/test/fixtures/artifacts/
|
||||
packages/sol-tracing-utils/test/fixtures/artifacts/
|
||||
packages/metacoin/artifacts/
|
||||
|
||||
# generated contract wrappers
|
||||
|
||||
@@ -18,12 +18,16 @@ lib
|
||||
/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
|
||||
/python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts
|
||||
/packages/json-schemas/schemas
|
||||
/python-packages/order_utils/src/zero_ex/json_schemas/schemas
|
||||
/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
|
||||
/packages/metacoin/src/contract_wrappers
|
||||
/packages/metacoin/artifacts
|
||||
/packages/sra-spec/public/
|
||||
/packages/dev-tools-pages/ts/**/data.json
|
||||
package.json
|
||||
scripts/postpublish_utils.js
|
||||
packages/sol-cov/test/fixtures/artifacts
|
||||
packages/sol-coverage/test/fixtures/artifacts
|
||||
.pytest_cache
|
||||
.mypy_cache
|
||||
.tox
|
||||
|
||||
@@ -24,7 +24,10 @@ packages/metacoin/ @LogvinovLeon
|
||||
packages/monorepo-scripts/ @fabioberger
|
||||
packages/order-utils/ @fabioberger @LogvinovLeon
|
||||
packages/sol-compiler/ @LogvinovLeon
|
||||
packages/sol-cov/ @LogvinovLeon
|
||||
packages/sol-coverage/ @LogvinovLeon
|
||||
packages/sol-profiler/ @LogvinovLeon
|
||||
packages/sol-trace/ @LogvinovLeon
|
||||
packages/sol-tracing-utils/ @LogvinovLeon
|
||||
packages/sol-resolver/ @LogvinovLeon
|
||||
packages/subproviders/ @fabioberger @dekz
|
||||
packages/verdaccio/ @albrow
|
||||
|
||||
@@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
- Using welcoming and inclusive language
|
||||
- Being respectful of differing viewpoints and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Focusing on what is best for the community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
|
||||
@@ -12,26 +12,26 @@ We welcome contributions from anyone on the internet and are grateful for even t
|
||||
|
||||
Before removing the `[WIP]` tag and submitting the PR for review, make sure:
|
||||
|
||||
* 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)
|
||||
- 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)
|
||||
|
||||
### Branch structure
|
||||
|
||||
We have two main branches:
|
||||
|
||||
* `master` represents the most recently released (published on npm) version of the codebase.
|
||||
* `development` represents the current development state of the codebase.
|
||||
- `master` represents the most recently released (published on npm) version of the codebase.
|
||||
- `development` represents the current development state of the codebase.
|
||||
|
||||
ALL PRs should be opened against `development`.
|
||||
|
||||
Branch names should be prefixed with `fix`, `feature` or `refactor`.
|
||||
|
||||
* 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`
|
||||
- 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`
|
||||
|
||||
### CHANGELOGs
|
||||
|
||||
@@ -67,8 +67,8 @@ If you want to change a rule, or add a custom rule, please make these changes to
|
||||
|
||||
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)
|
||||
- VSCode: [vscode-tslint](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)
|
||||
- Atom: [linter-tslint](https://atom.io/packages/linter-tslint)
|
||||
|
||||
#### Auto-formatter
|
||||
|
||||
@@ -76,10 +76,23 @@ We use [Prettier](https://prettier.io/) to auto-format our code. Be sure to eith
|
||||
|
||||
If using the Atom text editor, we recommend you install the following packages:
|
||||
|
||||
* VSCode: [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
* Atom: [prettier-atom](https://atom.io/packages/prettier-atom)
|
||||
- VSCode: [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
- Atom: [prettier-atom](https://atom.io/packages/prettier-atom)
|
||||
|
||||
## Fix `submit-coverage` CI failure
|
||||
## Unenforced coding conventions
|
||||
|
||||
A few of our coding conventions are not yet enforced by the linter/auto-formatter. Be careful to follow these conventions in your PR's.
|
||||
|
||||
1. Unused anonymous function parameters should be named with an underscore + number (e.g \_1, \_2, etc...)
|
||||
1. There should be a new-line between methods in a class and between test cases.
|
||||
1. If a string literal has the same value in two or more places, it should be a single constant referenced in both places.
|
||||
1. Do not import from a project's `index.ts` (e.g import { Token } from '../src';). Always import from the source file itself.
|
||||
1. Generic error variables should be named `err` instead of `e` or `error`.
|
||||
1. If you _must_ cast a variable to any - try to type it back as fast as possible. (e.g., `const cw = ((zeroEx as any)._contractWrappers as ContractWrappers);`). This ensures subsequent code is type-safe.
|
||||
1. Our enum conventions coincide with the recommended Typescript conventions, using capitalized keys, and all-caps snake-case values. Eg `GetStats = 'GET_STATS'`
|
||||
1. All public, exported methods/functions/classes must have associated Javadoc-style comments.
|
||||
|
||||
### Fix `submit-coverage` CI failure
|
||||
|
||||
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`.
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<!--- 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.
|
||||
* [ ] Add tests to cover changes as needed.
|
||||
* [ ] Update documentation as needed.
|
||||
* [ ] Add new entries to the relevant CHANGELOG.jsons.
|
||||
- [ ] Prefix PR title with `[WIP]` if necessary.
|
||||
- [ ] Add tests to cover changes as needed.
|
||||
- [ ] Update documentation as needed.
|
||||
- [ ] Add new entries to the relevant CHANGELOG.jsons.
|
||||
|
||||
16
README.md
16
README.md
@@ -1,4 +1,4 @@
|
||||
<img src="https://github.com/0xProject/branding/blob/master/0x_Black_CMYK.png" width="200px" >
|
||||
<img src="https://github.com/0xProject/branding/blob/master/0x%20Logo/PNG/0x-Logo-Black.png" width="150px" >
|
||||
|
||||
---
|
||||
|
||||
@@ -24,9 +24,13 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
|
||||
|
||||
### Python Packages
|
||||
|
||||
| Package | Version | Description |
|
||||
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||
| [`0x-order-utils.py`](/python-packages/order_utils) | [](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
|
||||
| Package | Version | Description |
|
||||
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| [`0x-contract-addresses`](/python-packages/contract_addresses) | [](https://pypi.org/project/0x-contract-addresses/) | A tiny utility library for getting known deployed contract addresses for a particular network |
|
||||
| [`0x-contract-artifacts`](/python-packages/contract_artifacts) | [](https://pypi.org/project/0x-contract-artifacts/) | 0x smart contract compilation artifacts |
|
||||
| [`0x-json-schemas`](/python-packages/json_schemas) | [](https://pypi.org/project/0x-json-schemas/) | 0x-related JSON schemas |
|
||||
| [`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
|
||||
|
||||
@@ -53,7 +57,9 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
|
||||
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [`@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-coverage`](/packages/sol-coverage) | [](https://www.npmjs.com/package/@0x/sol-coverage) | A solidity test coverage tool |
|
||||
| [`@0x/sol-profiler`](/packages/sol-profiler) | [](https://www.npmjs.com/package/@0x/sol-profiler) | A solidity gas cost profiler |
|
||||
| [`@0x/sol-trace`](/packages/sol-trace) | [](https://www.npmjs.com/package/@0x/sol-trace) | A solidity stack trace 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 |
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"avoid-tx-origin": "warn",
|
||||
"bracket-align": false,
|
||||
"code-complexity": false,
|
||||
"compiler-fixed": false,
|
||||
"const-name-snakecase": "error",
|
||||
"expression-indent": "error",
|
||||
"function-max-lines": false,
|
||||
|
||||
@@ -20,7 +20,7 @@ TEST_PROVIDER=geth yarn test
|
||||
|
||||
## Code coverage
|
||||
|
||||
In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
|
||||
In order to see the Solidity code coverage output generated by `@0x/sol-coverage`, run:
|
||||
|
||||
```
|
||||
yarn test:coverage
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"schemaVersion": "2.0.0",
|
||||
"contractName": "TestStaticCallReceiver",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "hash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "signature",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "isValidSignature",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isValid",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "hash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "signerAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "signature",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "isValidSignature",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isValid",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "token",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approveERC20",
|
||||
"outputs": [],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "0x6080604052600160005534801561001557600080fd5b5061023e806100256000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e811461005b5780639363470214610093578063a8e5e4aa146100d1575b600080fd5b34801561006757600080fd5b5061007f60048035906024803590810191013561010a565b604080519115158252519081900360200190f35b34801561009f57600080fd5b5061007f60048035906024803573ffffffffffffffffffffffffffffffffffffffff169160443591820191013561011e565b3480156100dd57600080fd5b5061010873ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610133565b005b6000610114610207565b5060019392505050565b6000610128610207565b506001949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1663095ea7b383836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156101d657600080fd5b505af11580156101ea573d6000803e3d6000fd5b505050506040513d602081101561020057600080fd5b5050505050565b6000805460010190555600a165627a7a72305820dc9fbd716d3526660fb3bc57c7b20ce5608225c45a4d9a3c6d6e16da10292ae00029",
|
||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x1 PUSH1 0x0 SSTORE CALLVALUE DUP1 ISZERO PUSH2 0x15 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x93 JUMPI DUP1 PUSH4 0xA8E5E4AA EQ PUSH2 0xD1 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x11E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xDD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x108 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x133 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH2 0x114 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x128 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x95EA7B3 DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1EA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x200 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xdc SWAP16 0xbd PUSH18 0x6D3526660FB3BC57C7B20CE5608225C45A4D SWAP11 EXTCODECOPY PUSH14 0x6E16DA10292AE000290000000000 ",
|
||||
"sourceMap": "716:1558:68:-;;;780:1;755:26;;716:1558;8:9:-1;5:2;;;30:1;27;20:12;5:2;716:1558:68;;;;;;;"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "0x6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e811461005b5780639363470214610093578063a8e5e4aa146100d1575b600080fd5b34801561006757600080fd5b5061007f60048035906024803590810191013561010a565b604080519115158252519081900360200190f35b34801561009f57600080fd5b5061007f60048035906024803573ffffffffffffffffffffffffffffffffffffffff169160443591820191013561011e565b3480156100dd57600080fd5b5061010873ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610133565b005b6000610114610207565b5060019392505050565b6000610128610207565b506001949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1663095ea7b383836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156101d657600080fd5b505af11580156101ea573d6000803e3d6000fd5b505050506040513d602081101561020057600080fd5b5050505050565b6000805460010190555600a165627a7a72305820dc9fbd716d3526660fb3bc57c7b20ce5608225c45a4d9a3c6d6e16da10292ae00029",
|
||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x93 JUMPI DUP1 PUSH4 0xA8E5E4AA EQ PUSH2 0xD1 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x11E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xDD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x108 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x133 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH2 0x114 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x128 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x95EA7B3 DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1EA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x200 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xdc SWAP16 0xbd PUSH18 0x6D3526660FB3BC57C7B20CE5608225C45A4D SWAP11 EXTCODECOPY PUSH14 0x6E16DA10292AE000290000000000 ",
|
||||
"sourceMap": "716:1558:68:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1551:182;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1551:182:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1100:213;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1100:213:68;;;;;;;;;;;;;;;;;;;;;1979:179;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1979:179:68;;;;;;;;;;;;;;;;1551:182;1664:12;1692:13;:11;:13::i;:::-;-1:-1:-1;1722:4:68;1551:182;;;;;:::o;1100:213::-;1244:12;1272:13;:11;:13::i;:::-;-1:-1:-1;1302:4:68;1100:213;;;;;;:::o;1979:179::-;2121:5;2109:26;;;2136:7;2145:5;2109:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2109:42:68;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2109:42:68;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;1979:179:68:o;2204:68::-;2258:5;:7;;;;;;2204:68::o"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"test/TestStaticCallReceiver/TestStaticCallReceiver.sol": {
|
||||
"id": 68
|
||||
},
|
||||
"@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol": {
|
||||
"id": 20
|
||||
}
|
||||
},
|
||||
"sourceCodes": {
|
||||
"test/TestStaticCallReceiver/TestStaticCallReceiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol\";\n\n\n// solhint-disable no-unused-vars\ncontract TestStaticCallReceiver {\n\n uint256 internal state = 1;\n\n /// @dev Updates state and returns true. Intended to be used with `Validator` signature type.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n returns (bool isValid)\n {\n updateState();\n return true;\n }\n\n /// @dev Updates state and returns true. Intended to be used with `Wallet` signature type.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n returns (bool isValid)\n {\n updateState();\n return true;\n }\n\n /// @dev Approves an ERC20 token to spend tokens from this address.\n /// @param token Address of ERC20 token.\n /// @param spender Address that will spend tokens.\n /// @param value Amount of tokens spender is approved to spend.\n function approveERC20(\n address token,\n address spender,\n uint256 value\n )\n external\n {\n IERC20Token(token).approve(spender, value);\n }\n\n /// @dev Increments state variable.\n function updateState()\n internal\n {\n state++;\n }\n}\n",
|
||||
"@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
|
||||
},
|
||||
"sourceTreeHashHex": "0xa3403404c74ebe121bf85d5daa92cad2c4f141038bcb08622d627a2f61dd1e42",
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "soljson-v0.4.24+commit.e67f0147.js",
|
||||
"settings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"networks": {}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
{
|
||||
"schemaVersion": "2.0.0",
|
||||
"contractName": "Validator",
|
||||
"compilerOutput": {
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "hash",
|
||||
"type": "bytes32"
|
||||
},
|
||||
{
|
||||
"name": "signerAddress",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "signature",
|
||||
"type": "bytes"
|
||||
}
|
||||
],
|
||||
"name": "isValidSignature",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isValid",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"inputs": [
|
||||
{
|
||||
"name": "validSigner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "constructor"
|
||||
}
|
||||
],
|
||||
"evm": {
|
||||
"bytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "0x608060405234801561001057600080fd5b50604051602080610134833981016040525160008054600160a060020a03909216600160a060020a031990921691909117905560e3806100516000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416639363470281146043575b600080fd5b348015604e57600080fd5b50607e60048035906024803573ffffffffffffffffffffffffffffffffffffffff16916044359182019101356092565b604080519115158252519081900360200190f35b505060005473ffffffffffffffffffffffffffffffffffffffff9081169116149190505600a165627a7a723058207475d0b323289366586452d827fd1dda36b13fd92b099dba7987456941d1c3b50029",
|
||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x134 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 MSTORE MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0xE3 DUP1 PUSH2 0x51 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x93634702 DUP2 EQ PUSH1 0x43 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x7E PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH1 0x92 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST POP POP PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP2 AND EQ SWAP2 SWAP1 POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH21 0x75D0B323289366586452D827FD1DDA36B13FD92B09 SWAP14 0xba PUSH26 0x87456941D1C3B500290000000000000000000000000000000000 ",
|
||||
"sourceMap": "685:992:29:-;;;987:84;8:9:-1;5:2;;;30:1;27;20:12;5:2;987:84:29;;;;;;;;;;;;;1038:12;:26;;-1:-1:-1;;;;;1038:26:29;;;-1:-1:-1;;;;;;1038:26:29;;;;;;;;;685:992;;;;;;"
|
||||
},
|
||||
"deployedBytecode": {
|
||||
"linkReferences": {},
|
||||
"object": "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416639363470281146043575b600080fd5b348015604e57600080fd5b50607e60048035906024803573ffffffffffffffffffffffffffffffffffffffff16916044359182019101356092565b604080519115158252519081900360200190f35b505060005473ffffffffffffffffffffffffffffffffffffffff9081169116149190505600a165627a7a723058207475d0b323289366586452d827fd1dda36b13fd92b099dba7987456941d1c3b50029",
|
||||
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x93634702 DUP2 EQ PUSH1 0x43 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x7E PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH1 0x92 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST POP POP PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP2 AND EQ SWAP2 SWAP1 POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH21 0x75D0B323289366586452D827FD1DDA36B13FD92B09 SWAP14 0xba PUSH26 0x87456941D1C3B500290000000000000000000000000000000000 ",
|
||||
"sourceMap": "685:992:29:-;;;;;;;;;;;;;;;;;;;;;;;1408:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1408:230:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1565:12:29;1618;;;;;1601:29;;;;1408:230;-1:-1:-1;1408:230:29:o"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sources": {
|
||||
"examples/Validator/Validator.sol": {
|
||||
"id": 29
|
||||
},
|
||||
"@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol": {
|
||||
"id": 8
|
||||
}
|
||||
},
|
||||
"sourceCodes": {
|
||||
"examples/Validator/Validator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol\";\n\n\ncontract Validator is \n IValidator\n{\n\n // The single valid signer for this wallet.\n // solhint-disable-next-line var-name-mixedcase\n address internal VALID_SIGNER;\n\n /// @dev constructs a new `Validator` with a single valid signer.\n /// @param validSigner The sole, valid signer.\n constructor (address validSigner) public {\n VALID_SIGNER = validSigner;\n }\n\n /// @dev Verifies that a signature is valid. `signer` must match `VALID_SIGNER`.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of signature.\n // solhint-disable no-unused-vars\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid)\n {\n return (signerAddress == VALID_SIGNER);\n }\n // solhint-enable no-unused-vars\n}\n",
|
||||
"@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n"
|
||||
},
|
||||
"sourceTreeHashHex": "0xa36c89c09f7e11e88bf4b6926dd23f5aba2ca4a4d2e731836e6274004f9840e1",
|
||||
"compiler": {
|
||||
"name": "solc",
|
||||
"version": "soljson-v0.4.24+commit.e67f0147.js",
|
||||
"settings": {
|
||||
"optimizer": {
|
||||
"enabled": true,
|
||||
"runs": 1000000
|
||||
},
|
||||
"outputSelection": {
|
||||
"*": {
|
||||
"*": [
|
||||
"abi",
|
||||
"evm.bytecode.object",
|
||||
"evm.bytecode.sourceMap",
|
||||
"evm.deployedBytecode.object",
|
||||
"evm.deployedBytecode.sourceMap"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"networks": {}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,650 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC20ProxyEventArgs =
|
||||
| ERC20ProxyAuthorizedAddressAddedEventArgs
|
||||
| ERC20ProxyAuthorizedAddressRemovedEventArgs;
|
||||
|
||||
export enum ERC20ProxyEvents {
|
||||
AuthorizedAddressAdded = 'AuthorizedAddressAdded',
|
||||
AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
|
||||
}
|
||||
|
||||
export interface ERC20ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC20ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'addAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorities = {
|
||||
async callAsync(
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'authorities(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'getProxyId()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public authorized = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'authorized(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'getAuthorizedAddresses()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC20ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC20Proxy', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,650 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type ERC721ProxyEventArgs =
|
||||
| ERC721ProxyAuthorizedAddressAddedEventArgs
|
||||
| ERC721ProxyAuthorizedAddressRemovedEventArgs;
|
||||
|
||||
export enum ERC721ProxyEvents {
|
||||
AuthorizedAddressAdded = 'AuthorizedAddressAdded',
|
||||
AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
|
||||
}
|
||||
|
||||
export interface ERC721ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ERC721ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'addAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorities = {
|
||||
async callAsync(
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'authorities(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getProxyId = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'getProxyId()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public authorized = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'authorized(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'getAuthorizedAddresses()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ERC721ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ERC721Proxy', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,379 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ExchangeWrapperContract extends BaseContract {
|
||||
public fillOrder = {
|
||||
async sendTransactionAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
takerSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.fillOrder.estimateGasAsync.bind(
|
||||
self,
|
||||
order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
takerSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
takerSignature: string,
|
||||
): string {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
takerSignature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature,
|
||||
takerSignature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public cancelOrdersUpTo = {
|
||||
async sendTransactionAsync(
|
||||
targetOrderEpoch: BigNumber,
|
||||
salt: BigNumber,
|
||||
makerSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
|
||||
[targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.cancelOrdersUpTo.estimateGasAsync.bind(
|
||||
self,
|
||||
targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
targetOrderEpoch: BigNumber,
|
||||
salt: BigNumber,
|
||||
makerSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
|
||||
[targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
targetOrderEpoch: BigNumber,
|
||||
salt: BigNumber,
|
||||
makerSignature: string,
|
||||
): string {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
|
||||
[targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
targetOrderEpoch: BigNumber,
|
||||
salt: BigNumber,
|
||||
makerSignature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ExchangeWrapperContract;
|
||||
const functionSignature = 'cancelOrdersUpTo(uint256,uint256,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo;
|
||||
const encodedData = ethersFunction.encode([targetOrderEpoch,
|
||||
salt,
|
||||
makerSignature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<ExchangeWrapperContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ExchangeWrapperContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<ExchangeWrapperContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`ExchangeWrapper successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ExchangeWrapperContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('ExchangeWrapper', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,731 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ForwarderContract extends BaseContract {
|
||||
public marketBuyOrdersWithEth = {
|
||||
async sendTransactionAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.marketBuyOrdersWithEth.estimateGasAsync.bind(
|
||||
self,
|
||||
orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
makerAssetFillAmount: BigNumber,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
makerAssetFillAmount,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public withdrawAsset = {
|
||||
async sendTransactionAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
amount
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.withdrawAsset.estimateGasAsync.bind(
|
||||
self,
|
||||
assetData,
|
||||
amount
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'withdrawAsset(bytes,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[assetData,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
amount
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset;
|
||||
const encodedData = ethersFunction.encode([assetData,
|
||||
amount
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public marketSellOrdersWithEth = {
|
||||
async sendTransactionAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.marketSellOrdersWithEth.estimateGasAsync.bind(
|
||||
self,
|
||||
orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
signatures: string[],
|
||||
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
signatures,
|
||||
feeOrders,
|
||||
feeSignatures,
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as ForwarderContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as ForwarderContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ForwarderContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange,
|
||||
_zrxAssetData,
|
||||
_wethAssetData
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('Forwarder', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,620 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type MixinAuthorizableEventArgs =
|
||||
| MixinAuthorizableAuthorizedAddressAddedEventArgs
|
||||
| MixinAuthorizableAuthorizedAddressRemovedEventArgs;
|
||||
|
||||
export enum MixinAuthorizableEvents {
|
||||
AuthorizedAddressAdded = 'AuthorizedAddressAdded',
|
||||
AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
|
||||
}
|
||||
|
||||
export interface MixinAuthorizableAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
export interface MixinAuthorizableAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
|
||||
target: string;
|
||||
caller: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class MixinAuthorizableContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.addAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'addAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorities = {
|
||||
async callAsync(
|
||||
index_0: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'authorities(uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddress.estimateGasAsync.bind(
|
||||
self,
|
||||
target
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'removeAuthorizedAddress(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
|
||||
const encodedData = ethersFunction.encode([target
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public removeAuthorizedAddressAtIndex = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
index
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
|
||||
index
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
index
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
index
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
index
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
index
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public authorized = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'authorized(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAuthorizedAddresses = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'getAuthorizedAddresses()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as MixinAuthorizableContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<MixinAuthorizableContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return MixinAuthorizableContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<MixinAuthorizableContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`MixinAuthorizable successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new MixinAuthorizableContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('MixinAuthorizable', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,358 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class OrderValidatorContract extends BaseContract {
|
||||
public getOrderAndTraderInfo = {
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAddress
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAddress
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAddress
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAddress
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getBalanceAndAllowance = {
|
||||
async callAsync(
|
||||
target: string,
|
||||
assetData: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber, BigNumber]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getBalanceAndAllowance(address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
assetData
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
assetData
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
assetData
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getOrdersAndTradersInfo = {
|
||||
async callAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
takerAddresses
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
takerAddresses
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getTradersInfo = {
|
||||
async callAsync(
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
takerAddresses: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getTradersInfo(tuple[],address[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[orders,
|
||||
takerAddresses
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [orders,
|
||||
takerAddresses
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo;
|
||||
const encodedData = ethersFunction.encode([orders,
|
||||
takerAddresses
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getERC721TokenOwner = {
|
||||
async callAsync(
|
||||
token: string,
|
||||
tokenId: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getERC721TokenOwner(address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[token,
|
||||
tokenId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
tokenId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
|
||||
tokenId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner;
|
||||
const encodedData = ethersFunction.encode([token,
|
||||
tokenId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getBalancesAndAllowances = {
|
||||
async callAsync(
|
||||
target: string,
|
||||
assetData: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber[], BigNumber[]]
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getBalancesAndAllowances(address,bytes[])';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
assetData
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
assetData
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
assetData
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
assetData
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public getTraderInfo = {
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAddress: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
|
||||
> {
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAddress
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAddress
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAddress
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAddress
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange,
|
||||
_zrxAssetData
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange,
|
||||
_zrxAssetData
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange,
|
||||
_zrxAssetData
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new OrderValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange,
|
||||
_zrxAssetData
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('OrderValidator', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,524 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type TestAssetProxyDispatcherEventArgs =
|
||||
| TestAssetProxyDispatcherAssetProxyRegisteredEventArgs;
|
||||
|
||||
export enum TestAssetProxyDispatcherEvents {
|
||||
AssetProxyRegistered = 'AssetProxyRegistered',
|
||||
}
|
||||
|
||||
export interface TestAssetProxyDispatcherAssetProxyRegisteredEventArgs extends DecodedLogArgs {
|
||||
id: string;
|
||||
assetProxy: string;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class TestAssetProxyDispatcherContract extends BaseContract {
|
||||
public assetProxies = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'assetProxies(bytes4)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public getAssetProxy = {
|
||||
async callAsync(
|
||||
assetProxyId: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'getAssetProxy(bytes4)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[assetProxyId
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy;
|
||||
const encodedData = ethersFunction.encode([assetProxyId
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public publicDispatchTransferFrom = {
|
||||
async sendTransactionAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
|
||||
[assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.publicDispatchTransferFrom.estimateGasAsync.bind(
|
||||
self,
|
||||
assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
|
||||
[assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
|
||||
[assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
assetData: string,
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'publicDispatchTransferFrom(bytes,address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDispatchTransferFrom;
|
||||
const encodedData = ethersFunction.encode([assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'publicDispatchTransferFrom'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public registerAssetProxy = {
|
||||
async sendTransactionAsync(
|
||||
assetProxy: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
|
||||
[assetProxy
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.registerAssetProxy.estimateGasAsync.bind(
|
||||
self,
|
||||
assetProxy
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetProxy: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
|
||||
[assetProxy
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
assetProxy: string,
|
||||
): string {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
|
||||
[assetProxy
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
assetProxy: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'registerAssetProxy(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[assetProxy
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
|
||||
const encodedData = ethersFunction.encode([assetProxy
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestAssetProxyDispatcherContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestAssetProxyDispatcherContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return TestAssetProxyDispatcherContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestAssetProxyDispatcherContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`TestAssetProxyDispatcher successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new TestAssetProxyDispatcherContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('TestAssetProxyDispatcher', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,747 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
export type TestSignatureValidatorEventArgs =
|
||||
| TestSignatureValidatorSignatureValidatorApprovalEventArgs;
|
||||
|
||||
export enum TestSignatureValidatorEvents {
|
||||
SignatureValidatorApproval = 'SignatureValidatorApproval',
|
||||
}
|
||||
|
||||
export interface TestSignatureValidatorSignatureValidatorApprovalEventArgs extends DecodedLogArgs {
|
||||
signerAddress: string;
|
||||
validatorAddress: string;
|
||||
approved: boolean;
|
||||
}
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class TestSignatureValidatorContract extends BaseContract {
|
||||
public preSign = {
|
||||
async sendTransactionAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.preSign.estimateGasAsync.bind(
|
||||
self,
|
||||
hash,
|
||||
signerAddress,
|
||||
signature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
): string {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'preSign(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transactions = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'transactions(bytes32)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public setSignatureValidatorApproval = {
|
||||
async sendTransactionAsync(
|
||||
validatorAddress: string,
|
||||
approval: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
|
||||
[validatorAddress,
|
||||
approval
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
|
||||
approval
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
|
||||
approval
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
|
||||
approval
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.setSignatureValidatorApproval.estimateGasAsync.bind(
|
||||
self,
|
||||
validatorAddress,
|
||||
approval
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
validatorAddress: string,
|
||||
approval: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
|
||||
[validatorAddress,
|
||||
approval
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
|
||||
approval
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
|
||||
approval
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
validatorAddress: string,
|
||||
approval: boolean,
|
||||
): string {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
|
||||
[validatorAddress,
|
||||
approval
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
|
||||
approval
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
|
||||
approval
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
validatorAddress: string,
|
||||
approval: boolean,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'setSignatureValidatorApproval(address,bool)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[validatorAddress,
|
||||
approval
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
|
||||
approval
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
|
||||
approval
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval;
|
||||
const encodedData = ethersFunction.encode([validatorAddress,
|
||||
approval
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public allowedValidators = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
index_1: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'allowedValidators(address,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0,
|
||||
index_1
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
|
||||
index_1
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
|
||||
index_1
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators;
|
||||
const encodedData = ethersFunction.encode([index_0,
|
||||
index_1
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public preSigned = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
index_1: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'preSigned(bytes32,address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0,
|
||||
index_1
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
|
||||
index_1
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
|
||||
index_1
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned;
|
||||
const encodedData = ethersFunction.encode([index_0,
|
||||
index_1
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public publicIsValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signer: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'publicIsValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signer,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signer,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signer,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signer,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'publicIsValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public executeTransaction = {
|
||||
async sendTransactionAsync(
|
||||
salt: BigNumber,
|
||||
signerAddress: string,
|
||||
data: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
|
||||
[salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.executeTransaction.estimateGasAsync.bind(
|
||||
self,
|
||||
salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
salt: BigNumber,
|
||||
signerAddress: string,
|
||||
data: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
|
||||
[salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
salt: BigNumber,
|
||||
signerAddress: string,
|
||||
data: string,
|
||||
signature: string,
|
||||
): string {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
|
||||
[salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
salt: BigNumber,
|
||||
signerAddress: string,
|
||||
data: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction;
|
||||
const encodedData = ethersFunction.encode([salt,
|
||||
signerAddress,
|
||||
data,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public EIP712_DOMAIN_HASH = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'EIP712_DOMAIN_HASH()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public currentContextAddress = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as TestSignatureValidatorContract;
|
||||
const functionSignature = 'currentContextAddress()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestSignatureValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return TestSignatureValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestSignatureValidatorContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`TestSignatureValidator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new TestSignatureValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('TestSignatureValidator', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,450 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class TestStaticCallReceiverContract extends BaseContract {
|
||||
public isValidSignature2 = {
|
||||
async sendTransactionAsync(
|
||||
hash: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
|
||||
[hash,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.isValidSignature2.estimateGasAsync.bind(
|
||||
self,
|
||||
hash,
|
||||
signature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
hash: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
|
||||
[hash,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signature: string,
|
||||
): string {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
|
||||
[hash,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public isValidSignature1 = {
|
||||
async sendTransactionAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.isValidSignature1.estimateGasAsync.bind(
|
||||
self,
|
||||
hash,
|
||||
signerAddress,
|
||||
signature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
): string {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public approveERC20 = {
|
||||
async sendTransactionAsync(
|
||||
token: string,
|
||||
spender: string,
|
||||
value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
|
||||
[token,
|
||||
spender,
|
||||
value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.approveERC20.estimateGasAsync.bind(
|
||||
self,
|
||||
token,
|
||||
spender,
|
||||
value
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
token: string,
|
||||
spender: string,
|
||||
value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
|
||||
[token,
|
||||
spender,
|
||||
value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
token: string,
|
||||
spender: string,
|
||||
value: BigNumber,
|
||||
): string {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
|
||||
[token,
|
||||
spender,
|
||||
value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
token: string,
|
||||
spender: string,
|
||||
value: BigNumber,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as TestStaticCallReceiverContract;
|
||||
const functionSignature = 'approveERC20(address,address,uint256)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[token,
|
||||
spender,
|
||||
value
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approveERC20;
|
||||
const encodedData = ethersFunction.encode([token,
|
||||
spender,
|
||||
value
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'approveERC20'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestStaticCallReceiverContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return TestStaticCallReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, );
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<TestStaticCallReceiverContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, []);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`TestStaticCallReceiver successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new TestStaticCallReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('TestStaticCallReceiver', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,116 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class ValidatorContract extends BaseContract {
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as ValidatorContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
validSigner: string,
|
||||
): Promise<ValidatorContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return ValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, validSigner
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
validSigner: string,
|
||||
): Promise<ValidatorContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[validSigner
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[validSigner
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [validSigner
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Validator successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new ValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [validSigner
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('Validator', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,111 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class WalletContract extends BaseContract {
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
eip712Signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WalletContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
eip712Signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
eip712Signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
eip712Signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
eip712Signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
walletOwner: string,
|
||||
): Promise<WalletContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return WalletContract.deployAsync(bytecode, abi, provider, txDefaults, walletOwner
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
walletOwner: string,
|
||||
): Promise<WalletContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[walletOwner
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[walletOwner
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [walletOwner
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Wallet successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new WalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [walletOwner
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('Wallet', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
@@ -1,548 +0,0 @@
|
||||
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract } from '@0x/base-contract';
|
||||
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
|
||||
import { BigNumber, classUtils, logUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as ethers from 'ethers';
|
||||
import * as _ from 'lodash';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
|
||||
/* istanbul ignore next */
|
||||
// tslint:disable:no-parameter-reassignment
|
||||
// tslint:disable-next-line:class-name
|
||||
export class WhitelistContract extends BaseContract {
|
||||
public fillOrderIfWhitelisted = {
|
||||
async sendTransactionAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.fillOrderIfWhitelisted.estimateGasAsync.bind(
|
||||
self,
|
||||
order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
): string {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
takerAssetFillAmount: BigNumber,
|
||||
salt: BigNumber,
|
||||
orderSignature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderIfWhitelisted;
|
||||
const encodedData = ethersFunction.encode([order,
|
||||
takerAssetFillAmount,
|
||||
salt,
|
||||
orderSignature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'fillOrderIfWhitelisted'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public isWhitelisted = {
|
||||
async callAsync(
|
||||
index_0: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'isWhitelisted(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[index_0
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [index_0
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isWhitelisted;
|
||||
const encodedData = ethersFunction.encode([index_0
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isWhitelisted'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public owner = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'owner()';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, []);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
|
||||
const encodedData = ethersFunction.encode([]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public isValidSignature = {
|
||||
async callAsync(
|
||||
hash: string,
|
||||
signerAddress: string,
|
||||
signature: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'isValidSignature(bytes32,address,bytes)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[hash,
|
||||
signerAddress,
|
||||
signature
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
|
||||
const encodedData = ethersFunction.encode([hash,
|
||||
signerAddress,
|
||||
signature
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray[0];
|
||||
},
|
||||
};
|
||||
public updateWhitelistStatus = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
isApproved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
|
||||
[target,
|
||||
isApproved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
isApproved
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
isApproved
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
|
||||
isApproved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.updateWhitelistStatus.estimateGasAsync.bind(
|
||||
self,
|
||||
target,
|
||||
isApproved
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
isApproved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
|
||||
[target,
|
||||
isApproved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
isApproved
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
|
||||
isApproved
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
isApproved: boolean,
|
||||
): string {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
|
||||
[target,
|
||||
isApproved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
isApproved
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
|
||||
isApproved
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
target: string,
|
||||
isApproved: boolean,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'updateWhitelistStatus(address,bool)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[target,
|
||||
isApproved
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [target,
|
||||
isApproved
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
|
||||
isApproved
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.updateWhitelistStatus;
|
||||
const encodedData = ethersFunction.encode([target,
|
||||
isApproved
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'updateWhitelistStatus'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<string> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
self.transferOwnership.estimateGasAsync.bind(
|
||||
self,
|
||||
newOwner
|
||||
),
|
||||
);
|
||||
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
return txHash;
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
): Promise<number> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
|
||||
return gas;
|
||||
},
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
const self = this as any as WhitelistContract;
|
||||
const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString);
|
||||
const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
|
||||
]);
|
||||
return abiEncodedTransactionData;
|
||||
},
|
||||
async callAsync(
|
||||
newOwner: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as WhitelistContract;
|
||||
const functionSignature = 'transferOwnership(address)';
|
||||
const inputAbi = self._lookupAbi(functionSignature).inputs;
|
||||
[newOwner
|
||||
] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
|
||||
], BaseContract._bigNumberToString.bind(self));
|
||||
BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
|
||||
]);
|
||||
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
|
||||
const encodedData = ethersFunction.encode([newOwner
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
let resultArray = ethersFunction.decode(rawCallResult);
|
||||
const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs;
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
|
||||
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
|
||||
return resultArray;
|
||||
},
|
||||
};
|
||||
public static async deployFrom0xArtifactAsync(
|
||||
artifact: ContractArtifact | SimpleContractArtifact,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<WhitelistContract> {
|
||||
if (_.isUndefined(artifact.compilerOutput)) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
const bytecode = artifact.compilerOutput.evm.bytecode.object;
|
||||
const abi = artifact.compilerOutput.abi;
|
||||
return WhitelistContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
|
||||
);
|
||||
}
|
||||
public static async deployAsync(
|
||||
bytecode: string,
|
||||
abi: ContractAbi,
|
||||
provider: Provider,
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<WhitelistContract> {
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange
|
||||
] = BaseContract._formatABIDataItemList(
|
||||
constructorAbi.inputs,
|
||||
[_exchange
|
||||
],
|
||||
BaseContract._bigNumberToString,
|
||||
);
|
||||
const iface = new ethers.utils.Interface(abi);
|
||||
const deployInfo = iface.deployFunction;
|
||||
const txData = deployInfo.encode(bytecode, [_exchange
|
||||
]);
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{data: txData},
|
||||
txDefaults,
|
||||
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
|
||||
);
|
||||
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
|
||||
logUtils.log(`transactionHash: ${txHash}`);
|
||||
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
logUtils.log(`Whitelist successfully deployed at ${txReceipt.contractAddress}`);
|
||||
const contractInstance = new WhitelistContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
|
||||
contractInstance.constructorArgs = [_exchange
|
||||
];
|
||||
return contractInstance;
|
||||
}
|
||||
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
|
||||
super('Whitelist', abi, address, provider, txDefaults);
|
||||
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
|
||||
}
|
||||
} // tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unbound-method
|
||||
38
contracts/examples/CHANGELOG.json
Normal file
38
contracts/examples/CHANGELOG.json
Normal file
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1547561734,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1547225310,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1547040760,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1544741676,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
22
contracts/examples/CHANGELOG.md
Normal file
22
contracts/examples/CHANGELOG.md
Normal file
@@ -0,0 +1,22 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.5 - _January 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _January 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _January 9, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _December 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-examples",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.5",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -14,7 +13,8 @@
|
||||
"build": "yarn pre_build && tsc -b",
|
||||
"build:ci": "yarn build",
|
||||
"pre_build": "run-s compile generate_contract_wrappers",
|
||||
"compile": "sol-compiler --contracts-dir contracts",
|
||||
"compile": "sol-compiler",
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
@@ -33,13 +33,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.18",
|
||||
"@0x/contracts-test-utils": "^1.0.1",
|
||||
"@0x/dev-utils": "^1.0.20",
|
||||
"@0x/sol-compiler": "^1.1.15",
|
||||
"@0x/sol-cov": "^2.1.15",
|
||||
"@0x/subproviders": "^2.1.7",
|
||||
"@0x/tslint-config": "^1.0.10",
|
||||
"@0x/abi-gen": "^1.0.22",
|
||||
"@0x/contracts-test-utils": "^2.0.0",
|
||||
"@0x/dev-utils": "^1.0.24",
|
||||
"@0x/sol-compiler": "^2.0.2",
|
||||
"@0x/subproviders": "^2.1.11",
|
||||
"@0x/tslint-config": "^2.0.2",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
@@ -53,27 +52,26 @@
|
||||
"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.9",
|
||||
"@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.6",
|
||||
"@0x/types": "^1.4.0",
|
||||
"@0x/typescript-typings": "^3.0.5",
|
||||
"@0x/utils": "^2.0.7",
|
||||
"@0x/web3-wrapper": "^3.2.0",
|
||||
"@0x/base-contract": "^3.0.13",
|
||||
"@0x/contracts-interfaces": "^1.0.5",
|
||||
"@0x/contracts-libs": "^1.0.5",
|
||||
"@0x/contracts-multisig": "^1.0.5",
|
||||
"@0x/contracts-tokens": "^1.0.5",
|
||||
"@0x/contracts-utils": "^1.0.5",
|
||||
"@0x/order-utils": "^3.1.2",
|
||||
"@0x/types": "^1.5.2",
|
||||
"@0x/typescript-typings": "^3.0.8",
|
||||
"@0x/utils": "^3.0.1",
|
||||
"@0x/web3-wrapper": "^3.2.4",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^1.1.3",
|
||||
"ethereum-types": "^1.1.6",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
|
||||
56
contracts/extensions/CHANGELOG.json
Normal file
56
contracts/extensions/CHANGELOG.json
Normal file
@@ -0,0 +1,56 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1547561734,
|
||||
"version": "1.2.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1547225310,
|
||||
"version": "1.2.1",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.2.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added Dutch Auction Wrapper",
|
||||
"pr": 1465
|
||||
}
|
||||
],
|
||||
"timestamp": 1547040760
|
||||
},
|
||||
{
|
||||
"version": "1.1.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Added Balance Threshold Filter",
|
||||
"pr": 1383
|
||||
},
|
||||
{
|
||||
"note": "Add OrderMatcher",
|
||||
"pr": 1117
|
||||
},
|
||||
{
|
||||
"note": "Add OrderValidator",
|
||||
"pr": 1464
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1544741676,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
28
contracts/extensions/CHANGELOG.md
Normal file
28
contracts/extensions/CHANGELOG.md
Normal file
@@ -0,0 +1,28 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.2.2 - _January 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.2.1 - _January 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.2.0 - _January 9, 2019_
|
||||
|
||||
* Added Dutch Auction Wrapper (#1465)
|
||||
|
||||
## v1.1.0 - _Invalid date_
|
||||
|
||||
* Added Balance Threshold Filter (#1383)
|
||||
* Add OrderMatcher (#1117)
|
||||
* Add OrderValidator (#1464)
|
||||
|
||||
## v1.0.2 - _December 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
31
contracts/extensions/DEPLOYS.json
Normal file
31
contracts/extensions/DEPLOYS.json
Normal file
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"name": "Forwarder",
|
||||
"version": "1.1.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Round up when calculating remaining amounts in marketBuy functions",
|
||||
"pr": 1162,
|
||||
"networks": {
|
||||
"1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
|
||||
"3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
|
||||
"42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Forwarder",
|
||||
"version": "1.0.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "protocol v2 deploy",
|
||||
"networks": {
|
||||
"1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
|
||||
"3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
|
||||
"42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -18,5 +18,5 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"contracts": ["DutchAuction", "Forwarder"]
|
||||
"contracts": ["BalanceThresholdFilter", "DutchAuction", "Forwarder", "OrderMatcher", "OrderValidator"]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "./interfaces/IThresholdAsset.sol";
|
||||
import "./MixinBalanceThresholdFilterCore.sol";
|
||||
|
||||
|
||||
contract BalanceThresholdFilter is
|
||||
MixinBalanceThresholdFilterCore
|
||||
{
|
||||
|
||||
/// @dev Constructs BalanceThresholdFilter.
|
||||
/// @param exchange Address of 0x exchange.
|
||||
/// @param thresholdAsset The asset that must be held by makers/takers.
|
||||
/// @param balanceThreshold The minimum balance of `thresholdAsset` that must be held by makers/takers.
|
||||
constructor(
|
||||
address exchange,
|
||||
address thresholdAsset,
|
||||
uint256 balanceThreshold
|
||||
)
|
||||
public
|
||||
{
|
||||
EXCHANGE = IExchange(exchange);
|
||||
THRESHOLD_ASSET = IThresholdAsset(thresholdAsset);
|
||||
BALANCE_THRESHOLD = balanceThreshold;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
|
||||
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/LICENSE2.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;
|
||||
|
||||
import "@0x/contracts-libs/contracts/libs/LibExchangeSelectors.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "./mixins/MBalanceThresholdFilterCore.sol";
|
||||
import "./MixinExchangeCalldata.sol";
|
||||
|
||||
|
||||
contract MixinBalanceThresholdFilterCore is
|
||||
MBalanceThresholdFilterCore,
|
||||
MixinExchangeCalldata,
|
||||
LibOrder,
|
||||
LibExchangeSelectors
|
||||
{
|
||||
|
||||
/// @dev Executes an Exchange transaction iff the maker and taker meet
|
||||
/// the hold at least `BALANCE_THRESHOLD` of the asset `THRESHOLD_ASSET` OR
|
||||
/// the exchange function is a cancellation.
|
||||
/// Supported Exchange functions:
|
||||
/// batchFillOrders
|
||||
/// batchFillOrdersNoThrow
|
||||
/// batchFillOrKillOrders
|
||||
/// fillOrder
|
||||
/// fillOrderNoThrow
|
||||
/// fillOrKillOrder
|
||||
/// marketBuyOrders
|
||||
/// marketBuyOrdersNoThrow
|
||||
/// marketSellOrders
|
||||
/// marketSellOrdersNoThrow
|
||||
/// matchOrders
|
||||
/// cancelOrder
|
||||
/// batchCancelOrders
|
||||
/// cancelOrdersUpTo
|
||||
/// Trying to call any other exchange function will throw.
|
||||
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
|
||||
/// @param signerAddress Address of transaction signer.
|
||||
/// @param signedExchangeTransaction AbiV2 encoded calldata.
|
||||
/// @param signature Proof of signer transaction by signer.
|
||||
function executeTransaction(
|
||||
uint256 salt,
|
||||
address signerAddress,
|
||||
bytes signedExchangeTransaction,
|
||||
bytes signature
|
||||
)
|
||||
external
|
||||
{
|
||||
// Get accounts whose balances must be validated
|
||||
address[] memory addressesToValidate = getAddressesToValidate(signerAddress);
|
||||
|
||||
// Validate account balances
|
||||
uint256 balanceThreshold = BALANCE_THRESHOLD;
|
||||
IThresholdAsset thresholdAsset = THRESHOLD_ASSET;
|
||||
for (uint256 i = 0; i < addressesToValidate.length; ++i) {
|
||||
uint256 addressBalance = thresholdAsset.balanceOf(addressesToValidate[i]);
|
||||
require(
|
||||
addressBalance >= balanceThreshold,
|
||||
"AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD"
|
||||
);
|
||||
}
|
||||
emit ValidatedAddresses(addressesToValidate);
|
||||
|
||||
// All addresses are valid. Execute exchange function.
|
||||
EXCHANGE.executeTransaction(
|
||||
salt,
|
||||
signerAddress,
|
||||
signedExchangeTransaction,
|
||||
signature
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Constructs an array of addresses to be validated.
|
||||
/// Addresses depend on which Exchange function is to be called
|
||||
/// (defined by `signedExchangeTransaction` above).
|
||||
/// @param signerAddress Address of transaction signer.
|
||||
/// @return addressesToValidate Array of addresses to validate.
|
||||
function getAddressesToValidate(address signerAddress)
|
||||
internal pure
|
||||
returns (address[] memory addressesToValidate)
|
||||
{
|
||||
bytes4 exchangeFunctionSelector = bytes4(exchangeCalldataload(0));
|
||||
// solhint-disable expression-indent
|
||||
if (
|
||||
exchangeFunctionSelector == BATCH_FILL_ORDERS_SELECTOR ||
|
||||
exchangeFunctionSelector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
|
||||
exchangeFunctionSelector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
|
||||
exchangeFunctionSelector == MARKET_BUY_ORDERS_SELECTOR ||
|
||||
exchangeFunctionSelector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
|
||||
exchangeFunctionSelector == MARKET_SELL_ORDERS_SELECTOR ||
|
||||
exchangeFunctionSelector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
|
||||
) {
|
||||
addressesToValidate = loadMakerAddressesFromOrderArray(0);
|
||||
addressesToValidate = addressesToValidate.append(signerAddress);
|
||||
} else if (
|
||||
exchangeFunctionSelector == FILL_ORDER_SELECTOR ||
|
||||
exchangeFunctionSelector == FILL_ORDER_NO_THROW_SELECTOR ||
|
||||
exchangeFunctionSelector == FILL_OR_KILL_ORDER_SELECTOR
|
||||
) {
|
||||
address makerAddress = loadMakerAddressFromOrder(0);
|
||||
addressesToValidate = addressesToValidate.append(makerAddress);
|
||||
addressesToValidate = addressesToValidate.append(signerAddress);
|
||||
} else if (exchangeFunctionSelector == MATCH_ORDERS_SELECTOR) {
|
||||
address leftMakerAddress = loadMakerAddressFromOrder(0);
|
||||
addressesToValidate = addressesToValidate.append(leftMakerAddress);
|
||||
address rightMakerAddress = loadMakerAddressFromOrder(1);
|
||||
addressesToValidate = addressesToValidate.append(rightMakerAddress);
|
||||
addressesToValidate = addressesToValidate.append(signerAddress);
|
||||
} else if (
|
||||
exchangeFunctionSelector != CANCEL_ORDER_SELECTOR &&
|
||||
exchangeFunctionSelector != BATCH_CANCEL_ORDERS_SELECTOR &&
|
||||
exchangeFunctionSelector != CANCEL_ORDERS_UP_TO_SELECTOR
|
||||
) {
|
||||
revert("INVALID_OR_BLOCKED_EXCHANGE_SELECTOR");
|
||||
}
|
||||
// solhint-enable expression-indent
|
||||
return addressesToValidate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
|
||||
/*
|
||||
|
||||
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/LICENSE2.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;
|
||||
|
||||
import "./mixins/MExchangeCalldata.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibAddressArray.sol";
|
||||
|
||||
|
||||
contract MixinExchangeCalldata is
|
||||
MExchangeCalldata
|
||||
{
|
||||
|
||||
using LibAddressArray for address[];
|
||||
|
||||
/// @dev Emulates the `calldataload` opcode on the embedded Exchange calldata,
|
||||
/// which is accessed through `signedExchangeTransaction`.
|
||||
/// @param offset Offset into the Exchange calldata.
|
||||
/// @return value Corresponding 32 byte value stored at `offset`.
|
||||
function exchangeCalldataload(uint256 offset)
|
||||
internal pure
|
||||
returns (bytes32 value)
|
||||
{
|
||||
assembly {
|
||||
// Pointer to exchange transaction
|
||||
// 0x04 for calldata selector
|
||||
// 0x40 to access `signedExchangeTransaction`, which is the third parameter
|
||||
let exchangeTxPtr := calldataload(0x44)
|
||||
|
||||
// Offset into Exchange calldata
|
||||
// We compute this by adding 0x24 to the `exchangeTxPtr` computed above.
|
||||
// 0x04 for calldata selector
|
||||
// 0x20 for length field of `signedExchangeTransaction`
|
||||
let exchangeCalldataOffset := add(exchangeTxPtr, add(0x24, offset))
|
||||
value := calldataload(exchangeCalldataOffset)
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/// @dev Convenience function that skips the 4 byte selector when loading
|
||||
/// from the embedded Exchange calldata.
|
||||
/// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
|
||||
/// @return value Corresponding 32 byte value stored at `offset` + 4.
|
||||
function loadExchangeData(uint256 offset)
|
||||
internal pure
|
||||
returns (bytes32 value)
|
||||
{
|
||||
value = exchangeCalldataload(offset + 4);
|
||||
return value;
|
||||
}
|
||||
|
||||
/// @dev Extracts the maker address from an order stored in the Exchange calldata
|
||||
/// (which is embedded in `signedExchangeTransaction`).
|
||||
/// @param orderParamIndex Index of the order in the Exchange function's signature.
|
||||
/// @return makerAddress The extracted maker address.
|
||||
function loadMakerAddressFromOrder(uint256 orderParamIndex)
|
||||
internal pure
|
||||
returns (address makerAddress)
|
||||
{
|
||||
uint256 orderOffsetInBytes = orderParamIndex * 32;
|
||||
uint256 orderPtr = uint256(loadExchangeData(orderOffsetInBytes));
|
||||
makerAddress = address(loadExchangeData(orderPtr));
|
||||
return makerAddress;
|
||||
}
|
||||
|
||||
/// @dev Extracts the maker addresses from an array of orders stored in the Exchange calldata
|
||||
/// (which is embedded in `signedExchangeTransaction`).
|
||||
/// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
|
||||
/// @return makerAddresses The extracted maker addresses.
|
||||
function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
|
||||
internal pure
|
||||
returns (address[] makerAddresses)
|
||||
{
|
||||
uint256 orderArrayOffsetInBytes = orderArrayParamIndex * 32;
|
||||
uint256 orderArrayPtr = uint256(loadExchangeData(orderArrayOffsetInBytes));
|
||||
uint256 orderArrayLength = uint256(loadExchangeData(orderArrayPtr));
|
||||
uint256 orderArrayLengthInBytes = orderArrayLength * 32;
|
||||
uint256 orderArrayElementPtr = orderArrayPtr + 32;
|
||||
uint256 orderArrayElementEndPtr = orderArrayElementPtr + orderArrayLengthInBytes;
|
||||
for (uint orderPtrOffset = orderArrayElementPtr; orderPtrOffset < orderArrayElementEndPtr; orderPtrOffset += 32) {
|
||||
uint256 orderPtr = uint256(loadExchangeData(orderPtrOffset));
|
||||
address makerAddress = address(loadExchangeData(orderPtr + orderArrayElementPtr));
|
||||
makerAddresses = makerAddresses.append(makerAddress);
|
||||
}
|
||||
return makerAddresses;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
|
||||
contract IBalanceThresholdFilterCore {
|
||||
|
||||
/// @dev Executes an Exchange transaction iff the maker and taker meet
|
||||
/// the hold at least `BALANCE_THRESHOLD` of the asset `THRESHOLD_ASSET` OR
|
||||
/// the exchange function is a cancellation.
|
||||
/// Supported Exchange functions:
|
||||
/// - batchFillOrders
|
||||
/// - batchFillOrdersNoThrow
|
||||
/// - batchFillOrKillOrders
|
||||
/// - fillOrder
|
||||
/// - fillOrderNoThrow
|
||||
/// - fillOrKillOrder
|
||||
/// - marketBuyOrders
|
||||
/// - marketBuyOrdersNoThrow
|
||||
/// - marketSellOrders
|
||||
/// - marketSellOrdersNoThrow
|
||||
/// - matchOrders
|
||||
/// - cancelOrder
|
||||
/// - batchCancelOrders
|
||||
/// - cancelOrdersUpTo
|
||||
/// Trying to call any other exchange function will throw.
|
||||
/// @param salt Arbitrary number to ensure uniqueness of transaction hash.
|
||||
/// @param signerAddress Address of transaction signer.
|
||||
/// @param signedExchangeTransaction AbiV2 encoded calldata.
|
||||
/// @param signature Proof of signer transaction by signer.
|
||||
function executeTransaction(
|
||||
uint256 salt,
|
||||
address signerAddress,
|
||||
bytes signedExchangeTransaction,
|
||||
bytes signature
|
||||
)
|
||||
external;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
contract IThresholdAsset {
|
||||
|
||||
/// @param _owner The address from which the balance will be retrieved
|
||||
/// @return Balance of owner
|
||||
function balanceOf(address _owner)
|
||||
external
|
||||
view
|
||||
returns (uint256);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
import "../interfaces/IThresholdAsset.sol";
|
||||
import "../interfaces/IBalanceThresholdFilterCore.sol";
|
||||
|
||||
|
||||
contract MBalanceThresholdFilterCore is
|
||||
IBalanceThresholdFilterCore
|
||||
{
|
||||
|
||||
// Points to 0x exchange contract
|
||||
// solhint-disable var-name-mixedcase
|
||||
IExchange internal EXCHANGE;
|
||||
|
||||
// The asset that must be held by makers/takers
|
||||
IThresholdAsset internal THRESHOLD_ASSET;
|
||||
|
||||
// The minimum balance of `THRESHOLD_ASSET` that must be held by makers/takers
|
||||
uint256 internal BALANCE_THRESHOLD;
|
||||
// solhint-enable var-name-mixedcase
|
||||
|
||||
// Addresses that hold at least `BALANCE_THRESHOLD` of `THRESHOLD_ASSET`
|
||||
event ValidatedAddresses (
|
||||
address[] addresses
|
||||
);
|
||||
|
||||
/// @dev Constructs an array of addresses to be validated.
|
||||
/// Addresses depend on which Exchange function is to be called
|
||||
/// (defined by `signedExchangeTransaction` above).
|
||||
/// @param signerAddress Address of transaction signer.
|
||||
/// @return addressesToValidate Array of addresses to validate.
|
||||
function getAddressesToValidate(address signerAddress)
|
||||
internal pure
|
||||
returns (address[] memory addressesToValidate);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
/*
|
||||
|
||||
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/LICENSE2.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;
|
||||
|
||||
|
||||
contract MExchangeCalldata {
|
||||
|
||||
/// @dev Emulates the `calldataload` opcode on the embedded Exchange calldata,
|
||||
/// which is accessed through `signedExchangeTransaction`.
|
||||
/// @param offset Offset into the Exchange calldata.
|
||||
/// @return value Corresponding 32 byte value stored at `offset`.
|
||||
function exchangeCalldataload(uint256 offset)
|
||||
internal pure
|
||||
returns (bytes32 value);
|
||||
|
||||
/// @dev Convenience function that skips the 4 byte selector when loading
|
||||
/// from the embedded Exchange calldata.
|
||||
/// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
|
||||
/// @return value Corresponding 32 byte value stored at `offset` + 4.
|
||||
function loadExchangeData(uint256 offset)
|
||||
internal pure
|
||||
returns (bytes32 value);
|
||||
|
||||
/// @dev Extracts the maker address from an order stored in the Exchange calldata
|
||||
/// (which is embedded in `signedExchangeTransaction`).
|
||||
/// @param orderParamIndex Index of the order in the Exchange function's signature.
|
||||
/// @return makerAddress The extracted maker address.
|
||||
function loadMakerAddressFromOrder(uint256 orderParamIndex)
|
||||
internal pure
|
||||
returns (address makerAddress);
|
||||
|
||||
/// @dev Extracts the maker addresses from an array of orders stored in the Exchange calldata
|
||||
/// (which is embedded in `signedExchangeTransaction`).
|
||||
/// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
|
||||
/// @return makerAddresses The extracted maker addresses.
|
||||
function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
|
||||
internal pure
|
||||
returns (address[] makerAddresses);
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./libs/LibConstants.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./libs/LibConstants.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
contract IAssets {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./IForwarderCore.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
// solhint-disable
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "../interfaces/IAssets.sol";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
contract MWeth {
|
||||
|
||||
195
contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
Normal file
195
contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
Normal file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
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 "./mixins/MAssets.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
|
||||
|
||||
contract MixinAssets is
|
||||
MAssets,
|
||||
Ownable,
|
||||
LibConstants
|
||||
{
|
||||
using LibBytes for bytes;
|
||||
|
||||
/// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
||||
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
|
||||
/// used to withdraw assets that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external
|
||||
onlyOwner
|
||||
{
|
||||
transferAssetToSender(assetData, amount);
|
||||
}
|
||||
|
||||
/// @dev Approves or disapproves an AssetProxy to spend asset.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveAssetProxy(
|
||||
bytes assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external
|
||||
onlyOwner
|
||||
{
|
||||
bytes4 proxyId = assetData.readBytes4(0);
|
||||
|
||||
if (proxyId == ERC20_DATA_ID) {
|
||||
approveERC20Token(assetData, amount);
|
||||
} else if (proxyId == ERC721_DATA_ID) {
|
||||
approveERC721Token(assetData, amount);
|
||||
} else {
|
||||
revert("UNSUPPORTED_ASSET_PROXY");
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Transfers given amount of asset to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferAssetToSender(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal
|
||||
{
|
||||
bytes4 proxyId = assetData.readBytes4(0);
|
||||
|
||||
if (proxyId == ERC20_DATA_ID) {
|
||||
transferERC20Token(assetData, amount);
|
||||
} else if (proxyId == ERC721_DATA_ID) {
|
||||
transferERC721Token(assetData, amount);
|
||||
} else {
|
||||
revert("UNSUPPORTED_ASSET_PROXY");
|
||||
}
|
||||
}
|
||||
|
||||
/// @dev Decodes ERC20 assetData and transfers given amount to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferERC20Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal
|
||||
{
|
||||
// 4 byte id + 12 0 bytes before ABI encoded token address.
|
||||
address token = assetData.readAddress(16);
|
||||
|
||||
// Transfer tokens.
|
||||
// We do a raw call so we can check the success separate
|
||||
// from the return data.
|
||||
bool success = token.call(abi.encodeWithSelector(
|
||||
ERC20_TRANSFER_SELECTOR,
|
||||
msg.sender,
|
||||
amount
|
||||
));
|
||||
require(
|
||||
success,
|
||||
"TRANSFER_FAILED"
|
||||
);
|
||||
|
||||
// Check return data.
|
||||
// If there is no return data, we assume the token incorrectly
|
||||
// does not return a bool. In this case we expect it to revert
|
||||
// on failure, which was handled above.
|
||||
// If the token does return data, we require that it is a single
|
||||
// value that evaluates to true.
|
||||
assembly {
|
||||
if returndatasize {
|
||||
success := 0
|
||||
if eq(returndatasize, 32) {
|
||||
// First 64 bytes of memory are reserved scratch space
|
||||
returndatacopy(0, 0, 32)
|
||||
success := mload(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
require(
|
||||
success,
|
||||
"TRANSFER_FAILED"
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Decodes ERC721 assetData and transfers given amount to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferERC721Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal
|
||||
{
|
||||
require(
|
||||
amount == 1,
|
||||
"INVALID_AMOUNT"
|
||||
);
|
||||
// Decode asset data.
|
||||
// 4 byte id + 12 0 bytes before ABI encoded token address.
|
||||
address token = assetData.readAddress(16);
|
||||
// 4 byte id + 32 byte ABI encoded token address before token id.
|
||||
uint256 tokenId = assetData.readUint256(36);
|
||||
|
||||
// Perform transfer.
|
||||
IERC721Token(token).transferFrom(
|
||||
address(this),
|
||||
msg.sender,
|
||||
tokenId
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Sets approval for ERC20 AssetProxy.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveERC20Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal
|
||||
{
|
||||
address token = assetData.readAddress(16);
|
||||
require(
|
||||
IERC20Token(token).approve(ERC20_PROXY_ADDRESS, amount),
|
||||
"APPROVAL_FAILED"
|
||||
);
|
||||
}
|
||||
|
||||
/// @dev Sets approval for ERC721 AssetProxy.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveERC721Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal
|
||||
{
|
||||
address token = assetData.readAddress(16);
|
||||
bool approval = amount >= 1;
|
||||
IERC721Token(token).setApprovalForAll(ERC721_PROXY_ADDRESS, approval);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
|
||||
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 "./libs/LibConstants.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||
|
||||
|
||||
contract MixinMatchOrders is
|
||||
Ownable,
|
||||
LibConstants
|
||||
{
|
||||
/// @dev Match two complementary orders that have a profitable spread.
|
||||
/// Each order is filled at their respective price point. However, the calculations are
|
||||
/// carried out as though the orders are both being filled at the right order's price point.
|
||||
/// The profit made by the left order is then used to fill the right order as much as possible.
|
||||
/// This results in a spread being taken in terms of both assets. The spread is held within this contract.
|
||||
/// @param leftOrder First order to match.
|
||||
/// @param rightOrder Second order to match.
|
||||
/// @param leftSignature Proof that order was created by the left maker.
|
||||
/// @param rightSignature Proof that order was created by the right maker.
|
||||
function matchOrders(
|
||||
LibOrder.Order memory leftOrder,
|
||||
LibOrder.Order memory rightOrder,
|
||||
bytes memory leftSignature,
|
||||
bytes memory rightSignature
|
||||
)
|
||||
public
|
||||
onlyOwner
|
||||
{
|
||||
// Match orders, maximally filling `leftOrder`
|
||||
LibFillResults.MatchedFillResults memory matchedFillResults = EXCHANGE.matchOrders(
|
||||
leftOrder,
|
||||
rightOrder,
|
||||
leftSignature,
|
||||
rightSignature
|
||||
);
|
||||
|
||||
uint256 leftMakerAssetSpreadAmount = matchedFillResults.leftMakerAssetSpreadAmount;
|
||||
uint256 rightOrderTakerAssetAmount = rightOrder.takerAssetAmount;
|
||||
|
||||
// Do not attempt to call `fillOrder` if no spread was taken or `rightOrder` has been completely filled
|
||||
if (leftMakerAssetSpreadAmount == 0 || matchedFillResults.right.takerAssetFilledAmount == rightOrderTakerAssetAmount) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The `assetData` fields of the `rightOrder` could have been null for the `matchOrders` call. We reassign them before calling `fillOrder`.
|
||||
rightOrder.makerAssetData = leftOrder.takerAssetData;
|
||||
rightOrder.takerAssetData = leftOrder.makerAssetData;
|
||||
|
||||
// Query `rightOrder` info to check if it has been completely filled
|
||||
// We need to make this check in case the `rightOrder` was partially filled before the `matchOrders` call
|
||||
LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(rightOrder);
|
||||
|
||||
// Do not attempt to call `fillOrder` if order has been completely filled
|
||||
if (orderInfo.orderTakerAssetFilledAmount == rightOrderTakerAssetAmount) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We do not need to pass in a signature since it was already validated in the `matchOrders` call
|
||||
EXCHANGE.fillOrder(
|
||||
rightOrder,
|
||||
leftMakerAssetSpreadAmount,
|
||||
""
|
||||
);
|
||||
}
|
||||
}
|
||||
38
contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol
Normal file
38
contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
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-utils/contracts/utils/Ownable/Ownable.sol";
|
||||
import "./libs/LibConstants.sol";
|
||||
import "./MixinMatchOrders.sol";
|
||||
import "./MixinAssets.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract OrderMatcher is
|
||||
MixinMatchOrders,
|
||||
MixinAssets
|
||||
{
|
||||
constructor (address _exchange)
|
||||
public
|
||||
LibConstants(_exchange)
|
||||
Ownable()
|
||||
{}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
|
||||
contract IAssets {
|
||||
|
||||
/// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
|
||||
/// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
|
||||
/// used to withdraw assets that were accidentally sent to this contract.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to withdraw.
|
||||
function withdrawAsset(
|
||||
bytes assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external;
|
||||
|
||||
/// @dev Approves or disapproves an AssetProxy to spend asset.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveAssetProxy(
|
||||
bytes assetData,
|
||||
uint256 amount
|
||||
)
|
||||
external;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
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-libs/contracts/libs/LibOrder.sol";
|
||||
|
||||
|
||||
contract IMatchOrders {
|
||||
|
||||
/// @dev Match two complementary orders that have a profitable spread.
|
||||
/// Each order is filled at their respective price point. However, the calculations are
|
||||
/// carried out as though the orders are both being filled at the right order's price point.
|
||||
/// The profit made by the left order is then used to fill the right order as much as possible.
|
||||
/// This results in a spread being taken in terms of both assets. The spread is held within this contract.
|
||||
/// @param leftOrder First order to match.
|
||||
/// @param rightOrder Second order to match.
|
||||
/// @param leftSignature Proof that order was created by the left maker.
|
||||
/// @param rightSignature Proof that order was created by the right maker.
|
||||
function matchOrders(
|
||||
LibOrder.Order memory leftOrder,
|
||||
LibOrder.Order memory rightOrder,
|
||||
bytes memory leftSignature,
|
||||
bytes memory rightSignature
|
||||
)
|
||||
public;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
|
||||
Copyright 2018 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@0x/contract-utils/contracts/utils/Ownable/IOwnable.sol";
|
||||
import "./IMatchOrders.sol";
|
||||
import "./IAssets.sol";
|
||||
|
||||
|
||||
// solhint-disable no-empty-blocks
|
||||
contract IOrderMatcher is
|
||||
IOwnable,
|
||||
IMatchOrders,
|
||||
IAssets
|
||||
{}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
|
||||
|
||||
|
||||
contract LibConstants {
|
||||
|
||||
// bytes4(keccak256("transfer(address,uint256)"))
|
||||
bytes4 constant internal ERC20_TRANSFER_SELECTOR = 0xa9059cbb;
|
||||
// bytes4(keccak256("ERC20Token(address)"))
|
||||
bytes4 constant internal ERC20_DATA_ID = 0xf47261b0;
|
||||
// bytes4(keccak256("ERC721Token(address,uint256)"))
|
||||
bytes4 constant internal ERC721_DATA_ID = 0x02571792;
|
||||
|
||||
// solhint-disable var-name-mixedcase
|
||||
IExchange internal EXCHANGE;
|
||||
address internal ERC20_PROXY_ADDRESS;
|
||||
address internal ERC721_PROXY_ADDRESS;
|
||||
// solhint-enable var-name-mixedcase
|
||||
|
||||
constructor (address _exchange)
|
||||
public
|
||||
{
|
||||
EXCHANGE = IExchange(_exchange);
|
||||
|
||||
ERC20_PROXY_ADDRESS = EXCHANGE.getAssetProxy(ERC20_DATA_ID);
|
||||
require(
|
||||
ERC20_PROXY_ADDRESS != address(0),
|
||||
"UNREGISTERED_ASSET_PROXY"
|
||||
);
|
||||
|
||||
ERC721_PROXY_ADDRESS = EXCHANGE.getAssetProxy(ERC721_DATA_ID);
|
||||
require(
|
||||
ERC721_PROXY_ADDRESS != address(0),
|
||||
"UNREGISTERED_ASSET_PROXY"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
|
||||
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;
|
||||
|
||||
import "../interfaces/IAssets.sol";
|
||||
|
||||
|
||||
contract MAssets is
|
||||
IAssets
|
||||
{
|
||||
/// @dev Transfers given amount of asset to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferAssetToSender(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal;
|
||||
|
||||
/// @dev Decodes ERC20 assetData and transfers given amount to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferERC20Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal;
|
||||
|
||||
/// @dev Decodes ERC721 assetData and transfers given amount to sender.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to transfer to sender.
|
||||
function transferERC721Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal;
|
||||
|
||||
/// @dev Sets approval for ERC20 AssetProxy.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveERC20Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal;
|
||||
|
||||
/// @dev Sets approval for ERC721 AssetProxy.
|
||||
/// @param assetData Byte array encoded for the respective asset proxy.
|
||||
/// @param amount Amount of asset to approve for respective proxy.
|
||||
function approveERC721Token(
|
||||
bytes memory assetData,
|
||||
uint256 amount
|
||||
)
|
||||
internal;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@0x/contracts-extensions",
|
||||
"version": "1.0.1",
|
||||
"version": "1.2.2",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -20,7 +19,8 @@
|
||||
"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",
|
||||
"compile": "sol-compiler",
|
||||
"watch": "sol-compiler -w",
|
||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
||||
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
|
||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||
@@ -32,7 +32,7 @@
|
||||
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
|
||||
},
|
||||
"config": {
|
||||
"abis": "generated-artifacts/@(DutchAuction|Forwarder).json"
|
||||
"abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|Forwarder|OrderMatcher|OrderValidator).json"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -44,13 +44,13 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^1.0.18",
|
||||
"@0x/contracts-test-utils": "^1.0.1",
|
||||
"@0x/dev-utils": "^1.0.20",
|
||||
"@0x/sol-compiler": "^1.1.15",
|
||||
"@0x/sol-cov": "^2.1.15",
|
||||
"@0x/subproviders": "^2.1.7",
|
||||
"@0x/tslint-config": "^1.0.10",
|
||||
"@0x/abi-gen": "^1.0.22",
|
||||
"@0x/contract-wrappers": "^5.0.0",
|
||||
"@0x/contracts-test-utils": "^2.0.0",
|
||||
"@0x/dev-utils": "^1.0.24",
|
||||
"@0x/sol-compiler": "^2.0.2",
|
||||
"@0x/subproviders": "^2.1.11",
|
||||
"@0x/tslint-config": "^2.0.2",
|
||||
"@types/bn.js": "^4.11.0",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/node": "*",
|
||||
@@ -64,27 +64,26 @@
|
||||
"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.9",
|
||||
"@0x/contracts-interfaces": "^1.0.1",
|
||||
"@0x/contracts-libs": "^1.0.1",
|
||||
"@0x/contracts-protocol": "^2.1.57",
|
||||
"@0x/contracts-tokens": "^1.0.1",
|
||||
"@0x/contracts-utils": "^1.0.1",
|
||||
"@0x/order-utils": "^3.0.6",
|
||||
"@0x/types": "^1.4.0",
|
||||
"@0x/typescript-typings": "^3.0.5",
|
||||
"@0x/utils": "^2.0.7",
|
||||
"@0x/web3-wrapper": "^3.2.0",
|
||||
"@0x/base-contract": "^3.0.13",
|
||||
"@0x/contracts-interfaces": "^1.0.5",
|
||||
"@0x/contracts-libs": "^1.0.5",
|
||||
"@0x/contracts-protocol": "^2.2.2",
|
||||
"@0x/contracts-tokens": "^1.0.5",
|
||||
"@0x/contracts-utils": "^1.0.5",
|
||||
"@0x/order-utils": "^3.1.2",
|
||||
"@0x/types": "^1.5.2",
|
||||
"@0x/typescript-typings": "^3.0.8",
|
||||
"@0x/utils": "^3.0.1",
|
||||
"@0x/web3-wrapper": "^3.2.4",
|
||||
"@types/js-combinatorics": "^0.5.29",
|
||||
"bn.js": "^4.11.8",
|
||||
"ethereum-types": "^1.1.3",
|
||||
"ethereum-types": "^1.1.6",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { ContractArtifact } from 'ethereum-types';
|
||||
|
||||
import * as BalanceThresholdFilter from '../../generated-artifacts/BalanceThresholdFilter.json';
|
||||
import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
|
||||
import * as Forwarder from '../../generated-artifacts/Forwarder.json';
|
||||
import * as OrderMatcher from '../../generated-artifacts/OrderMatcher.json';
|
||||
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
|
||||
|
||||
export const artifacts = {
|
||||
BalanceThresholdFilter: BalanceThresholdFilter as ContractArtifact,
|
||||
DutchAuction: DutchAuction as ContractArtifact,
|
||||
Forwarder: Forwarder as ContractArtifact,
|
||||
OrderMatcher: OrderMatcher as ContractArtifact,
|
||||
OrderValidator: OrderValidator as ContractArtifact,
|
||||
};
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
export * from '../../generated-wrappers/balance_threshold_filter';
|
||||
export * from '../../generated-wrappers/dutch_auction';
|
||||
export * from '../../generated-wrappers/forwarder';
|
||||
export * from '../../generated-wrappers/order_matcher';
|
||||
export * from '../../generated-wrappers/order_validator';
|
||||
|
||||
1644
contracts/extensions/test/extensions/balance_threshold_filter.ts
Normal file
1644
contracts/extensions/test/extensions/balance_threshold_filter.ts
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
|
||||
import {
|
||||
artifacts as protocolArtifacts,
|
||||
ERC20Wrapper,
|
||||
@@ -29,12 +30,11 @@ import { RevertReason, SignedOrder } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as chai from 'chai';
|
||||
import ethAbi = require('ethereumjs-abi');
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -68,19 +68,8 @@ describe(ContractName.DutchAuction, () => {
|
||||
let erc721MakerAssetIds: BigNumber[];
|
||||
const tenMinutesInSeconds = 10 * 60;
|
||||
|
||||
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
|
||||
return ethUtil.bufferToHex(
|
||||
Buffer.concat([
|
||||
ethUtil.toBuffer(makerAssetData),
|
||||
ethUtil.toBuffer(
|
||||
(ethAbi as any).rawEncode(
|
||||
['uint256', 'uint256'],
|
||||
[beginTimeSeconds.toString(), beginAmount.toString()],
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
let dutchAuctionTestWrapper: DutchAuctionTestWrapper;
|
||||
let defaultERC20MakerAssetData: string;
|
||||
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
@@ -136,6 +125,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
dutchAuctionInstance.address,
|
||||
provider,
|
||||
);
|
||||
dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider);
|
||||
|
||||
defaultMakerAssetAddress = erc20TokenA.address;
|
||||
const defaultTakerAssetAddress = wethContract.address;
|
||||
@@ -174,7 +164,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
feeRecipientAddress,
|
||||
// taker address or sender address should be set to the ducth auction contract
|
||||
takerAddress: dutchAuctionContract.address,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
@@ -199,6 +189,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
|
||||
sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams);
|
||||
buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams);
|
||||
defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress);
|
||||
});
|
||||
after(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
@@ -215,49 +206,41 @@ describe(ContractName.DutchAuction, () => {
|
||||
describe('matchOrders', () => {
|
||||
it('should be worth the begin price at the begining of the auction', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
});
|
||||
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
defaultERC20MakerAssetData,
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData });
|
||||
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.lte(auctionBeginTimeSeconds);
|
||||
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
});
|
||||
it('should be be worth the end price at the end of the auction', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
defaultERC20MakerAssetData,
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
makerAssetData,
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
});
|
||||
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.gte(auctionEndTimeSeconds);
|
||||
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount);
|
||||
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
|
||||
});
|
||||
it('should match orders at current amount and send excess to buyer', async () => {
|
||||
const beforeAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetAmount: beforeAuctionDetails.currentAmount.times(2),
|
||||
});
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
|
||||
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal(
|
||||
constants.ZERO_AMOUNT,
|
||||
@@ -276,17 +259,8 @@ describe(ContractName.DutchAuction, () => {
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerFee: new BigNumber(1),
|
||||
});
|
||||
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
|
||||
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
@@ -299,18 +273,9 @@ describe(ContractName.DutchAuction, () => {
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
makerFee: new BigNumber(1),
|
||||
});
|
||||
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
|
||||
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
|
||||
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
|
||||
);
|
||||
@@ -321,24 +286,17 @@ describe(ContractName.DutchAuction, () => {
|
||||
it('should revert when auction expires', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
|
||||
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
|
||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
defaultERC20MakerAssetData,
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
makerAssetData,
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
|
||||
RevertReason.AuctionExpired,
|
||||
);
|
||||
});
|
||||
@@ -347,15 +305,7 @@ describe(ContractName.DutchAuction, () => {
|
||||
makerAssetAmount: sellOrder.takerAssetAmount,
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
|
||||
RevertReason.AuctionInvalidAmount,
|
||||
);
|
||||
});
|
||||
@@ -364,38 +314,23 @@ describe(ContractName.DutchAuction, () => {
|
||||
takerAssetAmount: auctionBeginAmount.plus(1),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
|
||||
RevertReason.AuctionInvalidAmount,
|
||||
);
|
||||
});
|
||||
it('begin time is less than end time', async () => {
|
||||
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
|
||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
defaultERC20MakerAssetData,
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
makerAssetData,
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
|
||||
RevertReason.AuctionInvalidBeginTime,
|
||||
);
|
||||
});
|
||||
@@ -404,45 +339,30 @@ describe(ContractName.DutchAuction, () => {
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
});
|
||||
return expectTransactionFailedAsync(
|
||||
dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
|
||||
RevertReason.InvalidAssetData,
|
||||
);
|
||||
});
|
||||
|
||||
describe('ERC721', () => {
|
||||
it('should match orders when ERC721', async () => {
|
||||
const makerAssetId = erc721MakerAssetIds[0];
|
||||
const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
|
||||
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
|
||||
erc721MakerAssetData,
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
);
|
||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||
makerAssetAmount: new BigNumber(1),
|
||||
makerAssetData: extendMakerAssetData(
|
||||
assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
|
||||
auctionBeginTimeSeconds,
|
||||
auctionBeginAmount,
|
||||
),
|
||||
makerAssetData,
|
||||
});
|
||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||
takerAssetAmount: new BigNumber(1),
|
||||
takerAssetData: sellOrder.makerAssetData,
|
||||
});
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from: takerAddress,
|
||||
},
|
||||
),
|
||||
);
|
||||
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
|
||||
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
|
||||
const newBalances = await erc20Wrapper.getBalancesAsync();
|
||||
// HACK gte used here due to a bug in ganache where the timestamp can change
|
||||
// between multiple calls to the same block. Which can move the amount in our case
|
||||
|
||||
@@ -48,7 +48,6 @@ describe(ContractName.Forwarder, () => {
|
||||
let owner: string;
|
||||
let takerAddress: string;
|
||||
let feeRecipientAddress: string;
|
||||
let otherAddress: string;
|
||||
let defaultMakerAssetAddress: string;
|
||||
let zrxAssetData: string;
|
||||
let wethAssetData: string;
|
||||
@@ -78,7 +77,7 @@ describe(ContractName.Forwarder, () => {
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress, otherAddress] = accounts);
|
||||
const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
|
||||
|
||||
const txHash = await web3Wrapper.sendTransactionAsync({ from: accounts[0], to: accounts[0], value: 0 });
|
||||
const transaction = await web3Wrapper.getTransactionByHashAsync(txHash);
|
||||
|
||||
818
contracts/extensions/test/extensions/order_matcher.ts
Normal file
818
contracts/extensions/test/extensions/order_matcher.ts
Normal file
@@ -0,0 +1,818 @@
|
||||
import {
|
||||
artifacts as protocolArtifacts,
|
||||
ERC20ProxyContract,
|
||||
ERC20Wrapper,
|
||||
ERC721ProxyContract,
|
||||
ExchangeContract,
|
||||
ExchangeFillEventArgs,
|
||||
ExchangeWrapper,
|
||||
} from '@0x/contracts-protocol';
|
||||
import {
|
||||
chaiSetup,
|
||||
constants,
|
||||
ERC20BalancesByOwner,
|
||||
expectContractCreationFailedAsync,
|
||||
expectTransactionFailedAsync,
|
||||
LogDecoder,
|
||||
OrderFactory,
|
||||
provider,
|
||||
sendTransactionResult,
|
||||
txDefaults,
|
||||
web3Wrapper,
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { artifacts as tokenArtifacts, DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { assetDataUtils } from '@0x/order-utils';
|
||||
import { RevertReason } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import * as chai from 'chai';
|
||||
import { LogWithDecodedArgs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { OrderMatcherContract } from '../../generated-wrappers/order_matcher';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
// tslint:disable:no-unnecessary-type-assertion
|
||||
describe('OrderMatcher', () => {
|
||||
let makerAddressLeft: string;
|
||||
let makerAddressRight: string;
|
||||
let owner: string;
|
||||
let takerAddress: string;
|
||||
let feeRecipientAddressLeft: string;
|
||||
let feeRecipientAddressRight: string;
|
||||
|
||||
let erc20TokenA: DummyERC20TokenContract;
|
||||
let erc20TokenB: DummyERC20TokenContract;
|
||||
let zrxToken: DummyERC20TokenContract;
|
||||
let exchange: ExchangeContract;
|
||||
let erc20Proxy: ERC20ProxyContract;
|
||||
let erc721Proxy: ERC721ProxyContract;
|
||||
let orderMatcher: OrderMatcherContract;
|
||||
|
||||
let erc20BalancesByOwner: ERC20BalancesByOwner;
|
||||
let exchangeWrapper: ExchangeWrapper;
|
||||
let erc20Wrapper: ERC20Wrapper;
|
||||
let orderFactoryLeft: OrderFactory;
|
||||
let orderFactoryRight: OrderFactory;
|
||||
|
||||
let leftMakerAssetData: string;
|
||||
let leftTakerAssetData: string;
|
||||
let defaultERC20MakerAssetAddress: string;
|
||||
let defaultERC20TakerAssetAddress: string;
|
||||
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
});
|
||||
after(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
before(async () => {
|
||||
// Create accounts
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
// Hack(albrow): Both Prettier and TSLint insert a trailing comma below
|
||||
// but that is invalid syntax as of TypeScript version >= 2.8. We don't
|
||||
// have the right fine-grained configuration options in TSLint,
|
||||
// Prettier, or TypeScript, to reconcile this, so we will just have to
|
||||
// wait for them to sort it out. We disable TSLint and Prettier for
|
||||
// this part of the code for now. This occurs several times in this
|
||||
// file. See https://github.com/prettier/prettier/issues/4624.
|
||||
// prettier-ignore
|
||||
const usedAddresses = ([
|
||||
owner,
|
||||
makerAddressLeft,
|
||||
makerAddressRight,
|
||||
takerAddress,
|
||||
feeRecipientAddressLeft,
|
||||
// tslint:disable-next-line:trailing-comma
|
||||
feeRecipientAddressRight
|
||||
] = _.slice(accounts, 0, 6));
|
||||
// Create wrappers
|
||||
erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
|
||||
// Deploy ERC20 token & ERC20 proxy
|
||||
const numDummyErc20ToDeploy = 3;
|
||||
[erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
|
||||
numDummyErc20ToDeploy,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
);
|
||||
erc20Proxy = await erc20Wrapper.deployProxyAsync();
|
||||
await erc20Wrapper.setBalancesAndAllowancesAsync();
|
||||
// Deploy ERC721 proxy
|
||||
erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
|
||||
protocolArtifacts.ERC721Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
);
|
||||
// Depoy exchange
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
assetDataUtils.encodeERC20AssetData(zrxToken.address),
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||
await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
|
||||
await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
|
||||
// Authorize ERC20 trades by exchange
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
|
||||
from: owner,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
// Deploy OrderMatcher
|
||||
orderMatcher = await OrderMatcherContract.deployFrom0xArtifactAsync(
|
||||
artifacts.OrderMatcher,
|
||||
provider,
|
||||
txDefaults,
|
||||
exchange.address,
|
||||
);
|
||||
// Set default addresses
|
||||
defaultERC20MakerAssetAddress = erc20TokenA.address;
|
||||
defaultERC20TakerAssetAddress = erc20TokenB.address;
|
||||
leftMakerAssetData = assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress);
|
||||
leftTakerAssetData = assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress);
|
||||
// Set OrderMatcher balances and allowances
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await erc20TokenA.setBalance.sendTransactionAsync(orderMatcher.address, constants.INITIAL_ERC20_BALANCE, {
|
||||
from: owner,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await erc20TokenB.setBalance.sendTransactionAsync(orderMatcher.address, constants.INITIAL_ERC20_BALANCE, {
|
||||
from: owner,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(
|
||||
leftMakerAssetData,
|
||||
constants.INITIAL_ERC20_ALLOWANCE,
|
||||
),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(
|
||||
leftTakerAssetData,
|
||||
constants.INITIAL_ERC20_ALLOWANCE,
|
||||
),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
// Create default order parameters
|
||||
const defaultOrderParamsLeft = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressLeft,
|
||||
exchangeAddress: exchange.address,
|
||||
makerAssetData: leftMakerAssetData,
|
||||
takerAssetData: leftTakerAssetData,
|
||||
feeRecipientAddress: feeRecipientAddressLeft,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
};
|
||||
const defaultOrderParamsRight = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressRight,
|
||||
exchangeAddress: exchange.address,
|
||||
makerAssetData: leftTakerAssetData,
|
||||
takerAssetData: leftMakerAssetData,
|
||||
feeRecipientAddress: feeRecipientAddressRight,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
};
|
||||
const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
|
||||
orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
|
||||
const privateKeyRight = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressRight)];
|
||||
orderFactoryRight = new OrderFactory(privateKeyRight, defaultOrderParamsRight);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
});
|
||||
afterEach(async () => {
|
||||
await blockchainLifecycle.revertAsync();
|
||||
});
|
||||
describe('constructor', () => {
|
||||
it('should revert if assetProxy is unregistered', async () => {
|
||||
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
constants.NULL_BYTES,
|
||||
);
|
||||
return expectContractCreationFailedAsync(
|
||||
(OrderMatcherContract.deployFrom0xArtifactAsync(
|
||||
artifacts.OrderMatcher,
|
||||
provider,
|
||||
txDefaults,
|
||||
exchangeInstance.address,
|
||||
) as any) as sendTransactionResult,
|
||||
RevertReason.UnregisteredAssetProxy,
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('matchOrders', () => {
|
||||
beforeEach(async () => {
|
||||
erc20BalancesByOwner = await erc20Wrapper.getBalancesAsync();
|
||||
});
|
||||
it('should revert if not called by owner', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||
});
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await expectTransactionFailedAsync(
|
||||
web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: takerAddress,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
RevertReason.OnlyContractOwner,
|
||||
);
|
||||
});
|
||||
it('should transfer the correct amounts when orders completely fill each other', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||
});
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const expectedTransferAmounts = {
|
||||
// Left Maker
|
||||
amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
|
||||
amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
|
||||
// Right Maker
|
||||
amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
|
||||
amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
|
||||
// Taker
|
||||
leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
|
||||
};
|
||||
const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const newErc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
|
||||
);
|
||||
});
|
||||
it('should transfer the correct amounts when orders completely fill each other and taker doesnt take a profit', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
});
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const expectedTransferAmounts = {
|
||||
// Left Maker
|
||||
amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
|
||||
amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
|
||||
// Right Maker
|
||||
amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
|
||||
amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
|
||||
};
|
||||
const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const newErc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(initialLeftMakerAssetTakerBalance);
|
||||
});
|
||||
it('should transfer the correct amounts when left order is completely filled and right order would be partially filled', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
|
||||
});
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const expectedTransferAmounts = {
|
||||
// Left Maker
|
||||
amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
|
||||
amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
|
||||
// Right Maker
|
||||
amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
|
||||
amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
|
||||
// Taker
|
||||
leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
|
||||
leftTakerAssetSpreadAmount: signedOrderRight.makerAssetAmount.minus(signedOrderLeft.takerAssetAmount),
|
||||
};
|
||||
const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
const newErc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
|
||||
);
|
||||
expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
|
||||
);
|
||||
});
|
||||
it('should not call fillOrder when rightOrder is completely filled after matchOrders call and orders were never partially filled', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||
});
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
|
||||
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
);
|
||||
const fillLogs = _.filter(
|
||||
txReceipt.logs,
|
||||
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
|
||||
);
|
||||
// Only 2 Fill logs should exist for `matchOrders` call. `fillOrder` should not have been called and should not have emitted a Fill event.
|
||||
expect(fillLogs.length).to.be.equal(2);
|
||||
});
|
||||
it('should not call fillOrder when rightOrder is completely filled after matchOrders call and orders were initially partially filled', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
|
||||
});
|
||||
await exchangeWrapper.fillOrderAsync(signedOrderLeft, takerAddress, {
|
||||
takerAssetFillAmount: signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5),
|
||||
});
|
||||
await exchangeWrapper.fillOrderAsync(signedOrderRight, takerAddress, {
|
||||
takerAssetFillAmount: signedOrderRight.takerAssetAmount.dividedToIntegerBy(5),
|
||||
});
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
|
||||
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
);
|
||||
const fillLogs = _.filter(
|
||||
txReceipt.logs,
|
||||
log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
|
||||
);
|
||||
// Only 2 Fill logs should exist for `matchOrders` call. `fillOrder` should not have been called and should not have emitted a Fill event.
|
||||
expect(fillLogs.length).to.be.equal(2);
|
||||
});
|
||||
it('should only take a spread in rightMakerAsset if entire leftMakerAssetSpread amount can be used to fill rightOrder after matchOrders call', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(0.9), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(990), 18),
|
||||
});
|
||||
const initialLeftMakerAssetSpreadAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1.09), 18);
|
||||
const leftTakerAssetSpreadAmount = initialLeftMakerAssetSpreadAmount
|
||||
.times(signedOrderRight.makerAssetAmount)
|
||||
.dividedToIntegerBy(signedOrderRight.takerAssetAmount);
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const expectedTransferAmounts = {
|
||||
// Left Maker
|
||||
amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
|
||||
amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
|
||||
// Right Maker
|
||||
amountSoldByRightMaker: signedOrderLeft.takerAssetAmount.plus(leftTakerAssetSpreadAmount),
|
||||
amountBoughtByRightMaker: signedOrderLeft.makerAssetAmount,
|
||||
// Taker
|
||||
leftMakerAssetSpreadAmount: constants.ZERO_AMOUNT,
|
||||
leftTakerAssetSpreadAmount,
|
||||
};
|
||||
const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
const newErc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
|
||||
);
|
||||
expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
|
||||
);
|
||||
});
|
||||
it("should succeed if rightOrder's makerAssetData and takerAssetData are not provided", async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
|
||||
});
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
const expectedTransferAmounts = {
|
||||
// Left Maker
|
||||
amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
|
||||
amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
|
||||
// Right Maker
|
||||
amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
|
||||
amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
|
||||
// Taker
|
||||
leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
|
||||
leftTakerAssetSpreadAmount: signedOrderRight.makerAssetAmount.minus(signedOrderLeft.takerAssetAmount),
|
||||
};
|
||||
const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
// Match signedOrderLeft with signedOrderRight
|
||||
signedOrderRight.makerAssetData = constants.NULL_BYTES;
|
||||
signedOrderRight.takerAssetData = constants.NULL_BYTES;
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
|
||||
const newErc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
|
||||
expectedTransferAmounts.amountSoldByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByLeftMaker,
|
||||
),
|
||||
);
|
||||
expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
|
||||
erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
|
||||
expectedTransferAmounts.amountBoughtByRightMaker,
|
||||
),
|
||||
);
|
||||
expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
|
||||
);
|
||||
expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
|
||||
initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
|
||||
);
|
||||
});
|
||||
it('should revert with the correct reason if matchOrders call reverts', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
});
|
||||
signedOrderRight.signature = `0xff${signedOrderRight.signature.slice(4)}`;
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await expectTransactionFailedAsync(
|
||||
web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
RevertReason.InvalidOrderSignature,
|
||||
);
|
||||
});
|
||||
it('should revert with the correct reason if fillOrder call reverts', async () => {
|
||||
// Create orders to match
|
||||
const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
|
||||
});
|
||||
const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
|
||||
makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
|
||||
});
|
||||
// Matcher will not have enough allowance to fill rightOrder
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, constants.ZERO_AMOUNT, {
|
||||
from: owner,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const data = exchange.matchOrders.getABIEncodedTransactionData(
|
||||
signedOrderLeft,
|
||||
signedOrderRight,
|
||||
signedOrderLeft.signature,
|
||||
signedOrderRight.signature,
|
||||
);
|
||||
await expectTransactionFailedAsync(
|
||||
web3Wrapper.sendTransactionAsync({
|
||||
data,
|
||||
to: orderMatcher.address,
|
||||
from: owner,
|
||||
gas: constants.MAX_MATCH_ORDERS_GAS,
|
||||
}),
|
||||
RevertReason.TransferFailed,
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('withdrawAsset', () => {
|
||||
it('should allow owner to withdraw ERC20 tokens', async () => {
|
||||
const erc20AWithdrawAmount = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
expect(erc20AWithdrawAmount).to.be.bignumber.gt(constants.ZERO_AMOUNT);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.withdrawAsset.sendTransactionAsync(leftMakerAssetData, erc20AWithdrawAmount, {
|
||||
from: owner,
|
||||
}),
|
||||
);
|
||||
const newBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
expect(newBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
});
|
||||
it('should allow owner to withdraw ERC721 tokens', async () => {
|
||||
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
|
||||
tokenArtifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
const tokenId = new BigNumber(1);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await erc721Token.mint.sendTransactionAsync(orderMatcher.address, tokenId, { from: owner }),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId);
|
||||
const withdrawAmount = new BigNumber(1);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.withdrawAsset.sendTransactionAsync(assetData, withdrawAmount, { from: owner }),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const erc721Owner = await erc721Token.ownerOf.callAsync(tokenId);
|
||||
expect(erc721Owner).to.be.equal(owner);
|
||||
});
|
||||
it('should revert if not called by owner', async () => {
|
||||
const erc20AWithdrawAmount = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
|
||||
expect(erc20AWithdrawAmount).to.be.bignumber.gt(constants.ZERO_AMOUNT);
|
||||
await expectTransactionFailedAsync(
|
||||
orderMatcher.withdrawAsset.sendTransactionAsync(leftMakerAssetData, erc20AWithdrawAmount, {
|
||||
from: takerAddress,
|
||||
}),
|
||||
RevertReason.OnlyContractOwner,
|
||||
);
|
||||
});
|
||||
});
|
||||
describe('approveAssetProxy', () => {
|
||||
it('should be able to set an allowance for ERC20 tokens', async () => {
|
||||
const allowance = new BigNumber(55465465426546);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, allowance, {
|
||||
from: owner,
|
||||
}),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const newAllowance = await erc20TokenA.allowance.callAsync(orderMatcher.address, erc20Proxy.address);
|
||||
expect(newAllowance).to.be.bignumber.equal(allowance);
|
||||
});
|
||||
it('should be able to approve an ERC721 token by passing in allowance = 1', async () => {
|
||||
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
|
||||
tokenArtifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, constants.ZERO_AMOUNT);
|
||||
const allowance = new BigNumber(1);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(assetData, allowance, { from: owner }),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const isApproved = await erc721Token.isApprovedForAll.callAsync(orderMatcher.address, erc721Proxy.address);
|
||||
expect(isApproved).to.be.equal(true);
|
||||
});
|
||||
it('should be able to approve an ERC721 token by passing in allowance > 1', async () => {
|
||||
const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
|
||||
tokenArtifacts.DummyERC721Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
);
|
||||
const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, constants.ZERO_AMOUNT);
|
||||
const allowance = new BigNumber(2);
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
await orderMatcher.approveAssetProxy.sendTransactionAsync(assetData, allowance, { from: owner }),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
const isApproved = await erc721Token.isApprovedForAll.callAsync(orderMatcher.address, erc721Proxy.address);
|
||||
expect(isApproved).to.be.equal(true);
|
||||
});
|
||||
it('should revert if not called by owner', async () => {
|
||||
const approval = new BigNumber(1);
|
||||
await expectTransactionFailedAsync(
|
||||
orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, approval, {
|
||||
from: takerAddress,
|
||||
}),
|
||||
RevertReason.OnlyContractOwner,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
// tslint:disable:max-file-line-count
|
||||
// tslint:enable:no-unnecessary-type-assertion
|
||||
@@ -1,3 +1,12 @@
|
||||
import {
|
||||
artifacts as protocolArtifacts,
|
||||
ERC20ProxyContract,
|
||||
ERC20Wrapper,
|
||||
ERC721ProxyContract,
|
||||
ERC721Wrapper,
|
||||
ExchangeContract,
|
||||
ExchangeWrapper,
|
||||
} from '@0x/contracts-protocol';
|
||||
import {
|
||||
chaiSetup,
|
||||
constants,
|
||||
@@ -15,16 +24,8 @@ import { BigNumber } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import {
|
||||
artifacts,
|
||||
ERC20ProxyContract,
|
||||
ERC20Wrapper,
|
||||
ERC721ProxyContract,
|
||||
ERC721Wrapper,
|
||||
ExchangeContract,
|
||||
ExchangeWrapper,
|
||||
OrderValidatorContract,
|
||||
} from '../../src';
|
||||
import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
|
||||
import { artifacts } from '../../src/artifacts/index';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
@@ -80,7 +81,7 @@ describe('OrderValidator', () => {
|
||||
|
||||
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
protocolArtifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
zrxAssetData,
|
||||
@@ -431,7 +432,7 @@ describe('OrderValidator', () => {
|
||||
takerAddress,
|
||||
);
|
||||
const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
|
||||
expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(traderInfo.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
@@ -484,7 +485,7 @@ describe('OrderValidator', () => {
|
||||
takerAddress,
|
||||
);
|
||||
const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
|
||||
expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(traderInfo.makerBalance).to.be.bignumber.equal(makerBalance);
|
||||
@@ -513,10 +514,10 @@ describe('OrderValidator', () => {
|
||||
] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
|
||||
const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
|
||||
expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
|
||||
expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
|
||||
expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(traderInfo1.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
@@ -580,10 +581,10 @@ describe('OrderValidator', () => {
|
||||
] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
|
||||
const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
|
||||
const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
|
||||
expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
|
||||
expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
|
||||
expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.Fillable);
|
||||
expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
|
||||
expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
|
||||
expect(traderInfo1.makerBalance).to.be.bignumber.equal(makerBalance);
|
||||
283
contracts/extensions/test/utils/balance_threshold_wrapper.ts
Normal file
283
contracts/extensions/test/utils/balance_threshold_wrapper.ts
Normal file
@@ -0,0 +1,283 @@
|
||||
import { artifacts as protocolArtifacts, ExchangeContract } from '@0x/contracts-protocol';
|
||||
import {
|
||||
FillResults,
|
||||
formatters,
|
||||
LogDecoder,
|
||||
OrderInfo,
|
||||
orderUtils,
|
||||
TransactionFactory,
|
||||
} 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';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
export class BalanceThresholdWrapper {
|
||||
private readonly _balanceThresholdFilter: BalanceThresholdFilterContract;
|
||||
private readonly _signerTransactionFactory: TransactionFactory;
|
||||
private readonly _exchange: ExchangeContract;
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
private readonly _logDecoder: LogDecoder;
|
||||
constructor(
|
||||
balanceThresholdFilter: BalanceThresholdFilterContract,
|
||||
exchangeContract: ExchangeContract,
|
||||
signerTransactionFactory: TransactionFactory,
|
||||
provider: Provider,
|
||||
) {
|
||||
this._balanceThresholdFilter = balanceThresholdFilter;
|
||||
this._exchange = exchangeContract;
|
||||
this._signerTransactionFactory = signerTransactionFactory;
|
||||
this._web3Wrapper = new Web3Wrapper(provider);
|
||||
this._logDecoder = new LogDecoder(this._web3Wrapper, {
|
||||
...artifacts,
|
||||
...tokensArtifacts,
|
||||
...protocolArtifacts,
|
||||
});
|
||||
}
|
||||
public async fillOrderAsync(
|
||||
signedOrder: SignedOrder,
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.fillOrder.getABIEncodedTransactionData(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async fillOrKillOrderAsync(
|
||||
signedOrder: SignedOrder,
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.fillOrKillOrder.getABIEncodedTransactionData(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async fillOrderNoThrowAsync(
|
||||
signedOrder: SignedOrder,
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.fillOrderNoThrow.getABIEncodedTransactionData(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
|
||||
return txReceipt;
|
||||
}
|
||||
public async batchFillOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { takerAssetFillAmounts?: BigNumber[] } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
|
||||
const data = this._exchange.batchFillOrders.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.takerAssetFillAmounts,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async batchFillOrKillOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { takerAssetFillAmounts?: BigNumber[] } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
|
||||
const data = this._exchange.batchFillOrKillOrders.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.takerAssetFillAmounts,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async batchFillOrdersNoThrowAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { takerAssetFillAmounts?: BigNumber[]; gas?: number } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
|
||||
const data = this._exchange.batchFillOrKillOrders.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.takerAssetFillAmounts,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
|
||||
return txReceipt;
|
||||
}
|
||||
public async marketSellOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount: BigNumber },
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.marketSellOrders.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.takerAssetFillAmount,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async marketSellOrdersNoThrowAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount: BigNumber; gas?: number },
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.marketSellOrdersNoThrow.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.takerAssetFillAmount,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
|
||||
return txReceipt;
|
||||
}
|
||||
public async marketBuyOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { makerAssetFillAmount: BigNumber },
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
|
||||
const data = this._exchange.marketBuyOrders.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.makerAssetFillAmount,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async marketBuyOrdersNoThrowAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
opts: { makerAssetFillAmount: BigNumber; gas?: number },
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
|
||||
const data = this._exchange.marketBuyOrdersNoThrow.getABIEncodedTransactionData(
|
||||
params.orders,
|
||||
params.makerAssetFillAmount,
|
||||
params.signatures,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
|
||||
return txReceipt;
|
||||
}
|
||||
public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createCancel(signedOrder);
|
||||
const data = this._exchange.cancelOrder.getABIEncodedTransactionData(params.order);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async batchCancelOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = formatters.createBatchCancel(orders);
|
||||
const data = this._exchange.batchCancelOrders.getABIEncodedTransactionData(params.orders);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const data = this._exchange.cancelOrdersUpTo.getABIEncodedTransactionData(salt);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
|
||||
const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
|
||||
return filledAmount;
|
||||
}
|
||||
public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
|
||||
const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
|
||||
return isCancelled;
|
||||
}
|
||||
public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
|
||||
const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
|
||||
return orderEpoch;
|
||||
}
|
||||
public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
|
||||
const orderInfo = await this._exchange.getOrderInfo.callAsync(signedOrder);
|
||||
return orderInfo;
|
||||
}
|
||||
public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
|
||||
const ordersInfo = (await this._exchange.getOrdersInfo.callAsync(signedOrders)) as OrderInfo[];
|
||||
return ordersInfo;
|
||||
}
|
||||
public async matchOrdersAsync(
|
||||
signedOrderLeft: SignedOrder,
|
||||
signedOrderRight: SignedOrder,
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight);
|
||||
const data = await this._exchange.matchOrders.getABIEncodedTransactionData(
|
||||
params.left,
|
||||
params.right,
|
||||
params.leftSignature,
|
||||
params.rightSignature,
|
||||
);
|
||||
const txReceipt = this._executeTransactionAsync(data, from);
|
||||
return txReceipt;
|
||||
}
|
||||
public async getFillOrderResultsAsync(
|
||||
signedOrder: SignedOrder,
|
||||
from: string,
|
||||
opts: { takerAssetFillAmount?: BigNumber } = {},
|
||||
): Promise<FillResults> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const fillResults = await this._exchange.fillOrder.callAsync(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
{ from },
|
||||
);
|
||||
return fillResults;
|
||||
}
|
||||
public abiEncodeFillOrder(signedOrder: SignedOrder, opts: { takerAssetFillAmount?: BigNumber } = {}): string {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const data = this._exchange.fillOrder.getABIEncodedTransactionData(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
);
|
||||
return data;
|
||||
}
|
||||
public getBalanceThresholdAddress(): string {
|
||||
return this._balanceThresholdFilter.address;
|
||||
}
|
||||
public getExchangeAddress(): string {
|
||||
return this._exchange.address;
|
||||
}
|
||||
private async _executeTransactionAsync(
|
||||
abiEncodedExchangeTxData: string,
|
||||
from: string,
|
||||
gas?: number,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const signedExchangeTx = this._signerTransactionFactory.newSignedTransaction(abiEncodedExchangeTxData);
|
||||
const txOpts = _.isUndefined(gas) ? { from } : { from, gas };
|
||||
const txHash = await this._balanceThresholdFilter.executeTransaction.sendTransactionAsync(
|
||||
signedExchangeTx.salt,
|
||||
signedExchangeTx.signerAddress,
|
||||
signedExchangeTx.data,
|
||||
signedExchangeTx.signature,
|
||||
txOpts,
|
||||
);
|
||||
const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return txReceipt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
|
||||
import { LogDecoder } from '@0x/contracts-test-utils';
|
||||
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
|
||||
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
|
||||
import { artifacts } from '../../src/artifacts';
|
||||
|
||||
export class DutchAuctionTestWrapper {
|
||||
private readonly _dutchAuctionContract: DutchAuctionContract;
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
private readonly _logDecoder: LogDecoder;
|
||||
|
||||
constructor(contractInstance: DutchAuctionContract, provider: Provider) {
|
||||
this._dutchAuctionContract = contractInstance;
|
||||
this._web3Wrapper = new Web3Wrapper(provider);
|
||||
this._logDecoder = new LogDecoder(this._web3Wrapper, {
|
||||
...artifacts,
|
||||
...tokensArtifacts,
|
||||
...protocolArtifacts,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
|
||||
* start time and the auction begin amount. The sell order is a an order at the lowest amount
|
||||
* at the end of the auction. Excess from the match is transferred to the seller.
|
||||
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
|
||||
* @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
|
||||
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
|
||||
* @param from Address the transaction is being sent from.
|
||||
* @return Transaction receipt with decoded logs.
|
||||
*/
|
||||
public async matchOrdersAsync(
|
||||
buyOrder: SignedOrder,
|
||||
sellOrder: SignedOrder,
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const txHash = await this._dutchAuctionContract.matchOrders.sendTransactionAsync(
|
||||
buyOrder,
|
||||
sellOrder,
|
||||
buyOrder.signature,
|
||||
sellOrder.signature,
|
||||
{
|
||||
from,
|
||||
},
|
||||
);
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
}
|
||||
/**
|
||||
* Calculates the Auction Details for the given order
|
||||
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
|
||||
* @return The dutch auction details.
|
||||
*/
|
||||
public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
|
||||
const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
|
||||
return auctionDetails;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,12 @@
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||
"files": ["./generated-artifacts/DutchAuction.json", "./generated-artifacts/Forwarder.json"],
|
||||
"files": [
|
||||
"./generated-artifacts/BalanceThresholdFilter.json",
|
||||
"./generated-artifacts/DutchAuction.json",
|
||||
"./generated-artifacts/Forwarder.json",
|
||||
"./generated-artifacts/OrderMatcher.json",
|
||||
"./generated-artifacts/OrderValidator.json"
|
||||
],
|
||||
"exclude": ["./deploy/solc/solc_bin"]
|
||||
}
|
||||
|
||||
38
contracts/interfaces/CHANGELOG.json
Normal file
38
contracts/interfaces/CHANGELOG.json
Normal file
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"timestamp": 1547561734,
|
||||
"version": "1.0.5",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1547225310,
|
||||
"version": "1.0.4",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1547040760,
|
||||
"version": "1.0.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1544741676,
|
||||
"version": "1.0.2",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
22
contracts/interfaces/CHANGELOG.md
Normal file
22
contracts/interfaces/CHANGELOG.md
Normal file
@@ -0,0 +1,22 @@
|
||||
<!--
|
||||
changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
|
||||
Edit the package's CHANGELOG.json file only.
|
||||
-->
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v1.0.5 - _January 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.4 - _January 11, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.3 - _January 9, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v1.0.2 - _December 13, 2018_
|
||||
|
||||
* Dependencies updated
|
||||
@@ -6,8 +6,8 @@ Smart contract interfaces of the 0x protocol.
|
||||
|
||||
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).
|
||||
- [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
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
// solhint-disable
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "./IAuthorizable.sol";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
|
||||
|
||||
contract IAssetProxyDispatcher {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity 0.4.24;
|
||||
pragma solidity ^0.4.24;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "./IExchangeCore.sol";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user