token-lists icon indicating copy to clipboard operation
token-lists copied to clipboard

Multi-chain token lists

Open carlfairclough opened this issue 2 years ago • 1 comments

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.

carlfairclough avatar May 20 '22 12:05 carlfairclough

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.

akarys92 avatar Jun 23 '22 22:06 akarys92