-
Notifications
You must be signed in to change notification settings - Fork 552
Opensea operator filterer + toggle #303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
emit OperatorRestriction(_restriction); | ||
} | ||
|
||
function _canSetOperatorRestriction() internal virtual returns (bool) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're not calling this anywhere
function _safeMint( | ||
address to, | ||
uint256 quantity, | ||
bytes memory _data | ||
) internal { | ||
uint256 startTokenId = _currentIndex; | ||
if (to == address(0)) revert MintToZeroAddress(); | ||
if (quantity == 0) revert MintZeroQuantity(); | ||
|
||
_beforeTokenTransfers(address(0), to, startTokenId, quantity); | ||
|
||
// Overflows are incredibly unrealistic. | ||
// balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1 | ||
// updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1 | ||
unchecked { | ||
_addressData[to].balance += uint64(quantity); | ||
_addressData[to].numberMinted += uint64(quantity); | ||
|
||
_ownerships[startTokenId].addr = to; | ||
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp); | ||
|
||
uint256 updatedIndex = startTokenId; | ||
uint256 end = updatedIndex + quantity; | ||
|
||
if (to.isContract()) { | ||
do { | ||
emit Transfer(address(0), to, updatedIndex); | ||
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) { | ||
revert TransferToNonERC721ReceiverImplementer(); | ||
} | ||
} while (updatedIndex < end); | ||
// Reentrancy protection | ||
if (_currentIndex != startTokenId) revert(); | ||
} else { | ||
do { | ||
emit Transfer(address(0), to, updatedIndex++); | ||
} while (updatedIndex < end); | ||
} | ||
_currentIndex = updatedIndex; | ||
} | ||
_afterTokenTransfers(address(0), to, startTokenId, quantity); | ||
} |
Check warning
Code scanning / Slither
Reentrancy vulnerabilities
function _checkContractOnERC721Received( | ||
address from, | ||
address to, | ||
uint256 tokenId, | ||
bytes memory _data | ||
) private returns (bool) { | ||
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns ( | ||
bytes4 retval | ||
) { | ||
return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; | ||
} catch (bytes memory reason) { | ||
if (reason.length == 0) { | ||
revert TransferToNonERC721ReceiverImplementer(); | ||
} else { | ||
assembly { | ||
revert(add(32, reason), mload(reason)) | ||
} | ||
} | ||
} | ||
} |
Check warning
Code scanning / Slither
Unused return
bytes memory _data | ||
) private returns (bool) { | ||
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns ( | ||
bytes4 retval |
Check notice
Code scanning / Slither
Pre-declaration usage of local variables
bytes4 retval | ||
) { | ||
return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; | ||
} catch (bytes memory reason) { |
Check notice
Code scanning / Slither
Pre-declaration usage of local variables
bytes4 retval | ||
) { | ||
return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; | ||
} catch (bytes memory reason) { |
Check notice
Code scanning / Slither
Pre-declaration usage of local variables
function _checkContractOnERC721Received( | ||
address from, | ||
address to, | ||
uint256 tokenId, | ||
bytes memory _data | ||
) private returns (bool) { | ||
try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns ( | ||
bytes4 retval | ||
) { | ||
return retval == IERC721ReceiverUpgradeable(to).onERC721Received.selector; | ||
} catch (bytes memory reason) { | ||
if (reason.length == 0) { | ||
revert TransferToNonERC721ReceiverImplementer(); | ||
} else { | ||
assembly { | ||
revert(add(32, reason), mload(reason)) | ||
} | ||
} | ||
} | ||
} |
Check warning
Code scanning / Slither
Assembly usage
* variables without shifting down storage in the inheritance chain. | ||
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps | ||
*/ | ||
uint256[42] private __gap; |
Check warning
Code scanning / Slither
Unused state variable
extension/DefaultOperatorFilterer
andextension/OperatorFilterer
to apply operator filter restrictions based on a toggle.extension/OperatorFilterToggle
which is the aforementioned toggle.TokenERC721
,TokenERC1155
,DropERC721
andDropERC1155
to support OpenSea operator filter with a toggle.