Skip to content
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

Implicitly clear ERC721 approval on transfers #3481

Merged
merged 4 commits into from Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/token/ERC721/ERC721.sol
Expand Up @@ -338,7 +338,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
_beforeTokenTransfer(from, to, tokenId);

// Clear approvals from the previous owner
_approve(address(0), tokenId);
delete _tokenApprovals[tokenId];

_balances[from] -= 1;
_balances[to] += 1;
Expand Down
4 changes: 0 additions & 4 deletions test/token/ERC721/ERC721.behavior.js
Expand Up @@ -96,10 +96,6 @@ function shouldBehaveLikeERC721 (errorPrefix, owner, newOwner, approved, another
expect(await this.token.getApproved(tokenId)).to.be.equal(ZERO_ADDRESS);
});

it('emits an Approval event', async function () {
expectEvent(receipt, 'Approval', { owner, approved: ZERO_ADDRESS, tokenId: tokenId });
});

it('adjusts owners balances', async function () {
expect(await this.token.balanceOf(owner)).to.be.bignumber.equal('1');
});
Expand Down