Commit 556cd486 authored by OptimismBot's avatar OptimismBot Committed by GitHub

Merge pull request #6584 from ethereum-optimism/feat/deploy-script

contracts-bedrock: cleanup deploy script
parents d9207c6f 50bffd00
......@@ -109,6 +109,14 @@ contract Deploy is Deployer {
vm.stopBroadcast();
}
/// @notice Modifier that will only allow a function to be called on devnet.
modifier onlyDevnet() {
uint256 chainid = block.chainid;
if (chainid == Chains.LocalDevnet || chainid == Chains.GethDevnet) {
_;
}
}
/// @notice Deploy the AddressManager
function deployAddressManager() broadcast() public returns (address) {
AddressManager manager = new AddressManager();
......@@ -250,8 +258,7 @@ contract Deploy is Deployer {
}
/// @notice Deploy the DisputeGameFactoryProxy
function deployDisputeGameFactoryProxy() broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
function deployDisputeGameFactoryProxy() onlyDevnet broadcast() public returns (address) {
address proxyAdmin = mustGetAddress("ProxyAdmin");
Proxy proxy = new Proxy({
_admin: proxyAdmin
......@@ -265,8 +272,6 @@ contract Deploy is Deployer {
return address(proxy);
}
return address(0);
}
/// @notice Deploy the L1CrossDomainMessenger
function deployL1CrossDomainMessenger() broadcast() public returns (address) {
......@@ -351,40 +356,31 @@ contract Deploy is Deployer {
}
/// @notice Deploy the DisputeGameFactory
function deployDisputeGameFactory() broadcast() public returns (address) {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
function deployDisputeGameFactory() onlyDevnet broadcast() public returns (address) {
DisputeGameFactory factory = new DisputeGameFactory();
save("DisputeGameFactory", address(factory));
console.log("DisputeGameFactory deployed at %s", address(factory));
return address(factory);
}
return address(0);
}
/// @notice Deploy the PreimageOracle
function deployPreimageOracle() broadcast() public returns (address) {
if (block.chainid == 900) {
function deployPreimageOracle() onlyDevnet broadcast() public returns (address) {
PreimageOracle preimageOracle = new PreimageOracle();
save("PreimageOracle", address(preimageOracle));
console.log("PreimageOracle deployed at %s", address(preimageOracle));
return address(preimageOracle);
}
return address(0);
}
/// @notice Deploy Mips
function deployMips() broadcast() public returns (address) {
if (block.chainid == 900) {
function deployMips() onlyDevnet broadcast() public returns (address) {
MIPS mips = new MIPS();
save("Mips", address(mips));
console.log("Mips deployed at %s", address(mips));
console.log("MIPS deployed at %s", address(mips));
return address(mips);
}
return address(0);
}
/// @notice Deploy the SystemConfig
function deploySystemConfig() broadcast() public returns (address) {
......@@ -470,8 +466,7 @@ contract Deploy is Deployer {
}
/// @notice Initialize the DisputeGameFactory
function initializeDisputeGameFactory() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
function initializeDisputeGameFactory() onlyDevnet broadcast() public {
ProxyAdmin proxyAdmin = ProxyAdmin(mustGetAddress("ProxyAdmin"));
address disputeGameFactoryProxy = mustGetAddress("DisputeGameFactoryProxy");
address disputeGameFactory = mustGetAddress("DisputeGameFactory");
......@@ -488,7 +483,6 @@ contract Deploy is Deployer {
string memory version = DisputeGameFactory(disputeGameFactoryProxy).version();
console.log("DisputeGameFactory version: %s", version);
}
}
/// @notice Initialize the SystemConfig
function initializeSystemConfig() broadcast() public {
......@@ -704,8 +698,7 @@ contract Deploy is Deployer {
}
/// @notice Transfer ownership of the DisputeGameFactory contract to the final system owner
function transferDisputeGameFactoryOwnership() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
function transferDisputeGameFactoryOwnership() onlyDevnet broadcast() public {
DisputeGameFactory disputeGameFactory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
address owner = disputeGameFactory.owner();
address finalSystemOwner = cfg.finalSystemOwner();
......@@ -714,11 +707,9 @@ contract Deploy is Deployer {
console.log("DisputeGameFactory ownership transferred to: %s", finalSystemOwner);
}
}
}
/// @notice Sets the implementation for the `FAULT` game type in the `DisputeGameFactory`
function setFaultGameImplementation() broadcast() public {
if (block.chainid == Chains.LocalDevnet || block.chainid == Chains.GethDevnet) {
function setFaultGameImplementation() onlyDevnet broadcast() public {
DisputeGameFactory factory = DisputeGameFactory(mustGetAddress("DisputeGameFactoryProxy"));
Claim absolutePrestate = Claim.wrap(bytes32(cfg.faultGameAbsolutePrestate()));
IBigStepper faultVm = IBigStepper(new AlphabetVM(absolutePrestate));
......@@ -733,6 +724,5 @@ contract Deploy is Deployer {
console.log("DisputeGameFactory: set `FaultDisputeGame` implementation");
}
}
}
}
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