Uniswap / v2-core

🦄 🦄 Core smart contracts of Uniswap V2
https://uniswap.org/docs
GNU General Public License v3.0
2.97k stars 3.18k forks source link

symbol is the same for all liquidity tokens #63

Closed wjmelements closed 4 years ago

wjmelements commented 4 years ago

You can use the underlying symbols and encodePacked to generate a new symbol.

wjmelements commented 4 years ago

Example

NoahZinsmeister commented 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.

wjmelements commented 4 years ago

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.

NoahZinsmeister commented 4 years ago

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.

wjmelements commented 4 years ago

It doesn't have to be the primary key for symbol collision to be a bad UX.

Etherscan:

Screen Shot 2020-04-15 at 4 00 52 PM

Metamask:

wjmelements commented 4 years ago

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.

MicahZoltu commented 4 years ago

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.