Commit 7fcbfa5d authored by Mark Tyneway's avatar Mark Tyneway Committed by Andreas Bigger

contracts-bedrock: chains constants library

parent 546fc4bf
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice Chain IDs for the various networks.
library Chains {
uint256 internal constant Mainnet = 1;
uint256 internal constant OPMainnet = 10;
uint256 internal constant Goerli = 5;
uint256 internal constant OPGoerli = 420;
uint256 internal constant Sepolia = 11155111;
uint256 internal constant OPSepolia = 11155420;
uint256 internal constant LocalDevnet = 901;
uint256 internal constant OPLocalDevnet = 902;
uint256 internal constant GethDevnet = 1337;
}
......@@ -26,6 +26,7 @@ import { DisputeGameFactory } from "../src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../src/dispute/FaultDisputeGame.sol";
import { L1ERC721Bridge } from "../src/L1/L1ERC721Bridge.sol";
import { Predeploys } from "../src/libraries/Predeploys.sol";
import { Chains } from "./Chains.sol";
import { IBigStepper } from "../src/dispute/interfaces/IBigStepper.sol";
import { AlphabetVM } from "../test/FaultDisputeGame.t.sol";
......@@ -246,7 +247,7 @@ contract Deploy is Deployer {
/// @notice Deploy the DisputeGameFactoryProxy
function deployDisputeGameFactoryProxy() broadcast() public returns (address) {
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
......@@ -347,7 +348,7 @@ contract Deploy is Deployer {
/// @notice Deploy the DisputeGameFactory
function deployDisputeGameFactory() broadcast() public returns (address) {
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = new DisputeGameFactory();
save("DisputeGameFactory", address(factory));
console.log("DisputeGameFactory deployed at %s", address(factory));
......@@ -442,7 +443,7 @@ contract Deploy is Deployer {
/// @notice Initialize the DisputeGameFactory
function initializeDisputeGameFactory() broadcast() public {
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy");
address disputeGameFactory = mustGetAddress("DisputeGameFactory");
......@@ -676,7 +677,7 @@ contract Deploy is Deployer {
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
function transferDisputeGameFactoryOwnership() broadcast() public {
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner();
......@@ -689,7 +690,7 @@ contract Deploy is Deployer {
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() broadcast() public {
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
......
......@@ -5,6 +5,7 @@ import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
import { stdJson } from "forge-std/StdJson.sol";
import { Executables } from "./Executables.sol";
import { Chains } from "./Chains.sol";
/// @title DeployConfig
/// @notice Represents the configuration required to deploy the system. It is expected
......@@ -87,7 +88,7 @@ contract DeployConfig is Script {
eip1559Denominator = stdJson.readUint(_json, "$.eip1559Denominator");
eip1559Elasticity = stdJson.readUint(_json, "$.eip1559Elasticity");
if (block.chainid == 901 || block.chainid == 1337) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
faultGameAbsolutePrestate = stdJson.readUint(_json, "$.faultGameAbsolutePrestate");
faultGameMaxDepth = stdJson.readUint(_json, "$.faultGameMaxDepth");
faultGameMaxDuration = stdJson.readUint(_json, "$.faultGameMaxDuration");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment