From 99a643ac2989b6617deb7a5fcaa0d8fe809c047e Mon Sep 17 00:00:00 2001 From: CanvasL <746591811@qq.com> Date: Tue, 23 Jul 2024 14:55:12 +0800 Subject: [PATCH] feat: crete when rentalProject not exists --- src/Marketplace.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Marketplace.sol b/src/Marketplace.sol index 3a631eb..6d265d7 100644 --- a/src/Marketplace.sol +++ b/src/Marketplace.sol @@ -164,7 +164,9 @@ contract Marketplace is Ownable { address rentalProduct = RENTAL_PRODUCT_FACTORY.getRentalProduct( args.product ); - require(address(rentalProduct) != address(0), "unsupported nft"); + if(rentalProduct == address(0)) { + rentalProduct = RENTAL_PRODUCT_FACTORY.createRentalProduct(args.product); + } require( listings[rentalProduct][args.tokenId].status == ListingStatus.WithdrawnOrNotExist, // Never listed or withdrawn