Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #267 from brave/update-token-lists
Browse files Browse the repository at this point in the history
chore: update tokenlists and prevent blacklisted tokens
  • Loading branch information
onyb authored Aug 16, 2021
2 parents 7275e0b + 4f104f4 commit 55c856a
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 88 deletions.
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@
"netmask": "^2.0.1",
"ganache-core/lodash": "^4.17.21",
"underscore": "^1.12.1",
"url-parse": "^1.5.0",
"url-parse": "^1.5.2",
"ssri": "^6.0.2",
"hosted-git-info": "^3.0.8"
"hosted-git-info": "^3.0.8",
"**/swarm-js/tar": "^4.4.15",
"**/node-pre-gyp/tar": "^4.4.15",
"geckodriver/tar": "^6.1.2",
"**/node-sass/node-gyp/tar": "^4.4.3",
"**/path-parse": "^1.0.7",
"**/jszip": "^3.7.0"
},
"dependencies": {
"@babel/runtime": "^7.5.5",
Expand All @@ -93,7 +99,7 @@
"@formatjs/intl-relativetimeformat": "^5.2.6",
"@fortawesome/fontawesome-free": "^5.13.0",
"@material-ui/core": "^4.11.0",
"@metamask/contract-metadata": "^1.25.0",
"@metamask/contract-metadata": "1.26.0",
"@metamask/controllers": "^2.0.5",
"@metamask/eth-ledger-bridge-keyring": "github:brave/eth-ledger-bridge-keyring#6db82c15435f9ae47dadbc1fc19586552a7044eb",
"@metamask/etherscan-link": "^1.1.0",
Expand Down
146 changes: 130 additions & 16 deletions ui/app/pages/swap/assets/assets.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
"name": "2key network",
"decimals": 18
},
{
"address": "0xFFC97d72E13E01096502Cb8Eb52dEe56f74DAD7B",
"symbol": "AAAVE",
"name": "Aave AAVE",
"decimals": 18
},
{
"address": "0x05Ec93c0365baAeAbF7AefFb0972ea7ECdD39CF1",
"symbol": "ABAT",
Expand Down Expand Up @@ -185,6 +191,12 @@
"name": "Aave REN",
"decimals": 18
},
{
"address": "0x358AA737e033F34df7c54306960a38d09AaBd523",
"symbol": "ARES",
"name": "Ares Protocol",
"decimals": 18
},
{
"address": "0xfec0cF7fE078a500abf15F1284958F22049c2C7e",
"symbol": "ART",
Expand Down Expand Up @@ -227,6 +239,18 @@
"name": "Auctus",
"decimals": 18
},
{
"address": "0x18aAA7115705e8be94bfFEBDE57Af9BFc265B998",
"symbol": "AUDIO",
"name": "Audius",
"decimals": 18
},
{
"address": "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1",
"symbol": "AUNI",
"name": "Aave UNI",
"decimals": 18
},
{
"address": "0xBcca60bB61934080951369a648Fb03DF4F96263C",
"symbol": "AUSDC",
Expand All @@ -251,12 +275,24 @@
"name": "Aave WBTC",
"decimals": 18
},
{
"address": "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e",
"symbol": "AWETH",
"name": "Aave WETH",
"decimals": 18
},
{
"address": "0x71F85B2E46976bD21302B64329868fd15eb0D127",
"symbol": "AXN",
"name": "Axion",
"decimals": 18
},
{
"address": "0x5165d24277cD063F5ac44Efd447B27025e888f37",
"symbol": "AYFI",
"name": "Aave YFI",
"decimals": 18
},
{
"address": "0xDf7FF54aAcAcbFf42dfe29DD6144A69b629f8C9e",
"symbol": "AZRX",
Expand Down Expand Up @@ -413,6 +449,12 @@
"name": "SwissBorg",
"decimals": 8
},
{
"address": "0x75739d5944534115d7C54ee8C73F186D793BAE02",
"symbol": "CO2",
"name": "Collective",
"decimals": 18
},
{
"address": "0xc00e94Cb662C3520282E6f5717214004A7f26888",
"symbol": "COMP",
Expand Down Expand Up @@ -635,6 +677,12 @@
"name": "Hut34 Entropy",
"decimals": 18
},
{
"address": "0x1Da87b114f35E1DC91F72bF57fc07A768Ad40Bb0",
"symbol": "EQZ",
"name": "Equalizer",
"decimals": 18
},
{
"address": "0xb1CD6e4153B2a390Cf00A6556b0fC1458C4A5533",
"symbol": "ETHBNT",
Expand Down Expand Up @@ -695,6 +743,12 @@
"name": "FUNToken",
"decimals": 8
},
{
"address": "0x970B9bB2C0444F5E81e9d0eFb84C8ccdcdcAf84d",
"symbol": "FUSE",
"name": "Fuse",
"decimals": 18
},
{
"address": "0x35bD01FC9d6D5D81CA9E055Db88Dc49aa2c699A8",
"symbol": "FWB",
Expand Down Expand Up @@ -815,12 +869,24 @@
"name": "Indorse",
"decimals": 18
},
{
"address": "0x544c42fBB96B39B21DF61cf322b5EDC285EE7429",
"symbol": "INSUR",
"name": "InsurAce",
"decimals": 18
},
{
"address": "0x0DB8D8b76BC361bAcbB72E2C491E06085A97Ab31",
"symbol": "IQN",
"name": "IQeon",
"decimals": 18
},
{
"address": "0x7420B4b9a0110cdC71fB720908340C03F9Bc03EC",
"symbol": "JASMY",
"name": "JasmyCoin",
"decimals": 18
},
{
"address": "0x8727c112C712c4a03371AC87a74dD6aB104Af768",
"symbol": "JET",
Expand All @@ -833,6 +899,12 @@
"name": "JOYSO",
"decimals": 6
},
{
"address": "0x6E765D26388A17A6e86c49A8E41DF3F58aBcd337",
"symbol": "KANGAL",
"name": "Kangal",
"decimals": 18
},
{
"address": "0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC",
"symbol": "KEEP",
Expand Down Expand Up @@ -935,6 +1007,12 @@
"name": "MahaDAO",
"decimals": 18
},
{
"address": "0x75387e1287Dd85482aB66102DA9f6577E027f609",
"symbol": "MAI",
"name": "Mindsync",
"decimals": 18
},
{
"address": "0x0cae9e4d663793c2a2A0b211c1Cf4bBca2B9cAa7",
"symbol": "MAMZN",
Expand All @@ -953,12 +1031,6 @@
"name": "Midas Protocol",
"decimals": 18
},
{
"address": "0x1C9491865a1DE77C5b6e19d2E6a5F1D7a6F2b25F",
"symbol": "MATTER",
"name": "AntiMatter",
"decimals": 18
},
{
"address": "0x56aA298a19C93c6801FDde870fA63EF75Cc0aF72",
"symbol": "MBABA",
Expand Down Expand Up @@ -1121,6 +1193,12 @@
"name": "NANJCOIN",
"decimals": 8
},
{
"address": "0x4a615bB7166210CCe20E6642a6f8Fb5d4D044496",
"symbol": "NAOS",
"name": "NAOS Finance",
"decimals": 18
},
{
"address": "0xEB58343b36C7528F23CAAe63a150240241310049",
"symbol": "NBU",
Expand Down Expand Up @@ -1187,6 +1265,12 @@
"name": "Menlo One",
"decimals": 18
},
{
"address": "0xDb05EA0877A2622883941b939f0bb11d1ac7c400",
"symbol": "OPCT",
"name": "Opacity",
"decimals": 18
},
{
"address": "0xff56Cc6b1E6dEd347aA0B7676C85AB0B3D08B0FA",
"symbol": "ORBS",
Expand Down Expand Up @@ -1238,7 +1322,7 @@
{
"address": "0xeca82185adCE47f39c684352B0439f030f860318",
"symbol": "PERL",
"name": "Perlin",
"name": "PERL eco",
"decimals": 18
},
{
Expand Down Expand Up @@ -1481,6 +1565,18 @@
"name": "Router Protocol",
"decimals": 18
},
{
"address": "0x8762db106B2c2A0bccB3A80d1Ed41273552616E8",
"symbol": "RSR",
"name": "Reserve Rights Toke",
"decimals": 18
},
{
"address": "0x196f4727526eA7FB1e17b2071B3d8eAA38486988",
"symbol": "RSV",
"name": "Reserve",
"decimals": 18
},
{
"address": "0x3d1BA9be9f66B8ee101911bC36D3fB562eaC2244",
"symbol": "RVT",
Expand Down Expand Up @@ -1517,6 +1613,12 @@
"name": "sETH",
"decimals": 18
},
{
"address": "0x84810bcF08744d5862B8181f12d17bfd57d3b078",
"symbol": "SGT",
"name": "SharedStake Governa",
"decimals": 18
},
{
"address": "0x6888a16eA9792c15A4DCF2f6C623D055c8eDe792",
"symbol": "SIG",
Expand Down Expand Up @@ -1631,12 +1733,6 @@
"name": "Swarm City",
"decimals": 18
},
{
"address": "0xeF31Cb88048416E301Fee1eA13e7664b887BA7e8",
"symbol": "SYAX",
"name": "Staked yAxis",
"decimals": 18
},
{
"address": "0x8282df223AC402d04B2097d16f758Af4F70e7Db0",
"symbol": "SYFL",
Expand All @@ -1649,6 +1745,12 @@
"name": "Sylo",
"decimals": 18
},
{
"address": "0x182F4c4C97cd1c24E1Df8FC4c053E5C47bf53Bef",
"symbol": "TANGO",
"name": "keyTango",
"decimals": 18
},
{
"address": "0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa",
"symbol": "TBTC",
Expand Down Expand Up @@ -1733,6 +1835,12 @@
"name": "Sora Validator Toke",
"decimals": 18
},
{
"address": "0x898BAD2774EB97cF6b94605677F43b41871410B1",
"symbol": "VETH2",
"name": "vEth2",
"decimals": 18
},
{
"address": "0xfeF4185594457050cC9c23980d301908FE057Bb1",
"symbol": "VIDT",
Expand All @@ -1745,6 +1853,12 @@
"name": "Vesper Finance",
"decimals": 18
},
{
"address": "0x1cF4592ebfFd730c7dc92c1bdFFDfc3B9EfCf29a",
"symbol": "WAVES",
"name": "Waves",
"decimals": 18
},
{
"address": "0x667088b212ce3d06a1b553a7221E1fD19000d9aF",
"symbol": "WINGS",
Expand Down Expand Up @@ -1842,9 +1956,9 @@
"decimals": 18
},
{
"address": "0xC7e43A1c8E118aA2965F5EAbe0e718D83DB7A63C",
"symbol": "ZCRT",
"name": "ZCore Token",
"address": "0x5150956E082C748Ca837a5dFa0a7C10CA4697f9c",
"symbol": "ZDEX",
"name": "Zeedex",
"decimals": 18
},
{
Expand Down
43 changes: 31 additions & 12 deletions ui/app/pages/swap/assets/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ const ethUtil = require('ethereumjs-util')
const uniqBy = require('lodash/uniqBy')
const sortBy = require('lodash/sortBy')

const tokenLists = {
allTokens: 'https://tokens.coingecko.com/uniswap/all.json',
unsupportedTokens: 'https://raw.githubusercontent.com/Uniswap/uniswap-interface/main/src/constants/tokenLists/unsupported.tokenlist.json',
}

const ETH = {
symbol: 'ETH',
address: '',
Expand All @@ -26,8 +31,24 @@ const assetsPriorityList = [
'AAVE',
]

function writeTokens (tokens) {
let assets = uniqBy([ETH, ...tokens], (e) => e.address)

assets = prioritySort(assets, assetsPriorityList)

try {
fs.writeFileSync(
`${__dirname}/assets.mainnet.json`,
JSON.stringify(assets, null, 4),
)
console.log('✅️ Asset list successfully updated.')
} catch (error) {
console.error(error)
}
}

function main () {
fetch('https://tokens.coingecko.com/uniswap/all.json').then((r) =>
fetch(tokenLists.allTokens).then((r) =>
r.json().then((data) => {
const tokens = data.tokens
.map((token) => ({
Expand All @@ -38,19 +59,17 @@ function main () {
}))
.filter(({ address }) => address in contractMap)

let assets = uniqBy([ETH, ...tokens], (e) => e.address)
fetch(tokenLists.unsupportedTokens).then((u) =>
u.json().then((data) => {
const unsupportedTokens = data.tokens
.map(({ address }) => (ethUtil.toChecksumAddress(address)))

assets = prioritySort(assets, assetsPriorityList)
const supportedTokens = tokens
.filter(({ address }) => !(address in unsupportedTokens))

try {
fs.writeFileSync(
`${__dirname}/assets.mainnet.json`,
JSON.stringify(assets, null, 4),
)
console.log('✅️ Asset list successfully updated.')
} catch (error) {
console.error(error)
}
writeTokens(supportedTokens)
}),
)
}),
)
}
Expand Down
Loading

0 comments on commit 55c856a

Please sign in to comment.