@@ -17,7 +17,7 @@ pragma solidity ^0.8.11;
1717import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol " ;
1818import "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol " ;
1919
20- import "./eip/ERC721AVirtualApproveUpgradeable .sol " ;
20+ import "./eip/queryable/ERC721AQueryableUpgradeable .sol " ;
2121
2222// ========== Internal imports ==========
2323
@@ -28,7 +28,6 @@ import "./lib/CurrencyTransferLib.sol";
2828
2929import "./extension/Multicall.sol " ;
3030import "./extension/ContractMetadata.sol " ;
31- import "./extension/PlatformFee.sol " ;
3231import "./extension/Royalty.sol " ;
3332import "./extension/PrimarySale.sol " ;
3433import "./extension/Ownable.sol " ;
@@ -42,7 +41,6 @@ import "./extension/DefaultOperatorFiltererUpgradeable.sol";
4241contract OpenEditionERC721 is
4342 Initializable ,
4443 ContractMetadata ,
45- PlatformFee ,
4644 Royalty ,
4745 PrimarySale ,
4846 Ownable ,
@@ -52,7 +50,7 @@ contract OpenEditionERC721 is
5250 ERC2771ContextUpgradeable ,
5351 Multicall ,
5452 DefaultOperatorFiltererUpgradeable ,
55- ERC721AUpgradeable
53+ ERC721AQueryableUpgradeable
5654{
5755 using StringsUpgradeable for uint256 ;
5856
@@ -83,10 +81,8 @@ contract OpenEditionERC721 is
8381 address [] memory _trustedForwarders ,
8482 address _saleRecipient ,
8583 address _royaltyRecipient ,
86- uint128 _royaltyBps ,
87- uint128 _platformFeeBps ,
88- address _platformFeeRecipient
89- ) external initializer {
84+ uint128 _royaltyBps
85+ ) external initializerERC721A initializer {
9086 bytes32 _transferRole = keccak256 ("TRANSFER_ROLE " );
9187 bytes32 _minterRole = keccak256 ("MINTER_ROLE " );
9288
@@ -104,7 +100,6 @@ contract OpenEditionERC721 is
104100 _setupRole (_transferRole, _defaultAdmin);
105101 _setupRole (_transferRole, address (0 ));
106102
107- _setupPlatformFeeInfo (_platformFeeRecipient, _platformFeeBps);
108103 _setupDefaultRoyaltyInfo (_royaltyRecipient, _royaltyBps);
109104 _setupPrimarySaleRecipient (_saleRecipient);
110105
@@ -117,7 +112,13 @@ contract OpenEditionERC721 is
117112 //////////////////////////////////////////////////////////////*/
118113
119114 /// @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+ {
121122 if (! _exists (_tokenId)) {
122123 revert ("!ID " );
123124 }
@@ -130,7 +131,7 @@ contract OpenEditionERC721 is
130131 public
131132 view
132133 virtual
133- override (ERC721AUpgradeable , IERC165 )
134+ override (ERC721AUpgradeable , IERC165 , IERC721AUpgradeable )
134135 returns (bool )
135136 {
136137 return super .supportsInterface (interfaceId) || type (IERC2981Upgradeable ).interfaceId == interfaceId;
@@ -172,22 +173,7 @@ contract OpenEditionERC721 is
172173
173174 address saleRecipient = _primarySaleRecipient == address (0 ) ? primarySaleRecipient () : _primarySaleRecipient;
174175
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);
191177 }
192178
193179 /// @dev Transfers the NFTs being claimed.
@@ -196,15 +182,10 @@ contract OpenEditionERC721 is
196182 override
197183 returns (uint256 startTokenId_ )
198184 {
199- startTokenId_ = _currentIndex ;
185+ startTokenId_ = _nextTokenId () ;
200186 _safeMint (_to, _quantityBeingClaimed);
201187 }
202188
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-
208189 /// @dev Checks whether primary sale recipient can be set in the given execution context.
209190 function _canSetPrimarySaleRecipient () internal view override returns (bool ) {
210191 return hasRole (DEFAULT_ADMIN_ROLE, _msgSender ());
@@ -249,18 +230,18 @@ contract OpenEditionERC721 is
249230 */
250231 function totalMinted () external view returns (uint256 ) {
251232 unchecked {
252- return _currentIndex - _startTokenId ();
233+ return _nextTokenId () - _startTokenId ();
253234 }
254235 }
255236
256237 /// @dev The tokenId of the next NFT that will be minted / lazy minted.
257238 function nextTokenIdToMint () external view returns (uint256 ) {
258- return _currentIndex ;
239+ return _nextTokenId () ;
259240 }
260241
261242 /// @dev The next token ID of the NFT that can be claimed.
262243 function nextTokenIdToClaim () external view returns (uint256 ) {
263- return _currentIndex ;
244+ return _nextTokenId () ;
264245 }
265246
266247 /// @dev Burns `tokenId`. See {ERC721-_burn}.
@@ -287,12 +268,21 @@ contract OpenEditionERC721 is
287268 }
288269
289270 /// @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+ {
291276 super .setApprovalForAll (operator, approved);
292277 }
293278
294279 /// @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+ {
296286 super .approve (operator, tokenId);
297287 }
298288
@@ -301,7 +291,7 @@ contract OpenEditionERC721 is
301291 address from ,
302292 address to ,
303293 uint256 tokenId
304- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
294+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
305295 super .transferFrom (from, to, tokenId);
306296 }
307297
@@ -310,7 +300,7 @@ contract OpenEditionERC721 is
310300 address from ,
311301 address to ,
312302 uint256 tokenId
313- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
303+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
314304 super .safeTransferFrom (from, to, tokenId);
315305 }
316306
@@ -320,31 +310,23 @@ contract OpenEditionERC721 is
320310 address to ,
321311 uint256 tokenId ,
322312 bytes memory data
323- ) public override (ERC721AUpgradeable ) onlyAllowedOperator (from) {
313+ ) public payable override (ERC721AUpgradeable , IERC721AUpgradeable ) onlyAllowedOperator (from) {
324314 super .safeTransferFrom (from, to, tokenId, data);
325315 }
326316
327317 function _dropMsgSender () internal view virtual override returns (address ) {
328318 return _msgSender ();
329319 }
330320
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 ) {
338326 return ERC2771ContextUpgradeable ._msgSender ();
339327 }
340328
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 ) {
348330 return ERC2771ContextUpgradeable ._msgData ();
349331 }
350332}
0 commit comments