[Internal] Exclude entries that are in the custom overrides. Add exception for 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5. (#2935)

* CMC mapping update.

* CMC mapping: Small refactor, coin mapping as separate step.

* Revert "CMC mapping: Small refactor, coin mapping as separate step."

This reverts commit 2480269c7ea0790ad9993afdf97abfc6145cea61.

* CMC mapping: Small refactor, entry processing and adding separate steps.

* CMC mapping: Exclude entries that are in the custom overrides.

* CMC mapping: Add exception for 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5.

Co-authored-by: Catenocrypt <catenocrypt@users.noreply.github.com>
This commit is contained in:
Adam R 2020-07-29 11:33:32 +02:00 committed by GitHub
parent 191d948dd8
commit 4a7c5f7f89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 225 additions and 29 deletions

View File

@ -5701,8 +5701,9 @@
"id": 3344
},
{
"coin": 358,
"type": "coin",
"coin": 60,
"type": "token",
"token_id": "0x93190DbCE9b9BD4Aa546270a8D1D65905B5fDd28",
"id": 3345
},
{
@ -7027,12 +7028,6 @@
"token_id": "0x1C5b760F133220855340003B43cC9113EC494823",
"id": 3808
},
{
"coin": 60,
"type": "token",
"token_id": "0x70861e862E1Ac0C96f853C8231826e469eAd37B1",
"id": 3809
},
{
"coin": 60,
"type": "token",
@ -9558,6 +9553,12 @@
"token_id": "0xed0849BF46CfB9845a2d900A0A4E593F2dD3673c",
"id": 5010
},
{
"coin": 60,
"type": "token",
"token_id": "0x9d5686EaDeA7327F5a0c4820dcA90457A0E88763",
"id": 5011
},
{
"coin": 60,
"type": "token",
@ -9954,6 +9955,12 @@
"token_id": "0xAFFCDd96531bCd66faED95FC61e443D08F79eFEf",
"id": 5203
},
{
"coin": 60,
"type": "token",
"token_id": "0x688fF43c3c19e4714f0BeB76df8Ee394207Ab411",
"id": 5204
},
{
"coin": 60,
"type": "token",
@ -9994,6 +10001,12 @@
"type": "coin",
"id": 5234
},
{
"coin": 60,
"type": "token",
"token_id": "0x1fB6bccc7Da51aa32e96118B8A33226d2Ae16517",
"id": 5243
},
{
"coin": 60,
"type": "token",
@ -10042,6 +10055,18 @@
"token_id": "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643",
"id": 5263
},
{
"coin": 60,
"type": "token",
"token_id": "0xF5DCe57282A584D2746FaF1593d3121Fcac444dC",
"id": 5264
},
{
"coin": 60,
"type": "token",
"token_id": "0x39AA39c021dfbaE8faC545936693aC917d5E7563",
"id": 5265
},
{
"coin": 60,
"type": "token",
@ -10171,6 +10196,18 @@
"token_id": "0xa982B2e19e90b2D9F7948e9C1b65D119F1CE88D6",
"id": 5328
},
{
"coin": 60,
"type": "token",
"token_id": "0x09617F6fD6cF8A71278ec86e23bBab29C04353a7",
"id": 5330
},
{
"coin": 60,
"type": "token",
"token_id": "0xE0b7e882C194881C690924cb46154B8241F9145E",
"id": 5332
},
{
"coin": 60,
"type": "token",
@ -10297,6 +10334,12 @@
"token_id": "0x19B58d95929586Ad750893CAad43E77aa6e8Ce9E",
"id": 5388
},
{
"coin": 60,
"type": "token",
"token_id": "0x697eF32B4a3F5a4C39dE1cB7563f24CA7BfC5947",
"id": 5389
},
{
"coin": 60,
"type": "token",
@ -10552,6 +10595,12 @@
"token_id": "0x4c327471C44B2dacD6E90525f9D629bd2e4f662C",
"id": 5471
},
{
"coin": 60,
"type": "token",
"token_id": "0xDaab5E695bb0E8Ce8384ee56BA38fA8290618e52",
"id": 5473
},
{
"coin": 531,
"type": "coin",
@ -11276,6 +11325,12 @@
"token_id": "0xeEEE2a622330E6d2036691e983DEe87330588603",
"id": 5833
},
{
"coin": 60,
"type": "token",
"token_id": "0x9fBFed658919A896B5Dc7b00456Ce22D780f9B65",
"id": 5834
},
{
"coin": 60,
"type": "token",
@ -11490,5 +11545,131 @@
"type": "token",
"token_id": "0x4f56221252d117f35E2f6Ab937A3F77CAd38934D",
"id": 5907
},
{
"coin": 60,
"type": "token",
"token_id": "0x5dc60C4D5e75D22588FA17fFEB90A63E535efCE0",
"id": 5908
},
{
"coin": 60,
"type": "token",
"token_id": "0xE09394F8BA642430eD448CA20f342EC7aa1Ba2E1",
"id": 5910
},
{
"coin": 60,
"type": "token",
"token_id": "0xFF44b5719f0B77A9951636fc5e69d3a1fc9E7d73",
"id": 5912
},
{
"coin": 60,
"type": "token",
"token_id": "0x7533D63A2558965472398Ef473908e1320520AE2",
"id": 5914
},
{
"coin": 60,
"type": "token",
"token_id": "0x5C84bc60a796534bfeC3439Af0E6dB616A966335",
"id": 5915
},
{
"coin": 60,
"type": "token",
"token_id": "0xaa8d0e9A26853D51613ca75729CDE2564913BCfb",
"id": 5919
},
{
"coin": 60,
"type": "token",
"token_id": "0x4Ba012f6e411a1bE55b98E9E62C3A4ceb16eC88B",
"id": 5921
},
{
"coin": 714,
"type": "token",
"token_id": "SWINGBY-888",
"id": 5922
},
{
"coin": 60,
"type": "token",
"token_id": "0x536381a8628dBcC8C70aC9A30A7258442eAb4c92",
"id": 5924
},
{
"coin": 60,
"type": "token",
"token_id": "0x9F284E1337A815fe77D2Ff4aE46544645B20c5ff",
"id": 5931
},
{
"coin": 60,
"type": "token",
"token_id": "0x3F8A2f7bcD70e7F7Bdd3FbB079c11d073588DEA2",
"id": 5933
},
{
"coin": 60,
"type": "token",
"token_id": "0x20Bcae16A8bA95d8E8363E265de4eCFc36eC5cd9",
"id": 5934
},
{
"coin": 60,
"type": "token",
"token_id": "0x08AD83D779BDf2BBE1ad9cc0f78aa0D24AB97802",
"id": 5936
},
{
"coin": 60,
"type": "token",
"token_id": "0x0d438F3b5175Bebc262bF23753C1E53d03432bDE",
"id": 5939
},
{
"coin": 60,
"type": "token",
"token_id": "0x4161725D019690a3E0de50f6bE67b07a86A9fAe1",
"id": 5947
},
{
"coin": 60,
"type": "token",
"token_id": "0xf29e46887FFAE92f1ff87DfE39713875Da541373",
"id": 5948
},
{
"coin": 60,
"type": "token",
"token_id": "0x9135D92e3A34e2A94e4474B74b9DC2d51118eeD5",
"id": 5949
},
{
"coin": 60,
"type": "token",
"token_id": "0x1e3a2446C729D34373B87FD2C9CBb39A93198658",
"id": 5950
},
{
"coin": 60,
"type": "token",
"token_id": "0x4e352cF164E64ADCBad318C3a1e222E9EBa4Ce42",
"id": 5956
},
{
"coin": 60,
"type": "token",
"token_id": "0xa1d0E215a23d7030842FC67cE582a6aFa3CCaB83",
"id": 5957
},
{
"coin": 60,
"type": "token",
"token_id": "0x40284109c3309A7C3439111bFD93BF5E0fBB706c",
"id": 5958
}
]
]

View File

@ -51,6 +51,9 @@ const custom: mapTiker[] = [
{"coin": 60, "type": typeToken, "token_id": "0x49d716DFe60b37379010A75329ae09428f17118d", "id": 4943}, // Pool Dai (plDai)
{"coin": 60, "type": typeToken, "token_id": "0x589891a198195061Cb8ad1a75357A3b7DbaDD7Bc", "id": 4036}, // Contentos (COS)
{"coin": 60, "type": typeToken, "token_id": "0x30f271C9E86D2B7d00a6376Cd96A1cFBD5F0b9b3", "id": 5835}, // Decentr (DEC)
// CMC returns multiple entries with 0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5 (2020-07-28), including them in the override to avoid duplicate
// 5636 5742 5743 5744 5745 5746
{"coin": 60, "type": typeToken, "token_id": "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", "id": 5636},
// {"coin": 60, "type": typeToken, "token_id": "XXX", "id": XXX}, // XXX (XXX)
]
@ -74,11 +77,10 @@ async function run() {
}
}
async function processCoin(coin) {
function buildCoinEntry(coin: any): any {
const { id, symbol, name, platform } = coin
const platformType: PlatformType = platform == null ? "" : platform.name
log(`${symbol}:${platformType}`)
// await BluebirbPromise.mapSeries(types, async type => {
switch (platformType) {
case PlatformType.Ethereum:
// log(`Ticker ${name}(${symbol}) is a token with address ${address} and CMC id ${id}`)
@ -86,13 +88,12 @@ async function processCoin(coin) {
try {
const checksum = toChecksum(platform.token_address)
if (!isAddressInBlackList("ethereum", checksum)) {
log(`Added ${checksum}`)
addToContractsList({
return {
coin: 60,
type: typeToken,
token_id: checksum,
id
})
}
}
} catch (error) {
console.log(`Etheruem platform error`, error)
@ -100,6 +101,7 @@ async function processCoin(coin) {
}
}
break
case PlatformType.Binance:
if (symbol === "BNB") {
break
@ -107,27 +109,24 @@ async function processCoin(coin) {
const ownerAddress = platform.token_address.trim()
log(`Symbol ${symbol}:${ownerAddress}:${id}`)
if (ownerAddress && (ownerAddress in bnbOwnerToSymbol)) {
log(`Added ${bnbOwnerToSymbol[ownerAddress]}`)
addToContractsList({
return {
coin: 714,
type: typeToken,
token_id: bnbOwnerToSymbol[ownerAddress],
id
})
break
}
}
if (symbol in bnbOriginalSymbolToSymbol) {
log(`Added Binance ${bnbOriginalSymbolToSymbol[symbol]}`)
addToContractsList({
return {
coin: 714,
type: typeToken,
token_id: bnbOriginalSymbolToSymbol[symbol].trim(),
id
})
break
}
}
break
case PlatformType.TRON:
if (symbol === "TRX") {
break
@ -135,14 +134,15 @@ async function processCoin(coin) {
const tokenAddr = platform.token_address.trim()
log(`tron: ${tokenAddr}`)
if (tokenAddr.length > 0) {
addToContractsList({
return {
coin: 195,
type: typeToken,
token_id: tokenAddr,
id
})
}
}
break
// case PlatformType.VeChain:
// if (symbol === "VET") {
// break
@ -157,22 +157,37 @@ async function processCoin(coin) {
// id
// })
// break
default:
const coinIndex = getSlip44Index(symbol, name)
if (coinIndex >= 0) {
log(`Ticker ${name}(${symbol}) is a coin with id ${coinIndex}`)
addToContractsList({
return {
coin: coinIndex,
type: typeCoin,
id
})
} else {
log(`Coin ${coinIndex} ${name}(${symbol}) not listed in slip44`)
}
}
log(`Coin ${coinIndex} ${name}(${symbol}) not listed in slip44`)
break
}
// })
log(`Could not process entry ${symbol}:${name}:${platformType}`)
return null
}
async function processCoin(coin) {
const entry = buildCoinEntry(coin)
if (!entry) {
return
}
// check if it is in custom, in that case omit it
if (entry.token_id && custom.find(elem => elem.coin == entry.coin && elem.token_id === entry.token_id)) {
log(`Entry ${entry.token_id} is in custom, omitting`)
return
}
addToContractsList(entry)
log(`Added entry ${entry.token_id}`)
}
// Iniitalize state necessary for faster data looup during script run