From 6f4b539d993ee3de94fede4b16e727d542d0f72a Mon Sep 17 00:00:00 2001 From: Michael Hahn Date: Thu, 6 Feb 2025 12:29:56 -0800 Subject: [PATCH 1/2] chore: updated docs --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6dbb93b42b..6ed3155fc7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ A mapping of checksummed Ethereum contract addresses to metadata, like names, and images of their logos. All address keys follow the [EIP 55 address checksum format](https://github.com/ethereum/EIPs/issues/55). +All file keys follow the [CAIP 19 asset id format](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-19.md). This repository is effectively frozen. We recommend that developers of new tokens use [EIP 747](https://docs.metamask.io/guide/registering-your-token.html) to ask the user's permission to display your tokens in their wallet. This reduces the dangers of airdrop-based phishing, and reduces administrative overhead from managing this list. @@ -35,14 +36,13 @@ imageElFor ("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") Maintaining this list is a considerable chore, and it is not our highest priority. We do not guarantee inclusion in this list on any urgent timeline. We are actively looking for fair and safe ways to maintain a list like this in a decentralized way, because maintaining it is a large and security-delicate task. 1. Fork this repository. -2. Add your logo image in a web-safe format to the `images` folder. -3. Add an entry to the `contract-map.json` file with the specified address as the key, and the image file's name as the value. +2. Add your logo image in `.svg` file format to the `icons` folder. +3. Add your asset metadata in a json format to a `metadata/${caip19AssetId}.json` file with the CAIP-19 Asset ID as the key inside of the `metadata/` folder. Criteria: -- The icon should be small, square, but high resolution, ideally a vector/svg. -- The address should be in checksum format or it will not be accepted. -- Do not add your entry to the end of the JSON map, messing with the trailing comma. Your pull request should only be an addition of lines, and any line removals should be deliberate deprecations of those logos. +- The icon should be small, square, but high resolution, and a vector/svg. +- The address should be in checksum format or it will not be accepted. This is true of non-evm assets as well - since some network's addressing formats are case-sensitive. - PR should include link to official project website referencing the suggested address. - Project website should include explanation of project. - Project should have clear signs of activity, either traffic on the network, activity on GitHub, or community buzz. From 42ff798b37cdc0780c11498979e6500a871d37f0 Mon Sep 17 00:00:00 2001 From: Michael Hahn Date: Thu, 6 Feb 2025 13:00:50 -0800 Subject: [PATCH 2/2] chore: updated documentation further --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6ed3155fc7..22614940b8 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,21 @@ import contractMap from '@metamask/contract-metadata' import ethJSUtil from 'ethereumjs-util' const { toChecksumAddress } = ethJSUtil -function imageElFor (address) { - const metadata = contractMap[toChecksumAddress(address)] +function imageElForEVMToken (chainId, address) { + const caip19Address = `eip155:${chainId}/erc20:${toChecksumAddress(address)}` + const metadata = contractMap[caip19Address] if (metadata?.logo) { const fileName = metadata.logo - const path = `${__dirname}/images/contract/${fileName}` + const path = `${__dirname}/${metadata.logo}` const img = document.createElement('img') img.src = path img.style.width = '100%' return img } } - -imageElFor ("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") +// to get ethereum erc20 token img el +const ethereumNetworkChainId = 1 +imageElForEVMToken (ethereumNetworkChainId, "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") ``` ## Submission Process @@ -36,7 +38,7 @@ imageElFor ("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") Maintaining this list is a considerable chore, and it is not our highest priority. We do not guarantee inclusion in this list on any urgent timeline. We are actively looking for fair and safe ways to maintain a list like this in a decentralized way, because maintaining it is a large and security-delicate task. 1. Fork this repository. -2. Add your logo image in `.svg` file format to the `icons` folder. +2. Add your logo image in `.svg` file format to the `icons/` folder. 3. Add your asset metadata in a json format to a `metadata/${caip19AssetId}.json` file with the CAIP-19 Asset ID as the key inside of the `metadata/` folder. Criteria: @@ -47,15 +49,18 @@ Criteria: - Project website should include explanation of project. - Project should have clear signs of activity, either traffic on the network, activity on GitHub, or community buzz. - Nice to have a verified source code on a block explorer like Etherscan. -- Must have a ['NEUTRAL' reputation or 'OK' reputation](https://info.etherscan.com/etherscan-token-reputation) on Etherscan. +- Must have a ['NEUTRAL' reputation or 'OK' reputation](https://info.etherscan.com/etherscan-token-reputation) on Etherscan if it is an Ethereum-network asset. Other EVM Networks will be verified as possible. A sample submission: ```json { - "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef": { + "eip:155/erc20:0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef": { "name": "ENS Registrar", - "logo": "ens.svg" + "decimals": 18, + "symbol": "ENS", + "erc20": true, + "logo": "./icons/eip:155/erc20:0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef.svg" } } ```