Closed wjmelements closed 4 years ago
because symbol
is optional in ERC-20, we cannot rely on it to exist for all tokens. additionally, many existing symbol
implementations return a bytes32
value, not a string
. we deemed that handling these cases in a consistent way was not worth the added complexity.
Handling both of those types and having a sane default in the other cases would be a significant improvement for token trackers and wallet interfaces that otherwise have to treat your tokens differently than every other kind of token.
imo a far more valuable piece of knowledge about v2 pool tokens is how to value them, and to do that token trackers and wallet interfaces need to have specific knowledge of what the shares represent. once this is accomplished, handling the symbol should be fairly trivial.
anyway, using symbol as the unique identifier of an ERC20 is silly, the address is what matters.
It doesn't have to be the primary key for symbol collision to be a bad UX.
Etherscan:
Metamask:
The default is for wallets not to write special code for you. They have their own priorities. Even without price support, it would be nice for me to know which token I am sending.
I think there is value in a wallet being able to display a useful and-user token name/symbol without displaying the tokens value. Often when troubleshooting end-user issues I'll get a link to a token on Etherscan or Etherchain or whatever and it would be helpful to be able to quickly see what token pair they are working with without me having to root around to figure that out.
Similarly, a user just being able to see the pairs they are exposed to in their wallet is valuable, even if they don't have valuations.
While I do acknowledge that Uniswap is in a position where they might be able to get away with "every wallet will just write special code for Uniswap", I don't think that is the right thing to do when you could do better in the vast majority of situations.
You can use the underlying symbols and encodePacked to generate a new symbol.