mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
Add status field and remove deprecated field
This commit is contained in:
parent
314123e442
commit
956e7bd0db
|
@ -69,6 +69,9 @@ If the chain is an L2 or a shard of another chain you can link it to the parent
|
||||||
|
|
||||||
where you need to specify type 2 and the reference to an existing parent. The field about bridges is optional.
|
where you need to specify type 2 and the reference to an existing parent. The field about bridges is optional.
|
||||||
|
|
||||||
|
You can add a `status` field e.g. to `deprecate` a chain (a chain should never be deleted as this would open the door to replay attacks)
|
||||||
|
Other options for `status` are `active` (default) or `incubating`
|
||||||
|
|
||||||
## Aggregation
|
## Aggregation
|
||||||
|
|
||||||
There are also aggregated json files with all chains automatically assembled:
|
There are also aggregated json files with all chains automatically assembled:
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
"shortName": "mrock-old",
|
"shortName": "mrock-old",
|
||||||
"chainId": 1286,
|
"chainId": 1286,
|
||||||
"networkId": 1286,
|
"networkId": 1286,
|
||||||
"deprecated": true
|
"status": "deprecated"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
"shortName": "cennz-old",
|
"shortName": "cennz-old",
|
||||||
"chainId": 1337,
|
"chainId": 1337,
|
||||||
"networkId": 1337,
|
"networkId": 1337,
|
||||||
"deprecated": true
|
"status": "deprecated"
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
"shortName": "SO1-old",
|
"shortName": "SO1-old",
|
||||||
"chainId": 218,
|
"chainId": 218,
|
||||||
"networkId": 218,
|
"networkId": 218,
|
||||||
"deprecated": true
|
"status":"deprecated"
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ val optionalFields = listOf(
|
||||||
"title",
|
"title",
|
||||||
"network",
|
"network",
|
||||||
"parent",
|
"parent",
|
||||||
"deprecated"
|
"status"
|
||||||
)
|
)
|
||||||
|
|
||||||
val moshi: Moshi = Moshi.Builder().build()
|
val moshi: Moshi = Moshi.Builder().build()
|
||||||
|
|
|
@ -17,7 +17,7 @@ val dataPath = File(basePath, "_data")
|
||||||
val iconsPath = File(dataPath, "icons")
|
val iconsPath = File(dataPath, "icons")
|
||||||
|
|
||||||
val chainsPath = File(dataPath, "chains")
|
val chainsPath = File(dataPath, "chains")
|
||||||
private val allFiles = chainsPath.listFiles() ?: error("$chainsPath must contain the chain json files - but it does not")
|
private val allFiles = chainsPath.listFiles() ?: error("${chainsPath.absolutePath} must contain the chain json files - but it does not")
|
||||||
private val allChainFiles = allFiles.filter { !it.isDirectory }
|
private val allChainFiles = allFiles.filter { !it.isDirectory }
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
@ -235,9 +235,12 @@ fun checkChain(chainFile: File, connectRPC: Boolean) {
|
||||||
throw ENSRegistryAddressMustBeValid()
|
throw ENSRegistryAddressMustBeValid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsonObject["deprecated"]?.let {
|
jsonObject["status"]?.let {
|
||||||
if (it !is Boolean) {
|
if (it !is String) {
|
||||||
throw DeprecatedMustBeBoolean()
|
throw StatusMustBeString()
|
||||||
|
}
|
||||||
|
if (!setOf("incubating","active","deprecated").contains(it)) {
|
||||||
|
throw StatusMustBeIncubatingActiveOrDeprecated()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsonObject["parent"]?.let {
|
jsonObject["parent"]?.let {
|
||||||
|
|
|
@ -26,7 +26,8 @@ class ParentBridgeNoArray: Exception("parent bridge must be array")
|
||||||
class BridgeNoObject: Exception("parent bridges must be array consisting of json objects")
|
class BridgeNoObject: Exception("parent bridges must be array consisting of json objects")
|
||||||
class BridgeOnlyURL: Exception("parent bridge only contain an URL")
|
class BridgeOnlyURL: Exception("parent bridge only contain an URL")
|
||||||
class ParentChainDoesNotExist(chain: String): Exception("Referenced parent chain ($chain) does not exist")
|
class ParentChainDoesNotExist(chain: String): Exception("Referenced parent chain ($chain) does not exist")
|
||||||
class DeprecatedMustBeBoolean: Exception("deprecated must be boolean")
|
class StatusMustBeString: Exception("status must be a string")
|
||||||
|
class StatusMustBeIncubatingActiveOrDeprecated: Exception("status must be either incubating, active or deprecated")
|
||||||
class NativeCurrencyMustBeObject: Exception("Native currency must be object")
|
class NativeCurrencyMustBeObject: Exception("Native currency must be object")
|
||||||
class NativeCurrencySymbolMustBeString: Exception("Native currency symbol must be string")
|
class NativeCurrencySymbolMustBeString: Exception("Native currency symbol must be string")
|
||||||
class NativeCurrencySymbolMustHaveLessThan7Chars: Exception("Native currency symbol must have less than 7 chars")
|
class NativeCurrencySymbolMustHaveLessThan7Chars: Exception("Native currency symbol must have less than 7 chars")
|
||||||
|
|
|
@ -221,9 +221,14 @@ class TheChainChecker {
|
||||||
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
|
checkChain(getFile("invalid/explorermissingurl/eip155-1.json"), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = DeprecatedMustBeBoolean::class)
|
@Test(expected = StatusMustBeString::class)
|
||||||
fun shouldFailOnInvalidDeprecation() {
|
fun shouldFailOnInvalidStatusType() {
|
||||||
checkChain(getFile("invalid/invalid_deprecation/eip155-1.json"), false)
|
checkChain(getFile("invalid/invalid_status/eip155-1.json"), false)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = StatusMustBeIncubatingActiveOrDeprecated::class)
|
||||||
|
fun shouldFailOnInvalidStatus() {
|
||||||
|
checkChain(getFile("invalid/invalid_status/eip155-2.json"), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,5 +17,5 @@
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"explorers": [],
|
"explorers": [],
|
||||||
"deprecated": "yolo"
|
"status": 1
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "Ethereum Mainnet",
|
||||||
|
"shortName": "eth",
|
||||||
|
"chain": "ETH",
|
||||||
|
"network": "mainnet",
|
||||||
|
"chainId": 2,
|
||||||
|
"networkId": 2,
|
||||||
|
"rpc": [
|
||||||
|
"https://mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||||
|
"https://api.mycryptoapi.com/eth"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"infoURL": "https://ethereum.org",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Ether",
|
||||||
|
"symbol": "ETH",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"explorers": [],
|
||||||
|
"status": "yolo"
|
||||||
|
}
|
|
@ -15,6 +15,5 @@
|
||||||
"name": "Ether",
|
"name": "Ether",
|
||||||
"symbol": "ETH",
|
"symbol": "ETH",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
}
|
||||||
"deprecated": true
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user