From a957795c2087153721ec9250d8533174f15c041d Mon Sep 17 00:00:00 2001 From: Adam R <13562139+catenocrypt@users.noreply.github.com> Date: Fri, 12 Mar 2021 19:01:29 +0100 Subject: [PATCH] [Internal] Add check and fix id field (#5904) * Add check for existence of id field. * Fix id field if it differs from address. * Fix a few tokens with casing differences. Co-authored-by: Catenocrypt --- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- .../info.json | 2 +- script/generic/asset-infos.ts | 22 ++++++++++++++----- 10 files changed, 26 insertions(+), 14 deletions(-) diff --git a/blockchains/ethereum/assets/0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c/info.json b/blockchains/ethereum/assets/0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c/info.json index 05e7de3be..2818881cd 100644 --- a/blockchains/ethereum/assets/0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c/info.json +++ b/blockchains/ethereum/assets/0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c/info.json @@ -10,5 +10,5 @@ "symbol": "BFC", "decimals": 18, "status": "active", - "id": "0x0c7d5ae016f806603cb1782bea29ac69471cab9c" + "id": "0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x1fE24F25b1Cf609B9c4e7E12D802e3640dFA5e43/info.json b/blockchains/ethereum/assets/0x1fE24F25b1Cf609B9c4e7E12D802e3640dFA5e43/info.json index 54d735c11..2b8b9f8cc 100644 --- a/blockchains/ethereum/assets/0x1fE24F25b1Cf609B9c4e7E12D802e3640dFA5e43/info.json +++ b/blockchains/ethereum/assets/0x1fE24F25b1Cf609B9c4e7E12D802e3640dFA5e43/info.json @@ -14,5 +14,5 @@ "symbol": "CGG", "decimals": 18, "status": "active", - "id": "0x1fe24f25b1cf609b9c4e7e12d802e3640dfa5e43" + "id": "0x1fE24F25b1Cf609B9c4e7E12D802e3640dFA5e43" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be/info.json b/blockchains/ethereum/assets/0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be/info.json index b850fa238..ec75522b9 100644 --- a/blockchains/ethereum/assets/0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be/info.json +++ b/blockchains/ethereum/assets/0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be/info.json @@ -7,5 +7,5 @@ "symbol": "WSCRT", "decimals": 6, "status": "active", - "id": "0x2b89bf8ba858cd2fcee1fada378d5cd6936968be" + "id": "0x2B89bF8ba858cd2FCee1faDa378D5cd6936968Be" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x4691937a7508860F876c9c0a2a617E7d9E945D4B/info.json b/blockchains/ethereum/assets/0x4691937a7508860F876c9c0a2a617E7d9E945D4B/info.json index bb3cc8b7d..c5695d5dc 100644 --- a/blockchains/ethereum/assets/0x4691937a7508860F876c9c0a2a617E7d9E945D4B/info.json +++ b/blockchains/ethereum/assets/0x4691937a7508860F876c9c0a2a617E7d9E945D4B/info.json @@ -7,5 +7,5 @@ "description": "Wootrade is a layer one trading infrastructure complete with deep liquidity, frontend trading GUI, and the ability to integrate into any exchange, trading desk, wallet, dApp, or other trading-related platform.", "explorer": "https://etherscan.io/token/0x4691937a7508860f876c9c0a2a617e7d9e945d4b", "status": "active", - "id": "0x4691937a7508860f876c9c0a2a617e7d9e945d4b" + "id": "0x4691937a7508860F876c9c0a2a617E7d9E945D4B" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0x661Ab0Ed68000491d98C796146bcF28c20d7c559/info.json b/blockchains/ethereum/assets/0x661Ab0Ed68000491d98C796146bcF28c20d7c559/info.json index 43a14be18..4d7cd4140 100644 --- a/blockchains/ethereum/assets/0x661Ab0Ed68000491d98C796146bcF28c20d7c559/info.json +++ b/blockchains/ethereum/assets/0x661Ab0Ed68000491d98C796146bcF28c20d7c559/info.json @@ -7,5 +7,5 @@ "website": "http://shadows.link/", "explorer": "https://etherscan.io/token/0x661ab0ed68000491d98c796146bcf28c20d7c559", "status": "active", - "id": "0x661ab0ed68000491d98c796146bcf28c20d7c559" + "id": "0x661Ab0Ed68000491d98C796146bcF28c20d7c559" } \ No newline at end of file diff --git a/blockchains/ethereum/assets/0xb0dFd28d3CF7A5897C694904Ace292539242f858/info.json b/blockchains/ethereum/assets/0xb0dFd28d3CF7A5897C694904Ace292539242f858/info.json index a8b539eb2..80b8532b5 100644 --- a/blockchains/ethereum/assets/0xb0dFd28d3CF7A5897C694904Ace292539242f858/info.json +++ b/blockchains/ethereum/assets/0xb0dFd28d3CF7A5897C694904Ace292539242f858/info.json @@ -7,5 +7,5 @@ "symbol": "LOTTO", "decimals": 18, "status": "active", - "id": "0xb0dfd28d3cf7a5897c694904ace292539242f858" + "id": "0xb0dFd28d3CF7A5897C694904Ace292539242f858" } \ No newline at end of file diff --git a/blockchains/smartchain/assets/0x851F7a700c5d67DB59612b871338a85526752c25/info.json b/blockchains/smartchain/assets/0x851F7a700c5d67DB59612b871338a85526752c25/info.json index 43c0d7f40..816ff850e 100644 --- a/blockchains/smartchain/assets/0x851F7a700c5d67DB59612b871338a85526752c25/info.json +++ b/blockchains/smartchain/assets/0x851F7a700c5d67DB59612b871338a85526752c25/info.json @@ -7,5 +7,5 @@ "description": "Worlds first and only blockchain-based freelancer platform on the Binance Chain network, working with fully decentralized and smart contracts.", "explorer": "https://bscscan.com/token/0x851f7a700c5d67db59612b871338a85526752c25", "status": "active", - "id": "0x851f7a700c5d67db59612b871338a85526752c25" + "id": "0x851F7a700c5d67DB59612b871338a85526752c25" } \ No newline at end of file diff --git a/blockchains/smartchain/assets/0xAd6172123E1Bd3B4ce0B01ef92fDD63E83590b99/info.json b/blockchains/smartchain/assets/0xAd6172123E1Bd3B4ce0B01ef92fDD63E83590b99/info.json index ff5ca03e9..b347a7eb6 100644 --- a/blockchains/smartchain/assets/0xAd6172123E1Bd3B4ce0B01ef92fDD63E83590b99/info.json +++ b/blockchains/smartchain/assets/0xAd6172123E1Bd3B4ce0B01ef92fDD63E83590b99/info.json @@ -7,5 +7,5 @@ "symbol": "OXT", "decimals": 18, "status": "active", - "id": "0xad6172123e1bd3b4ce0b01ef92fdd63e83590b99" + "id": "0xAd6172123E1Bd3B4ce0B01ef92fDD63E83590b99" } \ No newline at end of file diff --git a/blockchains/smartchain/assets/0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6/info.json b/blockchains/smartchain/assets/0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6/info.json index 29d9dcf9d..60df7e037 100644 --- a/blockchains/smartchain/assets/0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6/info.json +++ b/blockchains/smartchain/assets/0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6/info.json @@ -25,5 +25,5 @@ "symbol": "EGG", "decimals": 18, "status": "active", - "id": "0xf952fc3ca7325cc27d15885d37117676d25bfda6" + "id": "0xF952Fc3ca7325Cc27D15885d37117676d25BfdA6" } \ No newline at end of file diff --git a/script/generic/asset-infos.ts b/script/generic/asset-infos.ts index ff0febd08..cb2941fbf 100644 --- a/script/generic/asset-infos.ts +++ b/script/generic/asset-infos.ts @@ -29,16 +29,14 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s typeof info['type'] === "string" && info['type'] !== "" && typeof info['symbol'] === "string" && info['symbol'] !== "" && typeof info['decimals'] === "number" && //(info['description'] === "-" || info['decimals'] !== 0) && - typeof info['status'] === "string" && info['status'] !== "" + typeof info['status'] === "string" && info['status'] !== "" && + typeof info['id'] === "string" && info['id'] !== "" ; if (!isKeys1CorrectType) { - return [`Check keys1 '${info['name']}' '${info['type']}' '${info['symbol']}' '${info['decimals']}' '${info['id']}' ${path}`, "", fixedInfo]; + return [`Field missing or invalid; name '${info['name']}' type '${info['type']}' symbol '${info['symbol']}' decimals '${info['decimals']}' id '${info['id']}' ${path}`, "", fixedInfo]; } // type - if (typeof info['type'] !== "string") { - return [`Incorrect type for type '${info['type']}' '${chain}' '${path}`, "", fixedInfo]; - } if (chainFromAssetType(info['type'].toUpperCase()) !== chain ) { return [`Incorrect value for type '${info['type']}' '${chain}' '${path}`, "", fixedInfo]; } @@ -52,6 +50,20 @@ function isAssetInfoValid(info: unknown, path: string, address: string, chain: s fixedInfo['type'] = info['type'].toUpperCase(); } + // id, should match address + if (info['id'] != address) { + if (checkOnly) { + if (info['id'].toUpperCase() != address.toUpperCase()) { + return [`Incorrect value for id '${info['id']}' '${chain}' '${path}`, "", fixedInfo]; + } + // is is correct value, but casing is wrong + return ["", `Wrong casing for id '${info['id']}' '${chain}' '${path}`, fixedInfo]; + } + // fix + if (!fixedInfo) { fixedInfo = info; } + fixedInfo['id'] = address; + } + const isKeys2CorrectType = typeof info['description'] === "string" && info['description'] !== "" && // website should be set (exception description='-' marks empty infos)