Skip to content

Commit

Permalink
Merge pull request #522 from maticnetwork/tokenlist-v2
Browse files Browse the repository at this point in the history
Tokenlist v2
  • Loading branch information
py-zoid authored Jan 9, 2024
2 parents 9fb80b7 + f50bdc4 commit de25a8e
Show file tree
Hide file tree
Showing 19 changed files with 4,926 additions and 513 deletions.
44 changes: 15 additions & 29 deletions src/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ 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 polygonTokensTokenList = require("./metadata/polygonTokens.json");
const popularTokenList = require("./metadata/popularTokens.json");
const testnetTokenList = require("./metadata/testnetTokens.json");
Expand All @@ -16,20 +18,8 @@ const allPolygonTokenList = require("./metadata/polygon.json");
const allPolygonTestnetTokenList = require("./metadata/polygonTestnet.json");
const allPolygonPopularTokenList = require("./metadata/polygonPopular.json");
const allPolygonTestnetPopularTokenList = require("./metadata/polygonTestnetPopular.json");

// Cross-chain lists
const ccTokenList = require("./metadata/crossChain.json");
const ccArbitrumTokens = require("./tokens/crossChain/arbitrum.json");
const ccAvalancheTokens = require("./tokens/crossChain/avalanche.json");
const ccBscTokens = require("./tokens/crossChain/bsc.json");
const ccEthereumTokens = require("./tokens/crossChain/ethereum.json");
const ccFantomTokens = require("./tokens/crossChain/fantom.json");
const ccFuseTokens = require("./tokens/crossChain/fuse.json");
const ccGnosisTokens = require("./tokens/crossChain/gnosis.json");
const ccMoonbeamTokens = require("./tokens/crossChain/moonbeam.json");
const ccMoonriverTokens = require("./tokens/crossChain/moonriver.json");
const ccOptimismTokens = require("./tokens/crossChain/optimism.json");
const ccPolygonTokens = require("./tokens/crossChain/polygonPoS.json");
const v2PopularTokenList = require("./metadata/defaultTokens.json");
const v2MappedTokenList = require("./metadata/mappedTokens.json");

// Staging list
const stagingTokenList = JSON.parse(JSON.stringify(polygonTokensTokenList));
Expand All @@ -56,6 +46,15 @@ popularTokens.forEach((token) => {
module.exports = function buildList() {
const timestamp = new Date().toISOString();

Object.assign(v2PopularTokenList, {
timestamp,
tokens: v2PopularTokens,
}); // v2 Default List
Object.assign(v2MappedTokenList, {
timestamp,
tokens: v2MappedTokens,
}); //v2 Mapped List

Object.assign(allPolygonTokenList, { timestamp, tokens: allPolygonTokens }); // Aggregated Polygon Tokens List
Object.assign(allPolygonPopularTokenList, {
timestamp,
Expand All @@ -77,20 +76,6 @@ module.exports = function buildList() {
}); // zkevm popular tokenlist
Object.assign(testnetTokenList, { timestamp, tokens: testnetTokens }); // Testnet tokenlist
Object.assign(blacklistTokenList, { timestamp, tokens: blacklistTokens }); // blacklist tokenlist
Object.assign(ccTokenList, {
timestamp,
tokens: ccArbitrumTokens
.concat(ccAvalancheTokens)
.concat(ccBscTokens)
.concat(ccEthereumTokens)
.concat(ccFantomTokens)
.concat(ccFuseTokens)
.concat(ccGnosisTokens)
.concat(ccMoonbeamTokens)
.concat(ccMoonriverTokens)
.concat(ccOptimismTokens)
.concat(ccPolygonTokens),
}); // Crosschain tokenlist
Object.assign(stagingTokenList, { timestamp, tokens: stagingList }); // Staging Tokenlist

return {
Expand All @@ -103,7 +88,8 @@ module.exports = function buildList() {
zkevmPopularTokenList,
testnetTokenList,
blacklistTokenList,
ccTokenList,
stagingTokenList,
v2PopularTokenList,
v2MappedTokenList,
};
};
45 changes: 45 additions & 0 deletions src/metadata/defaultTokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Popular Tokens",
"version": 2,
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg",
"description": "Contains the top 100 most used tokens on the Polygon chains",
"tags": {
"lxly": {
"name": "lxly",
"description": "Token mapped through lxly bride"
},
"pos": {
"name": "pos",
"description": "Token mapped through pos bride"
},
"plasma": {
"name": "plasma",
"description": "Token mapped through plasma bride"
},
"fx": { "name": "fx", "description": "Token mapped through fx bride" },
"zkevmMessageBridge": {
"name": "zkevmMessageBridge",
"description": "Token mapped through zkevmMessageBridge bride"
},
"customFx": {
"name": "customFx",
"description": "Token mapped through customFx bride"
},
"erc20": {
"name": "erc20",
"description": "Token of ERC20 token type"
},
"nativeToken": {
"name": "nativeToken",
"description": "Native token of the chain"
},
"customWithdrawEventSig": {
"name": "customWithdrawEventSig",
"description": "The token has a custom withdraw event signature"
},
"noDeposit": {
"name": "noDeposit",
"description": "Token not eligible for deposits"
}
}
}
45 changes: 45 additions & 0 deletions src/metadata/mappedTokens.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "Mapped Tokens",
"version": 2,
"logoURI": "https://assets.polygon.technology/tokenAssets/matic.svg",
"description": "Contains tokens that are mapped to Polygon PoS and Polygon zkEVM. Anyone can propose updates to this list.",
"tags": {
"lxly": {
"name": "lxly",
"description": "Token mapped through lxly bride"
},
"pos": {
"name": "pos",
"description": "Token mapped through pos bride"
},
"plasma": {
"name": "plasma",
"description": "Token mapped through plasma bride"
},
"fx": { "name": "fx", "description": "Token mapped through fx bride" },
"zkevmMessageBridge": {
"name": "zkevmMessageBridge",
"description": "Token mapped through zkevmMessageBridge bride"
},
"customFx": {
"name": "customFx",
"description": "Token mapped through customFx bride"
},
"erc20": {
"name": "erc20",
"description": "Token of ERC20 token type"
},
"nativeToken": {
"name": "nativeToken",
"description": "Native token of the chain"
},
"customWithdrawEventSig": {
"name": "customWithdrawEventSig",
"description": "The token has a custom withdraw event signature"
},
"noDeposit": {
"name": "noDeposit",
"description": "Token not eligible for deposits"
}
}
}
56 changes: 0 additions & 56 deletions src/tokens/crossChain/arbitrum.json

This file was deleted.

47 changes: 0 additions & 47 deletions src/tokens/crossChain/avalanche.json

This file was deleted.

38 changes: 0 additions & 38 deletions src/tokens/crossChain/bsc.json

This file was deleted.

65 changes: 0 additions & 65 deletions src/tokens/crossChain/ethereum.json

This file was deleted.

Loading

0 comments on commit de25a8e

Please sign in to comment.