@@ -232,18 +232,42 @@ contract ContractPublisherTest is BaseTest, IContractPublisherData {
232
232
// );
233
233
// }
234
234
235
- function test_unpublish () public {
235
+ function test_unpublish_state () public {
236
236
string memory contractId = "MyContract " ;
237
237
238
- vm.prank (publisher);
238
+ vm.startPrank (publisher);
239
239
byoc.publishContract (
240
240
publisher,
241
241
contractId,
242
- publishMetadataUri ,
242
+ " publish URI 1 " ,
243
243
compilerMetadataUri,
244
244
keccak256 (type (MockCustomContract).creationCode),
245
245
address (0 )
246
246
);
247
+ byoc.publishContract (
248
+ publisher,
249
+ contractId,
250
+ "publish URI 2 " ,
251
+ compilerMetadataUri,
252
+ keccak256 (type (MockCustomContract).creationCode),
253
+ address (0 )
254
+ );
255
+ byoc.publishContract (
256
+ publisher,
257
+ contractId,
258
+ "publish URI 3 " ,
259
+ compilerMetadataUri,
260
+ keccak256 (type (MockCustomContract).creationCode),
261
+ address (0 )
262
+ );
263
+
264
+ vm.stopPrank ();
265
+
266
+ IContractPublisher.CustomContractInstance[] memory allCustomContractsBefore = byoc.getPublishedContractVersions (
267
+ publisher,
268
+ contractId
269
+ );
270
+ assertEq (allCustomContractsBefore.length , 3 );
247
271
248
272
vm.prank (publisher);
249
273
byoc.unpublishContract (publisher, contractId);
@@ -257,6 +281,36 @@ contract ContractPublisherTest is BaseTest, IContractPublisherData {
257
281
assertEq (customContract.publishMetadataUri, "" );
258
282
assertEq (customContract.bytecodeHash, bytes32 (0 ));
259
283
assertEq (customContract.implementation, address (0 ));
284
+
285
+ IContractPublisher.CustomContractInstance[] memory allCustomContracts = byoc.getPublishedContractVersions (
286
+ publisher,
287
+ contractId
288
+ );
289
+
290
+ assertEq (allCustomContracts.length , 0 );
291
+
292
+ vm.prank (publisher);
293
+ byoc.publishContract (
294
+ publisher,
295
+ contractId,
296
+ "publish URI 4 " ,
297
+ compilerMetadataUri,
298
+ keccak256 (type (MockCustomContract).creationCode),
299
+ address (0 )
300
+ );
301
+
302
+ IContractPublisher.CustomContractInstance memory customContractRepublish = byoc.getPublishedContract (
303
+ publisher,
304
+ contractId
305
+ );
306
+
307
+ assertEq (customContractRepublish.contractId, contractId);
308
+ assertEq (customContractRepublish.publishMetadataUri, "publish URI 4 " );
309
+
310
+ IContractPublisher.CustomContractInstance[] memory allCustomContractsRepublish = byoc
311
+ .getPublishedContractVersions (publisher, contractId);
312
+
313
+ assertEq (allCustomContractsRepublish.length , 1 );
260
314
}
261
315
262
316
// Deprecated
0 commit comments