Improve cmc map (#740)

* Update test

* Update cmc map

For 714 coin, replace owner address with symbol
For 60 coin, update contract, add new, fix checlsum for some

* Optimised images with calibre/image-actions

* Add ERC20

* Map fuel coin's, Teteher, Harmony,

* Preserve sorting order

* One more update
This commit is contained in:
Mykola 2019-12-03 21:03:39 -08:00 committed by GitHub
parent a534f94bfb
commit 53429bc2b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 289 additions and 111 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -149,11 +149,6 @@
"type": "coin",
"id": 161
},
{
"coin": 202,
"type": "coin",
"id": 168
},
{
"coin": 10,
"type": "coin",
@ -385,28 +380,28 @@
"type": "coin",
"id": 819
},
{
"coin": 60,
"type": "token",
"token_id": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"id": 825
},
{
"coin": 195,
"type": "token",
"token_id": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"id": 825
},
{
"coin": 60,
"type": "token",
"token_id": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"id": 825
},
{
"coin": 0,
"type": "coin",
"id": 825
},
{
"coin": 84,
"type": "coin",
"id": 833
},
{
"coin": 186,
"type": "coin",
"id": 869
},
{
"coin": 43,
"type": "coin",
@ -453,6 +448,11 @@
"type": "coin",
"id": 1004
},
{
"coin": 289,
"type": "coin",
"id": 1008
},
{
"coin": 60,
"type": "token",
@ -597,12 +597,6 @@
"type": "coin",
"id": 1343
},
{
"coin": 60,
"type": "token",
"token_id": "0x020C710646e23AB868dbE5B88004892797fE4eFb",
"id": 1375
},
{
"coin": 888,
"type": "coin",
@ -744,6 +738,11 @@
"token_id": "0xB9e7F8568e08d5659f5D29C4997173d84CdF2607",
"id": 1562
},
{
"coin": 165,
"type": "coin",
"id": 1567
},
{
"coin": 323,
"type": "coin",
@ -1157,6 +1156,12 @@
"type": "coin",
"id": 1839
},
{
"coin": 60,
"type": "token",
"token_id": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52",
"id": 1839
},
{
"coin": 60,
"type": "token",
@ -2098,7 +2103,7 @@
{
"coin": 714,
"type": "token",
"token_id": "",
"token_id": "WISH-2D5",
"id": 2236
},
{
@ -2143,6 +2148,11 @@
"token_id": "0x88A3E4F35D64aAD41A6d4030ac9AFE4356cB84fA",
"id": 2245
},
{
"coin": 1122,
"type": "coin",
"id": 2246
},
{
"coin": 60,
"type": "token",
@ -2214,12 +2224,6 @@
"token_id": "0x672a1AD4f667FB18A333Af13667aa0Af1F5b5bDD",
"id": 2271
},
{
"coin": 60,
"type": "token",
"token_id": "0x63b992e6246d88f07fc35A056d2C365E6D441A3D",
"id": 2272
},
{
"coin": 60,
"type": "token",
@ -2448,6 +2452,11 @@
"token_id": "0x1234567461d3f8Db7496581774Bd869C83D51c93",
"id": 2334
},
{
"coin": 998,
"type": "coin",
"id": 2335
},
{
"coin": 60,
"type": "token",
@ -3036,7 +3045,7 @@
{
"coin": 714,
"type": "token",
"token_id": "",
"token_id": "EQL-586",
"id": 2479
},
{
@ -3310,6 +3319,12 @@
"token_id": "0x5c743a35E903F6c584514ec617ACEe0611Cf44f3",
"id": 2547
},
{
"coin": 60,
"type": "token",
"token_id": "0x6758B7d441a9739b98552B373703d8d3d14f9e62",
"id": 2548
},
{
"coin": 178,
"type": "coin",
@ -4295,6 +4310,11 @@
"token_id": "0x6fB3e0A217407EFFf7Ca062D46c26E5d60a14d69",
"id": 2777
},
{
"coin": 304,
"type": "coin",
"id": 2777
},
{
"coin": 60,
"type": "token",
@ -4400,7 +4420,7 @@
{
"coin": 714,
"type": "token",
"token_id": "",
"token_id": "TM2-0C4",
"id": 2850
},
{
@ -4641,12 +4661,6 @@
"token_id": "0xd37532D304214D588aeeaC4c365E8F1d72e2304A",
"id": 2904
},
{
"coin": 60,
"type": "token",
"token_id": "0x076a93a40Bf9E0D21d3F75dd1E0584DdbE0f9D1a",
"id": 2905
},
{
"coin": 60,
"type": "token",
@ -4967,18 +4981,17 @@
"token_id": "0xb5b8F5616Fe42d5ceCA3e87F3FddbDd8F496d760",
"id": 2972
},
{
"coin": 60,
"type": "token",
"token_id": "0xe7D7b37e72510309Db27C460378f957B1B04Bd5d",
"id": 2973
},
{
"coin": 60,
"type": "token",
"token_id": "0xbF5496122CF1bB778E0cBE5eaB936f2BE5fC0940",
"id": 2975
},
{
"coin": 382,
"type": "coin",
"id": 2976
},
{
"coin": 60,
"type": "token",
@ -5079,12 +5092,6 @@
"token_id": "0xff2b3353c3015E9f1FBF95B9Bda23F58Aa7cE007",
"id": 3011
},
{
"coin": 818,
"type": "token",
"token_id": "0x0000000000000000000000000000456E65726779",
"id": 3012
},
{
"coin": 60,
"type": "token",
@ -5149,17 +5156,6 @@
"token_id": "0x0223fc70574214F65813fE336D870Ac47E147fAe",
"id": 3040
},
{
"coin": 2941,
"type": "coin",
"id": 3046
},
{
"coin": 60,
"type": "token",
"token_id": "0xc7C03B8a3FC5719066E185ea616e87B88eba44a3",
"id": 3052
},
{
"coin": 60,
"type": "token",
@ -5693,7 +5689,7 @@
{
"coin": 1024,
"type": "token",
"token_id": "ong",
"token_id": "ont",
"id": 3217
},
{
@ -6650,12 +6646,6 @@
"token_id": "0x1563D521ba309e2Ad9f4aFfD6f4dE9759E8d4F21",
"id": 3520
},
{
"coin": 60,
"type": "token",
"token_id": "0x5874548C51822Da642661b235e101D6d636b6feb",
"id": 3522
},
{
"coin": 60,
"type": "token",
@ -6855,7 +6845,7 @@
"id": 3632
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "TG37mUxRUaH1E8DWSrrmoQ79BnZn1yHztb",
"id": 3633
@ -7075,12 +7065,6 @@
"token_id": "0x06e0feB0D74106c7adA8497754074D222Ec6BCDf",
"id": 3687
},
{
"coin": 60,
"type": "token",
"token_id": "0x33B919F54692dDbf702065763EA2b50Ca02e6bfF",
"id": 3689
},
{
"coin": 60,
"type": "token",
@ -7186,7 +7170,7 @@
"id": 3717
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "1002000",
"id": 3718
@ -7262,12 +7246,6 @@
"token_id": "0x94236591125E935F5ac128Bb3d5062944C24958c",
"id": 3735
},
{
"coin": 60,
"type": "token",
"token_id": "0x1254E59712e6e727dC71E0E3121Ae952b2c4c3b6",
"id": 3736
},
{
"coin": 60,
"type": "token",
@ -7470,12 +7448,6 @@
"token_id": "0x49D09cDa1Deb8a1680F1270C5ed15218fc4B18f0",
"id": 3784
},
{
"coin": 60,
"type": "token",
"token_id": "0xD178b20c6007572bD1FD01D205cC20D32B4A6015",
"id": 3785
},
{
"coin": 60,
"type": "token",
@ -7557,12 +7529,6 @@
"token_id": "0x26fb86579e371c7AEdc461b2DdEF0A8628c93d3B",
"id": 3801
},
{
"coin": 60,
"type": "token",
"token_id": "0x259059f137CB9B8F60AE27Bd199d97aBb69E539B",
"id": 3804
},
{
"coin": 60,
"type": "token",
@ -8009,6 +7975,11 @@
"token_id": "0x7865af71cf0b288b4E7F654f4F7851EB46a2B7F8",
"id": 3917
},
{
"coin": 19165,
"type": "coin",
"id": 3918
},
{
"coin": 60,
"type": "token",
@ -8016,7 +7987,7 @@
"id": 3920
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "TVimprG4oe3i2HapWzPuTh4WtuosRAh5Ew",
"id": 3922
@ -8132,6 +8103,18 @@
"type": "coin",
"id": 3945
},
{
"coin": 60,
"type": "token",
"token_id": "0x799a4202c12ca952cB311598a024C80eD371a41e",
"id": 3945
},
{
"coin": 714,
"type": "token",
"token_id": "ONE-5F9",
"id": 3945
},
{
"coin": 60,
"type": "token",
@ -8434,7 +8417,7 @@
{
"coin": 714,
"type": "token",
"token_id": "bnb1vdjhrkgvt4y76ykyvrvh68pzqg3lvv0y5yfxyf",
"token_id": "RAVEN-F66",
"id": 4024
},
{
@ -8520,7 +8503,7 @@
"id": 4053
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "TVQ6jYV5yTtRsKcD8aRc1a4Kei4V45ixLn",
"id": 4054
@ -8578,12 +8561,6 @@
"token_id": "0x6393E822874728f8Afa7e1C9944E417D37CA5878",
"id": 4067
},
{
"coin": 60,
"type": "token",
"token_id": "0x0ED8343dfdEE32E38b4c4cE15a3b00A59E90F3dB",
"id": 4068
},
{
"coin": 60,
"type": "token",
@ -8629,7 +8606,7 @@
{
"coin": 714,
"type": "token",
"token_id": " bnb1m5uzzfxs7x05sl28gg96zyecn9jwgtkpyeftyn",
"token_id": "ERD-D06",
"id": 4086
},
{
@ -8798,6 +8775,12 @@
"token_id": "0x420412E765BFa6d85aaaC94b4f7b708C89be2e2B",
"id": 4139
},
{
"coin": 60,
"type": "token",
"token_id": "0x225927F8fa71d16EE07968B8746364D1d9F839bD",
"id": 4141
},
{
"coin": 714,
"type": "token",
@ -8830,7 +8813,7 @@
{
"coin": 714,
"type": "token",
"token_id": " bnb1e4q8whcufp6d72w8nwmpuhxd96r4n0fstegyuy",
"token_id": "RUNE-B1A",
"id": 4157
},
{
@ -8951,6 +8934,12 @@
"token_id": "0x85ca6710D0F1D511d130f6935eDDA88ACBD921bD",
"id": 4196
},
{
"coin": 714,
"type": "token",
"token_id": "SHR-DB6",
"id": 4197
},
{
"coin": 60,
"type": "token",
@ -8975,7 +8964,7 @@
"id": 4205
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"id": 4206
@ -9283,6 +9272,12 @@
"token_id": "0x593114f03A0A575aece9ED675e52Ed68D2172B8c",
"id": 4452
},
{
"coin": 714,
"type": "token",
"token_id": "ECO-083",
"id": 4466
},
{
"coin": 60,
"type": "token",
@ -9314,7 +9309,7 @@
"id": 4494
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "TUL5yxRKeSWvceLZ3BSU5iNJcQmNxkWayh",
"id": 4495
@ -9361,6 +9356,12 @@
"token_id": "0xfB559CE67Ff522ec0b9Ba7f5dC9dc7EF6c139803",
"id": 4586
},
{
"coin": 60,
"type": "token",
"token_id": "0x63d958D765F5bd88efDbD8Afd32445393b24907f",
"id": 4598
},
{
"coin": 60,
"type": "token",
@ -9418,7 +9419,7 @@
{
"coin": 60,
"type": "token",
"token_id": "0x0794ce7d4459105926Da230F318c1e34BC790517",
"token_id": "0x301C755bA0fcA00B1923768Fffb3Df7f4E63aF31",
"id": 4678
},
{
@ -9563,6 +9564,12 @@
"type": "coin",
"id": 4769
},
{
"coin": 60,
"type": "token",
"token_id": "0xdA4129919F964a3A526D3182Bb03E6449e5a8872",
"id": 4774
},
{
"coin": 60,
"type": "token",
@ -9590,7 +9597,7 @@
{
"coin": 714,
"type": "token",
"token_id": "",
"token_id": "VOTE-FD4",
"id": 4792
},
{
@ -9665,6 +9672,12 @@
"token_id": "0xe0b9BcD54bF8A730EA5d3f1fFCe0885E911a502c",
"id": 4826
},
{
"coin": 60,
"type": "token",
"token_id": "0x166F1a7eCAe00bd43876A25B10a63C575e05c0e7",
"id": 4830
},
{
"coin": 60,
"type": "token",
@ -9680,7 +9693,19 @@
{
"coin": 60,
"type": "token",
"token_id": "0xA1F18BA7a1FA1F2c15EAE5C42e722278F1235b7a",
"token_id": "0xBA8c0244FBDEB10f19f6738750dAeEDF7a5081eb",
"id": 4841
},
{
"coin": 60,
"type": "token",
"token_id": "0x274c5236276422330060aA95cADEd86dA0a297c2",
"id": 4842
},
{
"coin": 60,
"type": "token",
"token_id": "0xA8eBb13B9895E52Ab7d815CE7F63591402581624",
"id": 4845
},
{
@ -9708,7 +9733,7 @@
"id": 4862
},
{
"coin": 714,
"coin": 195,
"type": "token",
"token_id": "1002413",
"id": 4867
@ -9719,6 +9744,12 @@
"token_id": "0xbACA8D824f471a6b20fdbac25E9e8943B9cD743B",
"id": 4868
},
{
"coin": 60,
"type": "token",
"token_id": "0x322f4f6a48329690957a3BCBd1301516C2B83c1F",
"id": 4870
},
{
"coin": 60,
"type": "token",
@ -9743,6 +9774,24 @@
"token_id": "0x1412f6Aa5ADC77C620715BB2a020AA690B85F68A",
"id": 4902
},
{
"coin": 60,
"type": "token",
"token_id": "0x6710CeE627Fa3A988200ffD5687cc1C814cEf0F6",
"id": 4907
},
{
"coin": 60,
"type": "token",
"token_id": "0x8c9E4CF756b9d01D791b95bc2D0913EF2Bf03784",
"id": 4920
},
{
"coin": 60,
"type": "token",
"token_id": "0x5978708d6ccE1CC9640Eed47422D64c91BbD5171",
"id": 4936
},
{
"coin": 60,
"type": "token",
@ -9760,5 +9809,64 @@
"type": "token",
"token_id": "0x0d16450D347c12C086d6C94c76c5Aaac35eA07E0",
"id": 4942
},
{
"coin": 60,
"type": "token",
"token_id": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"id": 4943
},
{
"coin": 60,
"type": "token",
"token_id": "0x0Ba45A8b5d5575935B8158a88C631E9F9C95a2e5",
"id": 4944
},
{
"coin": 60,
"type": "token",
"token_id": "0x3DB99ab08006aeFcC9600972eCA8C202396B4300",
"id": 4946
},
{
"coin": 309,
"type": "coin",
"id": 4948
},
{
"coin": 60,
"type": "token",
"token_id": "0xbf05571988dAaB22D33C28bbB13566eae9DeE626",
"id": 4949
},
{
"coin": 60,
"type": "token",
"token_id": "0x037A54AaB062628C9Bbae1FDB1583c195585fe41",
"id": 4950
},
{
"coin": 60,
"type": "token",
"token_id": "0xE1bAD922F84b198A08292FB600319300ae32471b",
"id": 4953
},
{
"coin": 60,
"type": "token",
"token_id": "0x6096d2460CF5177E40B515223428DC005ad35123",
"id": 4958
},
{
"coin": 60,
"type": "token",
"token_id": "0x4D0425e47Ee2D16b94c036715dfcb52a0cebC4Dc",
"id": 4981
},
{
"coin": 60,
"type": "token",
"token_id": "0x3be6e7bF2cD8E1a0A95597E72ca6D3709bBeFF76",
"id": 4983
}
]

View File

@ -19,6 +19,11 @@ import {
isLogoOK,
} from "./helpers"
enum TickerType {
Token = "token",
Coin = "coin"
}
describe("Check repository root dir", () => {
const rootDirAllowedFiles = [
".github",
@ -194,4 +199,69 @@ function testCosmosValidatorsAddress(assets) {
})
}
describe("Test Coinmarketcap mapping", () => {
const cmcMap = JSON.parse(readFileSync("./pricing/coinmarketcap/mapping.json"))
test("Must have items", () => {
expect(cmcMap.length, `CMC map must have items`).toBeGreaterThan(0)
})
test("Items must be sorted by id in desc order", () => {
cmcMap.forEach((el, i) => {
if (i > 0) {
const previousID = cmcMap[i - 1].id
const currentID = el.id
expect(currentID, `Item ${currentID} must be greather or equal to ${previousID} `).toBeGreaterThanOrEqual(previousID)
}
})
})
test("Properies value shoud not contain spaces", () => {
cmcMap.forEach(el => {
Object.keys(el).forEach(key => {
const val = el[key]
if (typeof val === "string") {
expect(val.indexOf(" ") >= 0, ` Property value "${val}" should not contain space`).toBe(false)
}
})
})
});
test("Params should have value and correct type", () => {
cmcMap.forEach(el => {
const {coin, type, id, token_id} = el
expect(typeof coin, `Coin ${coin} must be type "number"`).toBe("number")
expect(["token", "coin"], `Element with id ${id} has wrong type: "${type}"`).toContain(type)
if (type === "token") {
expect(token_id, `token_id ${token_id} with id ${id} must be type not empty`).toBeTruthy()
}
if (type === "coin") {
expect(el, `Element with id ${id} should not have property "token_id"`).not.toHaveProperty("token_id")
}
});
});
test(`"token_id" should be in correct format`, async () => {
const tokenSymbols = await getBinanceBEP2Symbols()
cmcMap.forEach(el => {
const {coin, token_id, type, id} = el
switch (coin) {
case 60 && type === TickerType.Token:
expect(isChecksum(token_id), `"token_id" ${token_id} with id ${id} must be in checksum`).toBe(true)
break;
case 195 && type === TickerType.Token:
expect(isTRC10(token_id) || isTRC20(token_id), `"token_id" ${token_id} with id ${id} must be in TRC10 or TRC20`).toBe(true)
break;
case 714 && type === TickerType.Token:
expect(tokenSymbols.indexOf(token_id), `"token_id" ${token_id} with id ${id} must be BEP2 symbol`).toBe(true)
default:
break;
}
})
})
})
// TODO test whitelist