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

Adds indexing event for saving transferFrom and burnFrom transactions. #1264

Closed
wants to merge 2 commits into from

Conversation

ardagokcek
Copy link

@ardagokcek ardagokcek commented Sep 2, 2018

Fixes #707

🚀 Description

I have added a new indexing Event to save the transfers from another wallet. I know it is not a game changer.

  • 📘 I've reviewed the OpenZeppelin Contributor Guidelines
  • ✅ I've added tests where applicable to test my new functionality.
  • 📖 I've made sure that my contracts are well-documented.
  • 🎨 I've run the JS/Solidity linters and fixed any issues (npm run lint:all:fix).

_burnFrom and _transferFrom functions has been changed to TransferFrom event.
@nventuro nventuro requested a review from frangio September 3, 2018 14:09
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ardagokcek! Thanks for this suggestion. I know that the lack of spender information in ERC20 events is a problem.

Are you aware of any precedent for this event? I don't want to lightly add an extension of the standard to our base ERC20 implementation.

@@ -104,7 +104,7 @@ contract ERC20 is IERC20 {
balances_[_from] = balances_[_from].sub(_value);
balances_[_to] = balances_[_to].add(_value);
allowed_[_from][msg.sender] = allowed_[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't remove the Transfer event from here because it's required by ERC20. If anything we have to add a new event.

@@ -32,4 +32,9 @@ interface IERC20 {
address indexed spender,
uint256 value
);
event TransferFrom(
address indexed executor,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual term for this account is "spender".

@frangio frangio added kind:improvement contracts Smart contract code. labels Sep 3, 2018
@ardagokcek
Copy link
Author

ardagokcek commented Sep 3, 2018

Hello @frangio, I really don't think this must %100 be in the ERC20 but I saw a comment in ERC20.sol _burnFrom function and said "It is simple why not just do it." and thank you for the comments about Transfer event, appreciated. This is kind of improvement which only covers token holders who want to check their data with other spenders like exchanges. But as I said it is not an essential improvement that must be in contracts.

@nventuro
Copy link
Contributor

Hi @ardagokcek, thanks for contributing to OpenZeppelin!

After considering this for a while, I think the approach suggested in #707 better suits our current needs, since we're not introducing any new non-standard events. I will keep this in mind though when considering how to differentiate transfer and transferFrom calls.

Thanks again!

@nventuro nventuro closed this Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contracts Smart contract code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit updated Approval in transferFrom
3 participants