Merge pull request #846 from gzliudan/constants

common: refactor constants
This commit is contained in:
Daniel Liu 2025-02-17 09:14:45 +08:00 committed by GitHub
commit 56752b1f07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 1209 additions and 530 deletions

View file

@ -1467,6 +1467,10 @@ 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)
} }
if ctx.Bool(XDCTestnetFlag.Name) {
cfg.NetworkId = 51
}
common.CopyConstans(cfg.NetworkId)
if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) { if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100 cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100

114
common/constants.devnet.go Normal file
View file

@ -0,0 +1,114 @@
package common
import (
"math/big"
)
var DevnetConstant = constant{
chainID: 551,
blackListHFNumber: 0,
maxMasternodesV2: 108,
tip2019Block: big.NewInt(0),
tipSigning: big.NewInt(0),
tipRandomize: big.NewInt(0),
tipNoHalvingMNReward: big.NewInt(0),
tipXDCX: big.NewInt(0),
tipXDCXLending: big.NewInt(0),
tipXDCXCancellationFee: big.NewInt(0),
tipXDCXCancellationFeeTestnet: big.NewInt(0),
tipTRC21Fee: big.NewInt(13523400),
tipTRC21FeeTestnet: big.NewInt(225000),
tipIncreaseMasternodes: big.NewInt(0),
berlinBlock: big.NewInt(0),
londonBlock: big.NewInt(0),
mergeBlock: big.NewInt(0),
shanghaiBlock: big.NewInt(0),
blockNumberGas50x: big.NewInt(0),
TIPV2SwitchBlock: big.NewInt(1800),
tipXDCXMinerDisable: big.NewInt(0),
tipXDCXReceiverDisable: big.NewInt(0),
eip1559Block: big.NewInt(0),
cancunBlock: big.NewInt(9999999999),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"),
relayerRegistrationSMC: "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02",
relayerRegistrationSMCTestnet: "0xA1996F69f47ba14Cb7f661010A7C31974277958c",
lendingRegistrationSMC: "0x7d761afd7ff65a79e4173897594a194e3c506e57",
lendingRegistrationSMCTestnet: "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8",
ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {},
1033200: {},
27307800: {},
28270800: {},
},
blacklist: map[Address]struct{}{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): {},
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): {},
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): {},
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): {},
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): {},
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): {},
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): {},
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): {},
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): {},
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): {},
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): {},
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): {},
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): {},
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): {},
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): {},
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): {},
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): {},
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): {},
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): {},
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): {},
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): {},
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): {},
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): {},
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): {},
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): {},
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): {},
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): {},
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): {},
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): {},
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): {},
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): {},
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): {},
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): {},
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): {},
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): {},
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): {},
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): {},
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): {},
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): {},
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): {},
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): {},
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): {},
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): {},
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): {},
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): {},
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): {},
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): {},
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): {},
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): {},
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): {},
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): {},
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): {},
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): {},
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): {},
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): {},
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): {},
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): {},
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): {},
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): {},
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): {},
HexToAddress("0x0000000000000000000000000000000000000011"): {},
},
}

View file

@ -1,6 +1,7 @@
package common package common
import ( import (
"maps"
"math/big" "math/big"
) )
@ -8,152 +9,207 @@ const (
RewardMasterPercent = 90 RewardMasterPercent = 90
RewardVoterPercent = 0 RewardVoterPercent = 0
RewardFoundationPercent = 10 RewardFoundationPercent = 10
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
EpocBlockSecret = 800 EpocBlockSecret = 800
EpocBlockOpening = 850 EpocBlockOpening = 850
EpocBlockRandomize = 900 EpocBlockRandomize = 900
MaxMasternodes = 18 MaxMasternodes = 18
MaxMasternodesV2 = 108 // Last v1 masternodes
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0 LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10 LimitThresholdNonceInQueue = 10
DefaultMinGasPrice = 250000000 DefaultMinGasPrice = 250000000
MergeSignRange = 15 MergeSignRange = 15
RangeReturnSigner = 150 RangeReturnSigner = 150
MinimunMinerBlockPerEpoch = 1 MinimunMinerBlockPerEpoch = 1
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
OneYear = uint64(365 * 86400) OneYear = uint64(365 * 86400)
LiquidateLendingTradeBlock = uint64(100) LiquidateLendingTradeBlock = uint64(100)
LimitTimeFinality = uint64(30) // limit in 30 block
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
) )
var Rewound = uint64(0) // variables for all network.
var (
IsTestnet bool = false
Enable0xPrefix bool = true
var TIP2019Block = big.NewInt(1) Rewound = uint64(0)
var TIPSigning = big.NewInt(3000000)
var TIPRandomize = big.NewInt(3464000)
var TIPV2SwitchBlock = big.NewInt(80370000) // Target 2nd Oct 2024 RollbackHash Hash
var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block. StoreRewardFolder string
var TIPNoHalvingMNReward = big.NewInt(38383838) // hardfork no halving masternodes reward
var BlackListHFNumber = uint64(38383838)
var TIPXDCX = big.NewInt(38383838)
var TIPXDCXLending = big.NewInt(38383838)
var TIPXDCXCancellationFee = big.NewInt(38383838)
var TIPXDCXCancellationFeeTestnet = big.NewInt(38383838)
var TIPXDCXMinerDisable = big.NewInt(80370000) // Target 2nd Oct 2024
var TIPXDCXReceiverDisable = big.NewInt(80370900) // Target 2nd Oct 2024, safer to release after disable miner
var Eip1559Block = big.NewInt(9999999999)
var CancunBlock = big.NewInt(9999999999)
var BerlinBlock = big.NewInt(76321000) // Target 19th June 2024
var LondonBlock = big.NewInt(76321000) // Target 19th June 2024
var MergeBlock = big.NewInt(76321000) // Target 19th June 2024
var ShanghaiBlock = big.NewInt(76321000) // Target 19th June 2024
var TIPXDCXTestnet = big.NewInt(38383838) TRC21GasPriceBefore = big.NewInt(2500)
var IsTestnet bool = false TRC21GasPrice = big.NewInt(250000000)
var Enable0xPrefix bool = true MinGasPrice = big.NewInt(DefaultMinGasPrice)
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var RelayerFee = big.NewInt(1000000000000000) // 0.001
var XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
var XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
var RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
var BaseLendingInterest = big.NewInt(100000000) // 1e8
var MinGasPrice = big.NewInt(DefaultMinGasPrice) // XDCx and XDCxlending
var RelayerRegistrationSMC = "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02" BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerRegistrationSMCTestnet = "0xA1996F69f47ba14Cb7f661010A7C31974277958c" RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var LendingRegistrationSMC = "0x7d761afd7ff65a79e4173897594a194e3c506e57" XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var LendingRegistrationSMCTestnet = "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8" XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F")
var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee")
var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53")
var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0")
var TRC21GasPriceBefore = big.NewInt(2500)
var TRC21GasPrice = big.NewInt(250000000)
var RateTopUp = big.NewInt(90) // 90%
var BaseTopUp = big.NewInt(100)
var BaseRecall = big.NewInt(100)
var TIPTRC21Fee = big.NewInt(38383838)
var TIPTRC21FeeTestnet = big.NewInt(38383838)
var BlockNumberGas50x = big.NewInt(80370000) // Target 2nd Oct 2024
var LimitTimeFinality = uint64(30) // limit in 30 block
var IgnoreSignerCheckBlockArray = map[uint64]bool{ // XDCx
uint64(1032300): true, RelayerFee = big.NewInt(1000000000000000) // 0.001
uint64(1033200): true, RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
uint64(27307800): true,
uint64(28270800): true, // XDCxlending
RateTopUp = big.NewInt(90) // 90%
BaseTopUp = big.NewInt(100)
BaseRecall = big.NewInt(100)
BaseLendingInterest = big.NewInt(100000000) // 1e8
RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
)
type constant struct {
chainID uint64
blackListHFNumber uint64
maxMasternodesV2 int // Last v1 masternodes
tip2019Block *big.Int
tipSigning *big.Int
tipRandomize *big.Int
tipNoHalvingMNReward *big.Int // hardfork no halving masternodes reward
tipXDCX *big.Int
tipXDCXLending *big.Int
tipXDCXCancellationFee *big.Int
tipXDCXCancellationFeeTestnet *big.Int
tipTRC21Fee *big.Int
tipTRC21FeeTestnet *big.Int
tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block.
berlinBlock *big.Int
londonBlock *big.Int
mergeBlock *big.Int
shanghaiBlock *big.Int
blockNumberGas50x *big.Int
TIPV2SwitchBlock *big.Int
tipXDCXMinerDisable *big.Int
tipXDCXReceiverDisable *big.Int
eip1559Block *big.Int
cancunBlock *big.Int
trc21IssuerSMCTestNet Address
trc21IssuerSMC Address
xdcxListingSMC Address
xdcxListingSMCTestNet Address
relayerRegistrationSMC string
relayerRegistrationSMCTestnet string
lendingRegistrationSMC string
lendingRegistrationSMCTestnet string
ignoreSignerCheckBlockArray map[uint64]struct{}
blacklist map[Address]struct{}
} }
var Blacklist = map[Address]bool{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): true, // variables for specific networks, copy values from MaintnetConstant to pass tests
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): true, var (
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): true, BlackListHFNumber = MaintnetConstant.blackListHFNumber
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): true, MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): true,
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): true, TIP2019Block = MaintnetConstant.tip2019Block
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): true, TIPSigning = MaintnetConstant.tipSigning
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): true, TIPRandomize = MaintnetConstant.tipRandomize
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): true, TIPNoHalvingMNReward = MaintnetConstant.tipNoHalvingMNReward
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): true, TIPXDCX = MaintnetConstant.tipXDCX
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): true, TIPXDCXLending = MaintnetConstant.tipXDCXLending
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): true, TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): true, TIPXDCXCancellationFeeTestnet = MaintnetConstant.tipXDCXCancellationFeeTestnet
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): true, TIPTRC21Fee = MaintnetConstant.tipTRC21Fee
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): true, TIPTRC21FeeTestnet = MaintnetConstant.tipTRC21FeeTestnet
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): true, TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): true, BerlinBlock = MaintnetConstant.berlinBlock
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): true, LondonBlock = MaintnetConstant.londonBlock
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): true, MergeBlock = MaintnetConstant.mergeBlock
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): true, ShanghaiBlock = MaintnetConstant.shanghaiBlock
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): true, BlockNumberGas50x = MaintnetConstant.blockNumberGas50x
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): true, TIPXDCXMinerDisable = MaintnetConstant.tipXDCXMinerDisable
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): true, TIPXDCXReceiverDisable = MaintnetConstant.tipXDCXReceiverDisable
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): true, Eip1559Block = MaintnetConstant.eip1559Block
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): true, CancunBlock = MaintnetConstant.cancunBlock
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): true,
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): true, TRC21IssuerSMCTestNet = MaintnetConstant.trc21IssuerSMCTestNet
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): true, TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): true, XDCXListingSMC = MaintnetConstant.xdcxListingSMC
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): true, XDCXListingSMCTestNet = MaintnetConstant.xdcxListingSMCTestNet
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): true,
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): true, RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): true, RelayerRegistrationSMCTestnet = MaintnetConstant.relayerRegistrationSMCTestnet
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): true, LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): true, LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): true,
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): true, ignoreSignerCheckBlockArray = map[uint64]struct{}{}
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): true, blacklist = map[Address]struct{}{}
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): true, )
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): true,
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): true, func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): true, _, ok := ignoreSignerCheckBlockArray[blockNumber]
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): true, return ok
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): true, }
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): true,
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): true, func IsInBlacklist(address *Address) bool {
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): true, if address == nil {
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): true, return false
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): true, }
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): true, _, ok := blacklist[*address]
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): true, return ok
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): true, }
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): true,
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): true, func CopyConstans(chainID uint64) {
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): true, var c *constant
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): true, if chainID == MaintnetConstant.chainID {
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): true, c = &MaintnetConstant
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): true, } else if chainID == TestnetConstant.chainID {
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): true, c = &TestnetConstant
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): true, } else if chainID == DevnetConstant.chainID {
HexToAddress("0x0000000000000000000000000000000000000011"): true, c = &DevnetConstant
} else if chainID == localConstant.chainID {
c = &localConstant
} else {
return
}
MaxMasternodesV2 = c.maxMasternodesV2
BlackListHFNumber = c.blackListHFNumber
TIP2019Block = c.tip2019Block
TIPSigning = c.tipSigning
TIPRandomize = c.tipRandomize
TIPNoHalvingMNReward = c.tipNoHalvingMNReward
TIPXDCX = c.tipXDCX
TIPXDCXLending = c.tipXDCXLending
TIPXDCXCancellationFee = c.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = c.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = c.tipTRC21Fee
TIPTRC21FeeTestnet = c.tipTRC21FeeTestnet
TIPIncreaseMasternodes = c.tipIncreaseMasternodes
BerlinBlock = c.berlinBlock
LondonBlock = c.londonBlock
MergeBlock = c.mergeBlock
ShanghaiBlock = c.shanghaiBlock
BlockNumberGas50x = c.blockNumberGas50x
TIPXDCXMinerDisable = c.tipXDCXMinerDisable
TIPXDCXReceiverDisable = c.tipXDCXReceiverDisable
Eip1559Block = c.eip1559Block
CancunBlock = c.cancunBlock
TRC21IssuerSMCTestNet = c.trc21IssuerSMCTestNet
TRC21IssuerSMC = c.trc21IssuerSMC
XDCXListingSMC = c.xdcxListingSMC
XDCXListingSMCTestNet = c.xdcxListingSMCTestNet
RelayerRegistrationSMC = c.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = c.relayerRegistrationSMCTestnet
LendingRegistrationSMC = c.lendingRegistrationSMC
LendingRegistrationSMCTestnet = c.lendingRegistrationSMCTestnet
clear(ignoreSignerCheckBlockArray)
maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray)
clear(blacklist)
maps.Copy(blacklist, c.blacklist)
} }

114
common/constants.local.go Normal file
View file

@ -0,0 +1,114 @@
package common
import (
"math/big"
)
var localConstant = constant{
chainID: 5151,
maxMasternodesV2: 108,
blackListHFNumber: 0,
tip2019Block: big.NewInt(0),
tipSigning: big.NewInt(0),
tipRandomize: big.NewInt(0),
tipNoHalvingMNReward: big.NewInt(0),
tipXDCX: big.NewInt(0),
tipXDCXLending: big.NewInt(0),
tipXDCXCancellationFee: big.NewInt(0),
tipXDCXCancellationFeeTestnet: big.NewInt(0),
tipTRC21Fee: big.NewInt(13523400),
tipTRC21FeeTestnet: big.NewInt(225000),
tipIncreaseMasternodes: big.NewInt(0),
berlinBlock: big.NewInt(0),
londonBlock: big.NewInt(0),
mergeBlock: big.NewInt(0),
shanghaiBlock: big.NewInt(0),
blockNumberGas50x: big.NewInt(0),
TIPV2SwitchBlock: big.NewInt(0),
tipXDCXMinerDisable: big.NewInt(0),
tipXDCXReceiverDisable: big.NewInt(0),
eip1559Block: big.NewInt(9999999999),
cancunBlock: big.NewInt(9999999999),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"),
relayerRegistrationSMC: "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02",
relayerRegistrationSMCTestnet: "0xA1996F69f47ba14Cb7f661010A7C31974277958c",
lendingRegistrationSMC: "0x7d761afd7ff65a79e4173897594a194e3c506e57",
lendingRegistrationSMCTestnet: "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8",
ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {},
1033200: {},
27307800: {},
28270800: {},
},
blacklist: map[Address]struct{}{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): {},
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): {},
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): {},
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): {},
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): {},
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): {},
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): {},
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): {},
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): {},
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): {},
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): {},
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): {},
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): {},
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): {},
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): {},
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): {},
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): {},
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): {},
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): {},
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): {},
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): {},
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): {},
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): {},
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): {},
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): {},
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): {},
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): {},
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): {},
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): {},
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): {},
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): {},
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): {},
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): {},
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): {},
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): {},
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): {},
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): {},
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): {},
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): {},
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): {},
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): {},
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): {},
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): {},
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): {},
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): {},
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): {},
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): {},
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): {},
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): {},
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): {},
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): {},
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): {},
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): {},
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): {},
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): {},
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): {},
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): {},
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): {},
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): {},
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): {},
HexToAddress("0x0000000000000000000000000000000000000011"): {},
},
}

114
common/constants.mainnet.go Normal file
View file

@ -0,0 +1,114 @@
package common
import (
"math/big"
)
var MaintnetConstant = constant{
chainID: 50,
blackListHFNumber: 38383838,
maxMasternodesV2: 108,
tip2019Block: big.NewInt(1),
tipSigning: big.NewInt(3000000),
tipRandomize: big.NewInt(3464000),
tipNoHalvingMNReward: big.NewInt(38383838),
tipXDCX: big.NewInt(38383838),
tipXDCXLending: big.NewInt(38383838),
tipXDCXCancellationFee: big.NewInt(38383838),
tipXDCXCancellationFeeTestnet: big.NewInt(38383838),
tipTRC21Fee: big.NewInt(38383838),
tipTRC21FeeTestnet: big.NewInt(38383838),
tipIncreaseMasternodes: big.NewInt(5000000),
berlinBlock: big.NewInt(76321000), // Target 19th June 2024
londonBlock: big.NewInt(76321000), // Target 19th June 2024
mergeBlock: big.NewInt(76321000), // Target 19th June 2024
shanghaiBlock: big.NewInt(76321000), // Target 19th June 2024
blockNumberGas50x: big.NewInt(80370000), // Target 2nd Oct 2024
TIPV2SwitchBlock: big.NewInt(80370000), // Target 2nd Oct 2024
tipXDCXMinerDisable: big.NewInt(80370000), // Target 2nd Oct 2024
tipXDCXReceiverDisable: big.NewInt(80370900), // Target 2nd Oct 2024, safer to release after disable miner
eip1559Block: big.NewInt(9999999999),
cancunBlock: big.NewInt(9999999999),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"),
relayerRegistrationSMC: "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02",
relayerRegistrationSMCTestnet: "0xA1996F69f47ba14Cb7f661010A7C31974277958c",
lendingRegistrationSMC: "0x7d761afd7ff65a79e4173897594a194e3c506e57",
lendingRegistrationSMCTestnet: "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8",
ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {},
1033200: {},
27307800: {},
28270800: {},
},
blacklist: map[Address]struct{}{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): {},
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): {},
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): {},
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): {},
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): {},
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): {},
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): {},
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): {},
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): {},
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): {},
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): {},
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): {},
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): {},
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): {},
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): {},
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): {},
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): {},
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): {},
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): {},
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): {},
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): {},
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): {},
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): {},
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): {},
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): {},
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): {},
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): {},
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): {},
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): {},
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): {},
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): {},
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): {},
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): {},
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): {},
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): {},
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): {},
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): {},
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): {},
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): {},
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): {},
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): {},
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): {},
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): {},
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): {},
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): {},
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): {},
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): {},
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): {},
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): {},
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): {},
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): {},
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): {},
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): {},
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): {},
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): {},
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): {},
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): {},
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): {},
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): {},
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): {},
HexToAddress("0x0000000000000000000000000000000000000011"): {},
},
}

114
common/constants.testnet.go Normal file
View file

@ -0,0 +1,114 @@
package common
import (
"math/big"
)
var TestnetConstant = constant{
chainID: 51,
blackListHFNumber: 23779191,
maxMasternodesV2: 15,
tip2019Block: big.NewInt(1),
tipSigning: big.NewInt(3000000),
tipRandomize: big.NewInt(3464000),
tipNoHalvingMNReward: big.NewInt(23779191),
tipXDCX: big.NewInt(23779191),
tipXDCXLending: big.NewInt(23779191),
tipXDCXCancellationFee: big.NewInt(23779191),
tipXDCXCancellationFeeTestnet: big.NewInt(23779191),
tipTRC21Fee: big.NewInt(23779191),
tipTRC21FeeTestnet: big.NewInt(23779191),
tipIncreaseMasternodes: big.NewInt(5000000),
berlinBlock: big.NewInt(61290000),
londonBlock: big.NewInt(61290000),
mergeBlock: big.NewInt(61290000),
shanghaiBlock: big.NewInt(61290000),
blockNumberGas50x: big.NewInt(56828700),
TIPV2SwitchBlock: big.NewInt(56828700),
tipXDCXMinerDisable: big.NewInt(61290000),
tipXDCXReceiverDisable: big.NewInt(66825000),
eip1559Block: big.NewInt(9999999999),
cancunBlock: big.NewInt(9999999999),
trc21IssuerSMCTestNet: HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F"),
trc21IssuerSMC: HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee"),
xdcxListingSMC: HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53"),
xdcxListingSMCTestNet: HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0"),
relayerRegistrationSMC: "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02",
relayerRegistrationSMCTestnet: "0xA1996F69f47ba14Cb7f661010A7C31974277958c",
lendingRegistrationSMC: "0x7d761afd7ff65a79e4173897594a194e3c506e57",
lendingRegistrationSMCTestnet: "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8",
ignoreSignerCheckBlockArray: map[uint64]struct{}{
1032300: {},
1033200: {},
27307800: {},
28270800: {},
},
blacklist: map[Address]struct{}{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): {},
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): {},
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): {},
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): {},
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): {},
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): {},
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): {},
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): {},
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): {},
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): {},
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): {},
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): {},
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): {},
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): {},
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): {},
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): {},
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): {},
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): {},
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): {},
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): {},
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): {},
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): {},
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): {},
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): {},
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): {},
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): {},
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): {},
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): {},
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): {},
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): {},
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): {},
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): {},
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): {},
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): {},
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): {},
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): {},
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): {},
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): {},
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): {},
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): {},
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): {},
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): {},
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): {},
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): {},
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): {},
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): {},
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): {},
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): {},
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): {},
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): {},
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): {},
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): {},
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): {},
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): {},
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): {},
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): {},
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): {},
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): {},
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): {},
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): {},
HexToAddress("0x0000000000000000000000000000000000000011"): {},
},
}

View file

@ -1,5 +0,0 @@
# Constants
This directory is used by dockerfile when builing the per environment constants.go
The benefit of this structure is to allow devnet, testnet and mainnet to have different constants configuration setup.
The default file under `common` directory is for the mainnet, whereas all files under this `constants` directory will override the `constants.go` when building image. For example, when building devnet images, we will do `ADD common/constants/constants.go.devnet /work/common/constants.go`

View file

@ -1,6 +1,7 @@
package common package common
import ( import (
"maps"
"math/big" "math/big"
) )
@ -8,152 +9,207 @@ const (
RewardMasterPercent = 90 RewardMasterPercent = 90
RewardVoterPercent = 0 RewardVoterPercent = 0
RewardFoundationPercent = 10 RewardFoundationPercent = 10
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
EpocBlockSecret = 800 EpocBlockSecret = 800
EpocBlockOpening = 850 EpocBlockOpening = 850
EpocBlockRandomize = 900 EpocBlockRandomize = 900
MaxMasternodes = 18 MaxMasternodes = 18
MaxMasternodesV2 = 108 // Last v1 masternodes
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0 LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10 LimitThresholdNonceInQueue = 10
DefaultMinGasPrice = 250000000 DefaultMinGasPrice = 250000000
MergeSignRange = 15 MergeSignRange = 15
RangeReturnSigner = 150 RangeReturnSigner = 150
MinimunMinerBlockPerEpoch = 1 MinimunMinerBlockPerEpoch = 1
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
OneYear = uint64(365 * 86400) OneYear = uint64(365 * 86400)
LiquidateLendingTradeBlock = uint64(100) LiquidateLendingTradeBlock = uint64(100)
LimitTimeFinality = uint64(30) // limit in 30 block
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
) )
var Rewound = uint64(0) // variables for all network.
var (
IsTestnet bool = false
Enable0xPrefix bool = true
var TIP2019Block = big.NewInt(0) Rewound = uint64(0)
var TIPSigning = big.NewInt(0)
var TIPRandomize = big.NewInt(0)
var TIPV2SwitchBlock = big.NewInt(1800) RollbackHash Hash
var TIPIncreaseMasternodes = big.NewInt(0) // Upgrade MN Count at Block. StoreRewardFolder string
var TIPNoHalvingMNReward = big.NewInt(0) // hardfork no halving masternodes reward
var BlackListHFNumber = uint64(0)
var TIPXDCX = big.NewInt(0)
var TIPXDCXLending = big.NewInt(0)
var TIPXDCXCancellationFee = big.NewInt(0)
var TIPXDCXCancellationFeeTestnet = big.NewInt(0)
var TIPXDCXMinerDisable = big.NewInt(0)
var TIPXDCXReceiverDisable = big.NewInt(0)
var BerlinBlock = big.NewInt(0)
var LondonBlock = big.NewInt(0)
var MergeBlock = big.NewInt(0)
var ShanghaiBlock = big.NewInt(0)
var Eip1559Block = big.NewInt(0)
var CancunBlock = big.NewInt(9999999999)
var TIPXDCXTestnet = big.NewInt(0) TRC21GasPriceBefore = big.NewInt(2500)
var IsTestnet bool = false TRC21GasPrice = big.NewInt(250000000)
var Enable0xPrefix bool = true MinGasPrice = big.NewInt(DefaultMinGasPrice)
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var RelayerFee = big.NewInt(1000000000000000) // 0.001
var XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
var XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
var RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
var BaseLendingInterest = big.NewInt(100000000) // 1e8
var MinGasPrice = big.NewInt(DefaultMinGasPrice) // XDCx and XDCxlending
var RelayerRegistrationSMC = "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02" BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerRegistrationSMCTestnet = "0xA1996F69f47ba14Cb7f661010A7C31974277958c" RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var LendingRegistrationSMC = "0x7d761afd7ff65a79e4173897594a194e3c506e57" XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var LendingRegistrationSMCTestnet = "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8" XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F")
var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee")
var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53")
var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0")
var TRC21GasPriceBefore = big.NewInt(2500)
var TRC21GasPrice = big.NewInt(250000000)
var RateTopUp = big.NewInt(90) // 90%
var BaseTopUp = big.NewInt(100)
var BaseRecall = big.NewInt(100)
var TIPTRC21Fee = big.NewInt(13523400)
var TIPTRC21FeeTestnet = big.NewInt(225000)
var BlockNumberGas50x = big.NewInt(11818181)
var LimitTimeFinality = uint64(30) // limit in 30 block
var IgnoreSignerCheckBlockArray = map[uint64]bool{ // XDCx
uint64(1032300): true, RelayerFee = big.NewInt(1000000000000000) // 0.001
uint64(1033200): true, RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
uint64(27307800): true,
uint64(28270800): true, // XDCxlending
RateTopUp = big.NewInt(90) // 90%
BaseTopUp = big.NewInt(100)
BaseRecall = big.NewInt(100)
BaseLendingInterest = big.NewInt(100000000) // 1e8
RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
)
type constant struct {
chainID uint64
blackListHFNumber uint64
maxMasternodesV2 int // Last v1 masternodes
tip2019Block *big.Int
tipSigning *big.Int
tipRandomize *big.Int
tipNoHalvingMNReward *big.Int // hardfork no halving masternodes reward
tipXDCX *big.Int
tipXDCXLending *big.Int
tipXDCXCancellationFee *big.Int
tipXDCXCancellationFeeTestnet *big.Int
tipTRC21Fee *big.Int
tipTRC21FeeTestnet *big.Int
tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block.
berlinBlock *big.Int
londonBlock *big.Int
mergeBlock *big.Int
shanghaiBlock *big.Int
blockNumberGas50x *big.Int
TIPV2SwitchBlock *big.Int
tipXDCXMinerDisable *big.Int
tipXDCXReceiverDisable *big.Int
eip1559Block *big.Int
cancunBlock *big.Int
trc21IssuerSMCTestNet Address
trc21IssuerSMC Address
xdcxListingSMC Address
xdcxListingSMCTestNet Address
relayerRegistrationSMC string
relayerRegistrationSMCTestnet string
lendingRegistrationSMC string
lendingRegistrationSMCTestnet string
ignoreSignerCheckBlockArray map[uint64]struct{}
blacklist map[Address]struct{}
} }
var Blacklist = map[Address]bool{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): true, // variables for specific networks, copy values from MaintnetConstant to pass tests
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): true, var (
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): true, BlackListHFNumber = MaintnetConstant.blackListHFNumber
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): true, MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): true,
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): true, TIP2019Block = MaintnetConstant.tip2019Block
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): true, TIPSigning = MaintnetConstant.tipSigning
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): true, TIPRandomize = MaintnetConstant.tipRandomize
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): true, TIPNoHalvingMNReward = MaintnetConstant.tipNoHalvingMNReward
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): true, TIPXDCX = MaintnetConstant.tipXDCX
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): true, TIPXDCXLending = MaintnetConstant.tipXDCXLending
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): true, TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): true, TIPXDCXCancellationFeeTestnet = MaintnetConstant.tipXDCXCancellationFeeTestnet
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): true, TIPTRC21Fee = MaintnetConstant.tipTRC21Fee
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): true, TIPTRC21FeeTestnet = MaintnetConstant.tipTRC21FeeTestnet
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): true, TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): true, BerlinBlock = MaintnetConstant.berlinBlock
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): true, LondonBlock = MaintnetConstant.londonBlock
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): true, MergeBlock = MaintnetConstant.mergeBlock
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): true, ShanghaiBlock = MaintnetConstant.shanghaiBlock
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): true, BlockNumberGas50x = MaintnetConstant.blockNumberGas50x
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): true, TIPXDCXMinerDisable = MaintnetConstant.tipXDCXMinerDisable
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): true, TIPXDCXReceiverDisable = MaintnetConstant.tipXDCXReceiverDisable
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): true, Eip1559Block = MaintnetConstant.eip1559Block
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): true, CancunBlock = MaintnetConstant.cancunBlock
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): true,
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): true, TRC21IssuerSMCTestNet = MaintnetConstant.trc21IssuerSMCTestNet
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): true, TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): true, XDCXListingSMC = MaintnetConstant.xdcxListingSMC
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): true, XDCXListingSMCTestNet = MaintnetConstant.xdcxListingSMCTestNet
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): true,
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): true, RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): true, RelayerRegistrationSMCTestnet = MaintnetConstant.relayerRegistrationSMCTestnet
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): true, LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): true, LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): true,
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): true, ignoreSignerCheckBlockArray = map[uint64]struct{}{}
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): true, blacklist = map[Address]struct{}{}
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): true, )
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): true,
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): true, func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): true, _, ok := ignoreSignerCheckBlockArray[blockNumber]
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): true, return ok
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): true, }
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): true,
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): true, func IsInBlacklist(address *Address) bool {
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): true, if address == nil {
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): true, return false
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): true, }
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): true, _, ok := blacklist[*address]
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): true, return ok
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): true, }
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): true,
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): true, func CopyConstans(chainID uint64) {
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): true, var c *constant
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): true, if chainID == MaintnetConstant.chainID {
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): true, c = &MaintnetConstant
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): true, } else if chainID == TestnetConstant.chainID {
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): true, c = &TestnetConstant
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): true, } else if chainID == DevnetConstant.chainID {
HexToAddress("0x0000000000000000000000000000000000000011"): true, c = &DevnetConstant
} else if chainID == localConstant.chainID {
c = &localConstant
} else {
return
}
MaxMasternodesV2 = c.maxMasternodesV2
BlackListHFNumber = c.blackListHFNumber
TIP2019Block = c.tip2019Block
TIPSigning = c.tipSigning
TIPRandomize = c.tipRandomize
TIPNoHalvingMNReward = c.tipNoHalvingMNReward
TIPXDCX = c.tipXDCX
TIPXDCXLending = c.tipXDCXLending
TIPXDCXCancellationFee = c.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = c.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = c.tipTRC21Fee
TIPTRC21FeeTestnet = c.tipTRC21FeeTestnet
TIPIncreaseMasternodes = c.tipIncreaseMasternodes
BerlinBlock = c.berlinBlock
LondonBlock = c.londonBlock
MergeBlock = c.mergeBlock
ShanghaiBlock = c.shanghaiBlock
BlockNumberGas50x = c.blockNumberGas50x
TIPXDCXMinerDisable = c.tipXDCXMinerDisable
TIPXDCXReceiverDisable = c.tipXDCXReceiverDisable
Eip1559Block = c.eip1559Block
CancunBlock = c.cancunBlock
TRC21IssuerSMCTestNet = c.trc21IssuerSMCTestNet
TRC21IssuerSMC = c.trc21IssuerSMC
XDCXListingSMC = c.xdcxListingSMC
XDCXListingSMCTestNet = c.xdcxListingSMCTestNet
RelayerRegistrationSMC = c.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = c.relayerRegistrationSMCTestnet
LendingRegistrationSMC = c.lendingRegistrationSMC
LendingRegistrationSMCTestnet = c.lendingRegistrationSMCTestnet
clear(ignoreSignerCheckBlockArray)
maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray)
clear(blacklist)
maps.Copy(blacklist, c.blacklist)
} }

View file

@ -1,6 +1,7 @@
package common package common
import ( import (
"maps"
"math/big" "math/big"
) )
@ -8,152 +9,207 @@ const (
RewardMasterPercent = 90 RewardMasterPercent = 90
RewardVoterPercent = 0 RewardVoterPercent = 0
RewardFoundationPercent = 10 RewardFoundationPercent = 10
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
EpocBlockSecret = 800 EpocBlockSecret = 800
EpocBlockOpening = 850 EpocBlockOpening = 850
EpocBlockRandomize = 900 EpocBlockRandomize = 900
MaxMasternodes = 18 MaxMasternodes = 18
MaxMasternodesV2 = 108 // Last v1 masternodes
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0 LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10 LimitThresholdNonceInQueue = 10
DefaultMinGasPrice = 250000000 DefaultMinGasPrice = 250000000
MergeSignRange = 15 MergeSignRange = 15
RangeReturnSigner = 150 RangeReturnSigner = 150
MinimunMinerBlockPerEpoch = 1 MinimunMinerBlockPerEpoch = 1
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
OneYear = uint64(365 * 86400) OneYear = uint64(365 * 86400)
LiquidateLendingTradeBlock = uint64(100) LiquidateLendingTradeBlock = uint64(100)
LimitTimeFinality = uint64(30) // limit in 30 block
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
) )
var Rewound = uint64(0) // variables for all network.
var (
IsTestnet bool = false
Enable0xPrefix bool = true
var TIP2019Block = big.NewInt(0) Rewound = uint64(0)
var TIPSigning = big.NewInt(0)
var TIPRandomize = big.NewInt(0)
var TIPV2SwitchBlock = big.NewInt(0) RollbackHash Hash
var TIPIncreaseMasternodes = big.NewInt(0) // Upgrade MN Count at Block. StoreRewardFolder string
var TIPNoHalvingMNReward = big.NewInt(0) // hardfork no halving masternodes reward
var BlackListHFNumber = uint64(0)
var TIPXDCX = big.NewInt(0)
var TIPXDCXLending = big.NewInt(0)
var TIPXDCXCancellationFee = big.NewInt(0)
var TIPXDCXCancellationFeeTestnet = big.NewInt(0)
var TIPXDCXMinerDisable = big.NewInt(0)
var TIPXDCXReceiverDisable = big.NewInt(0)
var BerlinBlock = big.NewInt(0)
var LondonBlock = big.NewInt(0)
var MergeBlock = big.NewInt(0)
var ShanghaiBlock = big.NewInt(0)
var Eip1559Block = big.NewInt(9999999999)
var CancunBlock = big.NewInt(9999999999)
var TIPXDCXTestnet = big.NewInt(0) TRC21GasPriceBefore = big.NewInt(2500)
var IsTestnet bool = false TRC21GasPrice = big.NewInt(250000000)
var Enable0xPrefix bool = true MinGasPrice = big.NewInt(DefaultMinGasPrice)
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var RelayerFee = big.NewInt(1000000000000000) // 0.001
var XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
var XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
var RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
var BaseLendingInterest = big.NewInt(100000000) // 1e8
var MinGasPrice = big.NewInt(DefaultMinGasPrice) // XDCx and XDCxlending
var RelayerRegistrationSMC = "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02" BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerRegistrationSMCTestnet = "0xA1996F69f47ba14Cb7f661010A7C31974277958c" RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var LendingRegistrationSMC = "0x7d761afd7ff65a79e4173897594a194e3c506e57" XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var LendingRegistrationSMCTestnet = "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8" XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F")
var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee")
var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53")
var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0")
var TRC21GasPriceBefore = big.NewInt(2500)
var TRC21GasPrice = big.NewInt(250000000)
var RateTopUp = big.NewInt(90) // 90%
var BaseTopUp = big.NewInt(100)
var BaseRecall = big.NewInt(100)
var TIPTRC21Fee = big.NewInt(13523400)
var TIPTRC21FeeTestnet = big.NewInt(225000)
var BlockNumberGas50x = big.NewInt(11818181)
var LimitTimeFinality = uint64(30) // limit in 30 block
var IgnoreSignerCheckBlockArray = map[uint64]bool{ // XDCx
uint64(1032300): true, RelayerFee = big.NewInt(1000000000000000) // 0.001
uint64(1033200): true, RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
uint64(27307800): true,
uint64(28270800): true, // XDCxlending
RateTopUp = big.NewInt(90) // 90%
BaseTopUp = big.NewInt(100)
BaseRecall = big.NewInt(100)
BaseLendingInterest = big.NewInt(100000000) // 1e8
RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
)
type constant struct {
chainID uint64
blackListHFNumber uint64
maxMasternodesV2 int // Last v1 masternodes
tip2019Block *big.Int
tipSigning *big.Int
tipRandomize *big.Int
tipNoHalvingMNReward *big.Int // hardfork no halving masternodes reward
tipXDCX *big.Int
tipXDCXLending *big.Int
tipXDCXCancellationFee *big.Int
tipXDCXCancellationFeeTestnet *big.Int
tipTRC21Fee *big.Int
tipTRC21FeeTestnet *big.Int
tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block.
berlinBlock *big.Int
londonBlock *big.Int
mergeBlock *big.Int
shanghaiBlock *big.Int
blockNumberGas50x *big.Int
TIPV2SwitchBlock *big.Int
tipXDCXMinerDisable *big.Int
tipXDCXReceiverDisable *big.Int
eip1559Block *big.Int
cancunBlock *big.Int
trc21IssuerSMCTestNet Address
trc21IssuerSMC Address
xdcxListingSMC Address
xdcxListingSMCTestNet Address
relayerRegistrationSMC string
relayerRegistrationSMCTestnet string
lendingRegistrationSMC string
lendingRegistrationSMCTestnet string
ignoreSignerCheckBlockArray map[uint64]struct{}
blacklist map[Address]struct{}
} }
var Blacklist = map[Address]bool{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): true, // variables for specific networks, copy values from MaintnetConstant to pass tests
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): true, var (
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): true, BlackListHFNumber = MaintnetConstant.blackListHFNumber
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): true, MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): true,
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): true, TIP2019Block = MaintnetConstant.tip2019Block
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): true, TIPSigning = MaintnetConstant.tipSigning
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): true, TIPRandomize = MaintnetConstant.tipRandomize
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): true, TIPNoHalvingMNReward = MaintnetConstant.tipNoHalvingMNReward
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): true, TIPXDCX = MaintnetConstant.tipXDCX
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): true, TIPXDCXLending = MaintnetConstant.tipXDCXLending
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): true, TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): true, TIPXDCXCancellationFeeTestnet = MaintnetConstant.tipXDCXCancellationFeeTestnet
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): true, TIPTRC21Fee = MaintnetConstant.tipTRC21Fee
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): true, TIPTRC21FeeTestnet = MaintnetConstant.tipTRC21FeeTestnet
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): true, TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): true, BerlinBlock = MaintnetConstant.berlinBlock
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): true, LondonBlock = MaintnetConstant.londonBlock
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): true, MergeBlock = MaintnetConstant.mergeBlock
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): true, ShanghaiBlock = MaintnetConstant.shanghaiBlock
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): true, BlockNumberGas50x = MaintnetConstant.blockNumberGas50x
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): true, TIPXDCXMinerDisable = MaintnetConstant.tipXDCXMinerDisable
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): true, TIPXDCXReceiverDisable = MaintnetConstant.tipXDCXReceiverDisable
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): true, Eip1559Block = MaintnetConstant.eip1559Block
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): true, CancunBlock = MaintnetConstant.cancunBlock
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): true,
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): true, TRC21IssuerSMCTestNet = MaintnetConstant.trc21IssuerSMCTestNet
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): true, TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): true, XDCXListingSMC = MaintnetConstant.xdcxListingSMC
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): true, XDCXListingSMCTestNet = MaintnetConstant.xdcxListingSMCTestNet
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): true,
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): true, RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): true, RelayerRegistrationSMCTestnet = MaintnetConstant.relayerRegistrationSMCTestnet
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): true, LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): true, LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): true,
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): true, ignoreSignerCheckBlockArray = map[uint64]struct{}{}
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): true, blacklist = map[Address]struct{}{}
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): true, )
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): true,
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): true, func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): true, _, ok := ignoreSignerCheckBlockArray[blockNumber]
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): true, return ok
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): true, }
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): true,
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): true, func IsInBlacklist(address *Address) bool {
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): true, if address == nil {
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): true, return false
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): true, }
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): true, _, ok := blacklist[*address]
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): true, return ok
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): true, }
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): true,
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): true, func CopyConstans(chainID uint64) {
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): true, var c *constant
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): true, if chainID == MaintnetConstant.chainID {
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): true, c = &MaintnetConstant
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): true, } else if chainID == TestnetConstant.chainID {
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): true, c = &TestnetConstant
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): true, } else if chainID == DevnetConstant.chainID {
HexToAddress("0x0000000000000000000000000000000000000011"): true, c = &DevnetConstant
} else if chainID == localConstant.chainID {
c = &localConstant
} else {
return
}
MaxMasternodesV2 = c.maxMasternodesV2
BlackListHFNumber = c.blackListHFNumber
TIP2019Block = c.tip2019Block
TIPSigning = c.tipSigning
TIPRandomize = c.tipRandomize
TIPNoHalvingMNReward = c.tipNoHalvingMNReward
TIPXDCX = c.tipXDCX
TIPXDCXLending = c.tipXDCXLending
TIPXDCXCancellationFee = c.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = c.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = c.tipTRC21Fee
TIPTRC21FeeTestnet = c.tipTRC21FeeTestnet
TIPIncreaseMasternodes = c.tipIncreaseMasternodes
BerlinBlock = c.berlinBlock
LondonBlock = c.londonBlock
MergeBlock = c.mergeBlock
ShanghaiBlock = c.shanghaiBlock
BlockNumberGas50x = c.blockNumberGas50x
TIPXDCXMinerDisable = c.tipXDCXMinerDisable
TIPXDCXReceiverDisable = c.tipXDCXReceiverDisable
Eip1559Block = c.eip1559Block
CancunBlock = c.cancunBlock
TRC21IssuerSMCTestNet = c.trc21IssuerSMCTestNet
TRC21IssuerSMC = c.trc21IssuerSMC
XDCXListingSMC = c.xdcxListingSMC
XDCXListingSMCTestNet = c.xdcxListingSMCTestNet
RelayerRegistrationSMC = c.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = c.relayerRegistrationSMCTestnet
LendingRegistrationSMC = c.lendingRegistrationSMC
LendingRegistrationSMCTestnet = c.lendingRegistrationSMCTestnet
clear(ignoreSignerCheckBlockArray)
maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray)
clear(blacklist)
maps.Copy(blacklist, c.blacklist)
} }

View file

@ -1,6 +1,7 @@
package common package common
import ( import (
"maps"
"math/big" "math/big"
) )
@ -8,152 +9,207 @@ const (
RewardMasterPercent = 90 RewardMasterPercent = 90
RewardVoterPercent = 0 RewardVoterPercent = 0
RewardFoundationPercent = 10 RewardFoundationPercent = 10
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
EpocBlockSecret = 800 EpocBlockSecret = 800
EpocBlockOpening = 850 EpocBlockOpening = 850
EpocBlockRandomize = 900 EpocBlockRandomize = 900
MaxMasternodes = 18 MaxMasternodes = 18
MaxMasternodesV2 = 15 // Last v1 masternodes
LimitPenaltyEpoch = 4 LimitPenaltyEpoch = 4
LimitPenaltyEpochV2 = 0 LimitPenaltyEpochV2 = 0
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
LimitThresholdNonceInQueue = 10 LimitThresholdNonceInQueue = 10
DefaultMinGasPrice = 250000000 DefaultMinGasPrice = 250000000
MergeSignRange = 15 MergeSignRange = 15
RangeReturnSigner = 150 RangeReturnSigner = 150
MinimunMinerBlockPerEpoch = 1 MinimunMinerBlockPerEpoch = 1
BlocksPerYearTest = uint64(200000)
BlocksPerYear = uint64(15768000)
OneYear = uint64(365 * 86400) OneYear = uint64(365 * 86400)
LiquidateLendingTradeBlock = uint64(100) LiquidateLendingTradeBlock = uint64(100)
LimitTimeFinality = uint64(30) // limit in 30 block
HexSignMethod = "e341eaa4"
HexSetSecret = "34d38600"
HexSetOpening = "e11f5ba2"
) )
var Rewound = uint64(0) // variables for all network.
var (
IsTestnet bool = false
Enable0xPrefix bool = true
var TIP2019Block = big.NewInt(1) Rewound = uint64(0)
var TIPSigning = big.NewInt(3000000)
var TIPRandomize = big.NewInt(3464000)
var TIPV2SwitchBlock = big.NewInt(56828700) // Target 13rd Nov 2023 RollbackHash Hash
var TIPIncreaseMasternodes = big.NewInt(5000000) // Upgrade MN Count at Block. StoreRewardFolder string
var TIPNoHalvingMNReward = big.NewInt(23779191) // hardfork no halving masternodes reward
var BlackListHFNumber = uint64(23779191)
var TIPXDCX = big.NewInt(23779191)
var TIPXDCXLending = big.NewInt(23779191)
var TIPXDCXCancellationFee = big.NewInt(23779191)
var TIPXDCXCancellationFeeTestnet = big.NewInt(23779191)
var TIPXDCXMinerDisable = big.NewInt(61290000) // Target 31st March 2024
var TIPXDCXReceiverDisable = big.NewInt(66825000) // Target 26 Aug 2024
var BerlinBlock = big.NewInt(61290000)
var LondonBlock = big.NewInt(61290000)
var MergeBlock = big.NewInt(61290000)
var ShanghaiBlock = big.NewInt(61290000) // Target 31st March 2024
var Eip1559Block = big.NewInt(9999999999)
var CancunBlock = big.NewInt(9999999999)
var TIPXDCXTestnet = big.NewInt(23779191) TRC21GasPriceBefore = big.NewInt(2500)
var IsTestnet bool = true TRC21GasPrice = big.NewInt(250000000)
var Enable0xPrefix bool = true MinGasPrice = big.NewInt(DefaultMinGasPrice)
var StoreRewardFolder string
var RollbackHash Hash
var BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var RelayerFee = big.NewInt(1000000000000000) // 0.001
var XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
var XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
var RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
var BaseLendingInterest = big.NewInt(100000000) // 1e8
var MinGasPrice = big.NewInt(DefaultMinGasPrice) // XDCx and XDCxlending
var RelayerRegistrationSMC = "0x16c63b79f9C8784168103C0b74E6A59EC2de4a02" BasePrice = big.NewInt(1000000000000000000) // 1
var RelayerRegistrationSMCTestnet = "0xA1996F69f47ba14Cb7f661010A7C31974277958c" RelayerLockedFund = big.NewInt(20000) // 20000 XDC
var LendingRegistrationSMC = "0x7d761afd7ff65a79e4173897594a194e3c506e57" XDCXBaseFee = big.NewInt(10000) // 1 / XDCXBaseFee
var LendingRegistrationSMCTestnet = "0x28d7fC2Cf5c18203aaCD7459EFC6Af0643C97bE8" XDCXBaseCancelFee = new(big.Int).Mul(XDCXBaseFee, big.NewInt(10)) // 1/ (XDCXBaseFee *10)
var TRC21IssuerSMCTestNet = HexToAddress("0x0E2C88753131CE01c7551B726b28BFD04e44003F")
var TRC21IssuerSMC = HexToAddress("0x8c0faeb5C6bEd2129b8674F262Fd45c4e9468bee")
var XDCXListingSMC = HexToAddress("0xDE34dD0f536170993E8CFF639DdFfCF1A85D3E53")
var XDCXListingSMCTestNet = HexToAddress("0x14B2Bf043b9c31827A472CE4F94294fE9a6277e0")
var TRC21GasPriceBefore = big.NewInt(2500)
var TRC21GasPrice = big.NewInt(250000000)
var RateTopUp = big.NewInt(90) // 90%
var BaseTopUp = big.NewInt(100)
var BaseRecall = big.NewInt(100)
var TIPTRC21Fee = big.NewInt(23779191)
var TIPTRC21FeeTestnet = big.NewInt(23779191)
var BlockNumberGas50x = big.NewInt(56828700)
var LimitTimeFinality = uint64(30) // limit in 30 block
var IgnoreSignerCheckBlockArray = map[uint64]bool{ // XDCx
uint64(1032300): true, RelayerFee = big.NewInt(1000000000000000) // 0.001
uint64(1033200): true, RelayerCancelFee = big.NewInt(100000000000000) // 0.0001
uint64(27307800): true,
uint64(28270800): true, // XDCxlending
RateTopUp = big.NewInt(90) // 90%
BaseTopUp = big.NewInt(100)
BaseRecall = big.NewInt(100)
BaseLendingInterest = big.NewInt(100000000) // 1e8
RelayerLendingFee = big.NewInt(10000000000000000) // 0.01
RelayerLendingCancelFee = big.NewInt(1000000000000000) // 0.001
)
type constant struct {
chainID uint64
blackListHFNumber uint64
maxMasternodesV2 int // Last v1 masternodes
tip2019Block *big.Int
tipSigning *big.Int
tipRandomize *big.Int
tipNoHalvingMNReward *big.Int // hardfork no halving masternodes reward
tipXDCX *big.Int
tipXDCXLending *big.Int
tipXDCXCancellationFee *big.Int
tipXDCXCancellationFeeTestnet *big.Int
tipTRC21Fee *big.Int
tipTRC21FeeTestnet *big.Int
tipIncreaseMasternodes *big.Int // Upgrade MN Count at Block.
berlinBlock *big.Int
londonBlock *big.Int
mergeBlock *big.Int
shanghaiBlock *big.Int
blockNumberGas50x *big.Int
TIPV2SwitchBlock *big.Int
tipXDCXMinerDisable *big.Int
tipXDCXReceiverDisable *big.Int
eip1559Block *big.Int
cancunBlock *big.Int
trc21IssuerSMCTestNet Address
trc21IssuerSMC Address
xdcxListingSMC Address
xdcxListingSMCTestNet Address
relayerRegistrationSMC string
relayerRegistrationSMCTestnet string
lendingRegistrationSMC string
lendingRegistrationSMCTestnet string
ignoreSignerCheckBlockArray map[uint64]struct{}
blacklist map[Address]struct{}
} }
var Blacklist = map[Address]bool{
HexToAddress("0x5248bfb72fd4f234e062d3e9bb76f08643004fcd"): true, // variables for specific networks, copy values from MaintnetConstant to pass tests
HexToAddress("0x5ac26105b35ea8935be382863a70281ec7a985e9"): true, var (
HexToAddress("0x09c4f991a41e7ca0645d7dfbfee160b55e562ea4"): true, BlackListHFNumber = MaintnetConstant.blackListHFNumber
HexToAddress("0xb3157bbc5b401a45d6f60b106728bb82ebaa585b"): true, MaxMasternodesV2 = MaintnetConstant.maxMasternodesV2 // Last v1 masternodes
HexToAddress("0x741277a8952128d5c2ffe0550f5001e4c8247674"): true,
HexToAddress("0x10ba49c1caa97d74b22b3e74493032b180cebe01"): true, TIP2019Block = MaintnetConstant.tip2019Block
HexToAddress("0x07048d51d9e6179578a6e3b9ee28cdc183b865e4"): true, TIPSigning = MaintnetConstant.tipSigning
HexToAddress("0x4b899001d73c7b4ec404a771d37d9be13b8983de"): true, TIPRandomize = MaintnetConstant.tipRandomize
HexToAddress("0x85cb320a9007f26b7652c19a2a65db1da2d0016f"): true, TIPNoHalvingMNReward = MaintnetConstant.tipNoHalvingMNReward
HexToAddress("0x06869dbd0e3a2ea37ddef832e20fa005c6f0ca39"): true, TIPXDCX = MaintnetConstant.tipXDCX
HexToAddress("0x82e48bc7e2c93d89125428578fb405947764ad7c"): true, TIPXDCXLending = MaintnetConstant.tipXDCXLending
HexToAddress("0x1f9a78534d61732367cbb43fc6c89266af67c989"): true, TIPXDCXCancellationFee = MaintnetConstant.tipXDCXCancellationFee
HexToAddress("0x7c3b1fa91df55ff7af0cad9e0399384dc5c6641b"): true, TIPXDCXCancellationFeeTestnet = MaintnetConstant.tipXDCXCancellationFeeTestnet
HexToAddress("0x5888dc1ceb0ff632713486b9418e59743af0fd20"): true, TIPTRC21Fee = MaintnetConstant.tipTRC21Fee
HexToAddress("0xa512fa1c735fc3cc635624d591dd9ea1ce339ca5"): true, TIPTRC21FeeTestnet = MaintnetConstant.tipTRC21FeeTestnet
HexToAddress("0x0832517654c7b7e36b1ef45d76de70326b09e2c7"): true, TIPIncreaseMasternodes = MaintnetConstant.tipIncreaseMasternodes
HexToAddress("0xca14e3c4c78bafb60819a78ff6e6f0f709d2aea7"): true, BerlinBlock = MaintnetConstant.berlinBlock
HexToAddress("0x652ce195a23035114849f7642b0e06647d13e57a"): true, LondonBlock = MaintnetConstant.londonBlock
HexToAddress("0x29a79f00f16900999d61b6e171e44596af4fb5ae"): true, MergeBlock = MaintnetConstant.mergeBlock
HexToAddress("0xf9fd1c2b0af0d91b0b6754e55639e3f8478dd04a"): true, ShanghaiBlock = MaintnetConstant.shanghaiBlock
HexToAddress("0xb835710c9901d5fe940ef1b99ed918902e293e35"): true, BlockNumberGas50x = MaintnetConstant.blockNumberGas50x
HexToAddress("0x04dd29ce5c253377a9a3796103ea0d9a9e514153"): true, TIPXDCXMinerDisable = MaintnetConstant.tipXDCXMinerDisable
HexToAddress("0x2b4b56846eaf05c1fd762b5e1ac802efd0ab871c"): true, TIPXDCXReceiverDisable = MaintnetConstant.tipXDCXReceiverDisable
HexToAddress("0x1d1f909f6600b23ce05004f5500ab98564717996"): true, Eip1559Block = MaintnetConstant.eip1559Block
HexToAddress("0x0dfdcebf80006dc9ab7aae8c216b51c6b6759e86"): true, CancunBlock = MaintnetConstant.cancunBlock
HexToAddress("0x2b373890a28e5e46197fbc04f303bbfdd344056f"): true,
HexToAddress("0xa8a3ef3dc5d8e36aee76f3671ec501ec31e28254"): true, TRC21IssuerSMCTestNet = MaintnetConstant.trc21IssuerSMCTestNet
HexToAddress("0x4f3d18136fe2b5665c29bdaf74591fc6625ef427"): true, TRC21IssuerSMC = MaintnetConstant.trc21IssuerSMC
HexToAddress("0x175d728b0e0f1facb5822a2e0c03bde93596e324"): true, XDCXListingSMC = MaintnetConstant.xdcxListingSMC
HexToAddress("0xd575c2611984fcd79513b80ab94f59dc5bab4916"): true, XDCXListingSMCTestNet = MaintnetConstant.xdcxListingSMCTestNet
HexToAddress("0x0579337873c97c4ba051310236ea847f5be41bc0"): true,
HexToAddress("0xed12a519cc15b286920fc15fd86106b3e6a16218"): true, RelayerRegistrationSMC = MaintnetConstant.relayerRegistrationSMC
HexToAddress("0x492d26d852a0a0a2982bb40ec86fe394488c419e"): true, RelayerRegistrationSMCTestnet = MaintnetConstant.relayerRegistrationSMCTestnet
HexToAddress("0xce5c7635d02dc4e1d6b46c256cae6323be294a32"): true, LendingRegistrationSMC = MaintnetConstant.lendingRegistrationSMC
HexToAddress("0x8b94db158b5e78a6c032c7e7c9423dec62c8b11c"): true, LendingRegistrationSMCTestnet = MaintnetConstant.lendingRegistrationSMCTestnet
HexToAddress("0x0e7c48c085b6b0aa7ca6e4cbcc8b9a92dc270eb4"): true,
HexToAddress("0x206e6508462033ef8425edc6c10789d241d49acb"): true, ignoreSignerCheckBlockArray = map[uint64]struct{}{}
HexToAddress("0x7710e7b7682f26cb5a1202e1cff094fbf7777758"): true, blacklist = map[Address]struct{}{}
HexToAddress("0xcb06f949313b46bbf53b8e6b2868a0c260ff9385"): true, )
HexToAddress("0xf884e43533f61dc2997c0e19a6eff33481920c00"): true,
HexToAddress("0x8b635ef2e4c8fe21fc2bda027eb5f371d6aa2fc1"): true, func IsIgnoreSignerCheckBlock(blockNumber uint64) bool {
HexToAddress("0x10f01a27cf9b29d02ce53497312b96037357a361"): true, _, ok := ignoreSignerCheckBlockArray[blockNumber]
HexToAddress("0x693dd49b0ed70f162d733cf20b6c43dc2a2b4d95"): true, return ok
HexToAddress("0xe0bec72d1c2a7a7fb0532cdfac44ebab9f6f41ee"): true, }
HexToAddress("0xc8793633a537938cb49cdbbffd45428f10e45b64"): true,
HexToAddress("0x0d07a6cbbe9fa5c4f154e5623bfe47fb4d857d8e"): true, func IsInBlacklist(address *Address) bool {
HexToAddress("0xd4080b289da95f70a586610c38268d8d4cf1e4c4"): true, if address == nil {
HexToAddress("0x8bcfb0caf41f0aa1b548cae76dcdd02e33866a1b"): true, return false
HexToAddress("0xabfef22b92366d3074676e77ea911ccaabfb64c1"): true, }
HexToAddress("0xcc4df7a32faf3efba32c9688def5ccf9fefe443d"): true, _, ok := blacklist[*address]
HexToAddress("0x7ec1e48a582475f5f2b7448a86c4ea7a26ea36f8"): true, return ok
HexToAddress("0xe3de67289080f63b0c2612844256a25bb99ac0ad"): true, }
HexToAddress("0x3ba623300cf9e48729039b3c9e0dee9b785d636e"): true,
HexToAddress("0x402f2cfc9c8942f5e7a12c70c625d07a5d52fe29"): true, func CopyConstans(chainID uint64) {
HexToAddress("0xd62358d42afbde095a4ca868581d85f9adcc3d61"): true, var c *constant
HexToAddress("0x3969f86acb733526cd61e3c6e3b4660589f32bc6"): true, if chainID == MaintnetConstant.chainID {
HexToAddress("0x67615413d7cdadb2c435a946aec713a9a9794d39"): true, c = &MaintnetConstant
HexToAddress("0xfe685f43acc62f92ab01a8da80d76455d39d3cb3"): true, } else if chainID == TestnetConstant.chainID {
HexToAddress("0x3538a544021c07869c16b764424c5987409cba48"): true, c = &TestnetConstant
HexToAddress("0xe187cf86c2274b1f16e8225a7da9a75aba4f1f5f"): true, } else if chainID == DevnetConstant.chainID {
HexToAddress("0x0000000000000000000000000000000000000011"): true, c = &DevnetConstant
} else if chainID == localConstant.chainID {
c = &localConstant
} else {
return
}
MaxMasternodesV2 = c.maxMasternodesV2
BlackListHFNumber = c.blackListHFNumber
TIP2019Block = c.tip2019Block
TIPSigning = c.tipSigning
TIPRandomize = c.tipRandomize
TIPNoHalvingMNReward = c.tipNoHalvingMNReward
TIPXDCX = c.tipXDCX
TIPXDCXLending = c.tipXDCXLending
TIPXDCXCancellationFee = c.tipXDCXCancellationFee
TIPXDCXCancellationFeeTestnet = c.tipXDCXCancellationFeeTestnet
TIPTRC21Fee = c.tipTRC21Fee
TIPTRC21FeeTestnet = c.tipTRC21FeeTestnet
TIPIncreaseMasternodes = c.tipIncreaseMasternodes
BerlinBlock = c.berlinBlock
LondonBlock = c.londonBlock
MergeBlock = c.mergeBlock
ShanghaiBlock = c.shanghaiBlock
BlockNumberGas50x = c.blockNumberGas50x
TIPXDCXMinerDisable = c.tipXDCXMinerDisable
TIPXDCXReceiverDisable = c.tipXDCXReceiverDisable
Eip1559Block = c.eip1559Block
CancunBlock = c.cancunBlock
TRC21IssuerSMCTestNet = c.trc21IssuerSMCTestNet
TRC21IssuerSMC = c.trc21IssuerSMC
XDCXListingSMC = c.xdcxListingSMC
XDCXListingSMCTestNet = c.xdcxListingSMCTestNet
RelayerRegistrationSMC = c.relayerRegistrationSMC
RelayerRegistrationSMCTestnet = c.relayerRegistrationSMCTestnet
LendingRegistrationSMC = c.lendingRegistrationSMC
LendingRegistrationSMCTestnet = c.lendingRegistrationSMCTestnet
clear(ignoreSignerCheckBlockArray)
maps.Copy(ignoreSignerCheckBlockArray, c.ignoreSignerCheckBlockArray)
clear(blacklist)
maps.Copy(blacklist, c.blacklist)
} }

View file

@ -272,7 +272,7 @@ func (x *XDPoS_v1) verifyCascadingFields(chain consensus.ChainReader, header *ty
func (x *XDPoS_v1) checkSignersOnCheckpoint(chain consensus.ChainReader, header *types.Header, signers []common.Address) error { func (x *XDPoS_v1) checkSignersOnCheckpoint(chain consensus.ChainReader, header *types.Header, signers []common.Address) error {
number := header.Number.Uint64() number := header.Number.Uint64()
// ignore signerCheck at checkpoint block. // ignore signerCheck at checkpoint block.
if common.IgnoreSignerCheckBlockArray[number] { if common.IsIgnoreSignerCheckBlock(number) {
return nil return nil
} }
penPenalties := []common.Address{} penPenalties := []common.Address{}

View file

@ -95,11 +95,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, tra
// check black-list txs after hf // check black-list txs after hf
if (block.Number().Uint64() >= common.BlackListHFNumber) && !common.IsTestnet { if (block.Number().Uint64() >= common.BlackListHFNumber) && !common.IsTestnet {
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return nil, nil, 0, fmt.Errorf("block contains transaction with sender in black-list: %v", tx.From().Hex()) return nil, nil, 0, fmt.Errorf("block contains transaction with sender in black-list: %v", tx.From().Hex())
} }
// check if receiver is in black list // check if receiver is in black list
if tx.To() != nil && common.Blacklist[*tx.To()] { if common.IsInBlacklist(tx.To()) {
return nil, nil, 0, fmt.Errorf("block contains transaction with receiver in black-list: %v", tx.To().Hex()) return nil, nil, 0, fmt.Errorf("block contains transaction with receiver in black-list: %v", tx.To().Hex())
} }
} }
@ -175,11 +175,11 @@ func (p *StateProcessor) ProcessBlockNoValidator(cBlock *CalculatedBlock, stated
// check black-list txs after hf // check black-list txs after hf
if (block.Number().Uint64() >= common.BlackListHFNumber) && !common.IsTestnet { if (block.Number().Uint64() >= common.BlackListHFNumber) && !common.IsTestnet {
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return nil, nil, 0, fmt.Errorf("block contains transaction with sender in black-list: %v", tx.From().Hex()) return nil, nil, 0, fmt.Errorf("block contains transaction with sender in black-list: %v", tx.From().Hex())
} }
// check if receiver is in black list // check if receiver is in black list
if tx.To() != nil && common.Blacklist[*tx.To()] { if common.IsInBlacklist(tx.To()) {
return nil, nil, 0, fmt.Errorf("block contains transaction with receiver in black-list: %v", tx.To().Hex()) return nil, nil, 0, fmt.Errorf("block contains transaction with receiver in black-list: %v", tx.To().Hex())
} }
} }

View file

@ -623,7 +623,7 @@ func (pool *LendingPool) validateLending(tx *types.LendingTransaction) error {
func (pool *LendingPool) validateTx(tx *types.LendingTransaction, local bool) error { func (pool *LendingPool) validateTx(tx *types.LendingTransaction, local bool) error {
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex()) return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex())
} }
// Heuristic limit, reject transactions over 32KB to prevent DOS attacks // Heuristic limit, reject transactions over 32KB to prevent DOS attacks

View file

@ -532,7 +532,7 @@ func (pool *OrderPool) validateOrder(tx *types.OrderTransaction) error {
func (pool *OrderPool) validateTx(tx *types.OrderTransaction, local bool) error { func (pool *OrderPool) validateTx(tx *types.OrderTransaction, local bool) error {
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex()) return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex())
} }
// Heuristic limit, reject transactions over 32KB to prevent DOS attacks // Heuristic limit, reject transactions over 32KB to prevent DOS attacks

View file

@ -631,11 +631,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
return ErrOversizedData return ErrOversizedData
} }
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex()) return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex())
} }
// check if receiver is in black list // check if receiver is in black list
if tx.To() != nil && common.Blacklist[*tx.To()] { if common.IsInBlacklist(tx.To()) {
return fmt.Errorf("reject transaction with receiver in black-list: %v", tx.To().Hex()) return fmt.Errorf("reject transaction with receiver in black-list: %v", tx.To().Hex())
} }
// Transactions can't be negative. This may never happen using RLP decoded // Transactions can't be negative. This may never happen using RLP decoded

View file

@ -356,11 +356,11 @@ func (p *TxPool) validateTx(ctx context.Context, tx *types.Transaction) error {
) )
// check if sender is in black list // check if sender is in black list
if tx.From() != nil && common.Blacklist[*tx.From()] { if common.IsInBlacklist(tx.From()) {
return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex()) return fmt.Errorf("reject transaction with sender in black-list: %v", tx.From().Hex())
} }
// check if receiver is in black list // check if receiver is in black list
if tx.To() != nil && common.Blacklist[*tx.To()] { if common.IsInBlacklist(tx.To()) {
return fmt.Errorf("reject transaction with receiver in black-list: %v", tx.To().Hex()) return fmt.Errorf("reject transaction with receiver in black-list: %v", tx.To().Hex())
} }

View file

@ -892,12 +892,12 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
if (w.header.Number.Uint64() >= common.BlackListHFNumber) && !common.IsTestnet { if (w.header.Number.Uint64() >= common.BlackListHFNumber) && !common.IsTestnet {
from := tx.From() from := tx.From()
// check if sender is in black list // check if sender is in black list
if from != nil && common.Blacklist[*from] { if common.IsInBlacklist(from) {
log.Debug("Skipping transaction with sender in black-list", "sender", from.Hex()) log.Debug("Skipping transaction with sender in black-list", "sender", from.Hex())
continue continue
} }
// check if receiver is in black list // check if receiver is in black list
if to != nil && common.Blacklist[*to] { if common.IsInBlacklist(to) {
log.Debug("Skipping transaction with receiver in black-list", "receiver", to.Hex()) log.Debug("Skipping transaction with receiver in black-list", "receiver", to.Hex())
continue continue
} }
@ -1005,13 +1005,13 @@ func (w *Work) commitTransactions(mux *event.TypeMux, balanceFee map[common.Addr
if (w.header.Number.Uint64() >= common.BlackListHFNumber) && !common.IsTestnet { if (w.header.Number.Uint64() >= common.BlackListHFNumber) && !common.IsTestnet {
from := tx.From() from := tx.From()
// check if sender is in black list // check if sender is in black list
if from != nil && common.Blacklist[*from] { if common.IsInBlacklist(from) {
log.Debug("Skipping transaction with sender in black-list", "sender", from.Hex()) log.Debug("Skipping transaction with sender in black-list", "sender", from.Hex())
txs.Pop() txs.Pop()
continue continue
} }
// check if receiver is in black list // check if receiver is in black list
if to != nil && common.Blacklist[*to] { if common.IsInBlacklist(to) {
log.Debug("Skipping transaction with receiver in black-list", "receiver", to.Hex()) log.Debug("Skipping transaction with receiver in black-list", "receiver", to.Hex())
txs.Shift() txs.Shift()
continue continue

View file

@ -166,8 +166,8 @@ var (
Gap: 450, Gap: 450,
FoudationWalletAddr: common.HexToAddress("xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"), FoudationWalletAddr: common.HexToAddress("xdc92a289fe95a85c53b8d0d113cbaef0c1ec98ac65"),
V2: &V2{ V2: &V2{
SwitchEpoch: common.TIPV2SwitchBlock.Uint64() / 900, SwitchEpoch: common.MaintnetConstant.TIPV2SwitchBlock.Uint64() / 900,
SwitchBlock: common.TIPV2SwitchBlock, SwitchBlock: common.MaintnetConstant.TIPV2SwitchBlock,
CurrentConfig: MainnetV2Configs[0], CurrentConfig: MainnetV2Configs[0],
AllConfigs: MainnetV2Configs, AllConfigs: MainnetV2Configs,
}, },
@ -207,8 +207,8 @@ var (
Gap: 450, Gap: 450,
FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"), FoudationWalletAddr: common.HexToAddress("xdc746249c61f5832c5eed53172776b460491bdcd5c"),
V2: &V2{ V2: &V2{
SwitchEpoch: common.TIPV2SwitchBlock.Uint64() / 900, SwitchEpoch: common.TestnetConstant.TIPV2SwitchBlock.Uint64() / 900,
SwitchBlock: common.TIPV2SwitchBlock, SwitchBlock: common.TestnetConstant.TIPV2SwitchBlock,
CurrentConfig: TestnetV2Configs[0], CurrentConfig: TestnetV2Configs[0],
AllConfigs: TestnetV2Configs, AllConfigs: TestnetV2Configs,
}, },
@ -231,8 +231,8 @@ var (
Gap: 450, Gap: 450,
FoudationWalletAddr: common.HexToAddress("0x746249c61f5832c5eed53172776b460491bdcd5c"), FoudationWalletAddr: common.HexToAddress("0x746249c61f5832c5eed53172776b460491bdcd5c"),
V2: &V2{ V2: &V2{
SwitchEpoch: common.TIPV2SwitchBlock.Uint64() / 900, SwitchEpoch: common.DevnetConstant.TIPV2SwitchBlock.Uint64() / 900,
SwitchBlock: common.TIPV2SwitchBlock, SwitchBlock: common.DevnetConstant.TIPV2SwitchBlock,
CurrentConfig: DevnetV2Configs[0], CurrentConfig: DevnetV2Configs[0],
AllConfigs: DevnetV2Configs, AllConfigs: DevnetV2Configs,
}, },