@@ -20,7 +20,9 @@ contract MockERC1155Initializable is MockERC1155 {
2020}
2121
2222contract InvalidImplementation is MockERC721 {
23- function initialize (string memory ) public {} // Missing name and symbol parameters
23+ function initialize (string memory ) public {
24+ revert ("deliberate failure " );
25+ } // Missing name and symbol parameters
2426}
2527
2628contract MagicDropCloneFactoryTest is Test {
@@ -34,10 +36,13 @@ contract MagicDropCloneFactoryTest is Test {
3436
3537 uint32 internal erc721ImplId;
3638 uint32 internal erc1155ImplId;
39+ InvalidImplementation invalidImplementation;
3740
3841 function setUp () public {
3942 vm.startPrank (owner);
4043
44+ invalidImplementation = new InvalidImplementation ();
45+
4146 // Deploy and initialize registry
4247 address registryImpl = LibClone.clone (address (new MagicDropTokenImplRegistry ()));
4348 registry = MagicDropTokenImplRegistry (payable (registryImpl));
@@ -156,16 +161,16 @@ contract MagicDropCloneFactoryTest is Test {
156161 vm.startPrank (user);
157162
158163 factory.createContractDeterministic {value: 0.01 ether }(
159- "TestNFT1 " , "TNFT1 " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (0 )
164+ "TestNFT1 " , "TNFT1 " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (uint256 ( 100 ) )
160165 );
161166 vm.expectRevert ();
162167 factory.createContractDeterministic {value: 0.01 ether }(
163- "TestNFT2 " , "TNFT2 " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (0 )
168+ "TestNFT2 " , "TNFT2 " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (uint256 ( 100 ) )
164169 );
165170 }
166171
167172 function testContractAlreadyDeployed () public {
168- bytes32 salt = bytes32 (uint256 (1 ));
173+ bytes32 salt = bytes32 (uint256 (101 ));
169174 uint32 implId = 1 ;
170175 TokenStandard standard = TokenStandard.ERC721 ;
171176 address initialOwner = address (0x1 );
@@ -188,21 +193,22 @@ contract MagicDropCloneFactoryTest is Test {
188193 TokenStandard standard = TokenStandard.ERC721 ;
189194
190195 vm.startPrank (owner);
191- InvalidImplementation impl = new InvalidImplementation ();
192- uint32 implId = registry.registerImplementation (standard, address (impl), false , 0.01 ether, 0.00001 ether);
196+
197+ uint32 implId =
198+ registry.registerImplementation (standard, address (invalidImplementation), false , 0.01 ether, 0.00001 ether);
193199 vm.stopPrank ();
194200
195201 vm.expectRevert (MagicDropCloneFactory.InitializationFailed.selector );
196202 factory.createContractDeterministic {value: 0.01 ether }(
197- "TestNFT " , "TNFT " , standard, payable (user), implId, bytes32 (0 )
203+ "TestNFT " , "TNFT " , standard, payable (user), implId, bytes32 (uint256 ( 102 ) )
198204 );
199205 }
200206
201207 function testInsufficientDeploymentFee () public {
202208 vm.startPrank (user);
203209 vm.expectRevert (MagicDropCloneFactory.InsufficientDeploymentFee.selector );
204210 factory.createContractDeterministic {value: 0.005 ether }(
205- "TestNFT " , "TNFT " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (0 )
211+ "TestNFT " , "TNFT " , TokenStandard.ERC721 , payable (user), erc721ImplId, bytes32 (uint256 ( 103 ) )
206212 );
207213 }
208214
0 commit comments