@@ -46,7 +46,6 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
4646
4747 event Reserved (address indexed reserver , uint256 indexed reservationId );
4848 event IPNFTMinted (address indexed owner , uint256 indexed tokenId , string tokenURI , string symbol );
49- event IPNFTPOI (uint256 indexed tokenId , bytes poi );
5049 event ReadAccessGranted (uint256 indexed tokenId , address indexed reader , uint256 until );
5150 event AuthorizerUpdated (address authorizer );
5251
@@ -114,27 +113,14 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
114113 * @param authorization a bytes encoded parameter that ensures that the poi is owned by the owner (to param)
115114 * @return computedTokenId
116115 */
117- function mintWithPOI (address to , bytes calldata poi , string calldata _tokenURI , string calldata _symbol , bytes calldata authorization )
116+ function mintWithPOI (address to , bytes32 poi , string calldata _tokenURI , string calldata _symbol , bytes calldata authorization )
118117 external
119118 payable
120119 whenNotPaused
121120 returns (uint256 )
122121 {
123- uint256 computedTokenId = uint256 (keccak256 (poi));
124- if (msg .value < SYMBOLIC_MINT_FEE) {
125- revert MintingFeeTooLow ();
126- }
127-
128- if (! mintAuthorizer.authorizeMint (_msgSender (), to, abi.encode (SignedMintAuthorization (computedTokenId, _tokenURI, authorization)))) {
129- revert Unauthorized ();
130- }
131-
132- mintAuthorizer.redeem (authorization);
133- symbol[computedTokenId] = _symbol;
134- _mint (to, computedTokenId);
135- _setTokenURI (computedTokenId, _tokenURI);
136- emit IPNFTMinted (to, computedTokenId, _tokenURI, _symbol);
137- emit IPNFTPOI (computedTokenId, poi);
122+ uint256 computedTokenId = uint256 (poi);
123+ _handleMint (to, computedTokenId, _tokenURI, _symbol, authorization);
138124 return computedTokenId;
139125 }
140126
@@ -160,22 +146,27 @@ contract IPNFT is ERC721URIStorageUpgradeable, ERC721BurnableUpgradeable, IReser
160146 revert NotOwningReservation (reservationId);
161147 }
162148
149+
150+ _handleMint (to, reservationId, _tokenURI, _symbol, authorization);
151+ delete reservations[reservationId];
152+ return reservationId;
153+ }
154+
155+ function _handleMint (address to , uint256 tokenId , string calldata _tokenURI , string calldata _symbol , bytes calldata authorization ) internal {
163156 if (msg .value < SYMBOLIC_MINT_FEE) {
164157 revert MintingFeeTooLow ();
165158 }
166159
167- if (! mintAuthorizer.authorizeMint (_msgSender (), to, abi.encode (SignedMintAuthorization (reservationId , _tokenURI, authorization)))) {
160+ if (! mintAuthorizer.authorizeMint (_msgSender (), to, abi.encode (SignedMintAuthorization (tokenId , _tokenURI, authorization)))) {
168161 revert Unauthorized ();
169162 }
170163
171- delete reservations[reservationId];
172- symbol[reservationId] = _symbol;
164+ symbol[tokenId] = _symbol;
173165 mintAuthorizer.redeem (authorization);
174166
175- _mint (to, reservationId);
176- _setTokenURI (reservationId, _tokenURI);
177- emit IPNFTMinted (to, reservationId, _tokenURI, _symbol);
178- return reservationId;
167+ _mint (to, tokenId);
168+ _setTokenURI (tokenId, _tokenURI);
169+ emit IPNFTMinted (to, tokenId, _tokenURI, _symbol);
179170 }
180171
181172 /**
0 commit comments