@@ -58,34 +58,32 @@ contract SignatureDropTest is BaseTest {
5858 }
5959
6060 /*
61- * note: Testing state changes; a batch of tokens, and nextTokenIdToMint
61+ * note: Testing revert condition; calling tokenURI for invalid batch id.
6262 */
63- function test_state_lazyMint_batchMintAndNextTokenIdToMint () public {
63+ function test_revert_lazyMint_batchMintAndTokenURI () public {
6464 vm.startPrank (deployer_signer);
6565
6666 sigdrop.lazyMint (100 , "ipfs:// " , "" );
6767
68- uint256 slot = stdstore.target (address (sigdrop)).sig ("nextTokenIdToMint() " ).find ();
69- bytes32 loc = bytes32 (slot);
70- uint256 nextTokenIdToMint = uint256 (vm.load (address (sigdrop), loc));
68+ vm.expectRevert ("No batch id for token. " );
69+ sigdrop.tokenURI (100 );
7170
72- assertEq (nextTokenIdToMint, 100 );
7371 vm.stopPrank ();
7472 }
7573
7674 /*
77- * note: Fuzz testing ; a batch of tokens, and nextTokenIdToMint
75+ * note: Testing state changes ; a batch of tokens, and nextTokenIdToMint
7876 */
79- function test_fuzz_lazyMint_batchMintAndNextTokenIdToMint ( uint256 x ) public {
77+ function test_state_lazyMint_batchMintAndNextTokenIdToMint ( ) public {
8078 vm.startPrank (deployer_signer);
8179
82- sigdrop.lazyMint (x , "ipfs:// " , "" );
80+ sigdrop.lazyMint (100 , "ipfs:// " , "" );
8381
8482 uint256 slot = stdstore.target (address (sigdrop)).sig ("nextTokenIdToMint() " ).find ();
8583 bytes32 loc = bytes32 (slot);
8684 uint256 nextTokenIdToMint = uint256 (vm.load (address (sigdrop), loc));
8785
88- assertEq (nextTokenIdToMint, x );
86+ assertEq (nextTokenIdToMint, 100 );
8987 vm.stopPrank ();
9088 }
9189
@@ -106,20 +104,6 @@ contract SignatureDropTest is BaseTest {
106104 vm.stopPrank ();
107105 }
108106
109- /*
110- * note: Testing revert condition; calling tokenURI for invalid batch id.
111- */
112- function test_revert_lazyMint_batchMintAndTokenURI () public {
113- vm.startPrank (deployer_signer);
114-
115- sigdrop.lazyMint (100 , "ipfs:// " , "" );
116-
117- vm.expectRevert ("No batch id for token. " );
118- sigdrop.tokenURI (100 );
119-
120- vm.stopPrank ();
121- }
122-
123107 /*
124108 * note: Testing state changes; a batch of tokens with encrypted base URI, and associated URI for tokens
125109 */
@@ -148,6 +132,22 @@ contract SignatureDropTest is BaseTest {
148132 vm.stopPrank ();
149133 }
150134
135+ /*
136+ * note: Fuzz testing; a batch of tokens, and nextTokenIdToMint
137+ */
138+ function test_fuzz_lazyMint_batchMintAndNextTokenIdToMint (uint256 x ) public {
139+ vm.startPrank (deployer_signer);
140+
141+ sigdrop.lazyMint (x, "ipfs:// " , "" );
142+
143+ uint256 slot = stdstore.target (address (sigdrop)).sig ("nextTokenIdToMint() " ).find ();
144+ bytes32 loc = bytes32 (slot);
145+ uint256 nextTokenIdToMint = uint256 (vm.load (address (sigdrop), loc));
146+
147+ assertEq (nextTokenIdToMint, x);
148+ vm.stopPrank ();
149+ }
150+
151151 /*///////////////////////////////////////////////////////////////
152152 Delayed Reveal Tests
153153 //////////////////////////////////////////////////////////////*/
@@ -532,6 +532,36 @@ contract SignatureDropTest is BaseTest {
532532 Claim Tests
533533 //////////////////////////////////////////////////////////////*/
534534
535+ /**
536+ * note: Testing revert condition; not allowed to claim again before wait time is over.
537+ */
538+ function test_revert_claimCondition_waitTimeInSecondsBetweenClaims () public {
539+ vm.warp (1 );
540+
541+ address receiver = getActor (0 );
542+ bytes32 [] memory proofs = new bytes32 [](0 );
543+
544+ SignatureDrop.AllowlistProof memory alp;
545+ alp.proof = proofs;
546+
547+ SignatureDrop.ClaimCondition[] memory conditions = new SignatureDrop.ClaimCondition [](1 );
548+ conditions[0 ].maxClaimableSupply = 100 ;
549+ conditions[0 ].quantityLimitPerTransaction = 100 ;
550+ conditions[0 ].waitTimeInSecondsBetweenClaims = type (uint256 ).max;
551+
552+ vm.prank (deployer_signer);
553+ sigdrop.lazyMint (100 , "ipfs:// " , "" );
554+ vm.prank (deployer_signer);
555+ sigdrop.setClaimConditions (conditions, false , "" );
556+
557+ vm.prank (getActor (5 ), getActor (5 ));
558+ sigdrop.claim (receiver, 1 , address (0 ), 0 , alp, "" );
559+
560+ vm.expectRevert ("cannot claim. " );
561+ vm.prank (getActor (5 ), getActor (5 ));
562+ sigdrop.claim (receiver, 1 , address (0 ), 0 , alp, "" );
563+ }
564+
535565 /**
536566 * note: Testing state changes; check startId and count after setting claim conditions.
537567 */
@@ -614,36 +644,6 @@ contract SignatureDropTest is BaseTest {
614644 assertEq (sigdrop.getActiveClaimConditionId (), 2 );
615645 }
616646
617- /**
618- * note: Testing revert condition; not allowed to claim again before wait time is over.
619- */
620- function test_revert_claimCondition_waitTimeInSecondsBetweenClaims () public {
621- vm.warp (1 );
622-
623- address receiver = getActor (0 );
624- bytes32 [] memory proofs = new bytes32 [](0 );
625-
626- SignatureDrop.AllowlistProof memory alp;
627- alp.proof = proofs;
628-
629- SignatureDrop.ClaimCondition[] memory conditions = new SignatureDrop.ClaimCondition [](1 );
630- conditions[0 ].maxClaimableSupply = 100 ;
631- conditions[0 ].quantityLimitPerTransaction = 100 ;
632- conditions[0 ].waitTimeInSecondsBetweenClaims = type (uint256 ).max;
633-
634- vm.prank (deployer_signer);
635- sigdrop.lazyMint (100 , "ipfs:// " , "" );
636- vm.prank (deployer_signer);
637- sigdrop.setClaimConditions (conditions, false , "" );
638-
639- vm.prank (getActor (5 ), getActor (5 ));
640- sigdrop.claim (receiver, 1 , address (0 ), 0 , alp, "" );
641-
642- vm.expectRevert ("cannot claim. " );
643- vm.prank (getActor (5 ), getActor (5 ));
644- sigdrop.claim (receiver, 1 , address (0 ), 0 , alp, "" );
645- }
646-
647647 /**
648648 * note: Testing state changes; reset eligibility of claim conditions and claiming again for same condition id.
649649 */
0 commit comments