From 92e22de83f66d53e4b410008c853520fcb11f357 Mon Sep 17 00:00:00 2001 From: Termina1 Date: Wed, 13 Sep 2023 19:42:56 +0300 Subject: [PATCH] add moonbase and celo --- docs/04-upstream-config.adoc | 5 +++++ emerald-grpc | 2 +- src/main/kotlin/io/emeraldpay/dshackle/Chain.kt | 8 ++++++-- src/main/kotlin/io/emeraldpay/dshackle/Global.kt | 5 +++++ .../dshackle/upstream/calls/DefaultEthereumMethods.kt | 7 +++++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/04-upstream-config.adoc b/docs/04-upstream-config.adoc index 9f9202822..a7c9564bb 100644 --- a/docs/04-upstream-config.adoc +++ b/docs/04-upstream-config.adoc @@ -167,6 +167,11 @@ Currently, dshackle supports next chains (should be used as chain names in confi - mantle-testnet - klaytn - klaytn-baobab +- celo +- celo-alfajores +- moonbeam +- moonriver +- moonbase-alpha === Roles and Fallback upstream diff --git a/emerald-grpc b/emerald-grpc index 1bda79548..31b4b70fa 160000 --- a/emerald-grpc +++ b/emerald-grpc @@ -1 +1 @@ -Subproject commit 1bda79548a965629cdf4c75e709fd4d8cd821f20 +Subproject commit 31b4b70fa57463a342efd7b496b9be5b895b20bc diff --git a/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt b/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt index 2eb8c7104..a0087faef 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt @@ -56,6 +56,9 @@ enum class Chain(val id: Int, val chainCode: String, val chainName: String) { // SCROLL__MAINNET(1016, "SCROLL", "Scroll"), MANTLE__MAINNET(1017, "MANTLE", "Mantle"), KLAYTN__MAINNET(1018, "KLAYTN", "Klaytn"), + CELO__MAINNET(1019, "CELO_MAINNET", "Celo"), + MOONBEAM__MAINNET(1020, "MOONBEAM_MAINNET", "Moonbeam"), + MOONBEAM__MOONRIVER(1021, "MOONBASE_MOONRIVER", "Moonriver"), // Testnets ETHEREUM__MORDEN(10001, "MORDEN", "Morden Testnet"), @@ -107,8 +110,9 @@ enum class Chain(val id: Int, val chainCode: String, val chainName: String) { KLAYTN__BAOBAB(10024, "KLAYTN_BAOBAB", "Klaytn Baobab"), SCROLL__SEPOLIA(10025, "SCROLL_SEPOLIA", "Scroll Sepolia"), BSC__TESTNET(10026, "BSC_TESTNET", "Binance Smart Chain Testnet"), - ETHEREUM__HOLESKY(10027, "ETHEREUM_HOLESKY", "Ethereum Holesky"); - + ETHEREUM__HOLESKY(10027, "ETHEREUM_HOLESKY", "Ethereum Holesky"), + CELO__ALFAJORES(10028, "CELO_ALFAJORES", "Celo Alfajores"), + MOONBEAM__ALPHA(10029, "MOONBEAM_ALPHA", "Moonbase Alpha"); companion object { fun byId(id: Int): Chain { for (chain in values()) { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt index 246300706..78ffdc6fc 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt @@ -101,6 +101,11 @@ class Global { "mantle-testnet" to Chain.MANTLE__TESTNET, "klaytn" to Chain.KLAYTN__MAINNET, "klaytn-baobab" to Chain.KLAYTN__BAOBAB, + "celo" to Chain.CELO__MAINNET, + "celo-alfajores" to Chain.CELO__ALFAJORES, + "moonriver" to Chain.MOONBEAM__MOONRIVER, + "moonbeam" to Chain.MOONBEAM__MAINNET, + "moonbase-alpha" to Chain.MOONBEAM__ALPHA ) fun chainById(id: String?): Chain { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt index 5e708f398..2f2ddaa52 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -127,6 +127,13 @@ class DefaultEthereumMethods( Chain.MANTLE__TESTNET to createHardcodedData("\"5001\"", "\"0x1389\""), Chain.KLAYTN__MAINNET to createHardcodedData("\"8217\"", "\"0x2019\""), Chain.KLAYTN__BAOBAB to createHardcodedData("\"1001\"", "\"0x3e9\""), + + Chain.MOONBEAM__MAINNET to createHardcodedData("\"1284\"", "\"0x504\""), + Chain.MOONBEAM__MOONRIVER to createHardcodedData("\"1285\"", "\"0x505\""), + Chain.MOONBEAM__ALPHA to createHardcodedData("\"1287\"", "\"0x507\""), + + Chain.CELO__MAINNET to createHardcodedData("\"42220\"", "\"0xa4ec\""), + Chain.CELO__ALFAJORES to createHardcodedData("\"44787\"", "\"0xaef3\""), ) fun getChainByData(data: HardcodedData) = CHAIN_DATA.entries.find { it.value == data }?.key