Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added owner to resolve error
Also fixed lint check error
  • Loading branch information
Saksham010 authored Apr 6, 2023
commit 2d88a2d4963e2dcf045d69f79797b334f309c64a
9 changes: 6 additions & 3 deletions contracts/token/ERC721/ERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
Expand Down Expand Up @@ -228,7 +229,8 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
* Requirements:
*
* - `tokenId` must not exist.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received},
* which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
Expand Down Expand Up @@ -363,9 +365,10 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
* Emits an {Approval} event.
*/
function _approve(address to, uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
_tokenApprovals[tokenId] = to;
emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
emit Approval(owner, to, tokenId);
}

/**
Expand Down