staking-deposit-cli/staking_deposit/settings.py
Hsiao-Wei Wang 160d69b52b
Update chain settings
1. Add Goerli, which is an alias of Prater
2. Remove Kintsugi
2022-07-28 18:06:54 +08:00

42 lines
1.2 KiB
Python

from typing import Dict, NamedTuple
DEPOSIT_CLI_VERSION = '2.2.0'
class BaseChainSetting(NamedTuple):
NETWORK_NAME: str
GENESIS_FORK_VERSION: bytes
MAINNET = 'mainnet'
ROPSTEN = 'ropsten'
GOERLI = 'goerli'
PRATER = 'prater'
KILN = 'kiln'
# Mainnet setting
MainnetSetting = BaseChainSetting(NETWORK_NAME=MAINNET, GENESIS_FORK_VERSION=bytes.fromhex('00000000'))
# Ropsten setting
RopstenSetting = BaseChainSetting(NETWORK_NAME=ROPSTEN, GENESIS_FORK_VERSION=bytes.fromhex('80000069'))
# GOERLI (PRATER is alias)
_GOERLI_GENESIS_FORK_VERSION = bytes.fromhex('00001020')
GoerliSetting = BaseChainSetting(NETWORK_NAME=GOERLI, GENESIS_FORK_VERSION=_GOERLI_GENESIS_FORK_VERSION)
PraterSetting = BaseChainSetting(NETWORK_NAME=PRATER, GENESIS_FORK_VERSION=_GOERLI_GENESIS_FORK_VERSION)
# Merge Testnet (spec v1.1.9)
KilnSetting = BaseChainSetting(NETWORK_NAME=KILN, GENESIS_FORK_VERSION=bytes.fromhex('70000069'))
ALL_CHAINS: Dict[str, BaseChainSetting] = {
MAINNET: MainnetSetting,
ROPSTEN: RopstenSetting,
GOERLI: GoerliSetting,
PRATER: PraterSetting,
KILN: KilnSetting,
}
def get_chain_setting(chain_name: str = MAINNET) -> BaseChainSetting:
return ALL_CHAINS[chain_name]