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

clearApproval should not fire event #100

Closed
mg6maciej opened this issue Jun 22, 2018 · 7 comments
Closed

clearApproval should not fire event #100

mg6maciej opened this issue Jun 22, 2018 · 7 comments
Assignees

Comments

@mg6maciej
Copy link
Contributor

Because this function is called only from _burn and _transfer in which cases also Transfer is emitted, clearApproval should only set state to 0 (might be more gas efficient to do it conditionally).

According to spec (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md)

    ///  When a Transfer event emits, this also indicates that the approved
    ///  address for that NFT (if any) is reset to none.
    event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId);

OZ also does it incorrectly, but "slightly" better.
https://github.com/OpenZeppelin/openzeppelin-solidity/blob/07020e954475a4fdd36e0252e88717b60f790b71/contracts/token/ERC721/ERC721BasicToken.sol#L300-L303

@lknix
Copy link
Contributor

lknix commented Jun 22, 2018

Hm, yes, I think this is a valid reasoning based on the EIP comment. @fulldecent can you comment on it?

@MoMannn MoMannn self-assigned this Jun 22, 2018
@MoMannn
Copy link
Collaborator

MoMannn commented Jun 22, 2018

You are correct.

Here is a similar discussion for reference:
ethereum/EIPs#841 (review)

@xpepermint
Copy link
Member

Alright, to the PR ...

@fulldecent
Copy link
Collaborator

I can’t see the context here. Is there a PR?

@xpepermint
Copy link
Member

@fulldecent the PR for this is in progress and will be ready by tomorrow. I will ask you to check that just to be sure it's aligned with the standard.

@fulldecent
Copy link
Collaborator

Yes, got it! clearApproval should not emit. We are currently emitting a superfluous event.

@MoMannn
Copy link
Collaborator

MoMannn commented Jun 23, 2018

#101

@MoMannn MoMannn closed this as completed Jun 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants