3
3
4
4
pragma solidity ^ 0.8.0 ;
5
5
6
- import " @openzeppelin/contracts/token/ERC721/IERC721.sol " ;
7
- import " @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol " ;
8
- import " @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol " ;
9
- import " @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol " ;
10
- import " @openzeppelin/contracts/utils/Address.sol " ;
11
- import " @openzeppelin/contracts/utils/Context.sol " ;
12
- import " @openzeppelin/contracts/utils/Strings.sol " ;
13
- import " @openzeppelin/contracts/utils/introspection/ERC165.sol " ;
6
+ import ' @openzeppelin/contracts/token/ERC721/IERC721.sol ' ;
7
+ import ' @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol ' ;
8
+ import ' @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol ' ;
9
+ import ' @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol ' ;
10
+ import ' @openzeppelin/contracts/utils/Address.sol ' ;
11
+ import ' @openzeppelin/contracts/utils/Context.sol ' ;
12
+ import ' @openzeppelin/contracts/utils/Strings.sol ' ;
13
+ import ' @openzeppelin/contracts/utils/introspection/ERC165.sol ' ;
14
14
15
15
/**
16
16
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
@@ -66,7 +66,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
66
66
string memory symbol_ ,
67
67
uint256 maxBatchSize_
68
68
) {
69
- require (maxBatchSize_ > 0 , " ERC721A: max batch size must be nonzero " );
69
+ require (maxBatchSize_ > 0 , ' ERC721A: max batch size must be nonzero ' );
70
70
_name = name_;
71
71
_symbol = symbol_;
72
72
maxBatchSize = maxBatchSize_;
@@ -83,7 +83,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
83
83
* @dev See {IERC721Enumerable-tokenByIndex}.
84
84
*/
85
85
function tokenByIndex (uint256 index ) public view override returns (uint256 ) {
86
- require (index < totalSupply (), " ERC721A: global index out of bounds " );
86
+ require (index < totalSupply (), ' ERC721A: global index out of bounds ' );
87
87
return index;
88
88
}
89
89
@@ -93,7 +93,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
93
93
* It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case.
94
94
*/
95
95
function tokenOfOwnerByIndex (address owner , uint256 index ) public view override returns (uint256 ) {
96
- require (index < balanceOf (owner), " ERC721A: owner index out of bounds " );
96
+ require (index < balanceOf (owner), ' ERC721A: owner index out of bounds ' );
97
97
uint256 numMintedSoFar = totalSupply ();
98
98
uint256 tokenIdsIdx = 0 ;
99
99
address currOwnershipAddr = address (0 );
@@ -109,7 +109,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
109
109
tokenIdsIdx++ ;
110
110
}
111
111
}
112
- revert (" ERC721A: unable to get token of owner by index " );
112
+ revert (' ERC721A: unable to get token of owner by index ' );
113
113
}
114
114
115
115
/**
@@ -127,17 +127,17 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
127
127
* @dev See {IERC721-balanceOf}.
128
128
*/
129
129
function balanceOf (address owner ) public view override returns (uint256 ) {
130
- require (owner != address (0 ), " ERC721A: balance query for the zero address " );
130
+ require (owner != address (0 ), ' ERC721A: balance query for the zero address ' );
131
131
return uint256 (_addressData[owner].balance);
132
132
}
133
133
134
134
function _numberMinted (address owner ) internal view returns (uint256 ) {
135
- require (owner != address (0 ), " ERC721A: number minted query for the zero address " );
135
+ require (owner != address (0 ), ' ERC721A: number minted query for the zero address ' );
136
136
return uint256 (_addressData[owner].numberMinted);
137
137
}
138
138
139
139
function ownershipOf (uint256 tokenId ) internal view returns (TokenOwnership memory ) {
140
- require (_exists (tokenId), " ERC721A: owner query for nonexistent token " );
140
+ require (_exists (tokenId), ' ERC721A: owner query for nonexistent token ' );
141
141
142
142
uint256 lowestTokenToCheck;
143
143
if (tokenId >= maxBatchSize) {
@@ -151,7 +151,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
151
151
}
152
152
}
153
153
154
- revert (" ERC721A: unable to determine the owner of token " );
154
+ revert (' ERC721A: unable to determine the owner of token ' );
155
155
}
156
156
157
157
/**
@@ -179,10 +179,10 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
179
179
* @dev See {IERC721Metadata-tokenURI}.
180
180
*/
181
181
function tokenURI (uint256 tokenId ) public view virtual override returns (string memory ) {
182
- require (_exists (tokenId), " ERC721Metadata: URI query for nonexistent token " );
182
+ require (_exists (tokenId), ' ERC721Metadata: URI query for nonexistent token ' );
183
183
184
184
string memory baseURI = _baseURI ();
185
- return bytes (baseURI).length > 0 ? string (abi.encodePacked (baseURI, tokenId.toString ())) : "" ;
185
+ return bytes (baseURI).length > 0 ? string (abi.encodePacked (baseURI, tokenId.toString ())) : '' ;
186
186
}
187
187
188
188
/**
@@ -191,19 +191,19 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
191
191
* by default, can be overriden in child contracts.
192
192
*/
193
193
function _baseURI () internal view virtual returns (string memory ) {
194
- return "" ;
194
+ return '' ;
195
195
}
196
196
197
197
/**
198
198
* @dev See {IERC721-approve}.
199
199
*/
200
200
function approve (address to , uint256 tokenId ) public override {
201
201
address owner = ERC721A .ownerOf (tokenId);
202
- require (to != owner, " ERC721A: approval to current owner " );
202
+ require (to != owner, ' ERC721A: approval to current owner ' );
203
203
204
204
require (
205
205
_msgSender () == owner || isApprovedForAll (owner, _msgSender ()),
206
- " ERC721A: approve caller is not owner nor approved for all "
206
+ ' ERC721A: approve caller is not owner nor approved for all '
207
207
);
208
208
209
209
_approve (to, tokenId, owner);
@@ -213,7 +213,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
213
213
* @dev See {IERC721-getApproved}.
214
214
*/
215
215
function getApproved (uint256 tokenId ) public view override returns (address ) {
216
- require (_exists (tokenId), " ERC721A: approved query for nonexistent token " );
216
+ require (_exists (tokenId), ' ERC721A: approved query for nonexistent token ' );
217
217
218
218
return _tokenApprovals[tokenId];
219
219
}
@@ -222,7 +222,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
222
222
* @dev See {IERC721-setApprovalForAll}.
223
223
*/
224
224
function setApprovalForAll (address operator , bool approved ) public override {
225
- require (operator != _msgSender (), " ERC721A: approve to caller " );
225
+ require (operator != _msgSender (), ' ERC721A: approve to caller ' );
226
226
227
227
_operatorApprovals[_msgSender ()][operator] = approved;
228
228
emit ApprovalForAll (_msgSender (), operator, approved);
@@ -254,7 +254,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
254
254
address to ,
255
255
uint256 tokenId
256
256
) public override {
257
- safeTransferFrom (from, to, tokenId, "" );
257
+ safeTransferFrom (from, to, tokenId, '' );
258
258
}
259
259
260
260
/**
@@ -269,7 +269,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
269
269
_transfer (from, to, tokenId);
270
270
require (
271
271
_checkOnERC721Received (from, to, tokenId, _data),
272
- " ERC721A: transfer to non ERC721Receiver implementer "
272
+ ' ERC721A: transfer to non ERC721Receiver implementer '
273
273
);
274
274
}
275
275
@@ -285,7 +285,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
285
285
}
286
286
287
287
function _safeMint (address to , uint256 quantity ) internal {
288
- _safeMint (to, quantity, "" );
288
+ _safeMint (to, quantity, '' );
289
289
}
290
290
291
291
/**
@@ -304,10 +304,10 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
304
304
bytes memory _data
305
305
) internal {
306
306
uint256 startTokenId = currentIndex;
307
- require (to != address (0 ), " ERC721A: mint to the zero address " );
307
+ require (to != address (0 ), ' ERC721A: mint to the zero address ' );
308
308
// We know if the first token in the batch doesn't exist, the other ones don't as well, because of serial ordering.
309
- require (! _exists (startTokenId), " ERC721A: token already minted " );
310
- require (quantity <= maxBatchSize, " ERC721A: quantity to mint too high " );
309
+ require (! _exists (startTokenId), ' ERC721A: token already minted ' );
310
+ require (quantity <= maxBatchSize, ' ERC721A: quantity to mint too high ' );
311
311
312
312
_beforeTokenTransfers (address (0 ), to, startTokenId, quantity);
313
313
@@ -324,7 +324,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
324
324
emit Transfer (address (0 ), to, updatedIndex);
325
325
require (
326
326
_checkOnERC721Received (address (0 ), to, updatedIndex, _data),
327
- " ERC721A: transfer to non ERC721Receiver implementer "
327
+ ' ERC721A: transfer to non ERC721Receiver implementer '
328
328
);
329
329
updatedIndex++ ;
330
330
}
@@ -354,10 +354,10 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
354
354
getApproved (tokenId) == _msgSender () ||
355
355
isApprovedForAll (prevOwnership.addr, _msgSender ()));
356
356
357
- require (isApprovedOrOwner, " ERC721A: transfer caller is not owner nor approved " );
357
+ require (isApprovedOrOwner, ' ERC721A: transfer caller is not owner nor approved ' );
358
358
359
- require (prevOwnership.addr == from, " ERC721A: transfer from incorrect owner " );
360
- require (to != address (0 ), " ERC721A: transfer to the zero address " );
359
+ require (prevOwnership.addr == from, ' ERC721A: transfer from incorrect owner ' );
360
+ require (to != address (0 ), ' ERC721A: transfer to the zero address ' );
361
361
362
362
_beforeTokenTransfers (from, to, tokenId, 1 );
363
363
@@ -402,13 +402,13 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
402
402
*/
403
403
function _setOwnersExplicit (uint256 quantity ) internal {
404
404
uint256 oldNextOwnerToSet = nextOwnerToExplicitlySet;
405
- require (quantity > 0 , " quantity must be nonzero " );
405
+ require (quantity > 0 , ' quantity must be nonzero ' );
406
406
uint256 endIndex = oldNextOwnerToSet + quantity - 1 ;
407
407
if (endIndex > currentIndex - 1 ) {
408
408
endIndex = currentIndex - 1 ;
409
409
}
410
410
// We know if the last one in the group exists, all in the group exist, due to serial ordering.
411
- require (_exists (endIndex), " not enough minted yet for this cleanup " );
411
+ require (_exists (endIndex), ' not enough minted yet for this cleanup ' );
412
412
for (uint256 i = oldNextOwnerToSet; i <= endIndex; i++ ) {
413
413
if (_ownerships[i].addr == address (0 )) {
414
414
TokenOwnership memory ownership = ownershipOf (i);
@@ -439,7 +439,7 @@ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable
439
439
return retval == IERC721Receiver (to).onERC721Received.selector ;
440
440
} catch (bytes memory reason ) {
441
441
if (reason.length == 0 ) {
442
- revert (" ERC721A: transfer to non ERC721Receiver implementer " );
442
+ revert (' ERC721A: transfer to non ERC721Receiver implementer ' );
443
443
} else {
444
444
assembly {
445
445
revert (add (32 , reason), mload (reason))
0 commit comments