Skip to content

Commit f38ea28

Browse files
committed
chore: move L2 constants that do not change by network to a separate file
1 parent b71abcc commit f38ea28

File tree

4 files changed

+28
-44
lines changed

4 files changed

+28
-44
lines changed

src/chains/L2.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
5+
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
6+
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
7+
8+
abstract contract RollupConstants {
9+
/// @notice The Rollup Passage contract for the Parmigiana testnet.
10+
RollupPassage constant PASSAGE = RollupPassage(payable(0x0000000000007369676E65742D70617373616765));
11+
12+
/// @notice The Rollup Orders contract for the Parmigiana testnet.
13+
RollupOrders constant ORDERS = RollupOrders(0x000000000000007369676E65742D6f7264657273);
14+
15+
/// @notice WETH token address for the Parmigiana testnet.
16+
IERC20 constant WETH = IERC20(0x0000000000000000007369676e65742d77657468);
17+
/// @notice WBTC token address for the Parmigiana testnet.
18+
IERC20 constant WBTC = IERC20(0x0000000000000000007369676e65742D77627463);
19+
/// @notice WUSD token address for the Parmigiana testnet.
20+
IERC20 constant WUSD = IERC20(0x0000000000000000007369676e65742D77757364);
21+
}

src/chains/Parmigiana.sol

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.13;
33

4-
import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
5-
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
64
import {HostOrders} from "zenith/src/orders/HostOrders.sol";
75
import {Passage} from "zenith/src/passage/Passage.sol";
8-
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
96

107
/// @title ParmigianaConstants
118
/// @author init4
@@ -24,12 +21,6 @@ library ParmigianaConstants {
2421
/// @notice The HostOrders contract for the Parmigiana testnet host chain.
2522
HostOrders constant HOST_ORDERS = HostOrders(0x96f44ddc3Bc8892371305531F1a6d8ca2331fE6C);
2623

27-
/// @notice The Rollup Passage contract for the Parmigiana testnet.
28-
RollupPassage constant ROLLUP_PASSAGE = RollupPassage(payable(0x0000000000007369676E65742D70617373616765));
29-
30-
/// @notice The Rollup Orders contract for the Parmigiana testnet.
31-
RollupOrders constant ROLLUP_ORDERS = RollupOrders(0x000000000000007369676E65742D6f7264657273);
32-
3324
/// USDC token for the Parmigiana testnet host chain.
3425
address constant HOST_USDC = 0x65Fb255585458De1F9A246b476aa8d5C5516F6fd;
3526
/// USDT token for the Parmigiana testnet host chain.
@@ -38,11 +29,4 @@ library ParmigianaConstants {
3829
address constant HOST_WBTC = 0xfb29F7d7a4CE607D6038d44150315e5F69BEa08A;
3930
/// WETH token for the Parmigiana testnet host chain.
4031
address constant HOST_WETH = 0xD1278f17e86071f1E658B656084c65b7FD3c90eF;
41-
42-
/// @notice WETH token address for the Parmigiana testnet.
43-
IERC20 constant WETH = IERC20(0x0000000000000000007369676e65742d77657468);
44-
/// @notice WBTC token address for the Parmigiana testnet.
45-
IERC20 constant WBTC = IERC20(0x0000000000000000007369676e65742D77627463);
46-
/// @notice WUSD token address for the Parmigiana testnet.
47-
IERC20 constant WUSD = IERC20(0x0000000000000000007369676e65742D77757364);
4832
}

src/l1/Signet.sol

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ abstract contract SignetL1 {
5555
WBTC = IERC20(ParmigianaConstants.HOST_WBTC);
5656
USDC = IERC20(ParmigianaConstants.HOST_USDC);
5757
USDT = IERC20(ParmigianaConstants.HOST_USDT);
58-
59-
RU_WUSD = address(ParmigianaConstants.WUSD);
60-
RU_WBTC = address(ParmigianaConstants.WBTC);
61-
RU_WETH = address(ParmigianaConstants.WETH);
6258
} else {
6359
revert UnsupportedChain(block.chainid);
6460
}

src/l2/Signet.sol

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
pragma solidity ^0.8.13;
33

44
import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
5-
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
6-
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
75

6+
import {RollupConstants} from "../chains/L2.sol";
87
import {ParmigianaConstants} from "../chains/Parmigiana.sol";
98
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";
109

11-
contract SignetL2 {
10+
contract SignetL2 is RollupConstants {
1211
/// @notice Sentinal value for the native asset in order inputs/outputs
1312
address constant NATIVE_ASSET = address(0);
1413

@@ -18,21 +17,9 @@ contract SignetL2 {
1817
/// @notice The chain ID of the host network.
1918
uint32 internal immutable HOST_CHAIN_ID;
2019

21-
/// @notice The Rollup Passage contract.
22-
RollupPassage internal immutable PASSAGE;
23-
/// @notice The Rollup Orders contract.
24-
RollupOrders internal immutable ORDERS;
25-
2620
/// @notice The address of the Rollup Passage on the host network.
2721
address immutable HOST_PASSAGE;
2822

29-
/// @notice The WETH token address.
30-
IERC20 internal immutable WETH;
31-
/// @notice The WBTC token address.
32-
IERC20 internal immutable WBTC;
33-
/// @notice The WUSD token address.
34-
IERC20 internal immutable WUSD;
35-
3623
/// @notice The USDC token address on the host network.
3724
address internal immutable HOST_USDC;
3825
/// @notice The USDT token address on the host network.
@@ -52,13 +39,6 @@ contract SignetL2 {
5239

5340
HOST_PASSAGE = address(ParmigianaConstants.HOST_PASSAGE);
5441

55-
PASSAGE = ParmigianaConstants.ROLLUP_PASSAGE;
56-
ORDERS = ParmigianaConstants.ROLLUP_ORDERS;
57-
58-
WETH = ParmigianaConstants.WETH;
59-
WBTC = ParmigianaConstants.WBTC;
60-
WUSD = ParmigianaConstants.WUSD;
61-
6242
HOST_USDC = ParmigianaConstants.HOST_USDC;
6343
HOST_USDT = ParmigianaConstants.HOST_USDT;
6444
HOST_WBTC = ParmigianaConstants.HOST_WBTC;
@@ -91,12 +71,15 @@ contract SignetL2 {
9171
input.amount = amount;
9272
}
9373

94-
function makeWethInput(uint256 amount) internal view returns (RollupOrders.Input memory input) {
74+
/// @notice Creates an Input struct for the WETH token.
75+
/// @param amount The amount of WETH.
76+
/// @return input The created Input struct for WETH.
77+
function makeWethInput(uint256 amount) internal pure returns (RollupOrders.Input memory input) {
9578
input.token = address(WETH);
9679
input.amount = amount;
9780
}
9881

99-
function makeWbtcInput(uint256 amount) internal view returns (RollupOrders.Input memory input) {
82+
function makeWbtcInput(uint256 amount) internal pure returns (RollupOrders.Input memory input) {
10083
input.token = address(WBTC);
10184
input.amount = amount;
10285
}

0 commit comments

Comments
 (0)