Skip to content

Commit

Permalink
Merge pull request #658 from maticnetwork/clean-lists
Browse files Browse the repository at this point in the history
Clean lists
  • Loading branch information
py-zoid authored Sep 25, 2024
2 parents 965931b + a17bcbb commit 4e5d5d5
Show file tree
Hide file tree
Showing 36 changed files with 5,912 additions and 141,573 deletions.
73 changes: 22 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,49 @@ This repo contains lists of tokens mapped to the Polygon chains that may be used

The JSON schema for the tokens includes: chainId, name, address, decimals, symbol, logoURI (optional), tags (optional), and custom extensions metadata.

1. [Mapped Tokens List](https://api-polygon-tokens.polygon.technology/tokenlists/polygon.tokenlist.json) Contains tokens that are mapped to Polygon PoS and Polygon zkEVM. Anyone can propose updates to this list.
1. [Mapped Tokens](https://api-polygon-tokens.polygon.technology/tokenlists/mapped.tokenlist.json) Contains tokens that are mapped to Polygon bridges. Anyone can propose updates to this list.

2. [Popular Tokens List](https://api-polygon-tokens.polygon.technology/tokenlists/polygonPopular.tokenlist.json) Contains the top 100 most used tokens on the Polygon chains.
2. [Popular Tokens](https://api-polygon-tokens.polygon.technology/tokenlists/popular.tokenlist.json) Contains the top 100 most used tokens on the mainnet chains.

3. [Testnet Tokens List](https://api-polygon-tokens.polygon.technology/tokenlists/polygonTestnet.tokenlist.json) contains the tokens mapped on the Mumbai chain.
3. [Mapped Tokens Testnet](https://api-polygon-tokens.polygon.technology/tokenlists/mappedTestnet.tokenlist.json) ontains tokens that are mapped to Polygon bridges on testnet chains. Anyone can propose updates to this list.

4. [Blacklist Tokens List](https://api-polygon-tokens.polygon.technology/tokenlists/blacklist.tokenlist.json) Contains tokens that have been flagged for issues.
4. [Popular Tokens Testnet](https://api-polygon-tokens.polygon.technology/tokenlists/popularTestnet.tokenlist.json) Contains the most used tokens on the testnet chains.

## Adding or Updating a token
## Updating a token

1. Fork the repository

2. Add the new token at the end of the token array in `src/tokens/polygonTokens.json`

Please make sure that the new token follows this schema.

```json
{
"chainId": 137, // Chain Id of the L2 chain
"name": "token_name",
"symbol": "token_symbol",
"decimals": "<token_decimals>",
"address": "token_address on Polygon",
"logoURI": "token_icon_uri",
"tags": ["<bridge>", "<token_type>", "<optional_tag>", "<optional_tag>", ...], // For all acceptable tags, check the below list
"extensions": {
"originTokenAddress": "token_address on the origin chain", // If not deployed on ethereum, add noDeposit and noWithdraw tags
"originTokenNetwork": "id of the token's origin chain", // Use 0 for Ethereum, 1 for zkEVM, -1 for PoS
"wrappedTokenNetwork": "id of the wrapper token's chain", // Only for tokens bridged via LxLy bridge (zkEVM)
"project": {
"name": "Project_Name",
"summary": "Short_Project_Description",
"contact": "Project_Support",
"website": "Project_Website"
},
"originChainBridgeAdapter": "Bridge adapter contract address on origin chain", // Only required for tokens bridged using zkEVM messaging layer
"wrapperChainBridgeAdapter": "Bridge adapter contract address on wrapper chain" // Only required for tokens bridged using zkEVM messaging layer
}
}
```
2. Update the token in the token array of `src/tokens/mapped.json` for mainnet or `src/tokens/mappedTestnet.json` for testnet

Please make sure that the updated token do not disturb the schema.

### Tags

1. `stablecoin`: Tokens that are pegged to a fiat asset, e.g. USDC, USDT
1. `lxly`: Tokens that are bridged using the LxLy bridge (Agg Layer v1)

2. `swapable`: Tokens are eligible for swapping through the 0x contracts
2. `pos`: Tokens that are bridged using the PoS bridge

3. `native`: Tokens are native tokens of the chain
3. `plasma`: Tokens that are bridged using the PLASMA bridge

4. `erc20`: Tokens are of ERC20 token type
4. `fx`: Tokens that are bridged using the FX

5. `pos`: Tokens that are bridged using the PoS bridge
Note: Also use this tag if the tokens cannot be bridged.
5. `customBridge`: Token mapped through custom bridges

6. `fx`: Tokens that are bridged using the FX or custom FX bridge
6. `zkevmMessageBridge`: Token mapped through zkevmMessageBridge bridge

7. `plasma`: Tokens that are bridged using the PLASMA bridge
7. `customFx`: Token mapped through customFx bridge

8. `lxly`: Tokens that are bridged using the LxLy bridge (zkEVM)
8. `erc20`: Token of ERC20 token type

9. `metaTx`: Tokens are eligible for meta transactions
Note: Use this tag if the tokens support meta transactions and can be used for a gasless swaps.
9. `governanceToken`: Governance token of the chain

10. `customSig`: The token has its custom withdraw event signature and does not depend on the transfer event signature while verifing withdrawals
10. `nativeToken`: Native token of the chain

11. `noDeposit`: Tokens are not eligible for deposits from Ethereum
Note: Also use this tag if the tokens cannot be bridged.
11. `customWithdrawEventSig`: The token has its custom withdraw event signature and does not depend on the transfer event signature while verifing withdrawals

12. `noWithdraw`: Tokens are not eligible for withdrawals back to Ethereum
Note: Also use this tag if the tokens cannot be bridged.
12. `noDeposit`: Token not eligible for deposits

13. `customZkevmBridge`: Tokens that are bridged using zkEVM messaging layer
13. `noWithdraw`: Token not eligible for withdrawals on PoS bridges

3. Run linter and fix the issues if any

Expand All @@ -99,7 +70,7 @@ The JSON schema for the tokens includes: chainId, name, address, decimals, symbo
npm run build
```

5. Commit the changes and raise a Pull request to our repo's dev branch
5. Commit the changes and raise a Pull request to our repo

### Disclaimer

Expand Down
139 changes: 30 additions & 109 deletions src/build.js
Original file line number Diff line number Diff line change
@@ -1,130 +1,51 @@
const polygonTokens = require("./tokens/polygonTokens.json");
const popularTokens = require("./tokens/popularTokens.json");
const testnetTokens = require("./tokens/testnetTokens.json");
const blacklistTokens = require("./tokens/blacklistTokens.json");
const zkevmPopularTokens = require("./tokens/zkevmPopularTokens.json");
const allPolygonTokens = require("./tokens/polygon.json");
const allPolygonTestnetTokens = require("./tokens/polygonTestnet.json");
const allPolygonPopularTokens = require("./tokens/polygonPopular.json");
const allPolygonTestnetPopularTokens = require("./tokens/polygonTestnetPopular.json");
const v2PopularTokens = require("./tokens/defaultTokens.json");
const v2MappedTokens = require("./tokens/mappedTokens.json");
const v2PopularTokensTestnet = require("./tokens/defaultTokensTestnet.json");
const v2PopularTokensTestnetNew = require("./tokens/defaultTokensTestnetNew.json");
const v2MappedTokensTestnet = require("./tokens/mappedTokensTestnet.json");
const v2PopularTokensStaging = require("./tokens/defaultTokensStaging.json");
const v2MappedTokensStaging = require("./tokens/mappedTokensStaging.json");
const v2MappedTokensTestnetNew = require("./tokens/mappedTokensTestnetNew.json");
const polygonTokensTokenList = require("./metadata/polygonTokens.json");
const popularTokenList = require("./metadata/popularTokens.json");
const testnetTokenList = require("./metadata/testnetTokens.json");
const blacklistTokenList = require("./metadata/blacklistTokens.json");
const zkevmPopularTokenList = require("./metadata/zkevmPopularTokens.json");
const allPolygonTokenList = require("./metadata/polygon.json");
const allPolygonTestnetTokenList = require("./metadata/polygonTestnet.json");
const allPolygonPopularTokenList = require("./metadata/polygonPopular.json");
const allPolygonTestnetPopularTokenList = require("./metadata/polygonTestnetPopular.json");
const v2PopularTokenList = require("./metadata/defaultTokens.json");
const v2MappedTokenList = require("./metadata/mappedTokens.json");
const v2PopularTestnetTokenList = require("./metadata/defaultTokensTestnet.json");
const v2MappedTestnetTokenList = require("./metadata/mappedTokensTestnet.json");
const v2PopularTestnetTokenListNew = require("./metadata/defaultTokensTestnetNew.json");
const v2PopularTokenListStaging = require("./metadata/defaultTokensStaging.json");
const v2MappedTokenListStaging = require("./metadata/mappedTokensStaging.json");
const v2MappedTestnetNewTokenList = require("./metadata/mappedTokensTestnetNew.json");

// Remove the project information from lists
allPolygonTokens.forEach((token) => {
delete token.extensions.project;
});

allPolygonPopularTokens.forEach((token) => {
delete token.extensions.project;
});

polygonTokens.forEach((token) => {
delete token.extensions.project;
});

popularTokens.forEach((token) => {
delete token.extensions.project;
});
const popularTokens = require("./tokens/defaultTokens.json");
const mappedTokens = require("./tokens/mappedTokens.json");
const popularTokensTestnet = require("./tokens/defaultTokensTestnet.json");
const mappedTokensTestnet = require("./tokens/mappedTokensTestnet.json");
const popularTokensStaging = require("./tokens/defaultTokensStaging.json");
const mappedTokensStaging = require("./tokens/mappedTokensStaging.json");

const popularTokenList = require("./metadata/defaultTokens.json");
const mappedTokenList = require("./metadata/mappedTokens.json");
const popularTestnetTokenList = require("./metadata/defaultTokensTestnet.json");
const mappedTestnetTokenList = require("./metadata/mappedTokensTestnet.json");
const popularTokenListStaging = require("./metadata/defaultTokensStaging.json");
const mappedTokenListStaging = require("./metadata/mappedTokensStaging.json");

module.exports = function buildList() {
const timestamp = new Date().toISOString();

Object.assign(v2PopularTokenList, {
Object.assign(popularTokenList, {
timestamp,
tokens: v2PopularTokens,
tokens: popularTokens,
}); // v2 Default List
Object.assign(v2MappedTokenList, {
Object.assign(mappedTokenList, {
timestamp,
tokens: v2MappedTokens,
tokens: mappedTokens,
}); //v2 Mapped List
Object.assign(v2PopularTestnetTokenList, {
Object.assign(popularTestnetTokenList, {
timestamp,
tokens: v2PopularTokensTestnet,
tokens: popularTokensTestnet,
}); // v2 Default Testnet List
Object.assign(v2MappedTestnetTokenList, {
Object.assign(mappedTestnetTokenList, {
timestamp,
tokens: v2MappedTokensTestnet,
tokens: mappedTokensTestnet,
}); //v2 Mapped Testnet List
Object.assign(v2MappedTestnetNewTokenList, {
timestamp,
tokens: v2MappedTokensTestnetNew,
}); //v2 Mapped Testnet New List
Object.assign(v2PopularTestnetTokenListNew, {
timestamp,
tokens: v2PopularTokensTestnetNew,
}); //v2 Default Testnet New List

Object.assign(allPolygonTokenList, { timestamp, tokens: allPolygonTokens }); // Aggregated Polygon Tokens List
Object.assign(allPolygonPopularTokenList, {
timestamp,
tokens: allPolygonPopularTokens,
}); // Aggregated Polygon Popular Tokens List
Object.assign(allPolygonTestnetTokenList, {
timestamp,
tokens: allPolygonTestnetTokens,
}); // Aggregated Polygon Testnet Tokens List
Object.assign(allPolygonTestnetPopularTokenList, {
timestamp,
tokens: allPolygonTestnetPopularTokens,
}); // Aggregated Polygon Testnet Popular Tokens List
Object.assign(polygonTokensTokenList, { timestamp, tokens: polygonTokens }); // PolygonTokens tokenlist
Object.assign(popularTokenList, { timestamp, tokens: popularTokens }); // popular tokenlist
Object.assign(zkevmPopularTokenList, {
timestamp,
tokens: zkevmPopularTokens,
}); // zkevm popular tokenlist
Object.assign(testnetTokenList, { timestamp, tokens: testnetTokens }); // Testnet tokenlist
Object.assign(blacklistTokenList, { timestamp, tokens: blacklistTokens }); // blacklist tokenlist
Object.assign(v2PopularTokenListStaging, {
Object.assign(popularTokenListStaging, {
timestamp,
tokens: v2PopularTokensStaging,
tokens: popularTokensStaging,
}); // Staging Tokenlist
Object.assign(v2MappedTokenListStaging, {
Object.assign(mappedTokenListStaging, {
timestamp,
tokens: v2MappedTokensStaging,
tokens: mappedTokensStaging,
}); // Staging Tokenlist

return {
allPolygonTokenList,
allPolygonPopularTokenList,
allPolygonTestnetTokenList,
allPolygonTestnetPopularTokenList,
polygonTokensTokenList,
popularTokenListStaging,
mappedTokenListStaging,
popularTokenList,
zkevmPopularTokenList,
testnetTokenList,
blacklistTokenList,
v2PopularTokenListStaging,
v2MappedTokenListStaging,
v2PopularTokenList,
v2MappedTokenList,
v2PopularTestnetTokenList,
v2MappedTestnetTokenList,
v2MappedTestnetNewTokenList,
v2PopularTestnetTokenListNew,
mappedTokenList,
popularTestnetTokenList,
mappedTestnetTokenList,
};
};
36 changes: 18 additions & 18 deletions src/listRegistry.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
[
{
"name": "Polygon Tokens",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/polygonTokens.tokenlist.json",
"summary": "A list of tokens on the polygon network added by the community",
"name": "Popular Tokens",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/popular.tokenlist.json",
"summary": "Contains the top 100 most used tokens on the Polygon chains",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
},
{
"name": "Popular Tokens",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/popularTokens.tokenlist.json",
"summary": "A list of most used tokens on the polygon wallet",
"name": "Popular Tokens Staging",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/staging.tokenlist.json",
"summary": "Contains the top 100 most used tokens on the Polygon chains - Staging purposes",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
},
{
"name": "ZKEVM Popular",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/zkevmPopular.tokenlist.json",
"summary": "A list of most used tokens on the polygon wallet zkevm chain",
"name": "Popular Tokens Testnet",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/popularTestnet.tokenlist.json",
"summary": "Contains the top 100 most used tokens on the Polygon testnet chains",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
},
{
"name": "Cross-Chain",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/cross-chain.tokenlist.json",
"summary": "A cross-chain tokens list for transfers and swaps",
"name": "Mapped Tokens",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/mapped.tokenlist.json",
"summary": "Contains tokens that are mapped on Polygon Bridges. Anyone can propose updates to this list.",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
},
{
"name": "Polygon Testnet",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/testnet.tokenlist.json",
"summary": "A list of tokens on the Mumbai testnet",
"name": "Mapped Tokens Staging",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/mappedStaging.tokenlist.json",
"summary": "Contains tokens that are mapped on Polygon Bridges. Anyone can propose updates to this list.",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
},
{
"name": "BlackList Tokens",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/blacklist.tokenlist.json",
"summary": "A list of tokens that are blacklisted",
"name": "Mapped Tokens Testnet",
"listURI": "api-polygon-tokens.polygon.technology/tokenlists/mappedTestnet.tokenlist.json",
"summary": "Contains tokens that are mapped on Polygon Bridges. Anyone can propose updates to this list.",
"homepage": "polygon.technology",
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg"
}
Expand Down
28 changes: 0 additions & 28 deletions src/metadata/blacklistTokens.json

This file was deleted.

Loading

0 comments on commit 4e5d5d5

Please sign in to comment.