Skip to content

Commit

Permalink
maint: move WETH contract to correct folders
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 committed Sep 17, 2024
1 parent d887cfa commit e8e2663
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 @@ -9,7 +9,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 @@ -9,7 +9,7 @@ import { Solarray } from "scripts/libraries/Solarray.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": "0xe1eab75651e3d81ad20ca01b1e7d373b25d716ee5f8841a56e56b4531a6e0e70",
"sourceCodeHash": "0x5182a2678dadb200dd255ecdfa395e5f7b1e1e27288e78ddf8802ab51ed2dd81"
"sourceCodeHash": "0x6d79beeb6616514277a7e42dc631fa878e52038510f63c16cda6c8c0c37621bd"
},
"src/L1/OptimismPortal.sol": {
"initCodeHash": "0xb7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6",
Expand Down Expand Up @@ -124,12 +124,12 @@
"sourceCodeHash": "0xd56922cb04597dea469c65e5a49d4b3c50c171e603601e6f41da9517cae0b11a"
},
"src/L2/SuperchainWETH.sol": {
"initCodeHash": "0x3131295bdf487120be7db6b9866d9192db32f379bbeff8f03ac61ebabdb62031",
"sourceCodeHash": "0x031aaacafaa27ad6648876cf06ba0c71d01f600897b58a9bd92ce17f7098a718"
"initCodeHash": "0xaa136fc27006d722867bcd017742cd119e58658d9860826551095775f70739ce",
"sourceCodeHash": "0x2b627b6492c4ca3cc6a457fe48b7d0b1d335125d9c6288f7373b6525542532e8"
},
"src/L2/WETH.sol": {
"initCodeHash": "0x789916977b4930eb266f2187a100bc432c12b76e3872931be673a7ef2773507a",
"sourceCodeHash": "0x3f7bd622a788b8d00fe1631b14b761488eedccf56879f7ea2d610dd5ce81efbe"
"initCodeHash": "0xfb253765520690623f177941c2cd9eba23e4c6d15063bccdd5e98081329d8956",
"sourceCodeHash": "0x2264ffc56057c0732a4ace9ebe05e3ba2394dc5345e6959a6763415be2525f1b"
},
"src/Safe/DeputyGuardianModule.sol": {
"initCodeHash": "0x785cb529957f4d42d1659f2c37967dce7c621f3c6e06550600897205c2551a88",
Expand Down Expand Up @@ -159,6 +159,10 @@
"initCodeHash": "0x73a094f7d00422c8a765a63f4645f9e2fb508655181f227fd9b338c62c26e106",
"sourceCodeHash": "0x7ed9631efb6f5cdec9fb09bc22f0e6248314db6331ed65f0baa462b230733b88"
},
"src/dispute/DelayedWETH.sol": {
"initCodeHash": "0x08c393e8fea87c6dea67d4836e454c5c3701bac3191284389e0f4dfd3ba8ebc5",
"sourceCodeHash": "0x761fae35b89ab7dcaf3c3f159a8456d0e71d5ff4229cd6de348079bd0972f75d"
},
"src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0xc1a10f65287c414076b68a7de6c238b91bc6252213187bdef35657d0f00f9382",
"sourceCodeHash": "0x3d391c58420abe60d8486136a57d7f9c7137f722c80a8d884305617eb31566ef"
Expand All @@ -167,10 +171,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 @@ -11,7 +11,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 } 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 @@ -946,7 +946,7 @@ contract Specification_Test is CommonTest {
pathExcludes[2] = "src/Safe/SafeSigners.sol";
pathExcludes[3] = "src/L1/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 @@ -30,7 +30,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 e8e2663

Please sign in to comment.