all: clean duplicate constants in package common

This commit is contained in:
Daniel Liu 2025-04-02 11:13:13 +08:00 committed by Daniel Liu
parent 468babfc3e
commit a4c7d7f458
11 changed files with 116 additions and 185 deletions

View file

@ -170,7 +170,7 @@ func initGenesis(ctx *cli.Context) error {
} }
if genesis.Config.ChainId != nil { if genesis.Config.ChainId != nil {
common.CopyConstans(genesis.Config.ChainId.Uint64()) common.CopyConstants(genesis.Config.ChainId.Uint64())
} }
// Open an initialise both full and light databases // Open an initialise both full and light databases

View file

@ -148,24 +148,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, XDCConfig) {
if ctx.IsSet(utils.MiningEnabledFlag.Name) { if ctx.IsSet(utils.MiningEnabledFlag.Name) {
log.Warn("The flag --mine is deprecated and will be removed") log.Warn("The flag --mine is deprecated and will be removed")
} }
// if !ctx.IsSet(debug.VerbosityFlag.Name) {
// debug.Verbosity(log.Lvl(cfg.Verbosity))
// }
if !ctx.IsSet(utils.NATFlag.Name) && cfg.NAT != "" { if !ctx.IsSet(utils.NATFlag.Name) && cfg.NAT != "" {
ctx.Set(utils.NATFlag.Name, cfg.NAT) ctx.Set(utils.NATFlag.Name, cfg.NAT)
} }
// Check testnet is enable.
if ctx.Bool(utils.TestnetFlag.Name) {
common.IsTestnet = true
common.TRC21IssuerSMC = common.TRC21IssuerSMCTestNet
cfg.Eth.NetworkId = 51
common.RelayerRegistrationSMC = common.RelayerRegistrationSMCTestnet
common.TIPTRC21Fee = common.TIPTRC21FeeTestnet
common.TIPXDCXCancellationFee = common.TIPXDCXCancellationFeeTestnet
}
if ctx.Bool(utils.EnableXDCPrefixFlag.Name) { if ctx.Bool(utils.EnableXDCPrefixFlag.Name) {
common.Enable0xPrefix = false common.Enable0xPrefix = false
} }

View file

@ -1393,6 +1393,21 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
} }
if ctx.IsSet(NetworkIdFlag.Name) { if ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name) cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name)
switch cfg.NetworkId {
case 50:
if !ctx.IsSet(MainnetFlag.Name) {
ctx.Set(MainnetFlag.Name, "true")
}
case 51:
common.IsTestnet = true
if !ctx.IsSet(TestnetFlag.Name) {
ctx.Set(TestnetFlag.Name, "true")
}
case 551:
if !ctx.IsSet(DevnetFlag.Name) {
ctx.Set(DevnetFlag.Name, "true")
}
}
} }
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) { if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
@ -1457,6 +1472,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
} }
cfg.Genesis = core.DefaultGenesisBlock() cfg.Genesis = core.DefaultGenesisBlock()
case ctx.Bool(TestnetFlag.Name): case ctx.Bool(TestnetFlag.Name):
common.IsTestnet = true
if !ctx.IsSet(NetworkIdFlag.Name) { if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 51 cfg.NetworkId = 51
} }

View file

@ -45,13 +45,11 @@ type constant struct {
tip2019Block *big.Int tip2019Block *big.Int
tipSigning *big.Int tipSigning *big.Int
tipRandomize *big.Int tipRandomize *big.Int
tipNoHalvingMNReward *big.Int // hardfork no halving masternodes reward tipNoHalvingMNReward *big.Int // hard fork no halving masternodes reward
tipXDCX *big.Int tipXDCX *big.Int
tipXDCXLending *big.Int tipXDCXLending *big.Int
tipXDCXCancellationFee *big.Int tipXDCXCancellationFee *big.Int
tipXDCXCancellationFeeTestnet *big.Int
tipTRC21Fee *big.Int tipTRC21Fee *big.Int
tipTRC21FeeTestnet *big.Int
tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block. tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block.
berlinBlock *big.Int berlinBlock *big.Int
londonBlock *big.Int londonBlock *big.Int
@ -66,22 +64,17 @@ type constant struct {
eip1559Block *big.Int eip1559Block *big.Int
cancunBlock *big.Int cancunBlock *big.Int
trc21IssuerSMCTestNet Address trc21IssuerSMC Address
trc21IssuerSMC Address xdcxListingSMC Address
xdcxListingSMC Address relayerRegistrationSMC Address
xdcxListingSMCTestNet Address lendingRegistrationSMC Address
relayerRegistrationSMC Address
relayerRegistrationSMCTestnet Address
lendingRegistrationSMC Address
lendingRegistrationSMCTestnet Address
ignoreSignerCheckBlockArray map[uint64]struct{} ignoreSignerCheckBlockArray map[uint64]struct{}
blacklist map[Address]struct{} blacklist map[Address]struct{}
} }
// variables for specific networks, copy values from MaintnetConstant to pass tests // variables for specific networks, copy values from maintnet constant to pass tests
var ( var (
BlackListHFNumber = MaintnetConstant.blackListHFNumber BlackListHFNumber = MaintnetConstant.blackListHFNumber
MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes
@ -93,9 +86,7 @@ var (
TIPXDCX = MaintnetConstant.tipXDCX TIPXDCX = MaintnetConstant.tipXDCX
TIPXDCXLending = MaintnetConstant.tipXDCXLending TIPXDCXLending = MaintnetConstant.tipXDCXLending
TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = MaintnetConstant.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = MaintnetConstant.tipTRC21Fee TIPTRC21Fee = MaintnetConstant.tipTRC21Fee
TIPTRC21FeeTestnet = MaintnetConstant.tipTRC21FeeTestnet
TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes
BerlinBlock = MaintnetConstant.berlinBlock BerlinBlock = MaintnetConstant.berlinBlock
LondonBlock = MaintnetConstant.londonBlock LondonBlock = MaintnetConstant.londonBlock
@ -109,15 +100,10 @@ var (
TIPUpgradeReward = MaintnetConstant.tipUpgradeReward TIPUpgradeReward = MaintnetConstant.tipUpgradeReward
TIPEpochHalving = MaintnetConstant.tipEpochHalving TIPEpochHalving = MaintnetConstant.tipEpochHalving
TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC
TRC21IssuerSMCTestNet = MaintnetConstant.trc21IssuerSMCTestNet XDCXListingSMC = MaintnetConstant.xdcxListingSMC
XDCXListingSMC = MaintnetConstant.xdcxListingSMC RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
XDCXListingSMCTestNet = MaintnetConstant.xdcxListingSMCTestNet LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = MaintnetConstant.relayerRegistrationSMCTestnet
LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray ignoreSignerCheckBlockArray = MaintnetConstant.ignoreSignerCheckBlockArray
blacklist = MaintnetConstant.blacklist blacklist = MaintnetConstant.blacklist
@ -136,9 +122,9 @@ func IsInBlacklist(address *Address) bool {
return ok return ok
} }
// CopyConstans only handles testnet, devnet, local. It does not // CopyConstants only handles testnet, devnet, local network.
// handles mainnet since the default value is from mainnet. // It skips mainnet since the default value is from mainnet.
func CopyConstans(chainID uint64) { func CopyConstants(chainID uint64) {
var c *constant var c *constant
if chainID == TestnetConstant.chainID { if chainID == TestnetConstant.chainID {
c = &TestnetConstant c = &TestnetConstant
@ -160,9 +146,7 @@ func CopyConstans(chainID uint64) {
TIPXDCX = c.tipXDCX TIPXDCX = c.tipXDCX
TIPXDCXLending = c.tipXDCXLending TIPXDCXLending = c.tipXDCXLending
TIPXDCXCancellationFee = c.tipXDCXCancellationFee TIPXDCXCancellationFee = c.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = c.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = c.tipTRC21Fee TIPTRC21Fee = c.tipTRC21Fee
TIPTRC21FeeTestnet = c.tipTRC21FeeTestnet
TIPIncreaseMasternodes = c.tipIncreaseMasternodes TIPIncreaseMasternodes = c.tipIncreaseMasternodes
BerlinBlock = c.berlinBlock BerlinBlock = c.berlinBlock
LondonBlock = c.londonBlock LondonBlock = c.londonBlock
@ -177,14 +161,9 @@ func CopyConstans(chainID uint64) {
TIPEpochHalving = c.tipEpochHalving TIPEpochHalving = c.tipEpochHalving
TRC21IssuerSMC = c.trc21IssuerSMC TRC21IssuerSMC = c.trc21IssuerSMC
TRC21IssuerSMCTestNet = c.trc21IssuerSMCTestNet
XDCXListingSMC = c.xdcxListingSMC XDCXListingSMC = c.xdcxListingSMC
XDCXListingSMCTestNet = c.xdcxListingSMCTestNet
RelayerRegistrationSMC = c.relayerRegistrationSMC RelayerRegistrationSMC = c.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = c.relayerRegistrationSMCTestnet
LendingRegistrationSMC = c.lendingRegistrationSMC LendingRegistrationSMC = c.lendingRegistrationSMC
LendingRegistrationSMCTestnet = c.lendingRegistrationSMCTestnet
clear(ignoreSignerCheckBlockArray) clear(ignoreSignerCheckBlockArray)
maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray) maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray)

View file

@ -9,39 +9,32 @@ var DevnetConstant = constant{
blackListHFNumber: 0, blackListHFNumber: 0,
maxMasternodesV2: 108, maxMasternodesV2: 108,
tip2019Block: big.NewInt(0), tip2019Block: big.NewInt(0),
tipSigning: big.NewInt(0), tipSigning: big.NewInt(0),
tipRandomize: big.NewInt(0), tipRandomize: big.NewInt(0),
tipNoHalvingMNReward: big.NewInt(0), tipNoHalvingMNReward: big.NewInt(0),
tipXDCX: big.NewInt(0), tipXDCX: big.NewInt(0),
tipXDCXLending: big.NewInt(0), tipXDCXLending: big.NewInt(0),
tipXDCXCancellationFee: big.NewInt(0), tipXDCXCancellationFee: big.NewInt(0),
tipXDCXCancellationFeeTestnet: big.NewInt(0), tipTRC21Fee: big.NewInt(13523400),
tipTRC21Fee: big.NewInt(13523400), tipIncreaseMasternodes: big.NewInt(0),
tipTRC21FeeTestnet: big.NewInt(225000), berlinBlock: big.NewInt(0),
tipIncreaseMasternodes: big.NewInt(0), londonBlock: big.NewInt(0),
berlinBlock: big.NewInt(0), mergeBlock: big.NewInt(0),
londonBlock: big.NewInt(0), shanghaiBlock: big.NewInt(0),
mergeBlock: big.NewInt(0), blockNumberGas50x: big.NewInt(0),
shanghaiBlock: big.NewInt(0), TIPV2SwitchBlock: big.NewInt(0),
blockNumberGas50x: big.NewInt(0), tipXDCXMinerDisable: big.NewInt(0),
TIPV2SwitchBlock: big.NewInt(0), tipXDCXReceiverDisable: big.NewInt(0),
tipXDCXMinerDisable: big.NewInt(0), eip1559Block: big.NewInt(0),
tipXDCXReceiverDisable: big.NewInt(0), cancunBlock: big.NewInt(1702800),
eip1559Block: big.NewInt(0), tipUpgradeReward: big.NewInt(1773000),
cancunBlock: big.NewInt(1702800), tipEpochHalving: big.NewInt(9999999999),
tipUpgradeReward: big.NewInt(1773000),
tipEpochHalving: big.NewInt(9999999999),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"), trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"), xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"), relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"), lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
relayerRegistrationSMCTestnet: HexToAddress("0xA1996F69f47ba14Cb7f661010A7C31974277958c"),
lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
lendingRegistrationSMCTestnet: HexToAddress("0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"),
ignoreSignerCheckBlockArray: map[uint64]struct{}{ ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {}, 1032300: {},

View file

@ -9,39 +9,32 @@ var localConstant = constant{
maxMasternodesV2: 108, maxMasternodesV2: 108,
blackListHFNumber: 0, blackListHFNumber: 0,
tip2019Block: big.NewInt(0), tip2019Block: big.NewInt(0),
tipSigning: big.NewInt(0), tipSigning: big.NewInt(0),
tipRandomize: big.NewInt(0), tipRandomize: big.NewInt(0),
tipNoHalvingMNReward: big.NewInt(0), tipNoHalvingMNReward: big.NewInt(0),
tipXDCX: big.NewInt(0), tipXDCX: big.NewInt(0),
tipXDCXLending: big.NewInt(0), tipXDCXLending: big.NewInt(0),
tipXDCXCancellationFee: big.NewInt(0), tipXDCXCancellationFee: big.NewInt(0),
tipXDCXCancellationFeeTestnet: big.NewInt(0), tipTRC21Fee: big.NewInt(0),
tipTRC21Fee: big.NewInt(13523400), tipIncreaseMasternodes: big.NewInt(0),
tipTRC21FeeTestnet: big.NewInt(225000), berlinBlock: big.NewInt(0),
tipIncreaseMasternodes: big.NewInt(0), londonBlock: big.NewInt(0),
berlinBlock: big.NewInt(0), mergeBlock: big.NewInt(0),
londonBlock: big.NewInt(0), shanghaiBlock: big.NewInt(0),
mergeBlock: big.NewInt(0), blockNumberGas50x: big.NewInt(0),
shanghaiBlock: big.NewInt(0), TIPV2SwitchBlock: big.NewInt(0),
blockNumberGas50x: big.NewInt(0), tipXDCXMinerDisable: big.NewInt(0),
TIPV2SwitchBlock: big.NewInt(0), tipXDCXReceiverDisable: big.NewInt(0),
tipXDCXMinerDisable: big.NewInt(0), eip1559Block: big.NewInt(0),
tipXDCXReceiverDisable: big.NewInt(0), cancunBlock: big.NewInt(0),
eip1559Block: big.NewInt(0), tipUpgradeReward: big.NewInt(0),
cancunBlock: big.NewInt(0), tipEpochHalving: big.NewInt(0),
tipUpgradeReward: big.NewInt(0),
tipEpochHalving: big.NewInt(0),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"), trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"), xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"), relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"), lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
relayerRegistrationSMCTestnet: HexToAddress("0xA1996F69f47ba14Cb7f661010A7C31974277958c"),
lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
lendingRegistrationSMCTestnet: HexToAddress("0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"),
ignoreSignerCheckBlockArray: map[uint64]struct{}{}, ignoreSignerCheckBlockArray: map[uint64]struct{}{},

View file

@ -9,39 +9,32 @@ var MaintnetConstant = constant{
blackListHFNumber: 38383838, blackListHFNumber: 38383838,
maxMasternodesV2: 108, maxMasternodesV2: 108,
tip2019Block: big.NewInt(1), tip2019Block: big.NewInt(1),
tipSigning: big.NewInt(3000000), tipSigning: big.NewInt(3000000),
tipRandomize: big.NewInt(3464000), tipRandomize: big.NewInt(3464000),
tipNoHalvingMNReward: big.NewInt(38383838), tipNoHalvingMNReward: big.NewInt(38383838),
tipXDCX: big.NewInt(38383838), tipXDCX: big.NewInt(38383838),
tipXDCXLending: big.NewInt(38383838), tipXDCXLending: big.NewInt(38383838),
tipXDCXCancellationFee: big.NewInt(38383838), tipXDCXCancellationFee: big.NewInt(38383838),
tipXDCXCancellationFeeTestnet: big.NewInt(38383838), tipTRC21Fee: big.NewInt(38383838),
tipTRC21Fee: big.NewInt(38383838), tipIncreaseMasternodes: big.NewInt(5000000),
tipTRC21FeeTestnet: big.NewInt(38383838), berlinBlock: big.NewInt(76321000), // Target 19th June 2024
tipIncreaseMasternodes: big.NewInt(5000000), londonBlock: big.NewInt(76321000), // Target 19th June 2024
berlinBlock: big.NewInt(76321000), // Target 19th June 2024 mergeBlock: big.NewInt(76321000), // Target 19th June 2024
londonBlock: big.NewInt(76321000), // Target 19th June 2024 shanghaiBlock: big.NewInt(76321000), // Target 19th June 2024
mergeBlock: big.NewInt(76321000), // Target 19th June 2024 blockNumberGas50x: big.NewInt(80370000), // Target 2nd Oct 2024
shanghaiBlock: big.NewInt(76321000), // Target 19th June 2024 TIPV2SwitchBlock: big.NewInt(80370000), // Target 2nd Oct 2024
blockNumberGas50x: big.NewInt(80370000), // Target 2nd Oct 2024 tipXDCXMinerDisable: big.NewInt(80370000), // Target 2nd Oct 2024
TIPV2SwitchBlock: big.NewInt(80370000), // Target 2nd Oct 2024 tipXDCXReceiverDisable: big.NewInt(80370900), // Target 2nd Oct 2024, safer to release after disable miner
tipXDCXMinerDisable: big.NewInt(80370000), // Target 2nd Oct 2024 eip1559Block: big.NewInt(9999999999),
tipXDCXReceiverDisable: big.NewInt(80370900), // Target 2nd Oct 2024, safer to release after disable miner cancunBlock: big.NewInt(9999999999),
eip1559Block: big.NewInt(9999999999), tipUpgradeReward: big.NewInt(9999999999),
cancunBlock: big.NewInt(9999999999), tipEpochHalving: big.NewInt(9999999999),
tipUpgradeReward: big.NewInt(9999999999),
tipEpochHalving: big.NewInt(9999999999),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"), trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"), xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"), relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"), lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
relayerRegistrationSMCTestnet: HexToAddress("0xA1996F69f47ba14Cb7f661010A7C31974277958c"),
lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
lendingRegistrationSMCTestnet: HexToAddress("0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"),
ignoreSignerCheckBlockArray: map[uint64]struct{}{ ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {}, 1032300: {},

View file

@ -16,9 +16,7 @@ var TestnetConstant = constant{
tipXDCX: big.NewInt(23779191), tipXDCX: big.NewInt(23779191),
tipXDCXLending: big.NewInt(23779191), tipXDCXLending: big.NewInt(23779191),
tipXDCXCancellationFee: big.NewInt(23779191), tipXDCXCancellationFee: big.NewInt(23779191),
tipXDCXCancellationFeeTestnet: big.NewInt(23779191),
tipTRC21Fee: big.NewInt(23779191), tipTRC21Fee: big.NewInt(23779191),
tipTRC21FeeTestnet: big.NewInt(23779191),
tipIncreaseMasternodes: big.NewInt(5000000), tipIncreaseMasternodes: big.NewInt(5000000),
blockNumberGas50x: big.NewInt(56828700), // Target 13rd Nov 2023 blockNumberGas50x: big.NewInt(56828700), // Target 13rd Nov 2023
TIPV2SwitchBlock: big.NewInt(56828700), // Target 13rd Nov 2023 TIPV2SwitchBlock: big.NewInt(56828700), // Target 13rd Nov 2023
@ -33,15 +31,10 @@ var TestnetConstant = constant{
tipUpgradeReward: big.NewInt(9999999999), tipUpgradeReward: big.NewInt(9999999999),
tipEpochHalving: big.NewInt(9999999999), tipEpochHalving: big.NewInt(9999999999),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"), trc21IssuerSMC: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"), xdcxListingSMC: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"), relayerRegistrationSMC: HexToAddress("0xA1996F69f47ba14Cb7f661010A7C31974277958c"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"), lendingRegistrationSMC: HexToAddress("0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"),
relayerRegistrationSMC: HexToAddress("0x16c63b79f9C8784168103C0b74E6A59EC2de4a02"),
relayerRegistrationSMCTestnet: HexToAddress("0xA1996F69f47ba14Cb7f661010A7C31974277958c"),
lendingRegistrationSMC: HexToAddress("0x7d761afd7ff65a79e4173897594a194e3c506e57"),
lendingRegistrationSMCTestnet: HexToAddress("0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8"),
ignoreSignerCheckBlockArray: map[uint64]struct{}{ ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {}, 1032300: {},

View file

@ -261,17 +261,10 @@ func (api *API) NetworkInformation() NetworkInformation {
info := NetworkInformation{} info := NetworkInformation{}
info.NetworkId = api.chain.Config().ChainId info.NetworkId = api.chain.Config().ChainId
info.XDCValidatorAddress = common.MasternodeVotingSMCBinary info.XDCValidatorAddress = common.MasternodeVotingSMCBinary
if common.IsTestnet { info.LendingAddress = common.LendingRegistrationSMC
info.LendingAddress = common.LendingRegistrationSMCTestnet info.RelayerRegistrationAddress = common.RelayerRegistrationSMC
info.RelayerRegistrationAddress = common.RelayerRegistrationSMCTestnet info.XDCXListingAddress = common.XDCXListingSMC
info.XDCXListingAddress = common.XDCXListingSMCTestNet info.XDCZAddress = common.TRC21IssuerSMC
info.XDCZAddress = common.TRC21IssuerSMCTestNet
} else {
info.LendingAddress = common.LendingRegistrationSMC
info.RelayerRegistrationAddress = common.RelayerRegistrationSMC
info.XDCXListingAddress = common.XDCXListingSMC
info.XDCZAddress = common.TRC21IssuerSMC
}
info.ConsensusConfigs = *api.XDPoS.config info.ConsensusConfigs = *api.XDPoS.config
return info return info

View file

@ -547,15 +547,7 @@ func (tx *Transaction) IsVotingTransaction() (bool, *common.Address) {
func (tx *Transaction) IsXDCXApplyTransaction() bool { func (tx *Transaction) IsXDCXApplyTransaction() bool {
to := tx.To() to := tx.To()
if to == nil { if to == nil || *to != common.XDCXListingSMC {
return false
}
addr := common.XDCXListingSMC
if common.IsTestnet {
addr = common.XDCXListingSMCTestNet
}
if *to != addr {
return false return false
} }
data := tx.Data() data := tx.Data()
@ -570,15 +562,7 @@ func (tx *Transaction) IsXDCXApplyTransaction() bool {
func (tx *Transaction) IsXDCZApplyTransaction() bool { func (tx *Transaction) IsXDCZApplyTransaction() bool {
to := tx.To() to := tx.To()
if to == nil { if to == nil || *to != common.TRC21IssuerSMC {
return false
}
addr := common.TRC21IssuerSMC
if common.IsTestnet {
addr = common.TRC21IssuerSMCTestNet
}
if *to != addr {
return false return false
} }
data := tx.Data() data := tx.Data()

View file

@ -135,7 +135,7 @@ func New(ctx *node.ServiceContext, config *ethconfig.Config, XDCXServ *XDCx.XDCX
if networkID == 0 { if networkID == 0 {
networkID = chainConfig.ChainId.Uint64() networkID = chainConfig.ChainId.Uint64()
} }
common.CopyConstans(networkID) common.CopyConstants(networkID)
log.Info(strings.Repeat("-", 153)) log.Info(strings.Repeat("-", 153))
for _, line := range strings.Split(chainConfig.Description(), "\n") { for _, line := range strings.Split(chainConfig.Description(), "\n") {