Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
2afa7a4b
Unverified
Commit
2afa7a4b
authored
Sep 19, 2024
by
smartcontracts
Committed by
GitHub
Sep 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add remaining L2 interfaces (#11984)
One more PR for adding L2 interfaces.
parent
4b8d23e1
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
348 additions
and
173 deletions
+348
-173
ETHLiquidity.md
packages/contracts-bedrock/invariant-docs/ETHLiquidity.md
+1
-1
SuperchainWETH.md
packages/contracts-bedrock/invariant-docs/SuperchainWETH.md
+1
-1
L2Genesis.s.sol
packages/contracts-bedrock/scripts/L2Genesis.s.sol
+7
-7
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+24
-24
OptimismPortal.sol
packages/contracts-bedrock/src/L1/OptimismPortal.sol
+5
-5
OptimismPortal2.sol
packages/contracts-bedrock/src/L1/OptimismPortal2.sol
+5
-5
ETHLiquidity.sol
packages/contracts-bedrock/src/L2/ETHLiquidity.sol
+11
-6
GasPriceOracle.sol
packages/contracts-bedrock/src/L2/GasPriceOracle.sol
+17
-14
L1Block.sol
packages/contracts-bedrock/src/L2/L1Block.sol
+2
-2
L1BlockIsthmus.sol
packages/contracts-bedrock/src/L2/L1BlockIsthmus.sol
+3
-0
L2CrossDomainMessenger.sol
packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol
+4
-4
L2StandardBridge.sol
packages/contracts-bedrock/src/L2/L2StandardBridge.sol
+4
-4
SuperchainWETH.sol
packages/contracts-bedrock/src/L2/SuperchainWETH.sol
+10
-10
WETH.sol
packages/contracts-bedrock/src/L2/WETH.sol
+5
-5
IBaseFeeVault.sol
...ges/contracts-bedrock/src/L2/interfaces/IBaseFeeVault.sol
+8
-0
IETHLiquidity.sol
...ges/contracts-bedrock/src/L2/interfaces/IETHLiquidity.sol
+14
-0
IGasPriceOracle.sol
...s/contracts-bedrock/src/L2/interfaces/IGasPriceOracle.sol
+23
-0
IL1Block.sol
packages/contracts-bedrock/src/L2/interfaces/IL1Block.sol
+39
-0
IL1FeeVault.sol
packages/contracts-bedrock/src/L2/interfaces/IL1FeeVault.sol
+8
-0
ISequencerFeeVault.sol
...ontracts-bedrock/src/L2/interfaces/ISequencerFeeVault.sol
+9
-0
ISuperchainWETH.sol
...s/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
+33
-0
L1BlockNumber.sol
packages/contracts-bedrock/src/legacy/L1BlockNumber.sol
+7
-4
IFeeVault.sol
.../contracts-bedrock/src/universal/interfaces/IFeeVault.sol
+23
-0
OptimismPortal.t.sol
packages/contracts-bedrock/test/L1/OptimismPortal.t.sol
+14
-14
OptimismPortal2.t.sol
packages/contracts-bedrock/test/L1/OptimismPortal2.t.sol
+15
-15
SystemConfig.t.sol
packages/contracts-bedrock/test/L1/SystemConfig.t.sol
+9
-9
L1Block.t.sol
packages/contracts-bedrock/test/L2/L1Block.t.sol
+1
-4
SuperchainWETH.t.sol
packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol
+10
-8
ETHLiquidity.t.sol
...ages/contracts-bedrock/test/invariants/ETHLiquidity.t.sol
+7
-4
SuperchainWETH.t.sol
...es/contracts-bedrock/test/invariants/SuperchainWETH.t.sol
+8
-5
L1BlockNumber.t.sol
packages/contracts-bedrock/test/legacy/L1BlockNumber.t.sol
+5
-5
Setup.sol
packages/contracts-bedrock/test/setup/Setup.sol
+16
-17
No files found.
packages/contracts-bedrock/invariant-docs/ETHLiquidity.md
View file @
2afa7a4b
# `ETHLiquidity` Invariants
## Calls to mint/burn repeatedly should never cause the actor's balance to increase beyond the starting balance.
**Test:**
[
`ETHLiquidity.t.sol#L8
3`
](
../test/invariants/ETHLiquidity.t.sol#L83
)
**Test:**
[
`ETHLiquidity.t.sol#L8
6`
](
../test/invariants/ETHLiquidity.t.sol#L86
)
packages/contracts-bedrock/invariant-docs/SuperchainWETH.md
View file @
2afa7a4b
# `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.
**Test:**
[
`SuperchainWETH.t.sol#L18
1`
](
../test/invariants/SuperchainWETH.t.sol#L181
)
**Test:**
[
`SuperchainWETH.t.sol#L18
4`
](
../test/invariants/SuperchainWETH.t.sol#L184
)
packages/contracts-bedrock/scripts/L2Genesis.s.sol
View file @
2afa7a4b
...
...
@@ -15,8 +15,6 @@ import { Process } from "scripts/libraries/Process.sol";
import { SetPreinstalls } from "scripts/SetPreinstalls.s.sol";
// Contracts
import { L1Block } from "src/L2/L1Block.sol";
import { GasPriceOracle } from "src/L2/GasPriceOracle.sol";
import { SequencerFeeVault } from "src/L2/SequencerFeeVault.sol";
import { BaseFeeVault } from "src/L2/BaseFeeVault.sol";
import { L1FeeVault } from "src/L2/L1FeeVault.sol";
...
...
@@ -31,11 +29,13 @@ import { Preinstalls } from "src/libraries/Preinstalls.sol";
// Interfaces
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 { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol";
import { IStandardBridge } from "src/universal/interfaces/IStandardBridge.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 {
function initialize(address _addr) external;
...
...
@@ -568,14 +568,14 @@ contract L2Genesis is Deployer {
require(Preinstalls.BeaconBlockRoots.code.length > 0, "L2Genesis: must have beacon-block-roots contract");
console.log("Activating ecotone in GasPriceOracle contract");
vm.prank(L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setEcotone();
vm.prank(
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
I
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setEcotone();
}
function activateFjord() public {
console.log("Activating fjord in GasPriceOracle contract");
vm.prank(L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setFjord();
vm.prank(
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).DEPOSITOR_ACCOUNT());
I
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE).setFjord();
}
/// @notice Sets the bytecode in state
...
...
packages/contracts-bedrock/semver-lock.json
View file @
2afa7a4b
...
...
@@ -36,15 +36,15 @@
"sourceCodeHash"
:
"0xb085725e18c1a0cc1826b770e403ecad765fce686bb80555bf0f6c3c67b21cba"
},
"src/L1/OptimismPortal.sol"
:
{
"initCodeHash"
:
"0xb
7a7a28d5b3b88334e7cb4bc1c5fbbf9f691d934e907a2fed6a30e461eb1c0f6
"
,
"sourceCodeHash"
:
"0x
17404b6cc3f62f66786c314e2abdf021a19c00845e2cbb2ec7796f2fa469991c
"
"initCodeHash"
:
"0xb
e2c0c81b3459014f287d8c89cdc0d27dde5d1f44e5d024fa1e4773ddc47c190
"
,
"sourceCodeHash"
:
"0x
b3dd8068477dd304ef1562acf69c2ce460b08cc36aef53b5bbe489fd7d992104
"
},
"src/L1/OptimismPortal2.sol"
:
{
"initCodeHash"
:
"0x
a5e9f45888a4a7cd6bf50c63bd6414181dd6ffdfc2afbcbe31046c0abc199a28
"
,
"sourceCodeHash"
:
"0x
dcecbbd01e867f6b93b3d57f22de946237d56341606bdabb53257e017117f10a
"
"initCodeHash"
:
"0x
c94c609e04ab8ffee880806550dffff53478dfffdfb079f7c487abe0e2996f3c
"
,
"sourceCodeHash"
:
"0x
3fb97859f66c078573753b6ba5ec370449ab03b8eca9e7779fce8db5bb23b7c0
"
},
"src/L1/OptimismPortalInterop.sol"
:
{
"initCodeHash"
:
"0x
8bac6679aaf2c593d22fbe6b558509eef004959846e842181e5cc55e14b36ada
"
,
"initCodeHash"
:
"0x
1c8372865dbf38225de4d843ca696a17f0d9e3cacf13c10a3d065ba19bdca05e
"
,
"sourceCodeHash"
:
"0xe6a7794799915f408cb57c73af266670de8a3f02408d3dbc2c97db25d3e42635"
},
"src/L1/ProtocolVersions.sol"
:
{
...
...
@@ -72,39 +72,39 @@
"sourceCodeHash"
:
"0xd219408d99f627770dfcdb3243a183dec7429372787f0aec3bdbff5b3c294f2a"
},
"src/L2/ETHLiquidity.sol"
:
{
"initCodeHash"
:
"0x
1d9958d75fd502f018408ed5585d541b156435ac9c163009135b866d66f8f6ee
"
,
"sourceCodeHash"
:
"0x
dd96f3fd6199dbdd8f3e480a517431b5884ea60078639ee8471df703593bf2ac
"
"initCodeHash"
:
"0x
713c18f95a6a746d0703f475f3ae10c106c9b9ecb64d881a2e61b8969b581371
"
,
"sourceCodeHash"
:
"0x
0b6afdc52d1ae88d9e4bbb5dc00920e7a6bd1e9d6595bfdbae64874190f39df0
"
},
"src/L2/GasPriceOracle.sol"
:
{
"initCodeHash"
:
"0x
a1aae095643272e2dd08f8121dd4425cc8d4fd798cd39db63e4b957863efa8c1
"
,
"sourceCodeHash"
:
"0x
aef30eab756a3804a241f57c8bb787179376477f6344a6ae49771d532153c9d3
"
"initCodeHash"
:
"0x
03947f33b80774b92214083374262fe6a4defa61da548391b44d471f2e87e9e7
"
,
"sourceCodeHash"
:
"0x
4f21025d4b5c9c74cf7040db6f8e9ce605b82931e3012fee51d3f5d9fbd7b73f
"
},
"src/L2/L1Block.sol"
:
{
"initCodeHash"
:
"0x
21a09e366c69cae22f8fa3f3e1ddbbfed19408dee19f482a3d60ae699bebf462
"
,
"sourceCodeHash"
:
"0x
254a5709e04e5a3b0a3e73253525457d956fde5299b22da4033012a44070ea09
"
"initCodeHash"
:
"0x
d12353c5bf71c6765cc9292eecf262f216e67f117f4ba6287796a5207dbca00f
"
,
"sourceCodeHash"
:
"0x
fe3a9585d9bfca8428e12759cab68a3114374e5c37371cfe08bb1976a9a5a041
"
},
"src/L2/L1BlockIsthmus.sol"
:
{
"initCodeHash"
:
"0x
93b0a4bc7a0990e5c4e7081fce10f729f4d1c8e9128a7931a610152b786dc461
"
,
"sourceCodeHash"
:
"0x6
e4927fb8c26273694257696ff286ed0382d8bd1ecaf02abec51aa4b53922c68
"
"initCodeHash"
:
"0x
b7a7a113056e4ac44824350b79fed5ea423e880223edcf1220e8f8b3172f50c5
"
,
"sourceCodeHash"
:
"0x6
be7e7402c4dfc10e1407e070712a3f9f352db45f8a8ab296e8f6bc56a341f47
"
},
"src/L2/L1FeeVault.sol"
:
{
"initCodeHash"
:
"0x3bfcd57e25ad54b66c374f63e24e33a6cf107044aa8f5f69ef21202c380b5c5b"
,
"sourceCodeHash"
:
"0x927cc729bf5c9f209112df597f649493f276c4c50e17a57f7da02c2be266b192"
},
"src/L2/L2CrossDomainMessenger.sol"
:
{
"initCodeHash"
:
"0x
ff39e6cf57acfc04e7f3242d7a45b0b4dec489b5cb3aabb319dae94dfb7ee454
"
,
"sourceCodeHash"
:
"0x6
0620a3aa6dd85974bb4267fb8c5845ffe8981dd7772b8d9055c0392ed414f77
"
"initCodeHash"
:
"0x
cc4527d21cceeedbb3cbf8e7028e22fe12bc1ab30365dbebd0713499451b959d
"
,
"sourceCodeHash"
:
"0x6
6e4ae82b58693cb394d70159308d50270ccdd56c495c5e2aaf55de1fdc78695
"
},
"src/L2/L2ERC721Bridge.sol"
:
{
"initCodeHash"
:
"0x827077e1a0ce6c8f9ee1196c409ea77d831efd440992b3969b05259083cdf0bd"
,
"sourceCodeHash"
:
"0x51a44e1fcef9483cc58ba0c9895cb3eec675785145428ece9aa7acd1a1a5b57c"
},
"src/L2/L2StandardBridge.sol"
:
{
"initCodeHash"
:
"0x
01692b613e3d4e649d877a0fd8f0798a26401ba8ccc4cda0e61f1f9079729320
"
,
"sourceCodeHash"
:
"0x
ca7d45b137fb66a941cbfe97a914c8bda78462c86ddd90085b6e2275cfb6da92
"
"initCodeHash"
:
"0x
651eed10044d0b19b7e4eba864345df15e252be1401f39a552ec0d2f9c4df064
"
,
"sourceCodeHash"
:
"0x
b55e58b5d4912edf05026878a5f5ac8019372212ed2a77843775d595fbf51b84
"
},
"src/L2/L2StandardBridgeInterop.sol"
:
{
"initCodeHash"
:
"0x
5c9ef6b0817f715d1b8b097f3fc19e33bc54453426ca12bb48e4cea143076339
"
,
"initCodeHash"
:
"0x
9bc28e8511a4593362c2517ff90b26f9c1ecee382cce3950b47ca08892a872ef
"
,
"sourceCodeHash"
:
"0x6c814f4536d9fb8f384ed2195957f868abd15252e36d6dd243f3d60349a61994"
},
"src/L2/L2ToL1MessagePasser.sol"
:
{
...
...
@@ -132,12 +132,12 @@
"sourceCodeHash"
:
"0xd56922cb04597dea469c65e5a49d4b3c50c171e603601e6f41da9517cae0b11a"
},
"src/L2/SuperchainWETH.sol"
:
{
"initCodeHash"
:
"0x
aa136fc27006d722867bcd017742cd119e58658d9860826551095775f70739ce
"
,
"sourceCodeHash"
:
"0x
2b627b6492c4ca3cc6a457fe48b7d0b1d335125d9c6288f7373b6525542532e8
"
"initCodeHash"
:
"0x
d8766c7ab41d34d935febf5b48289f947804634bde38f8e346075b9f2d867275
"
,
"sourceCodeHash"
:
"0x
6c1691c0fb5c86f1fd67e23495725c2cd86567556602e8cc0f28104ad6114bf4
"
},
"src/L2/WETH.sol"
:
{
"initCodeHash"
:
"0x
8ccf5227a09f3ee8e450df1f9dc72a538c03226f0182c23976635c2b49859147
"
,
"sourceCodeHash"
:
"0x
45d14c2e1c1e0ffa1c840c61010bbbffa976bc84864e084556ea690b05775fa7
"
"initCodeHash"
:
"0x
fb253765520690623f177941c2cd9eba23e4c6d15063bccdd5e98081329d8956
"
,
"sourceCodeHash"
:
"0x
2ab6be69795109a1ee04c5693a34d6ce0ff90b62e404cdeb18178bab18d06784
"
},
"src/cannon/MIPS.sol"
:
{
"initCodeHash"
:
"0x4043f262804931bbbbecff64f87f2d0bdc4554b4d0a8b22df8fff940e8d239bf"
,
...
...
@@ -172,8 +172,8 @@
"sourceCodeHash"
:
"0xc8fe9571fcf8fcb51a4dcb00ffa97f43a9ce811c323c4926e710b28c90a9005f"
},
"src/legacy/L1BlockNumber.sol"
:
{
"initCodeHash"
:
"0x
fc43380228388659578368ec31b4581404ad3f3d30f3fcedccd461b1feaeebb4
"
,
"sourceCodeHash"
:
"0x
1dbbf96cf6514bfa7b553cebaec1da2f32b9b154cd80134adb7c129ee109da74
"
"initCodeHash"
:
"0x
542955f1a84b304eaf291f76633b03e4c87c2654f7eff46c3bea94d27346ea1f
"
,
"sourceCodeHash"
:
"0x
898c239e6367a0971a075df18030a033cdada26983fa8a5cd6e7b88ec90d4958
"
},
"src/legacy/LegacyMessagePasser.sol"
:
{
"initCodeHash"
:
"0xefc6ed9e325c2d614ea0d28c3eabfff1b345f7c6054e90253c6a091c29508267"
,
...
...
packages/contracts-bedrock/src/L1/OptimismPortal.sol
View file @
2afa7a4b
...
...
@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
...
...
@@ -19,11 +18,12 @@ import "src/libraries/PortalErrors.sol";
// Interfaces
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 { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { I
Semver } from "src/universal/interfaces/ISemver
.sol";
import { I
L1Block } from "src/L2/interfaces/IL1Block
.sol";
/// @custom:proxied true
/// @title OptimismPortal
...
...
@@ -134,9 +134,9 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
}
/// @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) {
return "2.8.1-beta.
2
";
return "2.8.1-beta.
3
";
}
/// @notice Constructs the OptimismPortal contract.
...
...
@@ -592,7 +592,7 @@ contract OptimismPortal is Initializable, ResourceMetering, ISemver {
uint256(0), // value
uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit
false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
)
);
}
...
...
packages/contracts-bedrock/src/L1/OptimismPortal2.sol
View file @
2afa7a4b
...
...
@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
...
...
@@ -20,12 +19,13 @@ import "src/dispute/lib/Types.sol";
// Interfaces
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 { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISuperchainConfig } from "src/L1/interfaces/ISuperchainConfig.sol";
import { IDisputeGameFactory } from "src/dispute/interfaces/IDisputeGameFactory.sol";
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { I
Semver } from "src/universal/interfaces/ISemver
.sol";
import { I
L1Block } from "src/L2/interfaces/IL1Block
.sol";
/// @custom:proxied true
/// @title OptimismPortal2
...
...
@@ -164,9 +164,9 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
}
/// @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) {
return "3.11.0-beta.
4
";
return "3.11.0-beta.
5
";
}
/// @notice Constructs the OptimismPortal contract.
...
...
@@ -606,7 +606,7 @@ contract OptimismPortal2 is Initializable, ResourceMetering, ISemver {
uint256(0), // value
uint64(SYSTEM_DEPOSIT_GAS_LIMIT), // gasLimit
false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
)
);
}
...
...
packages/contracts-bedrock/src/L2/ETHLiquidity.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { SafeSend } from "src/universal/SafeSend.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";
import { SafeSend } from "src/universal/SafeSend.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @title ETHLiquidity
/// @notice The ETHLiquidity contract allows other contracts to access ETH liquidity without
...
...
@@ -18,13 +23,13 @@ contract ETHLiquidity is ISemver {
event LiquidityMinted(address indexed caller, uint256 value);
/// @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
";
/// @notice Allows an address to lock ETH liquidity into this contract.
function burn() external payable {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
if (
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
emit LiquidityBurned(msg.sender, msg.value);
}
...
...
@@ -32,7 +37,7 @@ contract ETHLiquidity is ISemver {
/// @param _amount The amount of liquidity to unlock.
function mint(uint256 _amount) external {
if (msg.sender != Predeploys.SUPERCHAIN_WETH) revert Unauthorized();
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
if (
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
new SafeSend{ value: _amount }(payable(msg.sender));
emit LiquidityMinted(msg.sender, _amount);
}
...
...
packages/contracts-bedrock/src/L2/GasPriceOracle.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
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 { L1Block } from "src/L2/L1Block.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:predeploy 0x420000000000000000000000000000000000000F
...
...
@@ -26,8 +29,8 @@ contract GasPriceOracle is ISemver {
uint256 public constant DECIMALS = 6;
/// @notice Semantic version.
/// @custom:semver 1.3.1-beta.
1
string public constant version = "1.3.1-beta.
1
";
/// @custom:semver 1.3.1-beta.
2
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
/// compressed transaction.
...
...
@@ -114,7 +117,7 @@ contract GasPriceOracle is ISemver {
/// @return Current fee overhead.
function overhead() public view returns (uint256) {
require(!isEcotone, "GasPriceOracle: overhead() is deprecated");
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
}
/// @custom:legacy
...
...
@@ -122,31 +125,31 @@ contract GasPriceOracle is ISemver {
/// @return Current fee scalar.
function scalar() public view returns (uint256) {
require(!isEcotone, "GasPriceOracle: scalar() is deprecated");
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
}
/// @notice Retrieves the latest known L1 base fee.
/// @return Latest known L1 base fee.
function l1BaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).basefee();
}
/// @notice Retrieves the current blob base fee.
/// @return Current blob base fee.
function blobBaseFee() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFee();
}
/// @notice Retrieves the current base fee scalar.
/// @return Current base fee scalar.
function baseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).baseFeeScalar();
}
/// @notice Retrieves the current blob base fee scalar.
/// @return Current blob base fee scalar.
function blobBaseFeeScalar() public view returns (uint32) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).blobBaseFeeScalar();
}
/// @custom:legacy
...
...
@@ -173,7 +176,7 @@ contract GasPriceOracle is ISemver {
if (isEcotone) {
return l1GasUsed;
}
return l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
return l1GasUsed +
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead();
}
/// @notice Computation of the L1 portion of the fee for Bedrock.
...
...
@@ -181,8 +184,8 @@ contract GasPriceOracle is ISemver {
/// @return L1 fee that should be paid for the tx
function _getL1FeeBedrock(bytes memory _data) internal view returns (uint256) {
uint256 l1GasUsed = _getCalldataGas(_data);
uint256 fee = (l1GasUsed + L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead()) * l1BaseFee()
* L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
uint256 fee = (l1GasUsed +
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeOverhead()) * l1BaseFee()
*
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).l1FeeScalar();
return fee / (10 ** DECIMALS);
}
...
...
packages/contracts-bedrock/src/L2/L1Block.sol
View file @
2afa7a4b
...
...
@@ -57,9 +57,9 @@ contract L1Block is ISemver, IGasToken {
/// @notice The latest L1 blob base fee.
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) {
return "1.5.1-beta.
1
";
return "1.5.1-beta.
2
";
}
/// @notice Returns the gas paying token, its decimals, name and symbol.
...
...
packages/contracts-bedrock/src/L2/L1BlockIsthmus.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Contracts
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { GasPayingToken } from "src/libraries/GasPayingToken.sol";
import { StaticConfig } from "src/libraries/StaticConfig.sol";
...
...
packages/contracts-bedrock/src/L2/L2CrossDomainMessenger.sol
View file @
2afa7a4b
...
...
@@ -3,7 +3,6 @@ pragma solidity 0.8.15;
// Contracts
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
...
...
@@ -14,6 +13,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2ToL1MessagePasser } from "src/L2/interfaces/IL2ToL1MessagePasser.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000007
...
...
@@ -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
/// level message passing contracts.
contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @custom:semver 2.1.1-beta.
2
string public constant version = "2.1.1-beta.
2
";
/// @custom:semver 2.1.1-beta.
3
string public constant version = "2.1.1-beta.
3
";
/// @notice Constructs the L2CrossDomainMessenger contract.
constructor() CrossDomainMessenger() {
...
...
@@ -53,7 +53,7 @@ contract L2CrossDomainMessenger is CrossDomainMessenger, ISemver {
/// @inheritdoc CrossDomainMessenger
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
(addr_, decimals_) =
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
}
/// @inheritdoc CrossDomainMessenger
...
...
packages/contracts-bedrock/src/L2/L2StandardBridge.sol
View file @
2afa7a4b
...
...
@@ -4,7 +4,6 @@ pragma solidity 0.8.15;
// Contracts
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { OptimismMintableERC20 } from "src/universal/OptimismMintableERC20.sol";
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
...
...
@@ -12,6 +11,7 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { ICrossDomainMessenger } from "src/universal/interfaces/ICrossDomainMessenger.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:proxied true
/// @custom:predeploy 0x4200000000000000000000000000000000000010
...
...
@@ -58,9 +58,9 @@ contract L2StandardBridge is StandardBridge, ISemver {
);
/// @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) {
return "1.11.1-beta.
1
";
return "1.11.1-beta.
2
";
}
/// @notice Constructs the L2StandardBridge contract.
...
...
@@ -86,7 +86,7 @@ contract L2StandardBridge is StandardBridge, ISemver {
/// @inheritdoc StandardBridge
function gasPayingToken() internal view override returns (address addr_, uint8 decimals_) {
(addr_, decimals_) = L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
(addr_, decimals_) =
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingToken();
}
/// @custom:legacy
...
...
packages/contracts-bedrock/src/L2/SuperchainWETH.sol
View file @
2afa7a4b
...
...
@@ -3,8 +3,6 @@ pragma solidity 0.8.15;
// 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";
...
...
@@ -14,6 +12,8 @@ import { Predeploys } from "src/libraries/Predeploys.sol";
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL2ToL2CrossDomainMessenger } from "src/L2/interfaces/IL2ToL2CrossDomainMessenger.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
/// @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
/// do not use a custom gas token.
contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
/// @notice Semantic version.
/// @custom:semver 1.0.0-beta.
3
string public constant version = "1.0.0-beta.
3
";
/// @custom:semver 1.0.0-beta.
4
string public constant version = "1.0.0-beta.
4
";
/// @inheritdoc WETH98
function deposit() public payable override {
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
if (
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.deposit();
}
/// @inheritdoc WETH98
function withdraw(uint256 wad) public override {
if (L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
if (
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) revert NotCustomGasToken();
super.withdraw(wad);
}
...
...
@@ -42,8 +42,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
_burn(msg.sender, wad);
// Burn to ETHLiquidity contract.
if (!L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
ETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: wad }();
if (!
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
I
ETHLiquidity(Predeploys.ETH_LIQUIDITY).burn{ value: wad }();
}
// Send message to other chain.
...
...
@@ -65,8 +65,8 @@ contract SuperchainWETH is WETH98, ISuperchainERC20Extensions, ISemver {
if (messenger.crossDomainMessageSender() != address(this)) revert Unauthorized();
// Mint from ETHLiquidity contract.
if (!L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
ETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(wad);
if (!
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).isCustomGasToken()) {
I
ETHLiquidity(Predeploys.ETH_LIQUIDITY).mint(wad);
}
// Get source chain ID.
...
...
packages/contracts-bedrock/src/L2/WETH.sol
View file @
2afa7a4b
...
...
@@ -3,29 +3,29 @@ pragma solidity 0.8.15;
// 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";
import { IL1Block } from "src/L2/interfaces/IL1Block.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.1.0-beta.
1
string public constant version = "1.1.0-beta.
1
";
/// @custom:semver 1.1.0-beta.
2
string public constant version = "1.1.0-beta.
2
";
/// @notice Returns the name of the wrapped native asset. Will be "Wrapped Ether"
/// if the native asset is Ether.
function name() external view override returns (string memory name_) {
name_ = string.concat("Wrapped ", L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName());
name_ = string.concat("Wrapped ",
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenName());
}
/// @notice Returns the symbol of the wrapped native asset. Will be "WETH" if the
/// native asset is Ether.
function symbol() external view override returns (string memory symbol_) {
symbol_ = string.concat("W", L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol());
symbol_ = string.concat("W",
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).gasPayingTokenSymbol());
}
}
packages/contracts-bedrock/src/L2/interfaces/IBaseFeeVault.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/IETHLiquidity.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/IGasPriceOracle.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/IL1Block.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/IL1FeeVault.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/ISequencerFeeVault.sol
0 → 100644
View file @
2afa7a4b
// 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);
}
packages/contracts-bedrock/src/L2/interfaces/ISuperchainWETH.sol
0 → 100644
View file @
2afa7a4b
// 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;
}
packages/contracts-bedrock/src/legacy/L1BlockNumber.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
import { L1Block } from "src/L2/L1Block.sol";
// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
// Interfaces
import { ISemver } from "src/universal/interfaces/ISemver.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
/// @custom:legacy true
/// @custom:proxied true
...
...
@@ -15,8 +18,8 @@ import { ISemver } from "src/universal/interfaces/ISemver.sol";
/// contract instead.
contract L1BlockNumber is ISemver {
/// @notice Semantic version.
/// @custom:semver 1.1.1-beta.
1
string public constant version = "1.1.1-beta.
1
";
/// @custom:semver 1.1.1-beta.
2
string public constant version = "1.1.1-beta.
2
";
/// @notice Returns the L1 block number.
receive() external payable {
...
...
@@ -39,6 +42,6 @@ contract L1BlockNumber is ISemver {
/// @notice Retrieves the latest L1 block number.
/// @return Latest L1 block number.
function getL1BlockNumber() public view returns (uint256) {
return L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
return
I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES).number();
}
}
packages/contracts-bedrock/src/universal/interfaces/IFeeVault.sol
0 → 100644
View file @
2afa7a4b
// 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_);
}
packages/contracts-bedrock/test/L1/OptimismPortal.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
import { stdError } from "forge-std/Test.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 { NextImpl } from "test/mocks/NextImpl.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";
// Contracts
import { Proxy } from "src/universal/Proxy.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
// Libraries
import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.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 { IOptimismPortal } from "src/L1/interfaces/IOptimismPortal.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 "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 {
address depositor;
...
...
@@ -462,7 +462,7 @@ contract OptimismPortal_Test is CommonTest {
uint256(0), // value
uint64(200_000), // gasLimit
false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
)
);
...
...
@@ -497,7 +497,7 @@ contract OptimismPortal_Test is CommonTest {
_value: 0,
_gasLimit: 200_000,
_isCreation: false,
_data: abi.encodeCall(L1Block.setGasPayingToken, (_token, 18, name, symbol))
_data: abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, 18, name, symbol))
});
VmSafe.Log[] memory logs = vm.getRecordedLogs();
...
...
packages/contracts-bedrock/test/L1/OptimismPortal2.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
import { stdError } from "forge-std/Test.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 { NextImpl } from "test/mocks/NextImpl.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
import { Types } from "src/libraries/Types.sol";
import { Hashing } from "src/libraries/Hashing.sol";
import { Constants } from "src/libraries/Constants.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 { MockERC20 } from "solmate/test/utils/mocks/MockERC20.sol";
import { FaultDisputeGame, IDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
import "src/dispute/lib/Types.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 {
address depositor;
...
...
@@ -316,7 +316,7 @@ contract OptimismPortal2_Test is CommonTest {
uint256(0), // value
uint64(200_000), // gasLimit
false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, _decimals, _name, _symbol))
)
);
...
...
@@ -351,7 +351,7 @@ contract OptimismPortal2_Test is CommonTest {
_value: 0,
_gasLimit: 200_000,
_isCreation: false,
_data: abi.encodeCall(L1Block.setGasPayingToken, (_token, 18, name, symbol))
_data: abi.encodeCall(
I
L1Block.setGasPayingToken, (_token, 18, name, symbol))
});
VmSafe.Log[] memory logs = vm.getRecordedLogs();
...
...
packages/contracts-bedrock/test/L1/SystemConfig.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
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 { Proxy } from "src/universal/Proxy.sol";
// Libraries
import { Constants } from "src/libraries/Constants.sol";
import { EIP1967Helper } from "test/mocks/EIP1967Helper.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";
// Target contract
// Interfaces
import { IResourceMetering } from "src/L1/interfaces/IResourceMetering.sol";
import { ISystemConfig } from "src/L1/interfaces/ISystemConfig.sol";
import { IL1Block } from "src/L2/interfaces/IL1Block.sol";
contract SystemConfig_Init is CommonTest {
event ConfigUpdate(uint256 indexed version, ISystemConfig.UpdateType indexed updateType, bytes data);
...
...
@@ -467,7 +467,7 @@ contract SystemConfig_Init_CustomGasToken is SystemConfig_Init {
uint256(0), // value
uint64(200_000), // gasLimit
false, // isCreation,
abi.encodeCall(L1Block.setGasPayingToken, (address(token), 18, bytes32("Silly"), bytes32("SIL")))
abi.encodeCall(
I
L1Block.setGasPayingToken, (address(token), 18, bytes32("Silly"), bytes32("SIL")))
)
);
...
...
packages/contracts-bedrock/test/L2/L1Block.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
import { Encoding } from "src/libraries/Encoding.sol";
import { Constants } from "src/libraries/Constants.sol";
// Target contract
import { L1Block } from "src/L2/L1Block.sol";
import "src/libraries/L1BlockErrors.sol";
contract L1BlockTest is CommonTest {
...
...
packages/contracts-bedrock/test/L2/SuperchainWETH.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
import { CommonTest } from "test/setup/CommonTest.sol";
// Contract imports
import { Unauthorized, NotCustomGasToken } from "src/libraries/errors/CommonErrors.sol";
// Libraries
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 {
ETHLiquidity } from "src/L2/
ETHLiquidity.sol";
import {
IETHLiquidity } from "src/L2/interfaces/I
ETHLiquidity.sol";
/// @title SuperchainWETH_Test
/// @notice Contract for testing the SuperchainWETH contract.
...
...
@@ -148,7 +150,7 @@ contract SuperchainWETH_Test is CommonTest {
emit Transfer(_caller, address(0), _amount);
vm.expectEmit(address(superchainWeth));
emit SendERC20(_caller, _recipient, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.burn, ()), 1);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(
I
ETHLiquidity.burn, ()), 1);
vm.expectCall(
Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER,
abi.encodeCall(
...
...
@@ -190,7 +192,7 @@ contract SuperchainWETH_Test is CommonTest {
emit Transfer(alice, address(0), _amount);
vm.expectEmit(address(superchainWeth));
emit SendERC20(alice, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.burn, ()), 0);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(
I
ETHLiquidity.burn, ()), 0);
vm.expectCall(
Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER,
abi.encodeCall(
...
...
@@ -255,7 +257,7 @@ contract SuperchainWETH_Test is CommonTest {
// Act
vm.expectEmit(address(superchainWeth));
emit RelayERC20(_sender, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.mint, (_amount)), 1);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(
I
ETHLiquidity.mint, (_amount)), 1);
vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER);
superchainWeth.relayERC20(_sender, bob, _amount);
...
...
@@ -298,7 +300,7 @@ contract SuperchainWETH_Test is CommonTest {
// Act
vm.expectEmit(address(superchainWeth));
emit RelayERC20(_sender, bob, _amount, _chainId);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(ETHLiquidity.mint, (_amount)), 0);
vm.expectCall(Predeploys.ETH_LIQUIDITY, abi.encodeCall(
I
ETHLiquidity.mint, (_amount)), 0);
vm.prank(Predeploys.L2_TO_L2_CROSS_DOMAIN_MESSENGER);
superchainWeth.relayERC20(_sender, bob, _amount);
...
...
packages/contracts-bedrock/test/invariants/ETHLiquidity.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
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
/// @notice Actor contract that interacts with the ETHLiquidity contract. Always pretends to be the
...
...
@@ -20,12 +23,12 @@ contract ETHLiquidity_User is StdUtils {
Vm internal vm;
/// @notice The ETHLiquidity contract.
ETHLiquidity internal liquidity;
I
ETHLiquidity internal liquidity;
/// @param _vm The Vm contract.
/// @param _liquidity The ETHLiquidity contract.
/// @param _balance The initial balance of the contract.
constructor(Vm _vm, ETHLiquidity _liquidity, uint256 _balance) {
constructor(Vm _vm,
I
ETHLiquidity _liquidity, uint256 _balance) {
vm = _vm;
liquidity = _liquidity;
vm.deal(Predeploys.SUPERCHAIN_WETH, _balance);
...
...
packages/contracts-bedrock/test/invariants/SuperchainWETH.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
import { StdUtils } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol";
import { CommonTest } from "test/setup/CommonTest.sol";
// Libraries
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
/// @notice Actor contract that interacts with the SuperchainWETH contract.
...
...
@@ -26,7 +29,7 @@ contract SuperchainWETH_User is StdUtils {
Vm internal vm;
/// @notice The SuperchainWETH contract.
SuperchainWETH internal weth;
I
SuperchainWETH internal weth;
/// @notice Mapping of sent messages.
mapping(bytes32 => bool) internal sent;
...
...
@@ -37,7 +40,7 @@ contract SuperchainWETH_User is StdUtils {
/// @param _vm The Vm contract.
/// @param _weth The SuperchainWETH contract.
/// @param _balance The initial balance of the contract.
constructor(Vm _vm, SuperchainWETH _weth, uint256 _balance) {
constructor(Vm _vm,
I
SuperchainWETH _weth, uint256 _balance) {
vm = _vm;
weth = _weth;
vm.deal(address(this), _balance);
...
...
packages/contracts-bedrock/test/legacy/L1BlockNumber.t.sol
View file @
2afa7a4b
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
// Testing
utilities
// Testing
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 { Predeploys } from "src/libraries/Predeploys.sol";
//
Target contract
import {
L1BlockNumber } from "src/legacy/L1BlockNumber
.sol";
//
Libraries
import {
Predeploys } from "src/libraries/Predeploys
.sol";
contract L1BlockNumberTest is Test {
L1Block lb;
...
...
packages/contracts-bedrock/test/setup/Setup.sol
View file @
2afa7a4b
...
...
@@ -14,15 +14,6 @@ import { OutputMode, Fork, ForkUtils } from "scripts/libraries/Config.sol";
import { Executables } from "scripts/libraries/Executables.sol";
// 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 { DelayedWETH } from "src/dispute/DelayedWETH.sol";
import { AnchorStateRegistry } from "src/dispute/AnchorStateRegistry.sol";
...
...
@@ -50,6 +41,14 @@ import { IL2ERC721Bridge } from "src/L2/interfaces/IL2ERC721Bridge.sol";
import { IOptimismMintableERC20Factory } from "src/universal/interfaces/IOptimismMintableERC20Factory.sol";
import { IAddressManager } from "src/legacy/interfaces/IAddressManager.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 { ILegacyMessagePasser } from "src/legacy/interfaces/ILegacyMessagePasser.sol";
...
...
@@ -99,16 +98,16 @@ contract Setup {
IOptimismMintableERC20Factory l2OptimismMintableERC20Factory =
IOptimismMintableERC20Factory(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY);
IL2ERC721Bridge l2ERC721Bridge = IL2ERC721Bridge(Predeploys.L2_ERC721_BRIDGE);
BaseFeeVault baseFeeVault =
BaseFeeVault(payable(Predeploys.BASE_FEE_VAULT));
SequencerFeeVault sequencerFeeVault =
SequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET));
L1FeeVault l1FeeVault =
L1FeeVault(payable(Predeploys.L1_FEE_VAULT));
GasPriceOracle gasPriceOracle =
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE);
L1Block l1Block =
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
IBaseFeeVault baseFeeVault = I
BaseFeeVault(payable(Predeploys.BASE_FEE_VAULT));
ISequencerFeeVault sequencerFeeVault = I
SequencerFeeVault(payable(Predeploys.SEQUENCER_FEE_WALLET));
IL1FeeVault l1FeeVault = I
L1FeeVault(payable(Predeploys.L1_FEE_VAULT));
IGasPriceOracle gasPriceOracle = I
GasPriceOracle(Predeploys.GAS_PRICE_ORACLE);
IL1Block l1Block = I
L1Block(Predeploys.L1_BLOCK_ATTRIBUTES);
IGovernanceToken governanceToken = IGovernanceToken(Predeploys.GOVERNANCE_TOKEN);
ILegacyMessagePasser legacyMessagePasser = ILegacyMessagePasser(Predeploys.LEGACY_MESSAGE_PASSER);
WETH weth =
WETH(payable(Predeploys.WETH));
SuperchainWETH superchainWeth =
SuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH));
ETHLiquidity ethLiquidity =
ETHLiquidity(Predeploys.ETH_LIQUIDITY);
IWETH weth = I
WETH(payable(Predeploys.WETH));
ISuperchainWETH superchainWeth = I
SuperchainWETH(payable(Predeploys.SUPERCHAIN_WETH));
IETHLiquidity ethLiquidity = I
ETHLiquidity(Predeploys.ETH_LIQUIDITY);
// TODO: Replace with OptimismSuperchainERC20Factory when updating pragmas
IOptimismERC20Factory l2OptimismSuperchainERC20Factory =
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment