Skip to content

Commit 5e8872c

Browse files
committed
core/systemcontracts: define fermiUpgrade
1 parent b448f7f commit 5e8872c

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

core/systemcontracts/fermi/chapel/StakeHubContract

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

core/systemcontracts/fermi/mainnet/StakeHubContract

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

core/systemcontracts/fermi/rialto/StakeHubContract

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package fermi
2+
3+
import _ "embed"
4+
5+
// contract codes for Mainnet upgrade
6+
var (
7+
//go:embed mainnet/StakeHubContract
8+
MainnetStakeHubContract string
9+
)
10+
11+
// contract codes for Chapel upgrade
12+
var (
13+
//go:embed chapel/StakeHubContract
14+
ChapelStakeHubContract string
15+
)
16+
17+
// contract codes for Rialto upgrade
18+
var (
19+
//go:embed rialto/StakeHubContract
20+
RialtoStakeHubContract string
21+
)

core/systemcontracts/upgrade.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/ethereum/go-ethereum/core/systemcontracts/bohr"
1212
"github.com/ethereum/go-ethereum/core/systemcontracts/bruno"
1313
"github.com/ethereum/go-ethereum/core/systemcontracts/euler"
14+
"github.com/ethereum/go-ethereum/core/systemcontracts/fermi"
1415
"github.com/ethereum/go-ethereum/core/systemcontracts/feynman"
1516
feynmanFix "github.com/ethereum/go-ethereum/core/systemcontracts/feynman_fix"
1617
"github.com/ethereum/go-ethereum/core/systemcontracts/gibbs"
@@ -92,6 +93,8 @@ var (
9293
lorentzUpgrade = make(map[string]*Upgrade)
9394

9495
maxwellUpgrade = make(map[string]*Upgrade)
96+
97+
fermiUpgrade = make(map[string]*Upgrade)
9598
)
9699

97100
func init() {
@@ -1019,6 +1022,40 @@ func init() {
10191022
},
10201023
},
10211024
}
1025+
1026+
// TODO(Nathan): update the Url once contracts merged into master branch for fermi hardfork
1027+
fermiUpgrade[mainNet] = &Upgrade{
1028+
UpgradeName: "fermi",
1029+
Configs: []*UpgradeConfig{
1030+
{
1031+
ContractAddr: common.HexToAddress(StakeHubContract),
1032+
CommitUrl: "https://github.com/allformless/bsc-genesis-contract/commit/62a516e06b73cff04a3f46a615c5d804753a2d29",
1033+
Code: fermi.MainnetStakeHubContract,
1034+
},
1035+
},
1036+
}
1037+
1038+
fermiUpgrade[chapelNet] = &Upgrade{
1039+
UpgradeName: "fermi",
1040+
Configs: []*UpgradeConfig{
1041+
{
1042+
ContractAddr: common.HexToAddress(StakeHubContract),
1043+
CommitUrl: "https://github.com/allformless/bsc-genesis-contract/commit/62a516e06b73cff04a3f46a615c5d804753a2d29",
1044+
Code: fermi.ChapelStakeHubContract,
1045+
},
1046+
},
1047+
}
1048+
1049+
fermiUpgrade[rialtoNet] = &Upgrade{
1050+
UpgradeName: "fermi",
1051+
Configs: []*UpgradeConfig{
1052+
{
1053+
ContractAddr: common.HexToAddress(StakeHubContract),
1054+
CommitUrl: "https://github.com/allformless/bsc-genesis-contract/commit/62a516e06b73cff04a3f46a615c5d804753a2d29",
1055+
Code: fermi.RialtoStakeHubContract,
1056+
},
1057+
},
1058+
}
10221059
}
10231060

10241061
func TryUpdateBuildInSystemContract(config *params.ChainConfig, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, statedb vm.StateDB, atBlockBegin bool) {
@@ -1134,6 +1171,10 @@ func upgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.I
11341171
applySystemContractUpgrade(maxwellUpgrade[network], blockNumber, statedb, logger)
11351172
}
11361173

1174+
if config.IsOnFermi(blockNumber, lastBlockTime, blockTime) {
1175+
applySystemContractUpgrade(fermiUpgrade[network], blockNumber, statedb, logger)
1176+
}
1177+
11371178
/*
11381179
apply other upgrades
11391180
*/

0 commit comments

Comments
 (0)