@@ -17,7 +17,7 @@ pragma solidity ^0.8.11;
17
17
import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol " ;
18
18
import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol " ;
19
19
20
- import "./eip/ERC721AVirtualApproveUpgradeable .sol " ;
20
+ import "./eip/queryable/ERC721AQueryableUpgradeable .sol " ;
21
21
22
22
// ========== Internal imports ==========
23
23
@@ -28,7 +28,6 @@ import "./lib/CurrencyTransferLib.sol";
28
28
29
29
import "./extension/Multicall.sol " ;
30
30
import "./extension/ContractMetadata.sol " ;
31
- import "./extension/PlatformFee.sol " ;
32
31
import "./extension/Royalty.sol " ;
33
32
import "./extension/PrimarySale.sol " ;
34
33
import "./extension/Ownable.sol " ;
@@ -42,7 +41,6 @@ import "./extension/DefaultOperatorFiltererUpgradeable.sol";
42
41
contract OpenEditionERC721 is
43
42
Initializable ,
44
43
ContractMetadata ,
45
- PlatformFee ,
46
44
Royalty ,
47
45
PrimarySale ,
48
46
Ownable ,
@@ -52,7 +50,7 @@ contract OpenEditionERC721 is
52
50
ERC2771ContextUpgradeable ,
53
51
Multicall ,
54
52
DefaultOperatorFiltererUpgradeable ,
55
- ERC721AUpgradeable
53
+ ERC721AQueryableUpgradeable
56
54
{
57
55
using StringsUpgradeable for uint256 ;
58
56
@@ -83,10 +81,8 @@ contract OpenEditionERC721 is
83
81
address [] memory _trustedForwarders ,
84
82
address _saleRecipient ,
85
83
address _royaltyRecipient ,
86
- uint128 _royaltyBps ,
87
- uint128 _platformFeeBps ,
88
- address _platformFeeRecipient
89
- ) external initializer {
84
+ uint128 _royaltyBps
85
+ ) external initializerERC721A initializer {
90
86
bytes32 _transferRole = keccak256 ("TRANSFER_ROLE " );
91
87
bytes32 _minterRole = keccak256 ("MINTER_ROLE " );
92
88
@@ -104,7 +100,6 @@ contract OpenEditionERC721 is
104
100
_setupRole (_transferRole, _defaultAdmin);
105
101
_setupRole (_transferRole, address (0 ));
106
102
107
- _setupPlatformFeeInfo (_platformFeeRecipient, _platformFeeBps);
108
103
_setupDefaultRoyaltyInfo (_royaltyRecipient, _royaltyBps);
109
104
_setupPrimarySaleRecipient (_saleRecipient);
110
105
@@ -117,7 +112,13 @@ contract OpenEditionERC721 is
117
112
//////////////////////////////////////////////////////////////*/
118
113
119
114
/// @dev Returns the URI for a given tokenId.
120
- function tokenURI (uint256 _tokenId ) public view virtual override returns (string memory ) {
115
+ function tokenURI (uint256 _tokenId )
116
+ public
117
+ view
118
+ virtual
119
+ override (ERC721AUpgradeable , IERC721AUpgradeable )
120
+ returns (string memory )
121
+ {
121
122
if (! _exists (_tokenId)) {
122
123
revert ("!ID " );
123
124
}
@@ -130,7 +131,7 @@ contract OpenEditionERC721 is
130
131
public
131
132
view
132
133
virtual
133
- override (ERC721AUpgradeable , IERC165 )
134
+ override (ERC721AUpgradeable , IERC165 , IERC721AUpgradeable )
134
135
returns (bool )
135
136
{
136
137
return super .supportsInterface (interfaceId) || type (IERC2981Upgradeable ).interfaceId == interfaceId;
@@ -172,22 +173,7 @@ contract OpenEditionERC721 is
172
173
173
174
address saleRecipient = _primarySaleRecipient == address (0 ) ? primarySaleRecipient () : _primarySaleRecipient;
174
175
175
- uint256 fees;
176
- address feeRecipient;
177
-
178
- PlatformFeeType feeType = getPlatformFeeType ();
179
- if (feeType == PlatformFeeType.Flat) {
180
- (feeRecipient, fees) = getFlatPlatformFeeInfo ();
181
- } else {
182
- uint16 platformFeeBps;
183
- (feeRecipient, platformFeeBps) = getPlatformFeeInfo ();
184
- fees = (totalPrice * platformFeeBps) / MAX_BPS;
185
- }
186
-
187
- require (totalPrice >= fees, "!F " );
188
-
189
- CurrencyTransferLib.transferCurrency (_currency, _msgSender (), feeRecipient, fees);
190
- CurrencyTransferLib.transferCurrency (_currency, _msgSender (), saleRecipient, totalPrice - fees);
176
+ CurrencyTransferLib.transferCurrency (_currency, _msgSender (), saleRecipient, totalPrice);
191
177
}
192
178
193
179
/// @dev Transfers the NFTs being claimed.
@@ -196,15 +182,10 @@ contract OpenEditionERC721 is
196
182
override
197
183
returns (uint256 startTokenId_ )
198
184
{
199
- startTokenId_ = _currentIndex ;
185
+ startTokenId_ = _nextTokenId () ;
200
186
_safeMint (_to, _quantityBeingClaimed);
201
187
}
202
188
203
- /// @dev Checks whether platform fee info can be set in the given execution context.
204
- function _canSetPlatformFeeInfo () internal view override returns (bool ) {
205
- return hasRole (DEFAULT_ADMIN_ROLE, _msgSender ());
206
- }
207
-
208
189
/// @dev Checks whether primary sale recipient can be set in the given execution context.
209
190
function _canSetPrimarySaleRecipient () internal view override returns (bool ) {
210
191
return hasRole (DEFAULT_ADMIN_ROLE, _msgSender ());
@@ -249,18 +230,18 @@ contract OpenEditionERC721 is
249
230
*/
250
231
function totalMinted () external view returns (uint256 ) {
251
232
unchecked {
252
- return _currentIndex - _startTokenId ();
233
+ return _nextTokenId () - _startTokenId ();
253
234
}
254
235
}
255
236
256
237
/// @dev The tokenId of the next NFT that will be minted / lazy minted.
257
238
function nextTokenIdToMint () external view returns (uint256 ) {
258
- return _currentIndex ;
239
+ return _nextTokenId () ;
259
240
}
260
241
261
242
/// @dev The next token ID of the NFT that can be claimed.
262
243
function nextTokenIdToClaim () external view returns (uint256 ) {
263
- return _currentIndex ;
244
+ return _nextTokenId () ;
264
245
}
265
246
266
247
/// @dev Burns `tokenId`. See {ERC721-_burn}.
@@ -287,12 +268,21 @@ contract OpenEditionERC721 is
287
268
}
288
269
289
270
/// @dev See {ERC721-setApprovalForAll}.
290
- function setApprovalForAll (address operator , bool approved ) public override onlyAllowedOperatorApproval (operator) {
271
+ function setApprovalForAll (address operator , bool approved )
272
+ public
273
+ override (IERC721AUpgradeable , ERC721AUpgradeable )
274
+ onlyAllowedOperatorApproval (operator)
275
+ {
291
276
super .setApprovalForAll (operator, approved);
292
277
}
293
278
294
279
/// @dev See {ERC721-approve}.
295
- function approve (address operator , uint256 tokenId ) public override onlyAllowedOperatorApproval (operator) {
280
+ function approve (address operator , uint256 tokenId )
281
+ public
282
+ payable
283
+ override (ERC721AUpgradeable , IERC721AUpgradeable )
284
+ onlyAllowedOperatorApproval (operator)
285
+ {
296
286
super .approve (operator, tokenId);
297
287
}
298
288
@@ -301,7 +291,7 @@ contract OpenEditionERC721 is
301
291
address from ,
302
292
address to ,
303
293
uint256 tokenId
304
- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
294
+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
305
295
super .transferFrom (from, to, tokenId);
306
296
}
307
297
@@ -310,7 +300,7 @@ contract OpenEditionERC721 is
310
300
address from ,
311
301
address to ,
312
302
uint256 tokenId
313
- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
303
+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
314
304
super .safeTransferFrom (from, to, tokenId);
315
305
}
316
306
@@ -320,31 +310,23 @@ contract OpenEditionERC721 is
320
310
address to ,
321
311
uint256 tokenId ,
322
312
bytes memory data
323
- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
313
+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
324
314
super .safeTransferFrom (from, to, tokenId, data);
325
315
}
326
316
327
317
function _dropMsgSender () internal view virtual override returns (address ) {
328
318
return _msgSender ();
329
319
}
330
320
331
- function _msgSender ()
332
- internal
333
- view
334
- virtual
335
- override (ContextUpgradeable, ERC2771ContextUpgradeable )
336
- returns (address sender )
337
- {
321
+ function _msgSenderERC721A () internal view virtual override returns (address ) {
322
+ return _msgSender ();
323
+ }
324
+
325
+ function _msgSender () internal view virtual override (ERC2771ContextUpgradeable ) returns (address sender ) {
338
326
return ERC2771ContextUpgradeable ._msgSender ();
339
327
}
340
328
341
- function _msgData ()
342
- internal
343
- view
344
- virtual
345
- override (ContextUpgradeable, ERC2771ContextUpgradeable )
346
- returns (bytes calldata )
347
- {
329
+ function _msgData () internal view virtual override (ERC2771ContextUpgradeable ) returns (bytes calldata ) {
348
330
return ERC2771ContextUpgradeable ._msgData ();
349
331
}
350
332
}
0 commit comments