Skip to content

Commit

Permalink
feat: add bohr upgrade contracts bytecode (#2605)
Browse files Browse the repository at this point in the history
* feat: add bohr upgrade contracts bytecode

* feat: add bohr upgrade contracts bytecode on rialto network

* feat: add protector for stakehub on rialto network
  • Loading branch information
cosinlink authored Jul 24, 2024
1 parent 17e0e45 commit cabd0f8
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/systemcontracts/bohr/chapel/StakeHubContract

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/systemcontracts/bohr/chapel/ValidatorContract

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/systemcontracts/bohr/mainnet/StakeHubContract

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/systemcontracts/bohr/mainnet/ValidatorContract

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/systemcontracts/bohr/rialto/StakeHubContract

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/systemcontracts/bohr/rialto/ValidatorContract

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions core/systemcontracts/bohr/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ import _ "embed"
var (
//go:embed mainnet/ValidatorContract
MainnetValidatorContract string
//go:embed mainnet/StakeHubContract
MainnetStakeHubContract string
)

// contract codes for Chapel upgrade
var (
//go:embed chapel/ValidatorContract
ChapelValidatorContract string
//go:embed chapel/StakeHubContract
ChapelStakeHubContract string
)

// contract codes for Rialto upgrade
var (
//go:embed rialto/ValidatorContract
RialtoValidatorContract string
//go:embed rialto/StakeHubContract
RialtoStakeHubContract string
)
49 changes: 49 additions & 0 deletions core/systemcontracts/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/systemcontracts/bohr"
"github.com/ethereum/go-ethereum/core/systemcontracts/bruno"
"github.com/ethereum/go-ethereum/core/systemcontracts/euler"
"github.com/ethereum/go-ethereum/core/systemcontracts/feynman"
Expand Down Expand Up @@ -738,6 +739,54 @@ func init() {
},
},
}

bohrUpgrade[mainNet] = &Upgrade{
UpgradeName: "bohr",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.MainnetValidatorContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.MainnetStakeHubContract,
},
},
}

bohrUpgrade[chapelNet] = &Upgrade{
UpgradeName: "bohr",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.ChapelValidatorContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.ChapelStakeHubContract,
},
},
}

bohrUpgrade[rialtoNet] = &Upgrade{
UpgradeName: "bohr",
Configs: []*UpgradeConfig{
{
ContractAddr: common.HexToAddress(ValidatorContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.RialtoValidatorContract,
},
{
ContractAddr: common.HexToAddress(StakeHubContract),
CommitUrl: "https://github.com/bnb-chain/bsc-genesis-contract/commit/04bc57c1876dd543dd3133b2755ba87cc5f1796a",
Code: bohr.RialtoStakeHubContract,
},
},
}
}

func UpgradeBuildInSystemContract(config *params.ChainConfig, blockNumber *big.Int, lastBlockTime uint64, blockTime uint64, statedb *state.StateDB) {
Expand Down

0 comments on commit cabd0f8

Please sign in to comment.