Changed ERC20 .sol files' syntax and formatting - #1
Open
Luiserebii wants to merge 2 commits into
Open
Conversation
…bility (lines are together, local scope vars with "_" prefix). Also, changed version from v0.4.24 to v0.4.25
… and ERC20Burnable. Updated version to ^0.4.25 in the rest
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello,
I felt that the expanded version that OpenZeppelin uses is difficult to read, so I changed it to a more legible version that is more "compact" and easier to trace from left-to-right. This has been done for ERC20.sol and IERC20.sol.
Aside from formatting, some variable name syntax has been changed; I personally feel that prefixing local/internal vars with underscores ("_") helps greatly with readability, since it becomes very clear which variable the permanent ones are. Perhaps the only inconsistency is with persistent private variables being denoted by "_", which now no longer have it, which could imply public variable depending on the way you see it. Perhaps adding a _ as a suffix for the parameters where they conflict with internal names...? (the doc "Style Guide" suggests the "_" suffix as a valid idea, see https://solidity.readthedocs.io/en/v0.4.25/style-guide.html under "Avoiding Naming Collisions").
Finally, TNetToken.sol has been created, extending from many of the ERC20 OpenZeppelin contracts such as ERC20, ERC20Detailed, ERC20Mintable, and ERC20Burnable. I realized that a neat solution to keep a pre-defined "constant" name, symbol, and decimal would be to override the constructor and just define it there. I think it fits in with multiple inheritance in Solidity...?
Please let me know what you guys think about this. Thanks!