diff --git a/contracts/OriumSftMarketplace.sol b/contracts/OriumSftMarketplace.sol index eebcdd6..5440d15 100644 --- a/contracts/OriumSftMarketplace.sol +++ b/contracts/OriumSftMarketplace.sol @@ -7,6 +7,7 @@ import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/I import { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol'; import { IERC1155 } from '@openzeppelin/contracts/token/ERC1155/IERC1155.sol'; import { IERC7589 } from './interfaces/IERC7589.sol'; +import { IERC7589Legacy } from './interfaces/IERC7589Legacy.sol'; import { LibOriumSftMarketplace, RentalOffer, CommitAndGrantRoleParams } from './libraries/LibOriumSftMarketplace.sol'; import { IOriumMarketplaceRoyalties } from './interfaces/IOriumMarketplaceRoyalties.sol'; @@ -21,6 +22,9 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra /// @dev oriumMarketplaceRoyalties stores the collection royalties and fees address public oriumMarketplaceRoyalties; + /// @dev Wearable address + address public constant wearableAddress = 0x58de9AaBCaeEC0f69883C94318810ad79Cc6a44f; + /// @dev hashedOffer => bool mapping(bytes32 => bool) public isCreated; @@ -128,12 +132,21 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra _validateCreateRentalOffer(_offer, _rolesRegistryAddress); if (_offer.commitmentId == 0) { - _offer.commitmentId = IERC7589(_rolesRegistryAddress).lockTokens( + if(_offer.tokenAddress == wearableAddress ){ + _offer.commitmentId = IERC7589Legacy(_rolesRegistryAddress).commitTokens( _offer.lender, _offer.tokenAddress, _offer.tokenId, _offer.tokenAmount ); + }else { + _offer.commitmentId = IERC7589(_rolesRegistryAddress).lockTokens( + _offer.lender, + _offer.tokenAddress, + _offer.tokenId, + _offer.tokenAmount + ); + } } nonceDeadline[msg.sender][_offer.nonce] = _offer.deadline; @@ -301,15 +314,26 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra _params[i].tokenAddress ); + IERC7589Legacy _rolesRegistryLegacy = IERC7589Legacy(_rolesRegistryAddress); IERC7589 _rolesRegistry = IERC7589(_rolesRegistryAddress); + uint256 _validCommitmentId = _params[i].commitmentId; if (_params[i].commitmentId == 0) { + if(_params[i].tokenAddress == wearableAddress) { + _validCommitmentId = _rolesRegistryLegacy.commitTokens( + msg.sender, + _params[i].tokenAddress, + _params[i].tokenId, + _params[i].tokenAmount + ); + } else { _validCommitmentId = _rolesRegistry.lockTokens( msg.sender, _params[i].tokenAddress, _params[i].tokenId, _params[i].tokenAmount ); + } } else { // if the user provided a valid commitmentId, it's necessary to verify if they actually own it, // and if all other parameters passed match the commitmentId