From 959e877717df52e497eb9e9ef8705500dcfe2a16 Mon Sep 17 00:00:00 2001 From: Daniel Lima Date: Tue, 23 Apr 2024 12:46:41 -0300 Subject: [PATCH] ON-814: reorg functions --- contracts/NftRentalMarketplace.sol | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/contracts/NftRentalMarketplace.sol b/contracts/NftRentalMarketplace.sol index ebb175c..47585c4 100644 --- a/contracts/NftRentalMarketplace.sol +++ b/contracts/NftRentalMarketplace.sol @@ -216,23 +216,6 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr IERC7432VaultExtension(_rolesRegistry).withdraw(_offer.tokenAddress, _offer.tokenId); } - /** - * @notice Cancels a rental offer. - * @dev Internal function to cancel a rental offer. - * @param _offer The rental offer struct. It should be the same as the one used to create the offer. - */ - function _cancelRentalOffer(RentalOffer calldata _offer) internal { - bytes32 _offerHash = LibNftRentalMarketplace.hashRentalOffer(_offer); - LibNftRentalMarketplace.validateCancelRentalOfferParams( - isCreated[_offerHash], - _offer.lender, - nonceDeadline[_offer.lender][_offer.nonce] - ); - - nonceDeadline[msg.sender][_offer.nonce] = uint64(block.timestamp); - emit RentalOfferCancelled(_offer.lender, _offer.nonce); - } - /** * @notice Ends the rental prematurely. * @dev Can only be called by the borrower. @@ -259,6 +242,25 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr emit RentalEnded(_offer.lender, _offer.nonce); } + /** ######### Internals ########### **/ + + /** + * @notice Cancels a rental offer. + * @dev Internal function to cancel a rental offer. + * @param _offer The rental offer struct. It should be the same as the one used to create the offer. + */ + function _cancelRentalOffer(RentalOffer calldata _offer) internal { + bytes32 _offerHash = LibNftRentalMarketplace.hashRentalOffer(_offer); + LibNftRentalMarketplace.validateCancelRentalOfferParams( + isCreated[_offerHash], + _offer.lender, + nonceDeadline[_offer.lender][_offer.nonce] + ); + + nonceDeadline[msg.sender][_offer.nonce] = uint64(block.timestamp); + emit RentalOfferCancelled(_offer.lender, _offer.nonce); + } + /** ============================ Core Functions ================================== **/ /** ######### Setters ########### **/