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

Updates: 0 address transfer prevention and emit keyword #135

Closed
wants to merge 9 commits into from

Conversation

maurelian
Copy link
Contributor

No description provided.

Muhammad Altabba and others added 8 commits May 31, 2018 19:38
Add code to prevent transferring to the 0x0 address, and the contract address, according to Token Implementation Best Practices.
Reference: https://consensys.github.io/smart-contract-best-practices/tokens/
Added short comments
Added SafeEIP20 that inherits from EIP20 and prevent transferring tokens to 0x0 and contract address.
EIP20Factory is changed to use SafeEIP20.
Reverted EIP20 to its state before the pull request created.
JavaScript Truffle Tests are writen for SafeEIP20.
Encapsulated EIP compatible functions' tests inside a function and make it called for both EIP20 and SafeEIP20 smart contracts.
@@ -37,7 +37,7 @@ contract EIP20Factory {
public
returns (address) {

EIP20 newToken = (new EIP20(_initialAmount, _name, _decimals, _symbol));
SafeEIP20 newToken = (new SafeEIP20(_initialAmount, _name, _decimals, _symbol));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to undo this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skmgoldin I had the impression that we were going to revert the factory back to EIP20.

Copy link

@Muhammad-Altabba Muhammad-Altabba Oct 23, 2018

Choose a reason for hiding this comment

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

Since we all agree that: it is part of the best practices to prevent transferring to 0x0 and the contract-address, why not apply this best practice every where? In other words, what is the harm of using the SafeEIP20 in the factory?
(The link to the best-practices I am referring: https://github.com/ConsenSys/smart-contract-best-practices/blob/master/docs/tokens.md).
Thanks,

Copy link
Contributor Author

@maurelian maurelian left a comment

Choose a reason for hiding this comment

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

My only comments pertain to:

  1. which contract to deploy from the factory
  2. whitespace style of long transferFrom calls

Highly recommend viewing with the Diff setting to ignore whitespace changes.

https://github.com/ConsenSys/Tokens/pull/135/files?utf8=%E2%9C%93&diff=split&w=1

const allowance = await HST.allowance.call(accounts[0], accounts[1]);
assert.strictEqual(allowance.toNumber(), 100);

await assertRevert(HST.transferFrom.call(accounts[0], ZERO_ADDRESS, 10, { from: accounts[1] }));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I quite like the multiline approach taken on transferFrom tests in the above file, any objection to me adding a commit on top for that?

@maurelian maurelian mentioned this pull request Jun 1, 2018
@maurelian maurelian closed this Jan 28, 2021
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

Successfully merging this pull request may close these issues.

4 participants