@@ -68,7 +68,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
68
68
. to . emit ( this . votes , 'DelegateVotesChanged' )
69
69
. withArgs ( this . bob , 0 , 15 ) ;
70
70
71
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
71
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
72
72
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address ] ) ;
73
73
74
74
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 1 ) ;
@@ -88,7 +88,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
88
88
. to . emit ( this . votes , 'DelegateVotesChanged' )
89
89
. withArgs ( this . alice , 0 , 20 ) ;
90
90
91
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
91
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
92
92
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address , this . alice . address ] ) ;
93
93
94
94
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 1 ) ;
@@ -127,7 +127,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
127
127
. to . emit ( this . votes , 'DelegateVotesChanged' )
128
128
. withArgs ( this . delegatee , 1 , 0 ) ;
129
129
130
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
130
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
131
131
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . bob . address ] ) ;
132
132
133
133
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 0 ) ;
@@ -151,7 +151,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
151
151
. to . emit ( this . votes , 'DelegateVotesChanged' )
152
152
. withArgs ( this . bob , 15 , 10 ) ;
153
153
154
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
154
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
155
155
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address ] ) ;
156
156
157
157
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 20 ) ;
@@ -167,7 +167,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
167
167
const tx = await this . votes . connect ( this . delegator ) . multiDelegate ( [ this . delegatee , this . other ] , [ 1 , 0 ] ) ;
168
168
await expect ( tx ) . to . not . emit ( this . votes , 'DelegateModified' ) . to . not . emit ( this . votes , 'DelegateVotesChanged' ) ;
169
169
170
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
170
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
171
171
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address ] ) ;
172
172
173
173
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 1 ) ;
@@ -268,7 +268,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
268
268
. to . emit ( this . votes , 'DelegateVotesChanged' )
269
269
. withArgs ( this . delegatee , 0 , 15 ) ;
270
270
271
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
271
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
272
272
expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address ] ) ;
273
273
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 15 ) ;
274
274
@@ -338,7 +338,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
338
338
expect ( log2 . args . previousVotes ) . to . equal ( 0 ) ;
339
339
expect ( log2 . args . newVotes ) . to . equal ( 15 ) ;
340
340
341
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
341
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
342
342
expect ( [ ...multiDelegates ] ) . to . have . members ( [ ] ) ;
343
343
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . other ) ) . to . equal ( 0 ) ;
344
344
expect ( await this . votes . getVotes ( this . other . address ) ) . to . equal ( 15 ) ;
@@ -384,7 +384,7 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
384
384
expect ( log2 . args . previousVotes ) . to . equal ( 0 ) ;
385
385
expect ( log2 . args . newVotes ) . to . equal ( 8 ) ;
386
386
387
- let multiDelegates = await this . votes . multiDelegates ( this . delegator ) ;
387
+ let multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
388
388
expect ( [ ...multiDelegates ] ) . to . have . members ( [ ] ) ;
389
389
expect ( await this . votes . getDelegatedUnits ( this . delegator , this . delegatee ) ) . to . equal ( 0 ) ;
390
390
expect ( await this . votes . getVotes ( this . delegatee . address ) ) . to . equal ( 8 ) ;
@@ -431,6 +431,36 @@ function shouldBehaveLikeMultiVotes(tokens, { mode = 'blocknumber', fungible = t
431
431
} ) ;
432
432
} ) ;
433
433
434
+ describe ( 'multiDelegates' , function ( ) {
435
+ it ( 'returns empty array if no partial delegation is active' , async function ( ) {
436
+ expect ( await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ) . to . deep . equal ( [ ] ) ;
437
+ } ) ;
438
+
439
+ it ( 'rejects if start is bigger than end' , async function ( ) {
440
+ expect ( this . votes . multiDelegates ( this . delegator , 1 , 0 ) )
441
+ . to . be . revertedWithCustomError ( this . votes , 'StartIsBiggerThanEnd' )
442
+ . withArgs ( 1 , 0 ) ;
443
+ } ) ;
444
+
445
+ it ( 'returns empty array if starts is bigger than delegations list' , async function ( ) {
446
+ await this . votes . connect ( this . delegator ) . multiDelegate ( [ this . delegatee , this . bob ] , [ 1 , 15 ] ) ;
447
+ expect ( await this . votes . multiDelegates ( this . delegator , 5 , 100 ) ) . to . deep . equal ( [ ] ) ;
448
+ } ) ;
449
+
450
+ it ( 'returns delegates list' , async function ( ) {
451
+ await this . votes . connect ( this . delegator ) . multiDelegate ( [ this . delegatee , this . bob , this . alice ] , [ 1 , 15 , 84 ] ) ;
452
+ const multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 2 ) ;
453
+ expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address , this . alice . address ] ) ;
454
+ } )
455
+
456
+ it ( 'cuts end if its bigger than delegations list' , async function ( ) {
457
+ await this . votes . connect ( this . delegator ) . multiDelegate ( [ this . delegatee , this . bob , this . alice ] , [ 1 , 15 , 84 ] ) ;
458
+ const multiDelegates = await this . votes . multiDelegates ( this . delegator , 0 , 100 ) ;
459
+ expect ( [ ...multiDelegates ] ) . to . have . members ( [ this . delegatee . address , this . bob . address , this . alice . address ] ) ;
460
+ } )
461
+
462
+ } )
463
+
434
464
describe ( 'burning' , async function ( ) {
435
465
it ( 'burns' , async function ( ) {
436
466
await this . votes . $_burn ( this . delegator , 50 ) ;
0 commit comments