Skip to content

Commit

Permalink
ON-814: reorg functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Apr 23, 2024
1 parent 786d655 commit 959e877
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions contracts/NftRentalMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 ########### **/
Expand Down

0 comments on commit 959e877

Please sign in to comment.