Skip to content

Commit

Permalink
Add scripts to deploy and upgrade holocene systemconfig (#223)
Browse files Browse the repository at this point in the history
* Add scripts to deploy and upgrade holocene systemconfig

* fixes

* fixes pt 2

* set denominator

* fix denominator
  • Loading branch information
henridevieux authored Nov 21, 2024
1 parent bd2f815 commit 15fd271
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ forge-deps:
github.com/OpenZeppelin/openzeppelin-contracts-upgradeable@v4.7.3 \
github.com/rari-capital/solmate@8f9b23f8838670afda0fd8983f2c41e8037ae6bc \
github.com/Saw-mon-and-Natalie/clones-with-immutable-args@105efee1b9127ed7f6fedf139e1fc796ce8791f2 \
github.com/Vectorized/solady@862a0afd3e66917f50e987e91886b9b90c4018a1
github.com/Vectorized/solady@1dd8967b93b379ca6cf384640e0715e55ef08e3d

.PHONY: checkout-op-commit
checkout-op-commit:
Expand Down
13 changes: 13 additions & 0 deletions sepolia-alpha/2024-11-19-holocene-contracts/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# op-contracts v1.8.0-rc.2
OP_COMMIT=df25977a160f85160779bbca71a8e56cf35b0f69
SYSTEM_CONFIG_PROXY=0x7F67DC4959cb3E532B10A99F41bDD906C46FdFdE

# Newly deployed implementation contract for Holocene
SYSTEM_CONFIG_IMPLEMENTATION=0x57563A1Ad5b07CEB7e77B395d767E6144699C887

# Same values as previous SystemConfig:
SYTEM_CONFIG_OWNER=0xAf6E0E871f38c7B653700F7CbAEDafaa2784D430

GAS_LIMIT=60000000
ELASTICITY_MULTIPLIER=2
DENOMINATOR=250
1 change: 1 addition & 0 deletions sepolia-alpha/2024-11-19-holocene-contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/
15 changes: 15 additions & 0 deletions sepolia-alpha/2024-11-19-holocene-contracts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include ../../Makefile
include ../.env
include .env

.PHONY: deploy
deploy:
forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) DeploySystemConfig --broadcast

.PHONY: upgrade
upgrade:
forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) UpgradeSystemConfig --broadcast

.PHONY: set-1559-params
set-1559-params:
forge script --rpc-url $(L1_RPC_URL) --private-key $(PRIVATE_KEY) SetEIP1559Params --broadcast
19 changes: 19 additions & 0 deletions sepolia-alpha/2024-11-19-holocene-contracts/foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[profile.default]
src = 'src'
out = 'out'
libs = ['lib']
broadcast = 'records'
fs_permissions = [ {access = "read-write", path = "./"} ]
optimizer = true
optimizer_runs = 999999
via-ir = true
remappings = [
'@eth-optimism-bedrock/contracts/=lib/optimism/packages/contracts-bedrock/src/',
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
'@rari-capital/solmate/=lib/solmate/',
'@solady/=lib/solady/src',
'@cwia/=lib/clones-with-immutable-args/src'
]

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "lib/optimism/packages/contracts-bedrock/src/L1/SystemConfig.sol";
import "forge-std/Script.sol";

contract DeploySystemConfig is Script {
function run() public {
vm.startBroadcast();
SystemConfig systemConfigImpl = new SystemConfig();
console.log("SystemConfig implementation deployed at: ", address(systemConfigImpl));
vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "forge-std/Script.sol";
import "@eth-optimism-bedrock/contracts/universal/ProxyAdmin.sol";
import "@eth-optimism-bedrock/contracts/L1/SystemConfig.sol";

contract SetEIP1559Params is Script {
address systemConfigProxyAddress = vm.envAddress("SYSTEM_CONFIG_PROXY");
address proxyAdminOwner = vm.envAddress("PROXY_ADMIN_OWNER");

uint64 gasLimit = uint64(vm.envUint("GAS_LIMIT"));

uint32 denominator = uint32(vm.envUint("DENOMINATOR"));
uint32 elasticityMultiplier = uint32(vm.envUint("ELASTICITY_MULTIPLIER"));


function run() public {
vm.startBroadcast(proxyAdminOwner);

SystemConfig(systemConfigProxyAddress).setEIP1559Params(denominator, elasticityMultiplier);
SystemConfig(systemConfigProxyAddress).setGasLimit(gasLimit);

vm.stopBroadcast();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import "forge-std/Script.sol";
import "@eth-optimism-bedrock/contracts/universal/ProxyAdmin.sol";
import "@eth-optimism-bedrock/contracts/L1/SystemConfig.sol";

contract UpgradeSystemConfig is Script {
address systemConfigProxy = vm.envAddress("SYSTEM_CONFIG_PROXY");
address systemConfigImplementation = vm.envAddress("SYSTEM_CONFIG_IMPLEMENTATION");
address proxyAdminOwner = vm.envAddress("PROXY_ADMIN_OWNER");

function run() public {
vm.broadcast(proxyAdminOwner);
ProxyAdmin proxyAdmin = ProxyAdmin(payable(vm.envAddress("PROXY_ADMIN")));

proxyAdmin.upgrade(
payable(systemConfigProxy),
systemConfigImplementation
);
}
}

0 comments on commit 15fd271

Please sign in to comment.