@@ -155,7 +155,35 @@ contract('KyberHintHandler', function(accounts) {
155
155
Helper . assertEqual ( hint , expected ) ;
156
156
} ) ;
157
157
158
- it ( 'should revert the T2E BEST-OF-ALL HINT if reserveIds or splits is NOT EMPTY' , async ( ) => {
158
+ it ( 'should revert the T2E BEST-OF-ALL HINT if reserveIds is NOT EMPTY' , async ( ) => {
159
+ t2eOpcode = BEST_OF_ALL ;
160
+
161
+ await expectRevert (
162
+ hintHandler . buildTokenToEthHint (
163
+ t2eToken ,
164
+ t2eOpcode ,
165
+ t2eReserves ,
166
+ [ ] ,
167
+ ) ,
168
+ 'reserveIds and splits must be empty'
169
+ ) ;
170
+ } ) ;
171
+
172
+ it ( 'should revert the T2E BEST-OF-ALL HINT if splits is NOT EMPTY' , async ( ) => {
173
+ t2eOpcode = BEST_OF_ALL ;
174
+
175
+ await expectRevert (
176
+ hintHandler . buildTokenToEthHint (
177
+ t2eToken ,
178
+ t2eOpcode ,
179
+ [ ] ,
180
+ t2eSplits ,
181
+ ) ,
182
+ 'reserveIds and splits must be empty'
183
+ ) ;
184
+ } ) ;
185
+
186
+ it ( 'should revert the T2E BEST-OF-ALL HINT if reserveIds and splits are NOT EMPTY' , async ( ) => {
159
187
t2eOpcode = BEST_OF_ALL ;
160
188
161
189
await expectRevert (
@@ -315,7 +343,35 @@ contract('KyberHintHandler', function(accounts) {
315
343
Helper . assertEqual ( hint , expected ) ;
316
344
} ) ;
317
345
318
- it ( 'should revert the E2T BEST-OF-ALL HINT if reserveIds or splits is NOT EMPTY' , async ( ) => {
346
+ it ( 'should revert the E2T BEST-OF-ALL HINT if reserveIds is NOT EMPTY' , async ( ) => {
347
+ e2tOpcode = BEST_OF_ALL ;
348
+
349
+ await expectRevert (
350
+ hintHandler . buildEthToTokenHint (
351
+ e2tToken ,
352
+ e2tOpcode ,
353
+ e2tReserves ,
354
+ [ ] ,
355
+ ) ,
356
+ 'reserveIds and splits must be empty'
357
+ ) ;
358
+ } ) ;
359
+
360
+ it ( 'should revert the E2T BEST-OF-ALL HINT if splits is NOT EMPTY' , async ( ) => {
361
+ e2tOpcode = BEST_OF_ALL ;
362
+
363
+ await expectRevert (
364
+ hintHandler . buildEthToTokenHint (
365
+ e2tToken ,
366
+ e2tOpcode ,
367
+ [ ] ,
368
+ e2tSplits ,
369
+ ) ,
370
+ 'reserveIds and splits must be empty'
371
+ ) ;
372
+ } ) ;
373
+
374
+ it ( 'should revert the E2T BEST-OF-ALL HINT if reserveIds and splits are NOT EMPTY' , async ( ) => {
319
375
e2tOpcode = BEST_OF_ALL ;
320
376
321
377
await expectRevert (
@@ -779,7 +835,47 @@ contract('KyberHintHandler', function(accounts) {
779
835
Helper . assertEqual ( hint , expected ) ;
780
836
} ) ;
781
837
782
- it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } if reserveIds or splits is NOT EMPTY` , async ( ) => {
838
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } if T2E reserveIds is NOT EMPTY` , async ( ) => {
839
+ t2eOpcode = BEST_OF_ALL ;
840
+ e2tOpcode = TRADE_TYPES [ e2tTradeType ] ;
841
+ e2tSplits = ( e2tTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
842
+
843
+ await expectRevert (
844
+ hintHandler . buildTokenToTokenHint (
845
+ t2eToken ,
846
+ t2eOpcode ,
847
+ t2eReserves ,
848
+ [ ] ,
849
+ e2tToken ,
850
+ e2tOpcode ,
851
+ e2tReserves ,
852
+ e2tSplits ,
853
+ ) ,
854
+ 'reserveIds and splits must be empty'
855
+ ) ;
856
+ } ) ;
857
+
858
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } if T2E splits is NOT EMPTY` , async ( ) => {
859
+ t2eOpcode = BEST_OF_ALL ;
860
+ e2tOpcode = TRADE_TYPES [ e2tTradeType ] ;
861
+ e2tSplits = ( e2tTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
862
+
863
+ await expectRevert (
864
+ hintHandler . buildTokenToTokenHint (
865
+ t2eToken ,
866
+ t2eOpcode ,
867
+ [ ] ,
868
+ t2eSplits ,
869
+ e2tToken ,
870
+ e2tOpcode ,
871
+ e2tReserves ,
872
+ e2tSplits ,
873
+ ) ,
874
+ 'reserveIds and splits must be empty'
875
+ ) ;
876
+ } ) ;
877
+
878
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } if T2E reserveIds and splits are NOT EMPTY` , async ( ) => {
783
879
t2eOpcode = BEST_OF_ALL ;
784
880
e2tOpcode = TRADE_TYPES [ e2tTradeType ] ;
785
881
e2tSplits = ( e2tTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
@@ -830,7 +926,47 @@ contract('KyberHintHandler', function(accounts) {
830
926
Helper . assertEqual ( hint , expected ) ;
831
927
} ) ;
832
928
833
- it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT if reserveIds or splits is NOT EMPTY` , async ( ) => {
929
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT if E2T reserveIds is NOT EMPTY` , async ( ) => {
930
+ t2eOpcode = TRADE_TYPES [ t2eTradeType ] ;
931
+ t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
932
+ e2tOpcode = BEST_OF_ALL ;
933
+
934
+ await expectRevert (
935
+ hintHandler . buildTokenToTokenHint (
936
+ t2eToken ,
937
+ t2eOpcode ,
938
+ t2eReserves ,
939
+ t2eSplits ,
940
+ e2tToken ,
941
+ e2tOpcode ,
942
+ e2tReserves ,
943
+ [ ] ,
944
+ ) ,
945
+ 'reserveIds and splits must be empty'
946
+ ) ;
947
+ } ) ;
948
+
949
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT if E2T splits is NOT EMPTY` , async ( ) => {
950
+ t2eOpcode = TRADE_TYPES [ t2eTradeType ] ;
951
+ t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
952
+ e2tOpcode = BEST_OF_ALL ;
953
+
954
+ await expectRevert (
955
+ hintHandler . buildTokenToTokenHint (
956
+ t2eToken ,
957
+ t2eOpcode ,
958
+ t2eReserves ,
959
+ t2eSplits ,
960
+ e2tToken ,
961
+ e2tOpcode ,
962
+ [ ] ,
963
+ e2tSplits ,
964
+ ) ,
965
+ 'reserveIds and splits must be empty'
966
+ ) ;
967
+ } ) ;
968
+
969
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT if E2T reserveIds and splits are NOT EMPTY` , async ( ) => {
834
970
t2eOpcode = TRADE_TYPES [ t2eTradeType ] ;
835
971
t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
836
972
e2tOpcode = BEST_OF_ALL ;
@@ -1285,7 +1421,31 @@ contract('KyberHintHandler', function(accounts) {
1285
1421
t2eMissingReserves = T2E_MISSING ;
1286
1422
} ) ;
1287
1423
1288
- it ( 'should revert the T2E BEST-OF-ALL HINT due to reserveIds or splits not empty' , async ( ) => {
1424
+ it ( 'should revert the T2E BEST-OF-ALL HINT due to reserveIds not empty' , async ( ) => {
1425
+ t2eHintType = BEST_OF_ALL ;
1426
+ t2eSplits = BPS_SPLIT ;
1427
+
1428
+ hint = Helper . buildHint ( 'BEST_OF_ALL' ) ( t2eHintType , t2eReserves , [ ] ) ;
1429
+
1430
+ await expectRevert (
1431
+ hintHandler . parseTokenToEthHint ( t2eToken , hint ) ,
1432
+ 'reserveIds and splits must be empty'
1433
+ ) ;
1434
+ } ) ;
1435
+
1436
+ it ( 'should revert the T2E BEST-OF-ALL HINT due to splits not empty' , async ( ) => {
1437
+ t2eHintType = BEST_OF_ALL ;
1438
+ t2eSplits = BPS_SPLIT ;
1439
+
1440
+ hint = Helper . buildHint ( 'BEST_OF_ALL' ) ( t2eHintType , [ ] , t2eSplits ) ;
1441
+
1442
+ await expectRevert (
1443
+ hintHandler . parseTokenToEthHint ( t2eToken , hint ) ,
1444
+ 'reserveIds and splits must be empty'
1445
+ ) ;
1446
+ } ) ;
1447
+
1448
+ it ( 'should revert the T2E BEST-OF-ALL HINT due to reserveIds and splits not empty' , async ( ) => {
1289
1449
t2eHintType = BEST_OF_ALL ;
1290
1450
t2eSplits = BPS_SPLIT ;
1291
1451
@@ -1456,7 +1616,31 @@ contract('KyberHintHandler', function(accounts) {
1456
1616
e2tMissingReserves = E2T_MISSING ;
1457
1617
} ) ;
1458
1618
1459
- it ( 'should revert the E2T BEST-OF-ALL HINT due to reserveIds or splits not empty' , async ( ) => {
1619
+ it ( 'should revert the E2T BEST-OF-ALL HINT due to reserveIds not empty' , async ( ) => {
1620
+ e2tHintType = BEST_OF_ALL ;
1621
+ e2tSplits = BPS_SPLIT ;
1622
+
1623
+ hint = Helper . buildHint ( 'BEST_OF_ALL' ) ( e2tHintType , e2tReserves , [ ] ) ;
1624
+
1625
+ await expectRevert (
1626
+ hintHandler . parseEthToTokenHint ( e2tToken , hint ) ,
1627
+ 'reserveIds and splits must be empty'
1628
+ ) ;
1629
+ } ) ;
1630
+
1631
+ it ( 'should revert the E2T BEST-OF-ALL HINT due to splits not empty' , async ( ) => {
1632
+ e2tHintType = BEST_OF_ALL ;
1633
+ e2tSplits = BPS_SPLIT ;
1634
+
1635
+ hint = Helper . buildHint ( 'BEST_OF_ALL' ) ( e2tHintType , [ ] , e2tSplits ) ;
1636
+
1637
+ await expectRevert (
1638
+ hintHandler . parseEthToTokenHint ( e2tToken , hint ) ,
1639
+ 'reserveIds and splits must be empty'
1640
+ ) ;
1641
+ } ) ;
1642
+
1643
+ it ( 'should revert the E2T BEST-OF-ALL HINT due to reserveIds and splits not empty' , async ( ) => {
1460
1644
e2tHintType = BEST_OF_ALL ;
1461
1645
e2tSplits = BPS_SPLIT ;
1462
1646
@@ -1635,7 +1819,53 @@ contract('KyberHintHandler', function(accounts) {
1635
1819
} ) ;
1636
1820
1637
1821
Object . keys ( TRADE_TYPES ) . forEach ( e2tTradeType => {
1638
- it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } due to reserveIds or splits not empty` , async ( ) => {
1822
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } due to T2E reserveIds not empty` , async ( ) => {
1823
+ t2eHintType = BEST_OF_ALL ;
1824
+ t2eSplits = [ ] ;
1825
+ e2tHintType = TRADE_TYPES [ e2tTradeType ] ;
1826
+ e2tSplits = ( e2tTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
1827
+
1828
+ hint = Helper . buildHintT2T (
1829
+ 'BEST_OF_ALL' ,
1830
+ t2eHintType ,
1831
+ t2eReserves ,
1832
+ t2eSplits ,
1833
+ e2tTradeType ,
1834
+ e2tHintType ,
1835
+ e2tReserves ,
1836
+ e2tSplits ,
1837
+ ) ;
1838
+
1839
+ await expectRevert (
1840
+ hintHandler . parseTokenToTokenHint ( t2eToken , e2tToken , hint ) ,
1841
+ 'reserveIds and splits must be empty'
1842
+ ) ;
1843
+ } ) ;
1844
+
1845
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } due to T2E splits not empty` , async ( ) => {
1846
+ t2eHintType = BEST_OF_ALL ;
1847
+ t2eSplits = BPS_SPLIT ;
1848
+ e2tHintType = TRADE_TYPES [ e2tTradeType ] ;
1849
+ e2tSplits = ( e2tTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
1850
+
1851
+ hint = Helper . buildHintT2T (
1852
+ 'BEST_OF_ALL' ,
1853
+ t2eHintType ,
1854
+ [ ] ,
1855
+ t2eSplits ,
1856
+ e2tTradeType ,
1857
+ e2tHintType ,
1858
+ e2tReserves ,
1859
+ e2tSplits ,
1860
+ ) ;
1861
+
1862
+ await expectRevert (
1863
+ hintHandler . parseTokenToTokenHint ( t2eToken , e2tToken , hint ) ,
1864
+ 'reserveIds and splits must be empty'
1865
+ ) ;
1866
+ } ) ;
1867
+
1868
+ it ( `should revert the T2T hint for T2E BEST-OF-ALL HINT, E2T ${ e2tTradeType } due to T2E reserveIds and splits not empty` , async ( ) => {
1639
1869
t2eHintType = BEST_OF_ALL ;
1640
1870
t2eSplits = BPS_SPLIT ;
1641
1871
e2tHintType = TRADE_TYPES [ e2tTradeType ] ;
@@ -1660,7 +1890,53 @@ contract('KyberHintHandler', function(accounts) {
1660
1890
} ) ;
1661
1891
1662
1892
Object . keys ( TRADE_TYPES ) . forEach ( t2eTradeType => {
1663
- it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT due to reserveIds or splits not empty` , async ( ) => {
1893
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT due to E2T reserveIds not empty` , async ( ) => {
1894
+ t2eHintType = TRADE_TYPES [ t2eTradeType ] ;
1895
+ t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
1896
+ e2tHintType = BEST_OF_ALL ;
1897
+ e2tSplits = [ ] ;
1898
+
1899
+ hint = Helper . buildHintT2T (
1900
+ t2eTradeType ,
1901
+ t2eHintType ,
1902
+ t2eReserves ,
1903
+ t2eSplits ,
1904
+ 'BEST_OF_ALL' ,
1905
+ e2tHintType ,
1906
+ e2tReserves ,
1907
+ e2tSplits ,
1908
+ ) ;
1909
+
1910
+ await expectRevert (
1911
+ hintHandler . parseTokenToTokenHint ( t2eToken , e2tToken , hint ) ,
1912
+ 'reserveIds and splits must be empty'
1913
+ ) ;
1914
+ } ) ;
1915
+
1916
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT due to E2T splits not empty` , async ( ) => {
1917
+ t2eHintType = TRADE_TYPES [ t2eTradeType ] ;
1918
+ t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
1919
+ e2tHintType = BEST_OF_ALL ;
1920
+ e2tSplits = BPS_SPLIT ;
1921
+
1922
+ hint = Helper . buildHintT2T (
1923
+ t2eTradeType ,
1924
+ t2eHintType ,
1925
+ t2eReserves ,
1926
+ t2eSplits ,
1927
+ 'BEST_OF_ALL' ,
1928
+ e2tHintType ,
1929
+ [ ] ,
1930
+ e2tSplits ,
1931
+ ) ;
1932
+
1933
+ await expectRevert (
1934
+ hintHandler . parseTokenToTokenHint ( t2eToken , e2tToken , hint ) ,
1935
+ 'reserveIds and splits must be empty'
1936
+ ) ;
1937
+ } ) ;
1938
+
1939
+ it ( `should revert the T2T hint for T2E ${ t2eTradeType } , E2T BEST-OF-ALL HINT due to E2T reserveIds splits not empty` , async ( ) => {
1664
1940
t2eHintType = TRADE_TYPES [ t2eTradeType ] ;
1665
1941
t2eSplits = ( t2eTradeType == 'SPLIT' ) ? BPS_SPLIT : [ ] ;
1666
1942
e2tHintType = BEST_OF_ALL ;
0 commit comments