@@ -322,6 +322,14 @@ contract SimpleAccountTest is BaseTest {
322
322
323
323
/// @dev Create more than one accounts with the same admin.
324
324
function test_state_createAccount_viaEntrypoint_multipleAccountSameAdmin () public {
325
+ uint256 start = 0 ;
326
+ uint256 end = 0 ;
327
+
328
+ assertEq (accountFactory.totalAccounts (), 0 );
329
+
330
+ vm.expectRevert ("BaseAccountFactory: invalid indices " );
331
+ address [] memory accs = accountFactory.getAccounts (start, end);
332
+
325
333
uint256 amount = 100 ;
326
334
327
335
for (uint256 i = 0 ; i < amount; i += 1 ) {
@@ -365,6 +373,50 @@ contract SimpleAccountTest is BaseTest {
365
373
)
366
374
);
367
375
}
376
+
377
+ start = 25 ;
378
+ end = 75 ;
379
+
380
+ address [] memory accountsPaginatedOne = accountFactory.getAccounts (start, end);
381
+
382
+ for (uint256 i = 0 ; i < (end - start); i += 1 ) {
383
+ assertEq (
384
+ accountsPaginatedOne[i],
385
+ Clones.predictDeterministicAddress (
386
+ accountFactory.accountImplementation (),
387
+ _generateSalt (accountAdmin, bytes (abi.encode (start + i))),
388
+ address (accountFactory)
389
+ )
390
+ );
391
+ }
392
+
393
+ start = 0 ;
394
+ end = amount;
395
+
396
+ address [] memory accountsPaginatedTwo = accountFactory.getAccounts (start, end);
397
+
398
+ for (uint256 i = 0 ; i < (end - start); i += 1 ) {
399
+ assertEq (
400
+ accountsPaginatedTwo[i],
401
+ Clones.predictDeterministicAddress (
402
+ accountFactory.accountImplementation (),
403
+ _generateSalt (accountAdmin, bytes (abi.encode (start + i))),
404
+ address (accountFactory)
405
+ )
406
+ );
407
+ }
408
+
409
+ start = 75 ;
410
+ end = 25 ;
411
+
412
+ vm.expectRevert ("BaseAccountFactory: invalid indices " );
413
+ accs = accountFactory.getAccounts (start, end);
414
+
415
+ start = 25 ;
416
+ end = amount + 1 ;
417
+
418
+ vm.expectRevert ("BaseAccountFactory: invalid indices " );
419
+ accs = accountFactory.getAccounts (start, end);
368
420
}
369
421
370
422
/*///////////////////////////////////////////////////////////////
0 commit comments