Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom gas token #10143

Merged
merged 45 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a75369f
contracts-bedrock: custom gas token L1 contracts
tynes Apr 12, 2024
d80c5a4
contracts-bedrock: custom gas token L2 contracts
tynes Apr 12, 2024
3a0b50d
contracts-bedrock: custom gas token contracts
tynes Apr 12, 2024
e83e6ed
contracts-bedrock: custom gas token scripts
tynes Apr 12, 2024
30685bf
contracts-bedrock: custom gas token tests
tynes Apr 12, 2024
34eede8
op-bindings: update with custom gas token
tynes Apr 12, 2024
e4cd841
op-chain-ops: fixup tests
tynes Apr 12, 2024
e53471d
contracts-bedrock: snapshots
tynes Apr 12, 2024
82bec65
cleanup: get tests passing
tynes Apr 12, 2024
4d3e0a0
contracts-bedrock: cleanup tests
tynes Apr 12, 2024
3f77d75
contracts-bedrock: cleanup custom gas token
tynes Apr 13, 2024
ba46d76
op-bindings: regenerate
tynes Apr 13, 2024
1e85157
codesize: fix
tynes Apr 19, 2024
052f17e
contracts-bedrock: custom gas token cleanup
tynes Apr 19, 2024
990e8e0
build: fix
tynes Apr 19, 2024
2bdce53
custom-gas-token: fix build
tynes Apr 19, 2024
8e439f0
custom-gas-token: cleanup, final spec nits
tynes Apr 23, 2024
c0e3fdd
gas-snapshot: fix
tynes Apr 23, 2024
4fd7961
contracts-bedrock: cleanup
tynes Apr 23, 2024
389684e
contracts-bedrock: semver lock
tynes Apr 23, 2024
23d5e0a
invariant-docs: fixup
tynes Apr 23, 2024
2ffc48e
storage-layout: address
tynes Apr 23, 2024
d3bf3cf
bindings: remove preview
tynes Apr 30, 2024
672414d
bindings: add back bindingspreview
tynes Apr 30, 2024
fe55099
weth: remove weth9
tynes May 1, 2024
7e1a17c
contracts-bedrock: cleanup
tynes May 1, 2024
6a6c4be
custom-gas-token: more cleanup
tynes May 1, 2024
aefb522
contracts-bedrock: test case
tynes May 1, 2024
8f5292f
custom-gas-token: cleanup, tests
tynes May 1, 2024
2dbef31
lint: fix
tynes May 1, 2024
d0243b6
custom-gas-token: address review comments
tynes May 2, 2024
973e1c6
snapshots: regenerate
tynes May 2, 2024
edbb9d1
lint: fix
tynes May 2, 2024
8116111
contracts-bedrock: clean up semantics of cgt
tynes May 2, 2024
8f55a2b
snapshots: regenerate
tynes May 2, 2024
be9bf5a
snapshots: gas snapshot
tynes May 2, 2024
ac36c38
semver-lock: regenerate
tynes May 2, 2024
0240cdf
comments: address
tynes May 2, 2024
9a410d9
semver: calculate
tynes May 2, 2024
0dccbae
ctb: revert in test
tynes May 2, 2024
4f05c00
tests: fix flake
tynes May 2, 2024
e532b85
portal: better comment
tynes May 2, 2024
25fef60
test: fixup
tynes May 2, 2024
4417094
lint: fix
tynes May 2, 2024
c21302e
snapshot: gas
tynes May 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
318 changes: 316 additions & 2 deletions op-bindings/bindings/l1block.go

Large diffs are not rendered by default.

59 changes: 45 additions & 14 deletions op-bindings/bindings/l1crossdomainmessenger.go

Large diffs are not rendered by default.

59 changes: 45 additions & 14 deletions op-bindings/bindings/l1standardbridge.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l2crossdomainmessenger.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l2standardbridge.go

Large diffs are not rendered by default.

122 changes: 120 additions & 2 deletions op-bindings/bindings/optimismportal.go

Large diffs are not rendered by default.

155 changes: 147 additions & 8 deletions op-bindings/bindings/systemconfig.go

Large diffs are not rendered by default.

1,133 changes: 1,133 additions & 0 deletions op-bindings/bindings/weth.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions op-bindings/predeploys/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "github.com/ethereum/go-ethereum/common"
const (
L2ToL1MessagePasser = "0x4200000000000000000000000000000000000016"
DeployerWhitelist = "0x4200000000000000000000000000000000000002"
WETH9 = "0x4200000000000000000000000000000000000006"
WETH = "0x4200000000000000000000000000000000000006"
L2CrossDomainMessenger = "0x4200000000000000000000000000000000000007"
L2StandardBridge = "0x4200000000000000000000000000000000000010"
SequencerFeeVault = "0x4200000000000000000000000000000000000011"
Expand Down Expand Up @@ -41,7 +41,7 @@ const (
var (
L2ToL1MessagePasserAddr = common.HexToAddress(L2ToL1MessagePasser)
DeployerWhitelistAddr = common.HexToAddress(DeployerWhitelist)
WETH9Addr = common.HexToAddress(WETH9)
WETHAddr = common.HexToAddress(WETH)
L2CrossDomainMessengerAddr = common.HexToAddress(L2CrossDomainMessenger)
L2StandardBridgeAddr = common.HexToAddress(L2StandardBridge)
SequencerFeeVaultAddr = common.HexToAddress(SequencerFeeVault)
Expand Down Expand Up @@ -77,7 +77,7 @@ var (
func init() {
Predeploys["L2ToL1MessagePasser"] = &Predeploy{Address: L2ToL1MessagePasserAddr}
Predeploys["DeployerWhitelist"] = &Predeploy{Address: DeployerWhitelistAddr}
Predeploys["WETH9"] = &Predeploy{Address: WETH9Addr, ProxyDisabled: true}
Predeploys["WETH"] = &Predeploy{Address: WETHAddr, ProxyDisabled: true}
Predeploys["L2CrossDomainMessenger"] = &Predeploy{Address: L2CrossDomainMessengerAddr}
Predeploys["L2StandardBridge"] = &Predeploy{Address: L2StandardBridgeAddr}
Predeploys["SequencerFeeVault"] = &Predeploy{Address: SequencerFeeVaultAddr}
Expand Down
11 changes: 10 additions & 1 deletion op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ type DeployConfig struct {
// UseFaultProofs is a flag that indicates if the system is using fault
// proofs instead of the older output oracle mechanism.
UseFaultProofs bool `json:"useFaultProofs"`

// UseCustomGasToken is a flag to indicate that a custom gas token should be used
UseCustomGasToken bool `json:"useCustomGasToken"`
// CustomGasTokenAddress is the address of the ERC20 token to be used to pay for gas on L2.
CustomGasTokenAddress common.Address `json:"customGasTokenAddress"`
tynes marked this conversation as resolved.
Show resolved Hide resolved
// UsePlasma is a flag that indicates if the system is using op-plasma
UsePlasma bool `json:"usePlasma"`
// DAChallengeWindow represents the block interval during which the availability of a data commitment can be challenged.
Expand Down Expand Up @@ -427,6 +430,12 @@ func (d *DeployConfig) Check() error {
return fmt.Errorf("%w: DAResolveWindow cannot be 0 when using plasma mode", ErrInvalidDeployConfig)
}
}
if d.UseCustomGasToken {
if d.CustomGasTokenAddress == (common.Address{}) {
return fmt.Errorf("%w: CustomGasTokenAddress cannot be address(0)", ErrInvalidDeployConfig)
}
log.Info("Using custom gas token", "address", d.CustomGasTokenAddress)
}
// checkFork checks that fork A is before or at the same time as fork B
checkFork := func(a, b *hexutil.Uint64, aName, bName string) error {
if a == nil && b == nil {
Expand Down
2 changes: 2 additions & 0 deletions op-chain-ops/genesis/testdata/test-deploy-config-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"channelTimeout": 30,
"l1UseClique": false,
"cliqueSignerAddress": "0x0000000000000000000000000000000000000000",
"customGasTokenAddress": "0x0000000000000000000000000000000000000000",
"p2pSequencerAddress": "0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc",
"batchInboxAddress": "0x42000000000000000000000000000000000000ff",
"batchSenderAddress": "0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc",
Expand Down Expand Up @@ -83,6 +84,7 @@
"proofMaturityDelaySeconds": 12,
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 0,
"useCustomGasToken": false,
"useFaultProofs": false,
"usePlasma": false,
"daBondSize": 0,
Expand Down
20 changes: 10 additions & 10 deletions op-e2e/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,47 +40,47 @@ func TestERC20BridgeDeposits(t *testing.T) {
opts, err := bind.NewKeyedTransactorWithChainID(sys.Cfg.Secrets.Alice, cfg.L1ChainIDBig())
require.Nil(t, err)

// Deploy WETH9
weth9Address, tx, WETH9, err := bindings.DeployWETH9(opts, l1Client)
// Deploy WETH
wethAddress, tx, WETH, err := bindings.DeployWETH(opts, l1Client)
require.NoError(t, err)
_, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err, "Waiting for deposit tx on L1")

// Get some WETH
opts.Value = big.NewInt(params.Ether)
tx, err = WETH9.Deposit(opts)
tx, err = WETH.Deposit(opts)
require.NoError(t, err)
_, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err)
opts.Value = nil
wethBalance, err := WETH9.BalanceOf(&bind.CallOpts{}, opts.From)
wethBalance, err := WETH.BalanceOf(&bind.CallOpts{}, opts.From)
require.NoError(t, err)
require.Equal(t, big.NewInt(params.Ether), wethBalance)

// Deploy L2 WETH9
// Deploy L2 WETH
l2Opts, err := bind.NewKeyedTransactorWithChainID(sys.Cfg.Secrets.Alice, cfg.L2ChainIDBig())
require.NoError(t, err)
optimismMintableTokenFactory, err := bindings.NewOptimismMintableERC20Factory(predeploys.OptimismMintableERC20FactoryAddr, l2Client)
require.NoError(t, err)
tx, err = optimismMintableTokenFactory.CreateOptimismMintableERC20(l2Opts, weth9Address, "L2-WETH", "L2-WETH")
tx, err = optimismMintableTokenFactory.CreateOptimismMintableERC20(l2Opts, wethAddress, "L2-WETH", "L2-WETH")
require.NoError(t, err)
rcpt, err := wait.ForReceiptOK(context.Background(), l2Client, tx.Hash())
require.NoError(t, err)

event, err := receipts.FindLog(rcpt.Logs, optimismMintableTokenFactory.ParseOptimismMintableERC20Created)
require.NoError(t, err, "Should emit ERC20Created event")

// Approve WETH9 with the bridge
tx, err = WETH9.Approve(opts, cfg.L1Deployments.L1StandardBridgeProxy, new(big.Int).SetUint64(math.MaxUint64))
// Approve WETH with the bridge
tx, err = WETH.Approve(opts, cfg.L1Deployments.L1StandardBridgeProxy, new(big.Int).SetUint64(math.MaxUint64))
require.NoError(t, err)
_, err = wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
require.NoError(t, err)

// Bridge the WETH9
// Bridge the WETH
l1StandardBridge, err := bindings.NewL1StandardBridge(cfg.L1Deployments.L1StandardBridgeProxy, l1Client)
require.NoError(t, err)
tx, err = transactions.PadGasEstimate(opts, 1.1, func(opts *bind.TransactOpts) (*types.Transaction, error) {
return l1StandardBridge.BridgeERC20(opts, weth9Address, event.LocalToken, big.NewInt(100), 100000, []byte{})
return l1StandardBridge.BridgeERC20(opts, wethAddress, event.LocalToken, big.NewInt(100), 100000, []byte{})
})
require.NoError(t, err)
depositReceipt, err := wait.ForReceiptOK(context.Background(), l1Client, tx.Hash())
Expand Down
20 changes: 10 additions & 10 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 356538)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2954723)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 549153)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4061129)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 450282)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3496031)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 59809)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92950)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68354)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 69018)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 369398)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2967433)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 562077)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4074053)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 467008)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3512757)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 72627)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 92973)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 68453)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark_1() (gas: 68945)
GasBenchMark_OptimismPortal:test_proveWithdrawalTransaction_benchmark() (gas: 155567)
1 change: 0 additions & 1 deletion packages/contracts-bedrock/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ line_length=120
multiline_func_header='all'
bracket_spacing=true
wrap_comments=true
ignore = ['src/vendor/WETH9.sol']

################################################################
# PROFILE: CI #
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# `SystemConfig` Invariants

## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
tynes marked this conversation as resolved.
Show resolved Hide resolved
**Test:** [`SystemConfig.t.sol#L68`](../test/invariants/SystemConfig.t.sol#L68)
**Test:** [`SystemConfig.t.sol#L69`](../test/invariants/SystemConfig.t.sol#L69)

4 changes: 2 additions & 2 deletions packages/contracts-bedrock/scripts/Artifacts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ abstract contract Artifacts {
return payable(Predeploys.L1_MESSAGE_SENDER);
} else if (digest == keccak256(bytes("DeployerWhitelist"))) {
return payable(Predeploys.DEPLOYER_WHITELIST);
} else if (digest == keccak256(bytes("WETH9"))) {
return payable(Predeploys.WETH9);
} else if (digest == keccak256(bytes("WETH"))) {
return payable(Predeploys.WETH);
} else if (digest == keccak256(bytes("LegacyERC20ETH"))) {
return payable(Predeploys.LEGACY_ERC20_ETH);
} else if (digest == keccak256(bytes("L1BlockNumber"))) {
Expand Down
42 changes: 29 additions & 13 deletions packages/contracts-bedrock/scripts/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,6 @@ contract Deploy is Deployer {
/// @notice Initialize all of the implementations
function initializeImplementations() public {
console.log("Initializing implementations");
initializeSystemConfig();
initializeL1StandardBridge();
initializeL1ERC721Bridge();
initializeOptimismMintableERC20Factory();
initializeL1CrossDomainMessenger();
initializeL2OutputOracle();
initializeDisputeGameFactory();
initializeDelayedWETH();
initializeAnchorStateRegistry();

// Selectively initialize either the original OptimismPortal or the new OptimismPortal2. Since this will upgrade
// the proxy, we cannot initialize both. FPAC warning can be removed once we're done with the old OptimismPortal
// contract.
Expand All @@ -399,6 +389,16 @@ contract Deploy is Deployer {
} else {
initializeOptimismPortal();
}

initializeSystemConfig();
initializeL1StandardBridge();
initializeL1ERC721Bridge();
initializeOptimismMintableERC20Factory();
initializeL1CrossDomainMessenger();
initializeL2OutputOracle();
initializeDisputeGameFactory();
initializeDelayedWETH();
initializeAnchorStateRegistry();
}

/// @notice Add Plasma setup to the OP chain
Expand Down Expand Up @@ -945,6 +945,11 @@ contract Deploy is Deployer {

bytes32 batcherHash = bytes32(uint256(uint160(cfg.batchSenderAddress())));

address customGasTokenAddress = Constants.ETHER;
if (cfg.useCustomGasToken()) {
customGasTokenAddress = cfg.customGasTokenAddress();
}
tynes marked this conversation as resolved.
Show resolved Hide resolved

_upgradeAndCallViaSafe({
_proxy: payable(systemConfigProxy),
_implementation: systemConfig,
Expand All @@ -965,7 +970,8 @@ contract Deploy is Deployer {
l1StandardBridge: mustGetAddress("L1StandardBridgeProxy"),
disputeGameFactory: mustGetAddress("DisputeGameFactoryProxy"),
optimismPortal: mustGetAddress("OptimismPortalProxy"),
optimismMintableERC20Factory: mustGetAddress("OptimismMintableERC20FactoryProxy")
optimismMintableERC20Factory: mustGetAddress("OptimismMintableERC20FactoryProxy"),
gasPayingToken: customGasTokenAddress
})
)
)
Expand All @@ -986,6 +992,7 @@ contract Deploy is Deployer {
address l1StandardBridge = mustGetAddress("L1StandardBridge");
address l1CrossDomainMessengerProxy = mustGetAddress("L1CrossDomainMessengerProxy");
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
address systemConfigProxy = mustGetAddress("SystemConfigProxy");

uint256 proxyType = uint256(proxyAdmin.proxyType(l1StandardBridgeProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.CHUGSPLASH)) {
Expand All @@ -1001,7 +1008,11 @@ contract Deploy is Deployer {
_implementation: l1StandardBridge,
_innerCallData: abi.encodeCall(
L1StandardBridge.initialize,
(L1CrossDomainMessenger(l1CrossDomainMessengerProxy), SuperchainConfig(superchainConfigProxy))
(
L1CrossDomainMessenger(l1CrossDomainMessengerProxy),
SuperchainConfig(superchainConfigProxy),
SystemConfig(systemConfigProxy)
)
)
});

Expand Down Expand Up @@ -1063,6 +1074,7 @@ contract Deploy is Deployer {
address l1CrossDomainMessenger = mustGetAddress("L1CrossDomainMessenger");
address superchainConfigProxy = mustGetAddress("SuperchainConfigProxy");
address optimismPortalProxy = mustGetAddress("OptimismPortalProxy");
address systemConfigProxy = mustGetAddress("SystemConfigProxy");

uint256 proxyType = uint256(proxyAdmin.proxyType(l1CrossDomainMessengerProxy));
if (proxyType != uint256(ProxyAdmin.ProxyType.RESOLVED)) {
Expand Down Expand Up @@ -1091,7 +1103,11 @@ contract Deploy is Deployer {
_implementation: l1CrossDomainMessenger,
_innerCallData: abi.encodeCall(
L1CrossDomainMessenger.initialize,
(SuperchainConfig(superchainConfigProxy), OptimismPortal(payable(optimismPortalProxy)))
(
SuperchainConfig(superchainConfigProxy),
OptimismPortal(payable(optimismPortalProxy)),
SystemConfig(systemConfigProxy)
)
)
});

Expand Down
16 changes: 16 additions & 0 deletions packages/contracts-bedrock/scripts/DeployConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ contract DeployConfig is Script {
uint256 public daBondSize;
uint256 public daResolverRefundPercentage;

bool public useCustomGasToken;
address public customGasTokenAddress;

function read(string memory _path) public {
console.log("DeployConfig: reading file %s", _path);
try vm.readFile(_path) returns (string memory data) {
Expand Down Expand Up @@ -145,6 +148,9 @@ contract DeployConfig is Script {
daResolveWindow = _readOr(_json, "$.daResolveWindow", 1000);
daBondSize = _readOr(_json, "$.daBondSize", 1000000000);
daResolverRefundPercentage = _readOr(_json, "$.daResolverRefundPercentage", 0);

useCustomGasToken = _readOr(_json, "$.useCustomGasToken", false);
customGasTokenAddress = _readOr(_json, "$.customGasTokenAddress", address(0));
}

function l1StartingBlockTag() public returns (bytes32) {
Expand Down Expand Up @@ -190,6 +196,12 @@ contract DeployConfig is Script {
fundDevAccounts = _fundDevAccounts;
}

/// @notice Allow the `useCustomGasToken` config to be overridden in testing environments
function setUseCustomGasToken(address _token) public {
useCustomGasToken = true;
customGasTokenAddress = _token;
}

function _getBlockByTag(string memory _tag) internal returns (bytes32) {
string[] memory cmd = new string[](3);
cmd[0] = Executables.bash;
Expand All @@ -206,4 +218,8 @@ contract DeployConfig is Script {
function _readOr(string memory json, string memory key, uint256 defaultValue) internal view returns (uint256) {
return vm.keyExists(json, key) ? stdJson.readUint(json, key) : defaultValue;
}

function _readOr(string memory json, string memory key, address defaultValue) internal view returns (address) {
tynes marked this conversation as resolved.
Show resolved Hide resolved
return vm.keyExists(json, key) ? stdJson.readAddress(json, key) : defaultValue;
}
}
30 changes: 4 additions & 26 deletions packages/contracts-bedrock/scripts/L2Genesis.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ contract L2Genesis is Deployer {
// 01: legacy, not used in OP-Stack
setDeployerWhitelist(); // 2
// 3,4,5: legacy, not used in OP-Stack.
setWETH9(); // 6: WETH9 (not behind a proxy)
setWETH(); // 6: WETH (not behind a proxy)
setL2CrossDomainMessenger(_l1Dependencies.l1CrossDomainMessengerProxy); // 7
// 8,9,A,B,C,D,E: legacy, not used in OP-Stack.
setGasPriceOracle(); // f
Expand Down Expand Up @@ -347,31 +347,9 @@ contract L2Genesis is Deployer {
/// @notice This predeploy is following the safety invariant #1.
/// This contract is NOT proxied and the state that is set
/// in the constructor is set manually.
function setWETH9() public {
console.log("Setting %s implementation at: %s", "WETH9", Predeploys.WETH9);
vm.etch(Predeploys.WETH9, vm.getDeployedCode("WETH9.sol:WETH9"));

vm.store(
Predeploys.WETH9,
/// string public name
hex"0000000000000000000000000000000000000000000000000000000000000000",
/// "Wrapped Ether"
hex"577261707065642045746865720000000000000000000000000000000000001a"
);
vm.store(
Predeploys.WETH9,
/// string public symbol
hex"0000000000000000000000000000000000000000000000000000000000000001",
/// "WETH"
hex"5745544800000000000000000000000000000000000000000000000000000008"
);
vm.store(
Predeploys.WETH9,
// uint8 public decimals
hex"0000000000000000000000000000000000000000000000000000000000000002",
/// 18
hex"0000000000000000000000000000000000000000000000000000000000000012"
);
function setWETH() public {
console.log("Setting %s implementation at: %s", "WETH", Predeploys.WETH);
vm.etch(Predeploys.WETH, vm.getDeployedCode("WETH.sol:WETH"));
}

/// @notice This predeploy is following the safety invariant #1.
Expand Down
Loading