From 0e07278a4c275fc089a425ff6c0e360332b19b29 Mon Sep 17 00:00:00 2001 From: a10zn8 Date: Wed, 19 Jul 2023 13:35:32 +0400 Subject: [PATCH] add base network --- docs/04-upstream-config.adoc | 2 ++ emerald-grpc | 2 +- .../kotlin/io/emeraldpay/dshackle/BlockchainType.kt | 4 +++- src/main/kotlin/io/emeraldpay/dshackle/Chain.kt | 4 +++- src/main/kotlin/io/emeraldpay/dshackle/Global.kt | 2 ++ .../upstream/calls/DefaultEthereumMethods.kt | 3 +++ src/main/resources/chains.yaml | 12 ++++++++++++ 7 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/04-upstream-config.adoc b/docs/04-upstream-config.adoc index b700a1f9..097bf2c5 100644 --- a/docs/04-upstream-config.adoc +++ b/docs/04-upstream-config.adoc @@ -147,6 +147,8 @@ Currently, dshackle supports next chains (should be used as chain names in confi - rinkeby (rinkeby-testnet) - ropsten (ropsten-testnet) - bitcoin (bitcoin-testnet) +- base +- base-goerli === Roles and Fallback upstream diff --git a/emerald-grpc b/emerald-grpc index b08e7107..a89869a1 160000 --- a/emerald-grpc +++ b/emerald-grpc @@ -1 +1 @@ -Subproject commit b08e7107332d4c8b4820bf5b0a7a25ec522ced98 +Subproject commit a89869a14dc8c11ae8cd5380ac9fede5d2680f5e diff --git a/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt b/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt index 27b6a554..062f781b 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/BlockchainType.kt @@ -21,7 +21,9 @@ enum class BlockchainType { chain == Chain.POLYGON_ZKEVM__TESTNET || chain == Chain.ZKSYNC__MAINNET || chain == Chain.ZKSYNC__TESTNET || - chain == Chain.POLYGON_POS__MUMBAI + chain == Chain.POLYGON_POS__MUMBAI || + chain == Chain.BASE__MAINNET || + chain == Chain.BASE__GOERLI ) { return EVM_POS } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt b/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt index 9660e534..528f8b62 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/Chain.kt @@ -47,6 +47,7 @@ enum class Chain(val id: Int, val chainCode: String, val chainName: String) { "Arbitrum Nova" ), ZKSYNC__MAINNET(1009, "ZKSYNC", "ZkSync Era"), + BASE__MAINNET(1010, "BASE", "Base"), // Testnets ETHEREUM__MORDEN(10001, "MORDEN", "Morden Testnet"), @@ -84,7 +85,8 @@ enum class Chain(val id: Int, val chainCode: String, val chainName: String) { 10013, "POLYGON_POS_MUMBAI", "Polygon POS Mumbai Testnet" - ); + ), + BASE__GOERLI(10014, "BASE_GOERLI", "Base Goerli Testnet"); companion object { fun byId(id: Int): Chain { diff --git a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt index 82549097..98f8da97 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/Global.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/Global.kt @@ -77,6 +77,8 @@ class Global { "zksync" to Chain.ZKSYNC__MAINNET, "zksync-testnet" to Chain.ZKSYNC__TESTNET, "polygon-mumbai" to Chain.POLYGON_POS__MUMBAI, + "base" to Chain.BASE__MAINNET, + "base-goerli" to Chain.BASE__GOERLI, ) 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 ae2fc8ce..1737a357 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/calls/DefaultEthereumMethods.kt @@ -271,6 +271,9 @@ class DefaultEthereumMethods( Chain.ZKSYNC__TESTNET to HardcodedData("\"280\"", "\"0x118\""), Chain.BSC__MAINNET to HardcodedData("\"56\"", "\"0x38\""), + + Chain.BASE__MAINNET to HardcodedData("\"8453\"", "\"0x2105\""), + Chain.BASE__GOERLI to HardcodedData("\"84531\"", "\"0x14a33\""), ) override fun executeHardcoded(method: String): ByteArray { diff --git a/src/main/resources/chains.yaml b/src/main/resources/chains.yaml index 0bb8a5be..6b7fab26 100644 --- a/src/main/resources/chains.yaml +++ b/src/main/resources/chains.yaml @@ -78,3 +78,15 @@ chain-settings: lags: syncing: 40 lagging: 20 + - id: base + options: + validate-peers: false + lags: + syncing: 40 + lagging: 20 + - id: base-goerli + options: + validate-peers: false + lags: + syncing: 40 + lagging: 20