From 6cb6228079b5783867d83c2a667208016f8801ae Mon Sep 17 00:00:00 2001 From: sam bacha Date: Tue, 12 Jan 2021 04:54:07 -0800 Subject: [PATCH] Initial commit --- .github/ISSUE_TEMPLATE/add-token-request.md | 21 ++++ .../ISSUE_TEMPLATE/remove-token-request.md | 17 +++ .../ISSUE_TEMPLATE/update-token-request.md | 21 ++++ .github/workflows/schema.yml | 10 ++ .gitignore | 106 ++++++++++++++++++ README.md | 65 +++++++++++ img/ethereum_logo.png | Bin 0 -> 509 bytes index.mjs | 10 ++ package.json | 23 ++++ tokens.json | 49 ++++++++ 10 files changed, 322 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/add-token-request.md create mode 100644 .github/ISSUE_TEMPLATE/remove-token-request.md create mode 100644 .github/ISSUE_TEMPLATE/update-token-request.md create mode 100644 .github/workflows/schema.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 img/ethereum_logo.png create mode 100644 index.mjs create mode 100644 package.json create mode 100644 tokens.json diff --git a/.github/ISSUE_TEMPLATE/add-token-request.md b/.github/ISSUE_TEMPLATE/add-token-request.md new file mode 100644 index 0000000..7e1ac42 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/add-token-request.md @@ -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: diff --git a/.github/ISSUE_TEMPLATE/remove-token-request.md b/.github/ISSUE_TEMPLATE/remove-token-request.md new file mode 100644 index 0000000..0a816e5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/remove-token-request.md @@ -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: diff --git a/.github/ISSUE_TEMPLATE/update-token-request.md b/.github/ISSUE_TEMPLATE/update-token-request.md new file mode 100644 index 0000000..9fd5c7a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/update-token-request.md @@ -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: diff --git a/.github/workflows/schema.yml b/.github/workflows/schema.yml new file mode 100644 index 0000000..e8f030e --- /dev/null +++ b/.github/workflows/schema.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3032a8 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..a6660b6 --- /dev/null +++ b/README.md @@ -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. diff --git a/img/ethereum_logo.png b/img/ethereum_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d518f6aaa47acdf5d1aae744792c2eded02fce72 GIT binary patch literal 509 zcmVP)t-sM{rET zPP4mvv%q1qzh|?(bF;aLv%Pb(!c?=qYqPy`v$&44z+kh&QM1EKv%^obxR0~AlC!#m zv%PV%zHGC?Q?t8!v$vbG#6Yt&4v#AU000?uQchCe5>$-y=3=2@?q9BT}z5kP*7TuZK_)$y9mxKy%Er)61 z^0Vmih`%VdQnqip!@SM&roZu6;xtqFCT|m_S?UKp6en;j^g-V>1cu(Owg$&oCbx;lf3aJBH<}jlh>5$o6hY_GY+_tf3ZLt37Jq{*aMv zGj!eO2x}3osUB)5G;1Ts=HnuB@vPYcv^kH#L$makXSJQC4l-%2v-R-n3>sSR=2ewd`0W zEkncSF)9Z-2*DU4mAO&zoZuK5yEV=LaB;8ykQYQr5|PsV-}4l%fFI8!D2K#s74Brl zvcPAy`%->guWWZZsgxA`K3V^K`rmiYDQ^;gpC=9+Yx6~J00000NkvXXu0mjf1-9}q literal 0 HcmV?d00001 diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..e3e13df --- /dev/null +++ b/index.mjs @@ -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()); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..34b5314 --- /dev/null +++ b/package.json @@ -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" + ] + } + \ No newline at end of file diff --git a/tokens.json b/tokens.json new file mode 100644 index 0000000..87acefe --- /dev/null +++ b/tokens.json @@ -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 + } +} \ No newline at end of file