Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sam bacha committed Jan 12, 2021
0 parents commit 6cb6228
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/add-token-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Add token request
about: Add a token to the tokenlist
title: 'Request: add {Token name}'
labels: add-request

---

- [ ] I understand that this is not the place to request a Uniswap token listing.
- [ ] I understand that filing an issue does not guarantee addition to the tokenlist.
- [ ] I will not ping the Discord or Telegram about this request.
- [ ] I have attached a logo_32x32.png or provided the link to the asset.

**Please provide the following information for your token.**

Token Address: {0x...}
Token Symbol:
Token Name:
Decimals:
Logo: {attached or url}
Link to the official homepage:
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/remove-token-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Remove token request
about: Remove a token from the tokenlist.
title: 'Request: remove {Token name}'
labels: remove-request

---

- [ ] I understand that filing an issue does not guarantee removal from the tokenlist.
- [ ] I will not ping the Discord or Telegram about this request.

**Please provide the following information for your token.**

Token Address: {0x...}
Token Symbol:
Token Name:
Reason for removal:
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/update-token-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Update token request
about: Update an existing token in the tokenlist.
title: 'Request: update {Token name}'
labels: update-request

---

- [ ] I understand that this is not the place to request a Uniswap token listing.
- [ ] I understand that filing an issue does not guarantee an update to the tokenlist.
- [ ] I will not ping the Discord or Telegram about this request.
- [ ] If a change is made to the image, I have attached a logo_32x32.png or provided the link to the asset.

**Please provide the following information for your token.**

Token Address: {0x...}
Token Symbol:
Token Name:
Decimals:
Logo: {attached or url}
Link to the official homepage:
10 changes: 10 additions & 0 deletions .github/workflows/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Schema
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Run Schema Validation
- run: npm install
- run: npm start
106 changes: 106 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package-lock.json

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# tokenlist template

[![Schema](https://github.com/nathanjessen/tokenlist-template/workflows/Schema/badge.svg)](https://github.com/nathanjessen/tokenlist-template/actions?query=workflow%3ASchema)

**Update this badge with your own repository address when you clone/fork the repository.**

Template for creating a tokenlist and validating against Uniswap token schema.

## Resources

* [Ethereum token lists](https://tokenlists.org/)
* [https://github.com/Uniswap/token-lists](https://github.com/Uniswap/token-lists)
* [Semantic versioning](https://github.com/Uniswap/token-lists/blob/master/README.md#semantic-versioning)

## Validation

Validation must pass for the tokenlist to work on Uniswap.

### Local Testing

The `tokens.json` is validated against Uniswap's tokenlist schema.

To test locally,

```
# Install dependencies
npm install
# Run test script
npm start
```

If there is an error, the error will be output to the terminal.

### GitHub Workflow & Issue Templates

A GitHub workflow is included that automatically tests for validation any time there is a push or pull request.
GitHub Issue Templates have been included to help manage new and existing tokens.

## Branch Protection Rules

A best practice would be to create a new branch for any change and create a pull request to master. I recommend branch protection rules to prevent invalid changes from being merged into the repository.

Settings -> Branches

Branch protection rules -> Add rule

Branch name pattern: `master` or `main`

Check the boxes for

* Require status checks to pass before merging
* Require branches to be up to date before merging
* build (may not be available until you save the page once)
* Include administrators

Save changes

## Deploying your list

You can paste the link to your raw json file in Uniswap.

More information can be found at [https://github.com/Uniswap/token-lists#deploying-your-list](https://github.com/Uniswap/token-lists#deploying-your-list)

After you've used the tokenlist on Uniswap, Uniswap will discover any change you make to the tokenlist as long as you follow the Semantic versioning instructions.
Binary file added img/ethereum_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import defaultExport from '@uniswap/token-lists';
import Ajv from 'ajv';
import * as data from './tokens.json';

var ajv = new Ajv();
var valid = ajv.addSchema(defaultExport.schema, 'mySchema')
.validate('mySchema', data.default);
if (!valid) {
throw new Error(ajv.errorsText());
}
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "tokenlist-template",
"version": "1.0.0",
"description": "Template for creating a tokenlist with schema validation",
"main": "index.mjs",
"dependencies": {},
"devDependencies": {
"@uniswap/token-lists": "^1.0.0-beta.16",
"ajv": "^6.12.4"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node --experimental-modules --experimental-json-modules ./index.mjs"
},
"keywords": [
"tokens",
"tokenlist",
"uniswap",
"schema",
"ethereum"
]
}

49 changes: 49 additions & 0 deletions tokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "My Token List",
"logoURI": "ipfs://QmUSNbwUxUYNMvMksKypkgWs8unSm8dX2GjCPBVGZ7GGMr",
"keywords": [
"audited",
"verified",
"special tokens"
],
"tags": {
"stablecoin": {
"name": "Stablecoin",
"description": "Tokens that are fixed to an external asset, e.g. the US dollar"
},
"compound": {
"name": "Compound Finance",
"description": "Tokens that earn interest on compound.finance"
}
},
"timestamp": "2020-06-12T00:00:00+00:00",
"tokens": [
{
"chainId": 1,
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"logoURI": "ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM",
"tags": [
"stablecoin"
]
},
{
"chainId": 1,
"address": "0x39AA39c021dfbaE8faC545936693aC917d5E7563",
"symbol": "cUSDC",
"name": "Compound USD Coin",
"decimals": 8,
"logoURI": "ipfs://QmUSNbwUxUYNMvMksKypkgWs8unSm8dX2GjCPBVGZ7GGMr",
"tags": [
"compound"
]
}
],
"version": {
"major": 1,
"minor": 0,
"patch": 0
}
}

0 comments on commit 6cb6228

Please sign in to comment.