From 1d4ad345e2efcd7ae712034a7ef3eaa21fbfa154 Mon Sep 17 00:00:00 2001 From: EDUARDO MELO DE SIQUEIRA Date: Mon, 17 Jun 2024 12:22:48 -0300 Subject: [PATCH] fix: validating if the rental expiration date is lte offer in _cancelRentalOffer --- contracts/NftRentalMarketplace.sol | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contracts/NftRentalMarketplace.sol b/contracts/NftRentalMarketplace.sol index d073ffa..bc8f14c 100644 --- a/contracts/NftRentalMarketplace.sol +++ b/contracts/NftRentalMarketplace.sol @@ -288,7 +288,12 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr nonceDeadline[msg.sender][_offer.nonce] = uint64(block.timestamp); for (uint256 i = 0; i < _offer.roles.length; i++) { - roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] = uint64(block.timestamp); + + if(rentals[_offerHash].expirationDate <= roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId]) { + roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] = rentals[_offerHash].expirationDate; + } else { + roleDeadline[_offer.roles[i]][_offer.tokenAddress][_offer.tokenId] = uint64(block.timestamp); + } } emit RentalOfferCancelled(_offer.lender, _offer.nonce); }