@@ -50,6 +50,8 @@ contract Multiwrap is
5050 bytes32 private constant TRANSFER_ROLE = keccak256 ("TRANSFER_ROLE " );
5151 /// @dev Only MINTER_ROLE holders can wrap tokens, when wrapping is restricted.
5252 bytes32 private constant MINTER_ROLE = keccak256 ("MINTER_ROLE " );
53+ /// @dev Only UNWRAP_ROLE holders can unwrap tokens, when unwrapping is restricted.
54+ bytes32 private constant UNWRAP_ROLE = keccak256 ("UNWRAP_ROLE " );
5355
5456 /// @dev Owner of the contract (purpose: OpenSea compatibility)
5557 address private _owner;
@@ -118,6 +120,7 @@ contract Multiwrap is
118120 _setupRole (MINTER_ROLE, _defaultAdmin);
119121 _setupRole (TRANSFER_ROLE, _defaultAdmin);
120122 _setupRole (TRANSFER_ROLE, address (0 ));
123+ _setupRole (UNWRAP_ROLE, address (0 ));
121124 }
122125
123126 /*///////////////////////////////////////////////////////////////
@@ -218,6 +221,10 @@ contract Multiwrap is
218221
219222 /// @dev Unwrap a wrapped NFT to retrieve underlying ERC1155, ERC721, ERC20 tokens.
220223 function unwrap (uint256 _tokenId , address _recipient ) external nonReentrant {
224+
225+ if (! hasRole (TRANSFER_ROLE, address (0 ))) {
226+ require (hasRole (TRANSFER_ROLE, _msgSender ()), "restricted to UNWRAP_ROLE holders. " );
227+ }
221228 require (_tokenId < nextTokenIdToMint, "invalid tokenId " );
222229 require (_isApprovedOrOwner (_msgSender (), _tokenId), "unapproved called " );
223230
0 commit comments