@@ -466,191 +466,3 @@ contract SemaphoreMockTest is Test {
466
466
semaphoreMock.validateProof (0 , validProof);
467
467
}
468
468
}
469
-
470
- // contract Voting is Test {
471
- // event Registered(address voter);
472
- // event Voted(address voter, uint8 option);
473
-
474
- // NFT internal nft;
475
- // BaseERC721Checker internal checker;
476
- // BaseERC721CheckerFactory internal checkerFactory;
477
- // BaseERC721Policy internal policy;
478
- // BaseERC721PolicyFactory internal policyFactory;
479
- // BaseVoting internal voting;
480
-
481
- // address public deployer = vm.addr(0x1);
482
- // address public subject = vm.addr(0x2);
483
- // address public notOwner = vm.addr(0x3);
484
-
485
- // function setUp() public virtual {
486
- // vm.startPrank(deployer);
487
-
488
- // nft = new NFT();
489
-
490
- // checkerFactory = new BaseERC721CheckerFactory();
491
- // policyFactory = new BaseERC721PolicyFactory();
492
-
493
- // vm.recordLogs();
494
- // checkerFactory.deploy(address(nft));
495
- // Vm.Log[] memory entries = vm.getRecordedLogs();
496
- // address checkerClone = address(uint160(uint256(entries[0].topics[1])));
497
- // checker = BaseERC721Checker(checkerClone);
498
-
499
- // vm.recordLogs();
500
- // policyFactory.deploy(address(checker));
501
- // entries = vm.getRecordedLogs();
502
- // address policyClone = address(uint160(uint256(entries[0].topics[1])));
503
- // policy = BaseERC721Policy(policyClone);
504
-
505
- // voting = new BaseVoting(policy);
506
-
507
- // vm.stopPrank();
508
- // }
509
-
510
- // function test_voting_deployed() public view {
511
- // assertEq(address(voting.POLICY()), address(policy));
512
- // assertEq(voting.hasVoted(subject), false);
513
- // assertEq(voting.registered(subject), false);
514
- // }
515
-
516
- // function test_register_whenCallerNotTarget_reverts() public {
517
- // vm.startPrank(deployer);
518
-
519
- // policy.setTarget(deployer);
520
- // nft.mint(subject);
521
-
522
- // vm.stopPrank();
523
-
524
- // vm.startPrank(notOwner);
525
-
526
- // vm.expectRevert(abi.encodeWithSelector(IPolicy.TargetOnly.selector));
527
- // voting.register(0);
528
-
529
- // vm.stopPrank();
530
- // }
531
-
532
- // function test_register_whenTokenDoesNotExist_reverts() public {
533
- // vm.startPrank(deployer);
534
-
535
- // policy.setTarget(address(voting));
536
- // nft.mint(subject);
537
-
538
- // vm.stopPrank();
539
-
540
- // vm.startPrank(subject);
541
-
542
- // vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721NonexistentToken.selector, uint256(1)));
543
- // voting.register(1);
544
-
545
- // vm.stopPrank();
546
- // }
547
-
548
- // function test_register_whenCheckFails_reverts() public {
549
- // vm.startPrank(deployer);
550
-
551
- // policy.setTarget(address(voting));
552
- // nft.mint(subject);
553
-
554
- // vm.stopPrank();
555
-
556
- // vm.startPrank(notOwner);
557
-
558
- // vm.expectRevert(abi.encodeWithSelector(IPolicy.UnsuccessfulCheck.selector));
559
- // voting.register(0);
560
-
561
- // vm.stopPrank();
562
- // }
563
-
564
- // function test_register_whenValid_succeeds() public {
565
- // vm.startPrank(deployer);
566
-
567
- // policy.setTarget(address(voting));
568
- // nft.mint(subject);
569
-
570
- // vm.stopPrank();
571
-
572
- // vm.startPrank(subject);
573
-
574
- // vm.expectEmit(true, true, true, true);
575
- // emit Registered(subject);
576
-
577
- // voting.register(0);
578
-
579
- // vm.stopPrank();
580
- // }
581
-
582
- // function test_vote_whenNotRegistered_reverts() public {
583
- // vm.startPrank(deployer);
584
-
585
- // policy.setTarget(address(voting));
586
- // nft.mint(subject);
587
-
588
- // vm.stopPrank();
589
-
590
- // vm.startPrank(subject);
591
-
592
- // vm.expectRevert(abi.encodeWithSelector(BaseVoting.NotRegistered.selector));
593
- // voting.vote(0);
594
-
595
- // vm.stopPrank();
596
- // }
597
-
598
- // function test_vote_whenInvalidOption_reverts() public {
599
- // vm.startPrank(deployer);
600
-
601
- // policy.setTarget(address(voting));
602
- // nft.mint(subject);
603
-
604
- // vm.stopPrank();
605
-
606
- // vm.startPrank(subject);
607
- // voting.register(0);
608
-
609
- // vm.expectRevert(abi.encodeWithSelector(BaseVoting.InvalidOption.selector));
610
- // voting.vote(3);
611
-
612
- // vm.stopPrank();
613
- // }
614
-
615
- // function test_vote_whenValid_succeeds() public {
616
- // vm.startPrank(deployer);
617
-
618
- // policy.setTarget(address(voting));
619
- // nft.mint(subject);
620
-
621
- // vm.stopPrank();
622
-
623
- // vm.startPrank(subject);
624
- // voting.register(0);
625
-
626
- // assertEq(voting.registered(subject), true);
627
-
628
- // vm.expectEmit(true, true, true, true);
629
- // emit Voted(subject, 0);
630
-
631
- // voting.vote(0);
632
-
633
- // assertEq(voting.hasVoted(subject), true);
634
-
635
- // vm.stopPrank();
636
- // }
637
-
638
- // function test_vote_whenAlreadyVoted_reverts() public {
639
- // vm.startPrank(deployer);
640
-
641
- // policy.setTarget(address(voting));
642
- // nft.mint(subject);
643
-
644
- // vm.stopPrank();
645
-
646
- // vm.startPrank(subject);
647
-
648
- // voting.register(0);
649
- // voting.vote(0);
650
-
651
- // vm.expectRevert(abi.encodeWithSelector(BaseVoting.AlreadyVoted.selector));
652
- // voting.vote(0);
653
-
654
- // vm.stopPrank();
655
- // }
656
- // }
0 commit comments