add ERC721 specific details in the 'How to upgrade from 4.x' section of the CHANGELOG

This commit is contained in:
Hadrien Croubois
2023-07-13 16:00:38 +02:00
parent 20048ca3b9
commit e996ba49d8
4 changed files with 22 additions and 8 deletions

View File

@ -146,8 +146,8 @@ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Er
if (to == address(0)) {
revert ERC721InvalidReceiver(address(0));
}
// Setting an "auth" arguments means that `_update` will check that the token exists (from != 0),
// no need to duplicate that check here.
// Setting an "auth" arguments enables the `_isApproved` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
address previousOwner = _update(to, tokenId, _msgSender());
if (previousOwner != from) {
revert ERC721IncorrectOwner(from, tokenId, previousOwner);
@ -394,7 +394,7 @@ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Er
*
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId, address auth) internal virtual {
function _approve(address to, uint256 tokenId, address auth) internal virtual returns (address) {
address owner = ownerOf(tokenId);
if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
@ -403,6 +403,8 @@ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Er
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
return owner;
}
/**

View File

@ -19,8 +19,8 @@ abstract contract ERC721Burnable is Context, ERC721 {
* - The caller must own `tokenId` or be an approved operator.
*/
function burn(uint256 tokenId) public virtual {
// Setting an "auth" arguments means that `_update` will check that the token exists (from != 0),
// no need to duplicate that check here.
// Setting an "auth" arguments enables the `_isApproved` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
_update(address(0), tokenId, _msgSender());
}
}

View File

@ -50,8 +50,8 @@ abstract contract ERC721Wrapper is ERC721, IERC721Receiver {
uint256 length = tokenIds.length;
for (uint256 i = 0; i < length; ++i) {
uint256 tokenId = tokenIds[i];
// Setting an "auth" arguments means that `_update` will check that the token exists (from != 0),
// no need to duplicate that check here.
// Setting an "auth" arguments enables the `_isApproved` check which verifies that the token exists
// (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
_update(address(0), tokenId, _msgSender());
// Checks were already performed at this point, and there's no way to retake ownership or approval from
// the wrapped tokenId after this point, so it's safe to remove the reentrancy check for the next line.