Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xrn authored Nov 25, 2020
2 parents 2a8c338 + ef5260f commit 7b79665
Show file tree
Hide file tree
Showing 134 changed files with 7,254 additions and 533 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aliases:
npm install

defaults: &defaults
working_directory: ~/eth-contract-metadata
working_directory: ~/contract-metadata

version: 2
jobs:
Expand Down
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ISC License

Copyright (c) 2020 MetaMask

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Ethereum Contract Metadata [![CircleCI](https://circleci.com/gh/MetaMask/eth-contract-metadata.svg?style=svg)](https://circleci.com/gh/MetaMask/eth-contract-metadata)
# @metamask/contract-metadata

[![Greenkeeper badge](https://badges.greenkeeper.io/MetaMask/eth-contract-metadata.svg)](https://greenkeeper.io/)

A mapping of checksummed ethereum addresses to metadata, like names, and images of those addresses' logos.
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).

Submit PRs to add valid logos, and obviously valid logos will be merged.
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.

## Usage

You can install from npm with `npm install eth-contract-metadata` and use it in your code like this:
You can install from npm with `npm install @metamask/contract-metadata` and use it in your code like this:

```javascript
const contractMap = require('eth-contract-metadata')
const toChecksumAddress = require('ethereumjs-util').toChecksumAddress
import contractMap from '@metamask/contract-metadata'
import ethJSUtil from 'ethereumjs-util'
const { toChecksumAddress } = ethJSUtil

function imageElFor (address) {
const metadata = iconMap[toChecksumAddress(address)]
if (!('logo' in metadata)) {
return false
const metadata = contractMap[toChecksumAddress(address)]
if (metadata?.logo) {
const fileName = metadata.logo
const path = `${__dirname}/images/contract/${fileName}`
const img = document.createElement('img')
img.src = path
img.style.width = '100%'
return img
}
const fileName = metadata.logo
const path = `images/contract/${fileName}`
const img = document.createElement('img')
img.src = path
img.style.width = '100%'
return img
}

imageElFor ("0x06012c8cf97BEaD5deAe237070F9587f8E7A266d")
```
## Submission Process
Expand All @@ -39,13 +39,14 @@ Maintaining this list is a considerable chore, and it is not our highest priorit
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.
Criteria:
- The icon should be small, square, but high resolution, ideally a vector/svg.
- 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.
- 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.
- Nice to have a verified source code on a block explorer like Etherscan.
- Must have a ['NEUTRAL' reputation or 'OK' reputation](https://etherscancom.freshdesk.com/support/solutions/articles/35000022146-etherscan-token-reputation-system) on Etherscan.
- Must have a ['NEUTRAL' reputation or 'OK' reputation](https://info.etherscan.com/etherscan-token-reputation) on Etherscan.
A sample submission:
Expand All @@ -64,4 +65,3 @@ Tokens should include a field `"erc20": true`, and can include additional fields
- decimals (precision of the tokens stored)
A full list of permitted fields can be found in the [permitted-fields.json](./permitted-fields.json) file.

Loading

0 comments on commit 7b79665

Please sign in to comment.