Commit 2afa7a4b authored by smartcontracts's avatar smartcontracts Committed by GitHub

feat: add remaining L2 interfaces (#11984)

One more PR for adding L2 interfaces.
parent 4b8d23e1
# `ETHLiquidity` Invariants # `ETHLiquidity` Invariants
## Calls to mint/burn repeatedly should never cause the actor's balance to increase beyond the starting balance. ## Calls to mint/burn repeatedly should never cause the actor's balance to increase beyond the starting balance.
**Test:** [`ETHLiquidity.t.sol#L83`](../test/invariants/ETHLiquidity.t.sol#L83) **Test:** [`ETHLiquidity.t.sol#L86`](../test/invariants/ETHLiquidity.t.sol#L86)
# `SuperchainWETH` Invariants # `SuperchainWETH` Invariants
## Calls to sendERC20 should always succeed as long as the actor has less than uint248 wei which is much greater than the total ETH supply. Actor's balance should also not increase out of nowhere. ## Calls to sendERC20 should always succeed as long as the actor has less than uint248 wei which is much greater than the total ETH supply. Actor's balance should also not increase out of nowhere.
**Test:** [`SuperchainWETH.t.sol#L181`](../test/invariants/SuperchainWETH.t.sol#L181) **Test:** [`SuperchainWETH.t.sol#L184`](../test/invariants/SuperchainWETH.t.sol#L184)
...@@ -15,8 +15,6 @@ import { Process } from "scripts/libraries/Process.sol"; ...@@ -15,8 +15,6 @@ import { Process } from "scripts/libraries/Process.sol";
import { SetPreinstalls } from "scripts/SetPreinstalls.s.sol"; import { SetPreinstalls } from "scripts/SetPreinstalls.s.sol";
// Contracts // Contracts
import { L1Block } from "src/L2/L1Block.sol";
import { GasPriceOracle } from "src/L2/GasPriceOracle.sol";
import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol"; import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol";
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol"; import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.sol"; import { L1FeeVault } from "src/L2/L1FeeVault.sol";
...@@ -31,11 +29,13 @@ import { Preinstalls } from "src/libraries/Preinstalls.sol"; ...@@ -31,11 +29,13 @@ import { Preinstalls } from "src/libraries/Preinstalls.sol";
// Interfaces // Interfaces
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IL2CrossDomainMessenger } from "src/L2/interfaces/IL2CrossDomainMessenger.sol";
import { IL2StandardBridge } from "src/L2/interfaces/IL2StandardBridge.sol"; import { IL2StandardBridge } from "src/L2/interfaces/IL2StandardBridge.sol";
import { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol"; import { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol";
import { IStandardBridge } from "src/universal/interfaces/IStandardBridge.sol"; import { IStandardBridge } from "src/universal/interfaces/IStandardBridge.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { IL2CrossDomainMessenger } from "src/L2/interfaces/IL2CrossDomainMessenger.sol";
import { IGasPriceOracle } from "src/L2/interfaces/IGasPriceOracle.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
interface IInitializable { interface IInitializable {
function initialize(address _addr) external; function initialize(address _addr) external;
...@@ -568,14 +568,14 @@ contract L2Genesis is Deployer { ...@@ -568,14 +568,14 @@ contract L2Genesis is Deployer {
require(Preinstalls.BeaconBlockRoots.code.length > 0, "L2Genesis: must have beacon-block-roots contract"); require(Preinstalls.BeaconBlockRoots.code.length > 0, "L2Genesis: must have beacon-block-roots contract");
console.log("Activating ecotone in GasPriceOracle contract"); console.log("Activating ecotone in GasPriceOracle contract");
vm.prank(L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT()); vm.prank(IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setEcotone(); IGasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setEcotone();
} }
function activateFjord() public { function activateFjord() public {
console.log("Activating fjord in GasPriceOracle contract"); console.log("Activating fjord in GasPriceOracle contract");
vm.prank(L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT()); vm.prank(IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setFjord(); IGasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setFjord();
} }
/// @notice Sets the bytecode in state /// @notice Sets the bytecode in state
......
...@@ -36,15 +36,15 @@ ...@@ -36,15 +36,15 @@
"sourceCodeHash": "0xb085725e18c1a0cc1826b770e403ecad765fce686bb80555bf0f6c3c67b21cba" "sourceCodeHash": "0xb085725e18c1a0cc1826b770e403ecad765fce686bb80555bf0f6c3c67b21cba"
}, },
"src/L1/OptimismPortal.sol": { "src/L1/OptimismPortal.sol": {
"initCodeHash": "0xb7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6", "initCodeHash": "0xbe2c0c81b3459014f287d8c89cdc0d27dde5d1f44e5d024fa1e4773ddc47c190",
"sourceCodeHash": "0x17404b6cc3f62f66786c314e2abdf021a19c00845e2cbb2ec7796f2fa469991c" "sourceCodeHash": "0xb3dd8068477dd304ef1562acf69c2ce460b08cc36aef53b5bbe489fd7d992104"
}, },
"src/L1/OptimismPortal2.sol": { "src/L1/OptimismPortal2.sol": {
"initCodeHash": "0xa5e9f45888a4a7cd6bf50c63bd6414181dd6ffdfc2afbcbe31046c0abc199a28", "initCodeHash": "0xc94c609e04ab8ffee880806550dffff53478dfffdfb079f7c487abe0e2996f3c",
"sourceCodeHash": "0xdcecbbd01e867f6b93b3d57f22de946237d56341606bdabb53257e017117f10a" "sourceCodeHash": "0x3fb97859f66c078573753b6ba5ec370449ab03b8eca9e7779fce8db5bb23b7c0"
}, },
"src/L1/OptimismPortalInterop.sol": { "src/L1/OptimismPortalInterop.sol": {
"initCodeHash": "0x8bac6679aaf2c593d22fbe6b558509eef004959846e842181e5cc55e14b36ada", "initCodeHash": "0x1c8372865dbf38225de4d843ca696a17f0d9e3cacf13c10a3d065ba19bdca05e",
"sourceCodeHash": "0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635" "sourceCodeHash": "0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635"
}, },
"src/L1/ProtocolVersions.sol": { "src/L1/ProtocolVersions.sol": {
...@@ -72,39 +72,39 @@ ...@@ -72,39 +72,39 @@
"sourceCodeHash": "0xd219408d99f627770dfcdb3243a183dec7429372787f0aec3bdbff5b3c294f2a" "sourceCodeHash": "0xd219408d99f627770dfcdb3243a183dec7429372787f0aec3bdbff5b3c294f2a"
}, },
"src/L2/ETHLiquidity.sol": { "src/L2/ETHLiquidity.sol": {
"initCodeHash": "0x1d9958d75fd502f018408ed5585d541b156435ac9c163009135b866d66f8f6ee", "initCodeHash": "0x713c18f95a6a746d0703f475f3ae10c106c9b9ecb64d881a2e61b8969b581371",
"sourceCodeHash": "0xdd96f3fd6199dbdd8f3e480a517431b5884ea60078639ee8471df703593bf2ac" "sourceCodeHash": "0x0b6afdc52d1ae88d9e4bbb5dc00920e7a6bd1e9d6595bfdbae64874190f39df0"
}, },
"src/L2/GasPriceOracle.sol": { "src/L2/GasPriceOracle.sol": {
"initCodeHash": "0xa1aae095643272e2dd08f8121dd4425cc8d4fd798cd39db63e4b957863efa8c1", "initCodeHash": "0x03947f33b80774b92214083374262fe6a4defa61da548391b44d471f2e87e9e7",
"sourceCodeHash": "0xaef30eab756a3804a241f57c8bb787179376477f6344a6ae49771d532153c9d3" "sourceCodeHash": "0x4f21025d4b5c9c74cf7040db6f8e9ce605b82931e3012fee51d3f5d9fbd7b73f"
}, },
"src/L2/L1Block.sol": { "src/L2/L1Block.sol": {
"initCodeHash": "0x21a09e366c69cae22f8fa3f3e1ddbbfed19408dee19f482a3d60ae699bebf462", "initCodeHash": "0xd12353c5bf71c6765cc9292eecf262f216e67f117f4ba6287796a5207dbca00f",
"sourceCodeHash": "0x254a5709e04e5a3b0a3e73253525457d956fde5299b22da4033012a44070ea09" "sourceCodeHash": "0xfe3a9585d9bfca8428e12759cab68a3114374e5c37371cfe08bb1976a9a5a041"
}, },
"src/L2/L1BlockIsthmus.sol": { "src/L2/L1BlockIsthmus.sol": {
"initCodeHash": "0x93b0a4bc7a0990e5c4e7081fce10f729f4d1c8e9128a7931a610152b786dc461", "initCodeHash": "0xb7a7a113056e4ac44824350b79fed5ea423e880223edcf1220e8f8b3172f50c5",
"sourceCodeHash": "0x6e4927fb8c26273694257696ff286ed0382d8bd1ecaf02abec51aa4b53922c68" "sourceCodeHash": "0x6be7e7402c4dfc10e1407e070712a3f9f352db45f8a8ab296e8f6bc56a341f47"
}, },
"src/L2/L1FeeVault.sol": { "src/L2/L1FeeVault.sol": {
"initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b", "initCodeHash": "0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b",
"sourceCodeHash": "0x927cc729bf5c9f209112df597f649493f276c4c50e17a57f7da02c2be266b192" "sourceCodeHash": "0x927cc729bf5c9f209112df597f649493f276c4c50e17a57f7da02c2be266b192"
}, },
"src/L2/L2CrossDomainMessenger.sol": { "src/L2/L2CrossDomainMessenger.sol": {
"initCodeHash": "0xff39e6cf57acfc04e7f3242d7a45b0b4dec489b5cb3aabb319dae94dfb7ee454", "initCodeHash": "0xcc4527d21cceeedbb3cbf8e7028e22fe12bc1ab30365dbebd0713499451b959d",
"sourceCodeHash": "0x60620a3aa6dd85974bb4267fb8c5845ffe8981dd7772b8d9055c0392ed414f77" "sourceCodeHash": "0x66e4ae82b58693cb394d70159308d50270ccdd56c495c5e2aaf55de1fdc78695"
}, },
"src/L2/L2ERC721Bridge.sol": { "src/L2/L2ERC721Bridge.sol": {
"initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd", "initCodeHash": "0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd",
"sourceCodeHash": "0x51a44e1fcef9483cc58ba0c9895cb3eec675785145428ece9aa7acd1a1a5b57c" "sourceCodeHash": "0x51a44e1fcef9483cc58ba0c9895cb3eec675785145428ece9aa7acd1a1a5b57c"
}, },
"src/L2/L2StandardBridge.sol": { "src/L2/L2StandardBridge.sol": {
"initCodeHash": "0x01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320", "initCodeHash": "0x651eed10044d0b19b7e4eba864345df15e252be1401f39a552ec0d2f9c4df064",
"sourceCodeHash": "0xca7d45b137fb66a941cbfe97a914c8bda78462c86ddd90085b6e2275cfb6da92" "sourceCodeHash": "0xb55e58b5d4912edf05026878a5f5ac8019372212ed2a77843775d595fbf51b84"
}, },
"src/L2/L2StandardBridgeInterop.sol": { "src/L2/L2StandardBridgeInterop.sol": {
"initCodeHash": "0x5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339", "initCodeHash": "0x9bc28e8511a4593362c2517ff90b26f9c1ecee382cce3950b47ca08892a872ef",
"sourceCodeHash": "0x6c814f4536d9fb8f384ed2195957f868abd15252e36d6dd243f3d60349a61994" "sourceCodeHash": "0x6c814f4536d9fb8f384ed2195957f868abd15252e36d6dd243f3d60349a61994"
}, },
"src/L2/L2ToL1MessagePasser.sol": { "src/L2/L2ToL1MessagePasser.sol": {
...@@ -132,12 +132,12 @@ ...@@ -132,12 +132,12 @@
"sourceCodeHash": "0xd56922cb04597dea469c65e5a49d4b3c50c171e603601e6f41da9517cae0b11a" "sourceCodeHash": "0xd56922cb04597dea469c65e5a49d4b3c50c171e603601e6f41da9517cae0b11a"
}, },
"src/L2/SuperchainWETH.sol": { "src/L2/SuperchainWETH.sol": {
"initCodeHash": "0xaa136fc27006d722867bcd017742cd119e58658d9860826551095775f70739ce", "initCodeHash": "0xd8766c7ab41d34d935febf5b48289f947804634bde38f8e346075b9f2d867275",
"sourceCodeHash": "0x2b627b6492c4ca3cc6a457fe48b7d0b1d335125d9c6288f7373b6525542532e8" "sourceCodeHash": "0x6c1691c0fb5c86f1fd67e23495725c2cd86567556602e8cc0f28104ad6114bf4"
}, },
"src/L2/WETH.sol": { "src/L2/WETH.sol": {
"initCodeHash": "0x8ccf5227a09f3ee8e450df1f9dc72a538c03226f0182c23976635c2b49859147", "initCodeHash": "0xfb253765520690623f177941c2cd9eba23e4c6d15063bccdd5e98081329d8956",
"sourceCodeHash": "0x45d14c2e1c1e0ffa1c840c61010bbbffa976bc84864e084556ea690b05775fa7" "sourceCodeHash": "0x2ab6be69795109a1ee04c5693a34d6ce0ff90b62e404cdeb18178bab18d06784"
}, },
"src/cannon/MIPS.sol": { "src/cannon/MIPS.sol": {
"initCodeHash": "0x4043f262804931bbbbecff64f87f2d0bdc4554b4d0a8b22df8fff940e8d239bf", "initCodeHash": "0x4043f262804931bbbbecff64f87f2d0bdc4554b4d0a8b22df8fff940e8d239bf",
...@@ -172,8 +172,8 @@ ...@@ -172,8 +172,8 @@
"sourceCodeHash": "0xc8fe9571fcf8fcb51a4dcb00ffa97f43a9ce811c323c4926e710b28c90a9005f" "sourceCodeHash": "0xc8fe9571fcf8fcb51a4dcb00ffa97f43a9ce811c323c4926e710b28c90a9005f"
}, },
"src/legacy/L1BlockNumber.sol": { "src/legacy/L1BlockNumber.sol": {
"initCodeHash": "0xfc43380228388659578368ec31b4581404ad3f3d30f3fcedccd461b1feaeebb4", "initCodeHash": "0x542955f1a84b304eaf291f76633b03e4c87c2654f7eff46c3bea94d27346ea1f",
"sourceCodeHash": "0x1dbbf96cf6514bfa7b553cebaec1da2f32b9b154cd80134adb7c129ee109da74" "sourceCodeHash": "0x898c239e6367a0971a075df18030a033cdada26983fa8a5cd6e7b88ec90d4958"
}, },
"src/legacy/LegacyMessagePasser.sol": { "src/legacy/LegacyMessagePasser.sol": {
"initCodeHash": "0xefc6ed9e325c2d614ea0d28c3eabfff1b345f7c6054e90253c6a091c29508267", "initCodeHash": "0xefc6ed9e325c2d614ea0d28c3eabfff1b345f7c6054e90253c6a091c29508267",
......
...@@ -4,7 +4,6 @@ pragma solidity 0.8.15; ...@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
...@@ -19,11 +18,12 @@ import "src/libraries/PortalErrors.sol"; ...@@ -19,11 +18,12 @@ import "src/libraries/PortalErrors.sol";
// Interfaces // Interfaces
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol"; import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortal /// @title OptimismPortal
...@@ -134,9 +134,9 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -134,9 +134,9 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
} }
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 2.8.1-beta.2 /// @custom:semver 2.8.1-beta.3
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "2.8.1-beta.2"; return "2.8.1-beta.3";
} }
/// @notice Constructs the OptimismPortal contract. /// @notice Constructs the OptimismPortal contract.
...@@ -592,7 +592,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver { ...@@ -592,7 +592,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
uint256(0), // value uint256(0), // value
uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit
false, // isCreation, false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol)) abi.encodeCall(IL1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
) )
); );
} }
......
...@@ -4,7 +4,6 @@ pragma solidity 0.8.15; ...@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol"; import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
...@@ -20,12 +19,13 @@ import "src/dispute/lib/Types.sol"; ...@@ -20,12 +19,13 @@ import "src/dispute/lib/Types.sol";
// Interfaces // Interfaces
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol"; import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol"; import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol"; import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @title OptimismPortal2 /// @title OptimismPortal2
...@@ -164,9 +164,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -164,9 +164,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
} }
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 3.11.0-beta.4 /// @custom:semver 3.11.0-beta.5
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "3.11.0-beta.4"; return "3.11.0-beta.5";
} }
/// @notice Constructs the OptimismPortal contract. /// @notice Constructs the OptimismPortal contract.
...@@ -606,7 +606,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver { ...@@ -606,7 +606,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
uint256(0), // value uint256(0), // value
uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit
false, // isCreation, false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol)) abi.encodeCall(IL1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
) )
); );
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { SafeSend } from "src/universal/SafeSend.sol";
// Libraries
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { SafeSend } from "src/universal/SafeSend.sol"; // Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @title ETHLiquidity /// @title ETHLiquidity
/// @notice The ETHLiquidity contract allows other contracts to access ETH liquidity without /// @notice The ETHLiquidity contract allows other contracts to access ETH liquidity without
...@@ -18,13 +23,13 @@ contract ETHLiquidity is ISemver { ...@@ -18,13 +23,13 @@ contract ETHLiquidity is ISemver {
event LiquidityMinted(address indexed caller, uint256 value); event LiquidityMinted(address indexed caller, uint256 value);
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.0.0-beta.2 /// @custom:semver 1.0.0-beta.3
string public constant version = "1.0.0-beta.2"; string public constant version = "1.0.0-beta.3";
/// @notice Allows an address to lock ETH liquidity into this contract. /// @notice Allows an address to lock ETH liquidity into this contract.
function burn() external payable { function burn() external payable {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
emit LiquidityBurned(msg.sender, msg.value); emit LiquidityBurned(msg.sender, msg.value);
} }
...@@ -32,7 +37,7 @@ contract ETHLiquidity is ISemver { ...@@ -32,7 +37,7 @@ contract ETHLiquidity is ISemver {
/// @param _amount The amount of liquidity to unlock. /// @param _amount The amount of liquidity to unlock.
function mint(uint256 _amount) external { function mint(uint256 _amount) external {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized(); if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
new SafeSend{ value: _amount }(payable(msg.sender)); new SafeSend{ value: _amount }(payable(msg.sender));
emit LiquidityMinted(msg.sender, _amount); emit LiquidityMinted(msg.sender, _amount);
} }
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { ISemver } from "src/universal/interfaces/ISemver.sol"; // Libraries
import { LibZip } from "@solady/utils/LibZip.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { LibZip } from "@solady/utils/LibZip.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x420000000000000000000000000000000000000F /// @custom:predeploy 0x420000000000000000000000000000000000000F
...@@ -26,8 +29,8 @@ contract GasPriceOracle is ISemver { ...@@ -26,8 +29,8 @@ contract GasPriceOracle is ISemver {
uint256 public constant DECIMALS = 6; uint256 public constant DECIMALS = 6;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.3.1-beta.1 /// @custom:semver 1.3.1-beta.2
string public constant version = "1.3.1-beta.1"; string public constant version = "1.3.1-beta.2";
/// @notice This is the intercept value for the linear regression used to estimate the final size of the /// @notice This is the intercept value for the linear regression used to estimate the final size of the
/// compressed transaction. /// compressed transaction.
...@@ -114,7 +117,7 @@ contract GasPriceOracle is ISemver { ...@@ -114,7 +117,7 @@ contract GasPriceOracle is ISemver {
/// @return Current fee overhead. /// @return Current fee overhead.
function overhead() public view returns (uint256) { function overhead() public view returns (uint256) {
require(!isEcotone, "GasPriceOracle: overhead() is deprecated"); require(!isEcotone, "GasPriceOracle: overhead() is deprecated");
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
} }
/// @custom:legacy /// @custom:legacy
...@@ -122,31 +125,31 @@ contract GasPriceOracle is ISemver { ...@@ -122,31 +125,31 @@ contract GasPriceOracle is ISemver {
/// @return Current fee scalar. /// @return Current fee scalar.
function scalar() public view returns (uint256) { function scalar() public view returns (uint256) {
require(!isEcotone, "GasPriceOracle: scalar() is deprecated"); require(!isEcotone, "GasPriceOracle: scalar() is deprecated");
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
} }
/// @notice Retrieves the latest known L1 base fee. /// @notice Retrieves the latest known L1 base fee.
/// @return Latest known L1 base fee. /// @return Latest known L1 base fee.
function l1BaseFee() public view returns (uint256) { function l1BaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee();
} }
/// @notice Retrieves the current blob base fee. /// @notice Retrieves the current blob base fee.
/// @return Current blob base fee. /// @return Current blob base fee.
function blobBaseFee() public view returns (uint256) { function blobBaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
} }
/// @notice Retrieves the current base fee scalar. /// @notice Retrieves the current base fee scalar.
/// @return Current base fee scalar. /// @return Current base fee scalar.
function baseFeeScalar() public view returns (uint32) { function baseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar();
} }
/// @notice Retrieves the current blob base fee scalar. /// @notice Retrieves the current blob base fee scalar.
/// @return Current blob base fee scalar. /// @return Current blob base fee scalar.
function blobBaseFeeScalar() public view returns (uint32) { function blobBaseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar();
} }
/// @custom:legacy /// @custom:legacy
...@@ -173,7 +176,7 @@ contract GasPriceOracle is ISemver { ...@@ -173,7 +176,7 @@ contract GasPriceOracle is ISemver {
if (isEcotone) { if (isEcotone) {
return l1GasUsed; return l1GasUsed;
} }
return l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead(); return l1GasUsed + IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
} }
/// @notice Computation of the L1 portion of the fee for Bedrock. /// @notice Computation of the L1 portion of the fee for Bedrock.
...@@ -181,8 +184,8 @@ contract GasPriceOracle is ISemver { ...@@ -181,8 +184,8 @@ contract GasPriceOracle is ISemver {
/// @return L1 fee that should be paid for the tx /// @return L1 fee that should be paid for the tx
function _getL1FeeBedrock(bytes memory _data) internal view returns (uint256) { function _getL1FeeBedrock(bytes memory _data) internal view returns (uint256) {
uint256 l1GasUsed = _getCalldataGas(_data); uint256 l1GasUsed = _getCalldataGas(_data);
uint256 fee = (l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead()) * l1BaseFee() uint256 fee = (l1GasUsed + IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead()) * l1BaseFee()
* L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar(); * IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
return fee / (10 ** DECIMALS); return fee / (10 ** DECIMALS);
} }
......
...@@ -57,9 +57,9 @@ contract L1Block is ISemver, IGasToken { ...@@ -57,9 +57,9 @@ contract L1Block is ISemver, IGasToken {
/// @notice The latest L1 blob base fee. /// @notice The latest L1 blob base fee.
uint256 public blobBaseFee; uint256 public blobBaseFee;
/// @custom:semver 1.5.1-beta.1 /// @custom:semver 1.5.1-beta.2
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "1.5.1-beta.1"; return "1.5.1-beta.2";
} }
/// @notice Returns the gas paying token, its decimals, name and symbol. /// @notice Returns the gas paying token, its decimals, name and symbol.
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Contracts
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { StaticConfig } from "src/libraries/StaticConfig.sol"; import { StaticConfig } from "src/libraries/StaticConfig.sol";
......
...@@ -3,7 +3,6 @@ pragma solidity 0.8.15; ...@@ -3,7 +3,6 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol"; import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
...@@ -14,6 +13,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -14,6 +13,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces // Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2ToL1MessagePasser } from "src/L2/interfaces/IL2ToL1MessagePasser.sol"; import { IL2ToL1MessagePasser } from "src/L2/interfaces/IL2ToL1MessagePasser.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000007 /// @custom:predeploy 0x4200000000000000000000000000000000000007
...@@ -22,8 +22,8 @@ import { IL2ToL1MessagePasser } from "src/L2/interfaces/IL2ToL1MessagePasser.sol ...@@ -22,8 +22,8 @@ import { IL2ToL1MessagePasser } from "src/L2/interfaces/IL2ToL1MessagePasser.sol
/// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower /// L2 on the L2 side. Users are generally encouraged to use this contract instead of lower
/// level message passing contracts. /// level message passing contracts.
contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @custom:semver 2.1.1-beta.2 /// @custom:semver 2.1.1-beta.3
string public constant version = "2.1.1-beta.2"; string public constant version = "2.1.1-beta.3";
/// @notice Constructs the L2CrossDomainMessenger contract. /// @notice Constructs the L2CrossDomainMessenger contract.
constructor() CrossDomainMessenger() { constructor() CrossDomainMessenger() {
...@@ -53,7 +53,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver { ...@@ -53,7 +53,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) { function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken(); (addr_, decimals_) = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
} }
/// @inheritdoc CrossDomainMessenger /// @inheritdoc CrossDomainMessenger
......
...@@ -4,7 +4,6 @@ pragma solidity 0.8.15; ...@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { StandardBridge } from "src/universal/StandardBridge.sol"; import { StandardBridge } from "src/universal/StandardBridge.sol";
import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol"; import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
...@@ -12,6 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -12,6 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces // Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol"; import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true /// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000010 /// @custom:predeploy 0x4200000000000000000000000000000000000010
...@@ -58,9 +58,9 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -58,9 +58,9 @@ contract L2StandardBridge is StandardBridge, ISemver {
); );
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.11.1-beta.1 /// @custom:semver 1.11.1-beta.2
function version() public pure virtual returns (string memory) { function version() public pure virtual returns (string memory) {
return "1.11.1-beta.1"; return "1.11.1-beta.2";
} }
/// @notice Constructs the L2StandardBridge contract. /// @notice Constructs the L2StandardBridge contract.
...@@ -86,7 +86,7 @@ contract L2StandardBridge is StandardBridge, ISemver { ...@@ -86,7 +86,7 @@ contract L2StandardBridge is StandardBridge, ISemver {
/// @inheritdoc StandardBridge /// @inheritdoc StandardBridge
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) { function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken(); (addr_, decimals_) = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
} }
/// @custom:legacy /// @custom:legacy
......
...@@ -3,8 +3,6 @@ pragma solidity 0.8.15; ...@@ -3,8 +3,6 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { WETH98 } from "src/universal/WETH98.sol"; import { WETH98 } from "src/universal/WETH98.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";
// Libraries // Libraries
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol"; import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
...@@ -14,6 +12,8 @@ import { Predeploys } from "src/libraries/Predeploys.sol"; ...@@ -14,6 +12,8 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol"; import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol";
import { ISuperchainERC20Extensions } from "src/L2/interfaces/ISuperchainERC20.sol"; import { ISuperchainERC20Extensions } from "src/L2/interfaces/ISuperchainERC20.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
import { IETHLiquidity } from "src/L2/interfaces/IETHLiquidity.sol";
/// @title SuperchainWETH /// @title SuperchainWETH
/// @notice SuperchainWETH is a version of WETH that can be freely transfrered between chains /// @notice SuperchainWETH is a version of WETH that can be freely transfrered between chains
...@@ -21,18 +21,18 @@ import { ISuperchainERC20Extensions } from "src/L2/interfaces/ISuperchainERC20.s ...@@ -21,18 +21,18 @@ import { ISuperchainERC20Extensions } from "src/L2/interfaces/ISuperchainERC20.s
/// do not use a custom gas token. /// do not use a custom gas token.
contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver { contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.0.0-beta.3 /// @custom:semver 1.0.0-beta.4
string public constant version = "1.0.0-beta.3"; string public constant version = "1.0.0-beta.4";
/// @inheritdoc WETH98 /// @inheritdoc WETH98
function deposit() public payable override { function deposit() public payable override {
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.deposit(); super.deposit();
} }
/// @inheritdoc WETH98 /// @inheritdoc WETH98
function withdraw(uint256 wad) public override { function withdraw(uint256 wad) public override {
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken(); if (IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.withdraw(wad); super.withdraw(wad);
} }
...@@ -42,8 +42,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver { ...@@ -42,8 +42,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
_burn(msg.sender, wad); _burn(msg.sender, wad);
// Burn to ETHLiquidity contract. // Burn to ETHLiquidity contract.
if (!L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
ETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: wad }(); IETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: wad }();
} }
// Send message to other chain. // Send message to other chain.
...@@ -65,8 +65,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver { ...@@ -65,8 +65,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
if (messenger.crossDomainMessageSender() != address(this)) revert Unauthorized(); if (messenger.crossDomainMessageSender() != address(this)) revert Unauthorized();
// Mint from ETHLiquidity contract. // Mint from ETHLiquidity contract.
if (!L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) { if (!IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
ETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(wad); IETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(wad);
} }
// Get source chain ID. // Get source chain ID.
......
...@@ -3,29 +3,29 @@ pragma solidity 0.8.15; ...@@ -3,29 +3,29 @@ pragma solidity 0.8.15;
// Contracts // Contracts
import { WETH98 } from "src/universal/WETH98.sol"; import { WETH98 } from "src/universal/WETH98.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces // Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @title WETH contract that reads the name and symbol from the L1Block contract. /// @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. /// Allows for nice rendering of token names for chains using custom gas token.
contract WETH is WETH98, ISemver { contract WETH is WETH98, ISemver {
/// @custom:semver 1.1.0-beta.1 /// @custom:semver 1.1.0-beta.2
string public constant version = "1.1.0-beta.1"; string public constant version = "1.1.0-beta.2";
/// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether" /// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether"
/// if the native asset is Ether. /// if the native asset is Ether.
function name() external view override returns (string memory name_) { function name() external view override returns (string memory name_) {
name_ = string.concat("Wrapped ", L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName()); name_ = string.concat("Wrapped ", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName());
} }
/// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the /// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the
/// native asset is Ether. /// native asset is Ether.
function symbol() external view override returns (string memory symbol_) { function symbol() external view override returns (string memory symbol_) {
symbol_ = string.concat("W", L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol()); symbol_ = string.concat("W", IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol());
} }
} }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IFeeVault } from "src/universal/interfaces/IFeeVault.sol";
interface IBaseFeeVault is IFeeVault {
function version() external view returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IETHLiquidity {
error NotCustomGasToken();
error Unauthorized();
event LiquidityBurned(address indexed caller, uint256 value);
event LiquidityMinted(address indexed caller, uint256 value);
function burn() external payable;
function mint(uint256 _amount) external;
function version() external view returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IGasPriceOracle {
function DECIMALS() external view returns (uint256);
function baseFee() external view returns (uint256);
function baseFeeScalar() external view returns (uint32);
function blobBaseFee() external view returns (uint256);
function blobBaseFeeScalar() external view returns (uint32);
function decimals() external pure returns (uint256);
function gasPrice() external view returns (uint256);
function getL1Fee(bytes memory _data) external view returns (uint256);
function getL1FeeUpperBound(uint256 _unsignedTxSize) external view returns (uint256);
function getL1GasUsed(bytes memory _data) external view returns (uint256);
function isEcotone() external view returns (bool);
function isFjord() external view returns (bool);
function l1BaseFee() external view returns (uint256);
function overhead() external view returns (uint256);
function scalar() external view returns (uint256);
function setEcotone() external;
function setFjord() external;
function version() external view returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IL1Block {
error NotDepositor();
event GasPayingTokenSet(address indexed token, uint8 indexed decimals, bytes32 name, bytes32 symbol);
function DEPOSITOR_ACCOUNT() external pure returns (address addr_);
function baseFeeScalar() external view returns (uint32);
function basefee() external view returns (uint256);
function batcherHash() external view returns (bytes32);
function blobBaseFee() external view returns (uint256);
function blobBaseFeeScalar() external view returns (uint32);
function gasPayingToken() external view returns (address addr_, uint8 decimals_);
function gasPayingTokenName() external view returns (string memory name_);
function gasPayingTokenSymbol() external view returns (string memory symbol_);
function hash() external view returns (bytes32);
function isCustomGasToken() external view returns (bool);
function l1FeeOverhead() external view returns (uint256);
function l1FeeScalar() external view returns (uint256);
function number() external view returns (uint64);
function sequenceNumber() external view returns (uint64);
function setGasPayingToken(address _token, uint8 _decimals, bytes32 _name, bytes32 _symbol) external;
function setL1BlockValues(
uint64 _number,
uint64 _timestamp,
uint256 _basefee,
bytes32 _hash,
uint64 _sequenceNumber,
bytes32 _batcherHash,
uint256 _l1FeeOverhead,
uint256 _l1FeeScalar
)
external;
function setL1BlockValuesEcotone() external;
function timestamp() external view returns (uint64);
function version() external pure returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IFeeVault } from "src/universal/interfaces/IFeeVault.sol";
interface IL1FeeVault is IFeeVault {
function version() external view returns (string memory);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import { IFeeVault } from "src/universal/interfaces/IFeeVault.sol";
interface ISequencerFeeVault is IFeeVault {
function version() external view returns (string memory);
function l1FeeWallet() external view returns (address);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface ISuperchainWETH {
error NotCustomGasToken();
error Unauthorized();
event Approval(address indexed src, address indexed guy, uint256 wad);
event Deposit(address indexed dst, uint256 wad);
event RelayERC20(address indexed from, address indexed to, uint256 amount, uint256 source);
event SendERC20(address indexed from, address indexed to, uint256 amount, uint256 destination);
event Transfer(address indexed src, address indexed dst, uint256 wad);
event Withdrawal(address indexed src, uint256 wad);
fallback() external payable;
receive() external payable;
function allowance(address, address) external view returns (uint256);
function approve(address guy, uint256 wad) external returns (bool);
function balanceOf(address) external view returns (uint256);
function decimals() external view returns (uint8);
function deposit() external payable;
function name() external view returns (string memory);
function relayERC20(address from, address dst, uint256 wad) external;
function sendERC20(address dst, uint256 wad, uint256 chainId) external;
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function transfer(address dst, uint256 wad) external returns (bool);
function transferFrom(address src, address dst, uint256 wad) external returns (bool);
function version() external view returns (string memory);
function withdraw(uint256 wad) external;
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { L1Block } from "src/L2/L1Block.sol"; // Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol"; import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:legacy true /// @custom:legacy true
/// @custom:proxied true /// @custom:proxied true
...@@ -15,8 +18,8 @@ import { ISemver } from "src/universal/interfaces/ISemver.sol"; ...@@ -15,8 +18,8 @@ import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// contract instead. /// contract instead.
contract L1BlockNumber is ISemver { contract L1BlockNumber is ISemver {
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 1.1.1-beta.1 /// @custom:semver 1.1.1-beta.2
string public constant version = "1.1.1-beta.1"; string public constant version = "1.1.1-beta.2";
/// @notice Returns the L1 block number. /// @notice Returns the L1 block number.
receive() external payable { receive() external payable {
...@@ -39,6 +42,6 @@ contract L1BlockNumber is ISemver { ...@@ -39,6 +42,6 @@ contract L1BlockNumber is ISemver {
/// @notice Retrieves the latest L1 block number. /// @notice Retrieves the latest L1 block number.
/// @return Latest L1 block number. /// @return Latest L1 block number.
function getL1BlockNumber() public view returns (uint256) { function getL1BlockNumber() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number(); return IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
} }
} }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IFeeVault {
enum WithdrawalNetwork {
L1,
L2
}
event Withdrawal(uint256 value, address to, address from);
event Withdrawal(uint256 value, address to, address from, WithdrawalNetwork withdrawalNetwork);
receive() external payable;
function MIN_WITHDRAWAL_AMOUNT() external view returns (uint256);
function RECIPIENT() external view returns (address);
function WITHDRAWAL_NETWORK() external view returns (WithdrawalNetwork);
function minWithdrawalAmount() external view returns (uint256 amount_);
function recipient() external view returns (address recipient_);
function totalProcessed() external view returns (uint256);
function withdraw() external;
function withdrawalNetwork() external view returns (WithdrawalNetwork network_);
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { stdError } from "forge-std/Test.sol"; import { stdError } from "forge-std/Test.sol";
import { VmSafe } from "forge-std/Vm.sol"; import { VmSafe } from "forge-std/Vm.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { NextImpl } from "test/mocks/NextImpl.sol"; import { NextImpl } from "test/mocks/NextImpl.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Contracts
import { Proxy } from "src/universal/Proxy.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
// Libraries // Libraries
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
// Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import "src/libraries/PortalErrors.sol"; import "src/libraries/PortalErrors.sol";
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { IL2OutputOracle } from "src/L1/interfaces/IL2OutputOracle.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
import { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.sol";
contract OptimismPortal_Test is CommonTest { contract OptimismPortal_Test is CommonTest {
address depositor; address depositor;
...@@ -462,7 +462,7 @@ contract OptimismPortal_Test is CommonTest { ...@@ -462,7 +462,7 @@ contract OptimismPortal_Test is CommonTest {
uint256(0), // value uint256(0), // value
uint64(200_000), // gasLimit uint64(200_000), // gasLimit
false, // isCreation, false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol)) abi.encodeCall(IL1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
) )
); );
...@@ -497,7 +497,7 @@ contract OptimismPortal_Test is CommonTest { ...@@ -497,7 +497,7 @@ contract OptimismPortal_Test is CommonTest {
_value: 0, _value: 0,
_gasLimit: 200_000, _gasLimit: 200_000,
_isCreation: false, _isCreation: false,
_data: abi.encodeCall(L1Block.setGasPayingToken, (_token, 18, name, symbol)) _data: abi.encodeCall(IL1Block.setGasPayingToken, (_token, 18, name, symbol))
}); });
VmSafe.Log[] memory logs = vm.getRecordedLogs(); VmSafe.Log[] memory logs = vm.getRecordedLogs();
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { stdError } from "forge-std/Test.sol"; import { stdError } from "forge-std/Test.sol";
import { VmSafe } from "forge-std/Vm.sol"; import { VmSafe } from "forge-std/Vm.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { NextImpl } from "test/mocks/NextImpl.sol"; import { NextImpl } from "test/mocks/NextImpl.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Contracts
import { Proxy } from "src/universal/Proxy.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { FaultDisputeGame, IDisputeGame } from "src/dispute/FaultDisputeGame.sol";
// Libraries // Libraries
import { Types } from "src/libraries/Types.sol"; import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol"; import { Hashing } from "src/libraries/Hashing.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies
import { Proxy } from "src/universal/Proxy.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol"; import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import { FaultDisputeGame, IDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import "src/dispute/lib/Types.sol"; import "src/dispute/lib/Types.sol";
import "src/libraries/PortalErrors.sol"; import "src/libraries/PortalErrors.sol";
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
import { IOptimismPortal2 } from "src/L1/interfaces/IOptimismPortal2.sol";
contract OptimismPortal2_Test is CommonTest { contract OptimismPortal2_Test is CommonTest {
address depositor; address depositor;
...@@ -316,7 +316,7 @@ contract OptimismPortal2_Test is CommonTest { ...@@ -316,7 +316,7 @@ contract OptimismPortal2_Test is CommonTest {
uint256(0), // value uint256(0), // value
uint64(200_000), // gasLimit uint64(200_000), // gasLimit
false, // isCreation, false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol)) abi.encodeCall(IL1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
) )
); );
...@@ -351,7 +351,7 @@ contract OptimismPortal2_Test is CommonTest { ...@@ -351,7 +351,7 @@ contract OptimismPortal2_Test is CommonTest {
_value: 0, _value: 0,
_gasLimit: 200_000, _gasLimit: 200_000,
_isCreation: false, _isCreation: false,
_data: abi.encodeCall(L1Block.setGasPayingToken, (_token, 18, name, symbol)) _data: abi.encodeCall(IL1Block.setGasPayingToken, (_token, 18, name, symbol))
}); });
VmSafe.Log[] memory logs = vm.getRecordedLogs(); VmSafe.Log[] memory logs = vm.getRecordedLogs();
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Contracts
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { Proxy } from "src/universal/Proxy.sol";
// Libraries // Libraries
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract dependencies
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol"; import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
// Target contract // Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol"; import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
contract SystemConfig_Init is CommonTest { contract SystemConfig_Init is CommonTest {
event ConfigUpdate(uint256 indexed version, ISystemConfig.UpdateType indexed updateType, bytes data); event ConfigUpdate(uint256 indexed version, ISystemConfig.UpdateType indexed updateType, bytes data);
...@@ -467,7 +467,7 @@ contract SystemConfig_Init_CustomGasToken is SystemConfig_Init { ...@@ -467,7 +467,7 @@ contract SystemConfig_Init_CustomGasToken is SystemConfig_Init {
uint256(0), // value uint256(0), // value
uint64(200_000), // gasLimit uint64(200_000), // gasLimit
false, // isCreation, false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (address(token), 18, bytes32("Silly"), bytes32("SIL"))) abi.encodeCall(IL1Block.setGasPayingToken, (address(token), 18, bytes32("Silly"), bytes32("SIL")))
) )
); );
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries // Libraries
import { Encoding } from "src/libraries/Encoding.sol"; import { Encoding } from "src/libraries/Encoding.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
// Target contract
import { L1Block } from "src/L2/L1Block.sol";
import "src/libraries/L1BlockErrors.sol"; import "src/libraries/L1BlockErrors.sol";
contract L1BlockTest is CommonTest { contract L1BlockTest is CommonTest {
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { CommonTest } from "test/setup/CommonTest.sol"; import { CommonTest } from "test/setup/CommonTest.sol";
// Contract imports // Libraries
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
// Interfaces
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol"; import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol"; import { IETHLiquidity } from "src/L2/interfaces/IETHLiquidity.sol";
/// @title SuperchainWETH_Test /// @title SuperchainWETH_Test
/// @notice Contract for testing the SuperchainWETH contract. /// @notice Contract for testing the SuperchainWETH contract.
...@@ -148,7 +150,7 @@ contract SuperchainWETH_Test is CommonTest { ...@@ -148,7 +150,7 @@ contract SuperchainWETH_Test is CommonTest {
emit Transfer(_caller, address(0), _amount); emit Transfer(_caller, address(0), _amount);
vm.expectEmit(address(superchainWeth)); vm.expectEmit(address(superchainWeth));
emit SendERC20(_caller, _recipient, _amount, _chainId); emit SendERC20(_caller, _recipient, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.burn, ()), 1); vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.burn, ()), 1);
vm.expectCall( vm.expectCall(
Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER,
abi.encodeCall( abi.encodeCall(
...@@ -190,7 +192,7 @@ contract SuperchainWETH_Test is CommonTest { ...@@ -190,7 +192,7 @@ contract SuperchainWETH_Test is CommonTest {
emit Transfer(alice, address(0), _amount); emit Transfer(alice, address(0), _amount);
vm.expectEmit(address(superchainWeth)); vm.expectEmit(address(superchainWeth));
emit SendERC20(alice, bob, _amount, _chainId); emit SendERC20(alice, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.burn, ()), 0); vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.burn, ()), 0);
vm.expectCall( vm.expectCall(
Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER, Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER,
abi.encodeCall( abi.encodeCall(
...@@ -255,7 +257,7 @@ contract SuperchainWETH_Test is CommonTest { ...@@ -255,7 +257,7 @@ contract SuperchainWETH_Test is CommonTest {
// Act // Act
vm.expectEmit(address(superchainWeth)); vm.expectEmit(address(superchainWeth));
emit RelayERC20(_sender, bob, _amount, _chainId); emit RelayERC20(_sender, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.mint, (_amount)), 1); vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.mint, (_amount)), 1);
vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER);
superchainWeth.relayERC20(_sender, bob, _amount); superchainWeth.relayERC20(_sender, bob, _amount);
...@@ -298,7 +300,7 @@ contract SuperchainWETH_Test is CommonTest { ...@@ -298,7 +300,7 @@ contract SuperchainWETH_Test is CommonTest {
// Act // Act
vm.expectEmit(address(superchainWeth)); vm.expectEmit(address(superchainWeth));
emit RelayERC20(_sender, bob, _amount, _chainId); emit RelayERC20(_sender, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.mint, (_amount)), 0); vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(IETHLiquidity.mint, (_amount)), 0);
vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER); vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER);
superchainWeth.relayERC20(_sender, bob, _amount); superchainWeth.relayERC20(_sender, bob, _amount);
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing
import { StdUtils } from "forge-std/Test.sol"; import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { ETHLiquidity } from "src/L2/ETHLiquidity.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; // Interfaces
import { IETHLiquidity } from "src/L2/interfaces/IETHLiquidity.sol";
/// @title ETHLiquidity_User /// @title ETHLiquidity_User
/// @notice Actor contract that interacts with the ETHLiquidity contract. Always pretends to be the /// @notice Actor contract that interacts with the ETHLiquidity contract. Always pretends to be the
...@@ -20,12 +23,12 @@ contract ETHLiquidity_User is StdUtils { ...@@ -20,12 +23,12 @@ contract ETHLiquidity_User is StdUtils {
Vm internal vm; Vm internal vm;
/// @notice The ETHLiquidity contract. /// @notice The ETHLiquidity contract.
ETHLiquidity internal liquidity; IETHLiquidity internal liquidity;
/// @param _vm The Vm contract. /// @param _vm The Vm contract.
/// @param _liquidity The ETHLiquidity contract. /// @param _liquidity The ETHLiquidity contract.
/// @param _balance The initial balance of the contract. /// @param _balance The initial balance of the contract.
constructor(Vm _vm, ETHLiquidity _liquidity, uint256 _balance) { constructor(Vm _vm, IETHLiquidity _liquidity, uint256 _balance) {
vm = _vm; vm = _vm;
liquidity = _liquidity; liquidity = _liquidity;
vm.deal(Predeploys.SUPERCHAIN_WETH, _balance); vm.deal(Predeploys.SUPERCHAIN_WETH, _balance);
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing
import { StdUtils } from "forge-std/Test.sol"; import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol"; import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
import { SuperchainWETH } from "src/L2/SuperchainWETH.sol";
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol";
import { CommonTest } from "test/setup/CommonTest.sol"; // Interfaces
import { ISuperchainWETH } from "src/L2/interfaces/ISuperchainWETH.sol";
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.sol";
/// @title SuperchainWETH_User /// @title SuperchainWETH_User
/// @notice Actor contract that interacts with the SuperchainWETH contract. /// @notice Actor contract that interacts with the SuperchainWETH contract.
...@@ -26,7 +29,7 @@ contract SuperchainWETH_User is StdUtils { ...@@ -26,7 +29,7 @@ contract SuperchainWETH_User is StdUtils {
Vm internal vm; Vm internal vm;
/// @notice The SuperchainWETH contract. /// @notice The SuperchainWETH contract.
SuperchainWETH internal weth; ISuperchainWETH internal weth;
/// @notice Mapping of sent messages. /// @notice Mapping of sent messages.
mapping(bytes32 => bool) internal sent; mapping(bytes32 => bool) internal sent;
...@@ -37,7 +40,7 @@ contract SuperchainWETH_User is StdUtils { ...@@ -37,7 +40,7 @@ contract SuperchainWETH_User is StdUtils {
/// @param _vm The Vm contract. /// @param _vm The Vm contract.
/// @param _weth The SuperchainWETH contract. /// @param _weth The SuperchainWETH contract.
/// @param _balance The initial balance of the contract. /// @param _balance The initial balance of the contract.
constructor(Vm _vm, SuperchainWETH _weth, uint256 _balance) { constructor(Vm _vm, ISuperchainWETH _weth, uint256 _balance) {
vm = _vm; vm = _vm;
weth = _weth; weth = _weth;
vm.deal(address(this), _balance); vm.deal(address(this), _balance);
......
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
// Testing utilities // Testing
import { Test } from "forge-std/Test.sol"; import { Test } from "forge-std/Test.sol";
// Target contract dependencies // Contracts
import { L1BlockNumber } from "src/legacy/L1BlockNumber.sol";
import { L1Block } from "src/L2/L1Block.sol"; import { L1Block } from "src/L2/L1Block.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
// Target contract // Libraries
import { L1BlockNumber } from "src/legacy/L1BlockNumber.sol"; import { Predeploys } from "src/libraries/Predeploys.sol";
contract L1BlockNumberTest is Test { contract L1BlockNumberTest is Test {
L1Block lb; L1Block lb;
......
...@@ -14,15 +14,6 @@ import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol"; ...@@ -14,15 +14,6 @@ import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol";
import { Executables } from "scripts/libraries/Executables.sol"; import { Executables } from "scripts/libraries/Executables.sol";
// Contracts // Contracts
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.sol";
import { GasPriceOracle } from "src/L2/GasPriceOracle.sol";
import { L1Block } from "src/L2/L1Block.sol";
import { FeeVault } from "src/universal/FeeVault.sol";
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 { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { DelayedWETH } from "src/dispute/DelayedWETH.sol"; import { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol"; import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
...@@ -50,6 +41,14 @@ import { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol"; ...@@ -50,6 +41,14 @@ import { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol"; import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol"; import { IAddressManager } from "src/legacy/interfaces/IAddressManager.sol";
import { IOptimismERC20Factory } from "src/L2/interfaces/IOptimismERC20Factory.sol"; import { IOptimismERC20Factory } from "src/L2/interfaces/IOptimismERC20Factory.sol";
import { IBaseFeeVault } from "src/L2/interfaces/IBaseFeeVault.sol";
import { ISequencerFeeVault } from "src/L2/interfaces/ISequencerFeeVault.sol";
import { IL1FeeVault } from "src/L2/interfaces/IL1FeeVault.sol";
import { IGasPriceOracle } from "src/L2/interfaces/IGasPriceOracle.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
import { ISuperchainWETH } from "src/L2/interfaces/ISuperchainWETH.sol";
import { IETHLiquidity } from "src/L2/interfaces/IETHLiquidity.sol";
import { IWETH } from "src/universal/interfaces/IWETH.sol";
import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol"; import { IGovernanceToken } from "src/governance/interfaces/IGovernanceToken.sol";
import { ILegacyMessagePasser } from "src/legacy/interfaces/ILegacyMessagePasser.sol"; import { ILegacyMessagePasser } from "src/legacy/interfaces/ILegacyMessagePasser.sol";
...@@ -99,16 +98,16 @@ contract Setup { ...@@ -99,16 +98,16 @@ contract Setup {
IOptimismMintableERC20Factory l2OptimismMintableERC20Factory = IOptimismMintableERC20Factory l2OptimismMintableERC20Factory =
IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY); IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY);
IL2ERC721Bridge l2ERC721Bridge = IL2ERC721Bridge(Predeploys.L2_ERC721_BRIDGE); IL2ERC721Bridge l2ERC721Bridge = IL2ERC721Bridge(Predeploys.L2_ERC721_BRIDGE);
BaseFeeVault baseFeeVault = BaseFeeVault(payable(Predeploys.BASE_FEE_VAULT)); IBaseFeeVault baseFeeVault = IBaseFeeVault(payable(Predeploys.BASE_FEE_VAULT));
SequencerFeeVault sequencerFeeVault = SequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET)); ISequencerFeeVault sequencerFeeVault = ISequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET));
L1FeeVault l1FeeVault = L1FeeVault(payable(Predeploys.L1_FEE_VAULT)); IL1FeeVault l1FeeVault = IL1FeeVault(payable(Predeploys.L1_FEE_VAULT));
GasPriceOracle gasPriceOracle = GasPriceOracle(Predeploys.GAS_PRICE_ORACLE); IGasPriceOracle gasPriceOracle = IGasPriceOracle(Predeploys.GAS_PRICE_ORACLE);
L1Block l1Block = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES); IL1Block l1Block = IL1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
IGovernanceToken governanceToken = IGovernanceToken(Predeploys.GOVERNANCE_TOKEN); IGovernanceToken governanceToken = IGovernanceToken(Predeploys.GOVERNANCE_TOKEN);
ILegacyMessagePasser legacyMessagePasser = ILegacyMessagePasser(Predeploys.LEGACY_MESSAGE_PASSER); ILegacyMessagePasser legacyMessagePasser = ILegacyMessagePasser(Predeploys.LEGACY_MESSAGE_PASSER);
WETH weth = WETH(payable(Predeploys.WETH)); IWETH weth = IWETH(payable(Predeploys.WETH));
SuperchainWETH superchainWeth = SuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH)); ISuperchainWETH superchainWeth = ISuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH));
ETHLiquidity ethLiquidity = ETHLiquidity(Predeploys.ETH_LIQUIDITY); IETHLiquidity ethLiquidity = IETHLiquidity(Predeploys.ETH_LIQUIDITY);
// TODO: Replace with OptimismSuperchainERC20Factory when updating pragmas // TODO: Replace with OptimismSuperchainERC20Factory when updating pragmas
IOptimismERC20Factory l2OptimismSuperchainERC20Factory = IOptimismERC20Factory l2OptimismSuperchainERC20Factory =
......
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