Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanolkies committed Apr 6, 2020
0 parents commit 50b9294
Show file tree
Hide file tree
Showing 13 changed files with 610 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
aliases:
- &install-node-dependencies
|
npm install

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

version: 2
jobs:
prep-deps:
<<: *defaults
docker:
- image: circleci/node:9
steps:
- checkout
- run: *install-node-dependencies
- persist_to_workspace:
root: .
paths:
- node_modules

test-unit:
<<: *defaults
docker:
- image: circleci/node:9
steps:
- checkout
- attach_workspace:
at: .
- run: npm test

workflows:
version: 2
ful_test:
jobs:
- prep-deps
- test-unit:
requires:
- prep-deps
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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.

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 RSK explorer.

Tokens should include a field `"erc20": true`, and can include additional fields:

- symbol (a five-character or less ticker symbol)
- decimals (precision of the tokens stored)

A sample submission:

```json
"0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5": {
"name": "RIF",
"logo": "rif.png",
"erc20": true,
"symbol": "RIF",
"decimals": 18
}
```
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# RSK Contract Metadata

[![CircleCI](https://circleci.com/gh/rsksmart/rsk-contract-metadata.svg?style=svg)](https://circleci.com/gh/rsksmart/rsk-contract-metadata)

A mapping of checksummed addresses to metadata, like names, and images of those addresses' logos.

All address keys follow the [EIP 1191 address checksum format](https://github.com/ethereum/EIPs/issues/1191).

Submit PRs to add valid logos, and obviously valid logos will be merged.

## Usage

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

```javascript
const contractMap = require('@rsksmart/rsk-contract-metadata')
const toChecksumAddress = require('rskjs-util').toChecksumAddress

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

## Submission Process

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.

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 RSK explorer.

Tokens should include a field `"erc20": true`, and can include additional fields:

- symbol (a five-character or less ticker symbol)
- decimals (precision of the tokens stored)

A sample submission:

```json
"0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5": {
"name": "RIF",
"logo": "rif.png",
"erc20": true,
"symbol": "RIF",
"decimals": 18
}
```

A full list of permitted fields can be found in the [permitted-fields.json](./permitted-fields.json) file.

## Disclaimer

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.
23 changes: 23 additions & 0 deletions contract-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5": {
"name": "RIF",
"logo": "rif.png",
"erc20": true,
"symbol": "RIF",
"decimals": 18
},
"0xE700691Da7B9851F2F35f8b8182C69C53ccad9DB": {
"name": "Dollar on Chain",
"logo": "doc.png",
"erc20": true,
"symbol": "DOC",
"decimals": 18
},
"0x440cd83C160de5C96DDb20246815EA44C7Abbca8": {
"name": "BitPRO",
"logo": "bpro.png",
"erc20": true,
"symbol": "BITP",
"decimals": 18
}
}
Binary file added images/bpro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/doc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./contract-map.json')
Loading

0 comments on commit 50b9294

Please sign in to comment.