Skip to content

Commit

Permalink
MeerChainConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
lochjin committed Mar 28, 2023
1 parent d3774ab commit a7e8e2c
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
12 changes: 12 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,18 @@ func (c *ChainConfig) Description() string {
} else {
banner += "Consensus: Beacon (proof-of-stake), merged from Clique (proof-of-authority)\n"
}
case IsQngNetwork(c.ChainID):
banner += "Consensus: MeerDAG (proof-of-work)\n"
return banner
case IsAmanaNetwork(c.ChainID):
banner += "Consensus: Amana (proof-of-authority)\n"
return banner
case IsFlanaNetwork(c.ChainID):
banner += "Consensus: Flana (rollup)\n"
return banner
case IsMizanaNetwork(c.ChainID):
banner += "Consensus: Mizana (ZK rollup)\n"
return banner
default:
banner += "Consensus: unknown\n"
}
Expand Down
123 changes: 123 additions & 0 deletions params/qng_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package params

import "math/big"

type MeerChainConfig struct {
ChainID *big.Int // chainId identifies the current chain and is used for replay protection
}

var (
QngMainnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(813),
}
QngTestnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8131),
}
QngMixnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8132),
}
QngPrivnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8133),
}

AmanaChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8134),
}
AmanaTestnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81341),
}
AmanaMixnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81342),
}
AmanaPrivnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81343),
}

FlanaChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8135),
}
FlanaTestnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81351),
}
FlanaMixnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81352),
}
FlanaPrivnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81353),
}

MizanaChainConfig = &MeerChainConfig{
ChainID: big.NewInt(8136),
}
MizanaTestnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81361),
}
MizanaMixnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81362),
}
MizanaPrivnetChainConfig = &MeerChainConfig{
ChainID: big.NewInt(81363),
}
)

func init() {
NetworkNames[QngMainnetChainConfig.ChainID.String()] = "qng"
NetworkNames[QngTestnetChainConfig.ChainID.String()] = "qng-test"
NetworkNames[QngMixnetChainConfig.ChainID.String()] = "qng-mix"
NetworkNames[QngPrivnetChainConfig.ChainID.String()] = "qng-priv"

NetworkNames[AmanaChainConfig.ChainID.String()] = "amana"
NetworkNames[AmanaTestnetChainConfig.ChainID.String()] = "amana-test"
NetworkNames[AmanaMixnetChainConfig.ChainID.String()] = "amana-mix"
NetworkNames[AmanaPrivnetChainConfig.ChainID.String()] = "amana-priv"

NetworkNames[FlanaChainConfig.ChainID.String()] = "flana"
NetworkNames[FlanaTestnetChainConfig.ChainID.String()] = "flana-test"
NetworkNames[FlanaMixnetChainConfig.ChainID.String()] = "flana-mix"
NetworkNames[FlanaPrivnetChainConfig.ChainID.String()] = "flana-priv"

NetworkNames[MizanaChainConfig.ChainID.String()] = "mizana"
NetworkNames[MizanaTestnetChainConfig.ChainID.String()] = "mizana-test"
NetworkNames[MizanaMixnetChainConfig.ChainID.String()] = "mizana-mix"
NetworkNames[MizanaPrivnetChainConfig.ChainID.String()] = "mizana-priv"
}

func IsQngNetwork(chainID *big.Int) bool {
if chainID == QngMainnetChainConfig.ChainID ||
chainID == QngTestnetChainConfig.ChainID ||
chainID == QngMixnetChainConfig.ChainID ||
chainID == QngPrivnetChainConfig.ChainID {
return true
}
return false
}

func IsAmanaNetwork(chainID *big.Int) bool {
if chainID == AmanaChainConfig.ChainID ||
chainID == AmanaTestnetChainConfig.ChainID ||
chainID == AmanaMixnetChainConfig.ChainID ||
chainID == AmanaPrivnetChainConfig.ChainID {
return true
}
return false
}

func IsFlanaNetwork(chainID *big.Int) bool {
if chainID == FlanaChainConfig.ChainID ||
chainID == FlanaTestnetChainConfig.ChainID ||
chainID == FlanaMixnetChainConfig.ChainID ||
chainID == FlanaPrivnetChainConfig.ChainID {
return true
}
return false
}

func IsMizanaNetwork(chainID *big.Int) bool {
if chainID == MizanaChainConfig.ChainID ||
chainID == MizanaTestnetChainConfig.ChainID ||
chainID == MizanaMixnetChainConfig.ChainID ||
chainID == MizanaPrivnetChainConfig.ChainID {
return true
}
return false
}

0 comments on commit a7e8e2c

Please sign in to comment.