-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4c35ee5
Prevent Transferring to 0x0 and Contract Address
d3c1f75
Update EIP20.sol
9a47117
SafeEIP20 and its Test Cases
Muhammad-Altabba b33e6e1
Added a deleted line by mistake
Muhammad-Altabba 769e411
Modify SafeEIP20 to Follow Solidity Style Guide
Muhammad-Altabba 9ebea96
Encapsulated EIP compatible tests and apply them for EIP20 and SafeEIP20
Muhammad-Altabba fffe41a
Bumped pragmas & added emit
simondlr f3a8329
Fix linter errors
skmgoldin 6d8a82d
Dependency updates for security
maurelian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
/* | |||
Implements EIP20 token that 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/ | |||
.*/ | |||
|
|||
|
|||
pragma solidity ^0.4.18; | |||
|
|||
import "./EIP20.sol"; | |||
|
|||
|
|||
contract SafeEIP20 is EIP20 { | |||
|
|||
modifier validDestination(address _to) { | |||
require(_to != address(0x0)); // If the user did not enter a value for _to, it will equal to "zero" | |||
require(_to != address(this)); // address(this) is the Contract Address | |||
_; | |||
} | |||
|
|||
function SafeEIP20( | |||
uint256 _initialAmount, | |||
string _tokenName, | |||
uint8 _decimalUnits, | |||
string _tokenSymbol | |||
) | |||
public | |||
EIP20(_initialAmount, _tokenName, _decimalUnits, _tokenSymbol) | |||
{ | |||
} | |||
|
|||
function transfer(address _to, uint256 _value) public validDestination(_to) returns (bool success) { | |||
return super.transfer(_to, _value); | |||
} | |||
|
|||
function transferFrom(address _from, address _to, uint256 _value) public validDestination(_to) returns (bool success) { | |||
return super.transferFrom(_from, _to, _value); | |||
} | |||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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,