Skip to content

Commit 9ccf31a

Browse files
authored
precommit hook to validate + autogenerate index/index.json master index file (#93)
1 parent b3fd571 commit 9ccf31a

35 files changed

+79494
-22026
lines changed

.husky/pre-commit

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# 1. Run your pnpm script
2+
pnpm run reindex
3+
4+
# 2. If that script caused changes, fail the commit
5+
if ! git diff --quiet; then
6+
echo "ERROR: Regenerated file changed. Please run 'pnpm reindex', add 'index/index.json' and commit again."
7+
exit 1
8+
fi

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
11
Sequence Token Directory
22
========================
33

4-
Token directory that contains a list of almost all ERC-20, ERC-721 and ERC-1155 tokens.
4+
Token directory that contains a comprehensive list of ERC-20, ERC-721, ERC-1155 and other contracts.
5+
6+
**NOTES:**
7+
* The [./index/index.json](./index/index.json) is an auto-generated file that is a master index of all ./index/**/* contents
8+
including chain names, chain ids, file names, and sha256 hashes of the file contents. This file
9+
is perfect for using as the primary index of this repo, and when syncing contents you can traverse this
10+
index file and also compare the sha256 hash if the file has changed.
11+
* The [./index/deprecated.json](./index/deprecated.json) is a manually maintained file which lists all folders which are deprecated
12+
and as a result the files will be labelled as deprecated in the master index.json.
13+
* The [./index/external.json](./index/external.json) is a manually maintained file of external token list sources which are synced
14+
and downloaded to the [./index/_external](./index/_external) folder. We store the contents here to ensure data integrity,
15+
and we also compute and include these files in the master index.json.
16+
17+
**REMINDERS:**
18+
* `pnpm reindex` is automatically called as a pre-commit hook anytime an entry it changed. You may also
19+
call it manually if you like.
20+
* `pnpm sync-external` must be called manually periodically to ensure we have the latest contents, this
21+
script is not run automatically.
22+
23+
24+
## Setup
25+
26+
* `pnpm install` will setup your local tools
27+
* `pnpm reindex` to reindex the token directory master index.json, but see notes above, as this
28+
is also automatically called as a pre-commit hook.
29+
* `pnpm sync-external` to sync ./index/external.json files to local ./index/_external/ folder.
530

631
## Token List Formats
732

8-
The ERC-20 token lists present in this repository follow the [Uniswap Token List Schema](https://github.com/Uniswap/token-lists). The original list was populated using [Coingecko](https://www.coingecko.com/en)'s erc20 token list [CoinGecko@95.1.0](https://tokens.coingecko.com/uniswap/all.json). Token description and links are taken from Coingecko's API.
33+
The ERC-20 token lists present in this repository follow the [Uniswap Token List Schema](https://github.com/Uniswap/token-lists). The original list was populated using [Coingecko](https://www.coingecko.com/en)'s erc20 token list [CoinGecko](https://tokens.coingecko.com/uniswap/all.json). Token description and links are taken from Coingecko's API.
34+
35+
The ERC-721 and ERC-1155 token lists present in this repository follow the [Sequence Collectible List Schema](https://github.com/0xsequence/collectible-lists).
936

10-
The ERC-721 and ERC-1155 token lists present in this repository follow the [Sequence Collectible List Schema](https://github.com/0xsequence/collectible-lists). The original list was populated using [Dune Analytics](https://www.duneanalytics.com/) via the query [#16838](https://explore.duneanalytics.com/queries/16838). Token description and links were taken from [OpenSea](https://opensea.io/)'s API.
1137

12-
## How to Add or Update Your Token
38+
## How to Add or Update Your Token / Contract
1339

1440
If a token is missing entirely, or contains incorrect or missing information, please stick to the following procedure;
1541

16-
1. Fork the current Token Directory repository
17-
2. Add your token in the `tokens` array in the correct file in the [src/registry/](https://github.com/0xsequence/token-directory/tree/main/src/registry) folder
18-
e.g. Registring a new ERC-721 token on Polygon should be done by adding entry [here](https://github.com/0xsequence/token-directory/blob/master/index/polygon/erc721.json).
19-
3. [Open a PR](https://github.com/0xsequence/token-directory/compare) comparing the main branch with your fork
20-
4. In the PR, add an explanation if this PR is for an existing token that needs to be updated
42+
1. Fork this repository
43+
2. git clone, then: `pnpm install` to setup local tools
44+
3. Add your entry directly inside of `./index/<chain>/<standard>.json`
45+
4. [Open a PR](https://github.com/0xsequence/token-directory/compare) comparing the master branch with your fork
46+
5. In the PR, add an explanation if this PR is for an existing token that needs to be updated
2147

2248

2349
## Formats
50+
2451
Depending on the standard, your token entries should respect the following format:
2552

2653
### ERC20
2754

28-
See [here](https://github.com/0xsequence/token-directory/blob/main/index/mainnet/erc20.json) for examples.
55+
See [here](https://github.com/0xsequence/token-directory/blob/master/index/mainnet/erc20.json) for examples.
2956

3057
```typescript
3158
{
@@ -44,7 +71,7 @@ See [here](https://github.com/0xsequence/token-directory/blob/main/index/mainnet
4471
4572
### ERC721 and ERC1155
4673
47-
See [here](https://github.com/0xsequence/token-directory/blob/main/index/mainnet/erc721.json) for erc721 and [here](https://github.com/0xsequence/token-directory/blob/main/index/mainnet/erc1155.json) for erc1155 examples.
74+
See [here](https://github.com/0xsequence/token-directory/blob/master/index/mainnet/erc721.json) for erc721 and [here](https://github.com/0xsequence/token-directory/blob/master/index/mainnet/erc1155.json) for erc1155 examples.
4875
4976
```typescript
5077
{

0 commit comments

Comments
 (0)