@@ -50,6 +50,8 @@ contract Multiwrap is
50
50
bytes32 private constant TRANSFER_ROLE = keccak256 ("TRANSFER_ROLE " );
51
51
/// @dev Only MINTER_ROLE holders can wrap tokens, when wrapping is restricted.
52
52
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 " );
53
55
54
56
/// @dev Owner of the contract (purpose: OpenSea compatibility)
55
57
address private _owner;
@@ -118,6 +120,7 @@ contract Multiwrap is
118
120
_setupRole (MINTER_ROLE, _defaultAdmin);
119
121
_setupRole (TRANSFER_ROLE, _defaultAdmin);
120
122
_setupRole (TRANSFER_ROLE, address (0 ));
123
+ _setupRole (UNWRAP_ROLE, address (0 ));
121
124
}
122
125
123
126
/*///////////////////////////////////////////////////////////////
@@ -218,6 +221,10 @@ contract Multiwrap is
218
221
219
222
/// @dev Unwrap a wrapped NFT to retrieve underlying ERC1155, ERC721, ERC20 tokens.
220
223
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
+ }
221
228
require (_tokenId < nextTokenIdToMint, "invalid tokenId " );
222
229
require (_isApprovedOrOwner (_msgSender (), _tokenId), "unapproved called " );
223
230
0 commit comments