Skip to content

Commit

Permalink
add moonbase and celo (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Termina1 authored Sep 15, 2023
1 parent 9747cb8 commit 8053431
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/04-upstream-config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion emerald-grpc
8 changes: 6 additions & 2 deletions src/main/kotlin/io/emeraldpay/dshackle/Chain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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()) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/io/emeraldpay/dshackle/Global.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8053431

Please sign in to comment.