Skip to content

Commit

Permalink
maint: move WETH contract to correct folders (ethereum-optimism#11870)
Browse files Browse the repository at this point in the history
Moves WETH98 over to the universal/ folder where it belongs and
brings DelayedWETH up to the top of the dispute folder since there
is no longer any need for a weth/ subfolder.
  • Loading branch information
smartcontracts authored and samlaf committed Nov 10, 2024
1 parent 53a1614 commit 4b9696c
Show file tree
Hide file tree
Showing 21 changed files with 56 additions and 41 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ graph LR
DisputeGameFactory(<a href="https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/src/dispute/DisputeGameFactory.sol">DisputeGameFactory</a>)
FaultDisputeGame(<a href="https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol">FaultDisputeGame</a>)
AnchorStateRegistry(<a href="https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/src/dispute/AnchorStateRegistry.sol">AnchorStateRegistry</a>)
DelayedWETH(<a href="/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/src/dispute/weth/DelayedWETH.sol">DelayedWETH</a>)
DelayedWETH(<a href="/ethereum-optimism/optimism/tree/develop/packages/contracts-bedrock/src/dispute/DelayedWETH.sol">DelayedWETH</a>)
end
subgraph "User Interactions (Permissionless)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";

import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { IPreimageOracle } from "src/cannon/interfaces/IPreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/scripts/DeployOPChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Constants } from "src/libraries/Constants.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";

import { AddressManager } from "src/legacy/AddressManager.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ISystemConfigV0 } from "scripts/interfaces/ISystemConfigV0.sol";
// Contracts
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";

// Libraries
import { Constants } from "src/libraries/Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/scripts/deploy/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol";
Expand Down
18 changes: 9 additions & 9 deletions packages/contracts-bedrock/semver-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"src/L1/OPStackManager.sol": {
"initCodeHash": "0x31378d0ea88a358f517927f5bc530a5b958f43c5462e4a822388ec70bd45e8d4",
"sourceCodeHash": "0xf8ac1ce2fbaa9aa21bd6c60e0bf863b06ea3bdd1c4ed801ed70ee64c1b534f67"
"sourceCodeHash": "0x9ed271fbb40f25528652bfecc10d2010a588629047b3aaed2b14247d2fa7b45e"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0xb7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6",
Expand Down Expand Up @@ -132,12 +132,12 @@
"sourceCodeHash": "0xd56922cb04597dea469c65e5a49d4b3c50c171e603601e6f41da9517cae0b11a"
},
"src/L2/SuperchainWETH.sol": {
"initCodeHash": "0x3131295bdf487120be7db6b9866d9192db32f379bbeff8f03ac61ebabdb62031",
"sourceCodeHash": "0x031aaacafaa27ad6648876cf06ba0c71d01f600897b58a9bd92ce17f7098a718"
"initCodeHash": "0xaa136fc27006d722867bcd017742cd119e58658d9860826551095775f70739ce",
"sourceCodeHash": "0x2b627b6492c4ca3cc6a457fe48b7d0b1d335125d9c6288f7373b6525542532e8"
},
"src/L2/WETH.sol": {
"initCodeHash": "0x789916977b4930eb266f2187a100bc432c12b76e3872931be673a7ef2773507a",
"sourceCodeHash": "0x3f7bd622a788b8d00fe1631b14b761488eedccf56879f7ea2d610dd5ce81efbe"
"initCodeHash": "0x8ccf5227a09f3ee8e450df1f9dc72a538c03226f0182c23976635c2b49859147",
"sourceCodeHash": "0x45d14c2e1c1e0ffa1c840c61010bbbffa976bc84864e084556ea690b05775fa7"
},
"src/cannon/MIPS.sol": {
"initCodeHash": "0x4043f262804931bbbbecff64f87f2d0bdc4554b4d0a8b22df8fff940e8d239bf",
Expand All @@ -155,6 +155,10 @@
"initCodeHash": "0x73a094f7d00422c8a765a63f4645f9e2fb508655181f227fd9b338c62c26e106",
"sourceCodeHash": "0x7ed9631efb6f5cdec9fb09bc22f0e6248314db6331ed65f0baa462b230733b88"
},
"src/dispute/DelayedWETH.sol": {
"initCodeHash": "0xbda8166b77517df1df1dcef7c307c11a5520188f83555aec9439f6887c419dd0",
"sourceCodeHash": "0x70192d1eae4e16f791d826edf75a825246136fe5f8645b066a401b1dfee3e38c"
},
"src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0xc1a10f65287c414076b68a7de6c238b91bc6252213187bdef35657d0f00f9382",
"sourceCodeHash": "0x3d391c58420abe60d8486136a57d7f9c7137f722c80a8d884305617eb31566ef"
Expand All @@ -163,10 +167,6 @@
"initCodeHash": "0x0084ca38e6ceb3c70ce77ef9769a724e8be5b92457222ef2b09c63bb4b449bf2",
"sourceCodeHash": "0xf199eace79690c010d0f252819e62ef7ad165d9af19c1ee47a6aa451cda259b2"
},
"src/dispute/weth/DelayedWETH.sol": {
"initCodeHash": "0x5e7251e2c638c907c8672166f770cf2bd1fda11eed1d629ceb7568fe2b670006",
"sourceCodeHash": "0x6817260542fe6c2acbc081aad9f4b91c1502e8ae75020197213a8f8d15b6463b"
},
"src/legacy/DeployerWhitelist.sol": {
"initCodeHash": "0x0b8177ed75b69eddbb9ce6537683f69a9935efed86a1d6faa8feaafbd151c1bd",
"sourceCodeHash": "0xc8fe9571fcf8fcb51a4dcb00ffa97f43a9ce811c323c4926e710b28c90a9005f"
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/src/L1/OPStackManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";

import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
Expand Down
17 changes: 11 additions & 6 deletions packages/contracts-bedrock/src/L2/SuperchainWETH.sol
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { WETH98 } from "src/dispute/weth/WETH98.sol";
// Contracts
import { WETH98 } from "src/universal/WETH98.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";

// Libraries
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { L1Block } from "src/L2/L1Block.sol";

// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";
import { ISuperchainERC20Extensions } from "src/L2/interfaces/ISuperchainERC20.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";

/// @title SuperchainWETH
/// @notice SuperchainWETH is a version of WETH that can be freely transfrered between chains
/// within the superchain. SuperchainWETH can be converted into native ETH on chains that
/// do not use a custom gas token.
contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
/// @notice Semantic version.
/// @custom:semver 1.0.0-beta.2
string public constant version = "1.0.0-beta.2";
/// @custom:semver 1.0.0-beta.3
string public constant version = "1.0.0-beta.3";

/// @inheritdoc WETH98
function deposit() public payable override {
Expand Down
13 changes: 9 additions & 4 deletions packages/contracts-bedrock/src/L2/WETH.sol
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import { WETH98 } from "src/dispute/weth/WETH98.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
// Contracts
import { WETH98 } from "src/universal/WETH98.sol";
import { L1Block } from "src/L2/L1Block.sol";

// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";

// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";

/// @title WETH contract that reads the name and symbol from the L1Block contract.
/// Allows for nice rendering of token names for chains using custom gas token.
contract WETH is WETH98, ISemver {
/// @custom:semver 1.0.0-beta.1
string public constant version = "1.0.0-beta.1";
/// @custom:semver 1.1.0-beta.1
string public constant version = "1.1.0-beta.1";

/// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether"
/// if the native asset is Ether.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

// Contracts
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { WETH98 } from "src/universal/WETH98.sol";

// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IWETH } from "src/universal/interfaces/IWETH.sol";
import { IDelayedWETH } from "src/dispute/interfaces/IDelayedWETH.sol";
import { IWETH } from "src/dispute/interfaces/IWETH.sol";
import { WETH98 } from "src/dispute/weth/WETH98.sol";

import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";

/// @custom:proxied true
Expand All @@ -22,8 +23,8 @@ import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
/// Not the prettiest contract in the world, but it gets the job done.
contract DelayedWETH is OwnableUpgradeable, WETH98, IDelayedWETH, ISemver {
/// @notice Semantic version.
/// @custom:semver 1.1.1-beta.2
string public constant version = "1.1.1-beta.2";
/// @custom:semver 1.2.0-beta.1
string public constant version = "1.2.0-beta.1";

/// @inheritdoc IDelayedWETH
mapping(address => mapping(address => WithdrawalRequest)) public withdrawals;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IWETH } from "src/dispute/interfaces/IWETH.sol";
import { IWETH } from "src/universal/interfaces/IWETH.sol";

/// @title IDelayedWETH
/// @notice Interface for the DelayedWETH contract.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

pragma solidity 0.8.15;

import { IWETH } from "src/dispute/interfaces/IWETH.sol";
import { IWETH } from "src/universal/interfaces/IWETH.sol";

/// @title WETH98
/// @notice WETH98 is a version of WETH9 upgraded for Solidity 0.8.x.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.15;

import { Test, stdStorage, StdStorage } from "forge-std/Test.sol";

import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { MIPS } from "src/cannon/MIPS.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/DeployOPChain.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DeployOPChainInput, DeployOPChain, DeployOPChainOutput } from "scripts/
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";

import { AddressManager } from "src/legacy/AddressManager.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/Specs.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ contract Specification_Test is CommonTest {
pathExcludes[3] = "src/L1/interfaces/*";
pathExcludes[4] = "src/governance/interfaces/*";
Abi[] memory abis = ForgeArtifacts.getContractFunctionAbis(
"src/{L1,dispute,governance,safe,universal/ProxyAdmin.sol}", pathExcludes
"src/{L1,dispute,governance,safe,universal/ProxyAdmin.sol,universal/WETH98.sol}", pathExcludes
);

uint256 numCheckedEntries = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/dispute/DelayedWETH.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import "src/dispute/lib/Errors.sol";
import { Test } from "forge-std/Test.sol";
import { DisputeGameFactory, IDisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { Burn } from "src/libraries/Burn.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Vm } from "forge-std/Vm.sol";
import { DisputeGameFactory_Init } from "test/dispute/DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame, IDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";

import "src/dispute/lib/Types.sol";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Vm } from "forge-std/Vm.sol";
import { DisputeGameFactory_Init } from "test/dispute/DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { PermissionedDisputeGame } from "src/dispute/PermissionedDisputeGame.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol";

Expand Down
6 changes: 5 additions & 1 deletion packages/contracts-bedrock/test/dispute/WETH98.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

// Testing
import { Test } from "forge-std/Test.sol";
import { WETH98 } from "src/dispute/weth/WETH98.sol";

// Contracts
import { WETH98 } from "src/universal/WETH98.sol";

contract WETH98_Test is Test {
event Approval(address indexed src, address indexed guy, uint256 wad);
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/test/setup/Setup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { WETH } from "src/L2/WETH.sol";
import { SuperchainWETH } from "src/L2/SuperchainWETH.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/weth/DelayedWETH.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";

// Libraries
Expand Down

0 comments on commit 4b9696c

Please sign in to comment.