diff --git a/_data/chains/eip155-16001.json b/_data/chains/eip155-16001.json index 9727cebc..64d0a66a 100644 --- a/_data/chains/eip155-16001.json +++ b/_data/chains/eip155-16001.json @@ -9,7 +9,7 @@ ], "nativeCurrency": { "name": "MetaDot Token TestNet", - "symbol": "MTT-test", + "symbol": "MTTest", "decimals": 18 }, "infoURL": "https://metadot.network", diff --git a/_data/chains/eip155-200101.json b/_data/chains/eip155-200101.json index 0e5dee2d..00395c65 100644 --- a/_data/chains/eip155-200101.json +++ b/_data/chains/eip155-200101.json @@ -10,7 +10,7 @@ "faucets": [], "nativeCurrency": { "name": "milkTAda", - "symbol": "milkTAda", + "symbol": "mTAda", "decimals": 18 }, "infoURL": "https://milkomeda.com", @@ -24,4 +24,4 @@ "standard": "none" } ] -} \ No newline at end of file +} diff --git a/_data/chains/eip155-385.json b/_data/chains/eip155-385.json index afb79bac..30c74158 100644 --- a/_data/chains/eip155-385.json +++ b/_data/chains/eip155-385.json @@ -9,11 +9,11 @@ ], "nativeCurrency": { "name": "Lisinski Ether", - "symbol": "LISINSKI", + "symbol": "LISINS", "decimals": 18 }, "infoURL": "https://lisinski.online", "shortName": "lisinski", "chainId": 385, "networkId": 385 -} \ No newline at end of file +} diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt index ace5915c..786f9352 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/Main.kt @@ -171,6 +171,29 @@ fun checkChain(chainFile: File, connectRPC: Boolean) { } } + jsonObject["nativeCurrency"]?.let { + if (it !is JsonObject) { + throw NativeCurrencyMustBeObject() + } + val symbol = it["symbol"] + if (symbol !is String) { + throw NativeCurrencySymbolMustBeString() + } + + if (symbol.length >= 7) { + throw NativeCurrencySymbolMustHaveLessThan7Chars() + } + if (it.keys != setOf("symbol","decimals","name")) { + throw NativeCurrencyCanOnlyHaveSymbolNameAndDecimals() + } + if (it["decimals"] !is Int) { + throw NativeCurrencyDecimalMustBeInt() + } + if (it["name"] !is String) { + throw NativeCurrencyNameMustBeString() + } + } + jsonObject["explorers"]?.let { if (it !is JsonArray<*>) { throw (ExplorersMustBeArray()) diff --git a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt index 522e9eb2..f02e62da 100644 --- a/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt +++ b/processor/src/main/kotlin/org/ethereum/lists/chains/model/Exceptions.kt @@ -26,4 +26,10 @@ class ParentBridgeNoArray: Exception("parent bridge must be array") class BridgeNoObject: Exception("parent bridges must be array consisting of json objects") class BridgeOnlyURL: Exception("parent bridge only contain an URL") class ParentChainDoesNotExist(chain: String): Exception("Referenced parent chain ($chain) does not exist") -class DeprecatedMustBeBoolean: Exception("deprecated must be boolean") \ No newline at end of file +class DeprecatedMustBeBoolean: Exception("deprecated must be boolean") +class NativeCurrencyMustBeObject: Exception("Native currency must be object") +class NativeCurrencySymbolMustBeString: Exception("Native currency symbol must be string") +class NativeCurrencySymbolMustHaveLessThan7Chars: Exception("Native currency symbol must have less than 7 chars") +class NativeCurrencyCanOnlyHaveSymbolNameAndDecimals: Exception("Native currency can only have symbol decimals and name") +class NativeCurrencyDecimalMustBeInt: Exception("Native currency decimals must be int") +class NativeCurrencyNameMustBeString: Exception("Native currency name must be string") \ No newline at end of file