Skip to content

Changed ERC20 .sol files' syntax and formatting - #1

Open
Luiserebii wants to merge 2 commits into
masterfrom
erc20-syntax
Open

Changed ERC20 .sol files' syntax and formatting#1
Luiserebii wants to merge 2 commits into
masterfrom
erc20-syntax

Conversation

@Luiserebii

Copy link
Copy Markdown
Member

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").

Avoiding Naming Collisions

- single_trailing_underscore_

This convention is suggested when the desired name collides with that of a built-in or otherwise reserved name.

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!

…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
@Luiserebii Luiserebii added enhancement New feature or request question Further information is requested labels Oct 23, 2018
@Luiserebii Luiserebii self-assigned this Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant