-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Change name and symbol functions to view for Metadata extension #1072
Conversation
The mutability of the `name()` and `symbol()` functions in the metadata extension should be `view` not `pure`. Having it set to `pure` assumes that the token name and symbol will be hard-coded into the contract functions, rather than set (for example, in the constructor). The mutability guarantee rules allow you to go stricter, (ie move from `view` to `pure`), but not the other way, so dropping it down to `view` wouldn't take anything away but would allow for these variables to be set and stored elsewhere in the contract.
Hi! I'm a bot, and I wanted to automerge your PR, but couldn't because of the following issue(s):
|
Dropping to view DOES take something away. It removes the interface consumers' confidence that the name and symbol will not change in the future. Presently it is possible to cache this value. With the proposed change it would not be possible to cache. From the hip I am favorable to this change because most implementations I have seen are ignoring the standard and are implementing the way you describe above. To fully supporting this change, I'd like to see facts:
|
Also conceding that in EVM, purecall is not actually enforced. Discussion at #195 |
I have advertised this PR at: |
Contract deployment would be much easier and more flexible with |
I have reviewed existing mainnet implementations that I could find. Several have violated the But I know we must make a decision before Thursday May 17, 2018.
|
An argument against changing from With this in mind, the need to specify |
Further I have reviewed all the prior art tokens standards which are cited from the ERC-721 paper: ERC-223, ERC-677, ERC-827. None of these use pure. They all use |
DECISION: I approve this change. RATIONALE: Perhaps the ideal solution is to wait for Solidity to support Swift-style immutable declarations like: pragma solidity ^0.4.22;
contract BagOfCoins {
int constant public a;
constructor() {
a = 6; // If this line is missing then ERROR: constant a is not initialized
}
} However, idealism is not in scope for this standards specification, and no such change is being considered in Solidity. Practically, the benefits for contract authors to use storage for implementing the contract name and symbol has many benefits. And practically, the EVM does not yet support I have reviewed the entire standard text to ensure the rationale is consistent after the change. And also I have reviewed all other cited token standards and every deployed 721 contract on mainnet to support this decision, as referenced above. This change is entirely additive for contractor authors and does not break any known implementation on the blockchain. |
@AnAllergyToAnalogy Please click the repull button above. So we can merge this. Thank you for your review and your help! |
@fulldecent No worries, glad to be able to contribute to ERC721, I think it's an important standard. Thanks for accepting my pull request. |
@AnAllergyToAnalogy Your name is epically difficult to DDGTFW. What is your Twitter please? |
@cashtagyolo |
The mutability of the
name()
andsymbol()
functions in the metadata extension should beview
notpure
. Having it set topure
assumes that the token name and symbol will be hard-coded into the contract functions, rather than set (for example, in the constructor).The mutability guarantee rules allow you to go stricter, (ie move from
view
topure
), but not the other way, so dropping it down toview
wouldn't take anything away but would allow for these variables to be set and stored elsewhere in the contract.When opening a pull request to submit a new EIP, please use the suggested template: https://github.com/ethereum/EIPs/blob/master/eip-X.md
We have a GitHub bot that automatically merges some PRs. It will merge yours immediately if certain criteria are met: