Uniswap / token-lists

📚 The Token Lists specification
https://tokenlists.org
MIT License
1.37k stars 931 forks source link

Multi-chain token lists #130

Open carlfairclough opened 2 years ago

carlfairclough commented 2 years ago

Token lists are currently geared towards one-chain-per-token, and lead to workarounds such as Optimism's:

    {
      "chainId": 1,
      "address": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
      "name": "Synthetix",
      "symbol": "SNX",
      "decimals": 18,
      "logoURI": "https://ethereum-optimism.github.io/logos/SNX.svg",
      "extensions": {
        "optimismBridgeAddress": "0x39Ea01a0298C315d149a490E34B59Dbf2EC7e48F"
      }
    },
    {
      "chainId": 10,
      "address": "0x8700daec35af8ff88c16bdf0418774cb3d7599b4",
      "name": "Synthetix",
      "symbol": "SNX",
      "decimals": 18,
      "logoURI": "https://ethereum-optimism.github.io/logos/SNX.svg",
      "extensions": {
        "optimismBridgeAddress": "0x136b1EC699c62b0606854056f02dC7Bb80482d63"
      }
    },
    {
      "chainId": 42,
      "address": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
      "name": "Synthetix",
      "symbol": "SNX",
      "decimals": 18,
      "logoURI": "https://ethereum-optimism.github.io/logos/SNX.svg",
      "extensions": {
        "optimismBridgeAddress": "0xc00E7C2Bd7B0Fb95DbBF10d2d336399A939099ee"
      }
    },

Rather than doing this, I'd like to propose an update to the format along the following structure:

    {
     "deployments": [{
          "chainId": 1,
          "address": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
          "extensions": {},
        },{
          "chainId": 10,
          "address": "0x8700daec35af8ff88c16bdf0418774cb3d7599b4",
          "extensions": {},
        },{
          "chainId": 42,
          "address": "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
          "extensions": {},
        }
      ],
      "name": "Synthetix",
      "symbol": "SNX",
      "decimals": 18,
      "logoURI": "https://ethereum-optimism.github.io/logos/SNX.svg",
      "extensions": {},
    }

This avoids people leveraging the token list from having to match symbols/names against eachother, which is a fairly perilous process with the larger token lists. Any suggestions here would be greatly appreciated.

akarys92 commented 2 years ago

It's recommended to use the schema outlined here that utilizes the extensions field. You can use this package to automatically add the mappings to your existing token lists.