Skip to content

Commit fac120d

Browse files
authored
feat: parmigiana (#6)
* feat: parmigiana * chore: remove pecorino * fix: tests * chore: remove pecorino
1 parent 6f55933 commit fac120d

File tree

6 files changed

+89
-83
lines changed

6 files changed

+89
-83
lines changed

src/chains/Parmigiana.sol

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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 {HostOrders} from "zenith/src/orders/HostOrders.sol";
7+
import {Passage} from "zenith/src/passage/Passage.sol";
8+
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
9+
10+
/// @title ParmigianaConstants
11+
/// @author init4
12+
/// @notice Constants for the Parmigiana testnet.
13+
/// @dev These constants are used to configure the SignetStd contract in its
14+
/// constructor, if the chain ID matches the Parmigiana testnet chain ID.
15+
library ParmigianaConstants {
16+
/// @notice The Parmigiana host chain ID.
17+
uint32 constant HOST_CHAIN_ID = 3151908;
18+
/// @notice The Parmigiana Rollup chain ID.
19+
uint32 constant ROLLUP_CHAIN_ID = 88888;
20+
21+
/// @notice The Passage contract for the Parmigiana testnet host chain.
22+
Passage constant HOST_PASSAGE = Passage(payable(0x28524D2a753925Ef000C3f0F811cDf452C6256aF));
23+
24+
/// @notice The HostOrders contract for the Parmigiana testnet host chain.
25+
HostOrders constant HOST_ORDERS = HostOrders(0x96f44ddc3Bc8892371305531F1a6d8ca2331fE6C);
26+
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+
33+
/// USDC token for the Parmigiana testnet host chain.
34+
address constant HOST_USDC = 0x65Fb255585458De1F9A246b476aa8d5C5516F6fd;
35+
/// USDT token for the Parmigiana testnet host chain.
36+
address constant HOST_USDT = 0xb9Df1b911B6cf6935b2a918Ba03dF2372E94e267;
37+
/// WBTC token for the Parmigiana testnet host chain.
38+
address constant HOST_WBTC = 0xfb29F7d7a4CE607D6038d44150315e5F69BEa08A;
39+
/// WETH token for the Parmigiana testnet host chain.
40+
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);
48+
}

src/chains/Pecorino.sol

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/l1/Signet.sol

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
77
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
88
import {IWETH} from "../interfaces/IWETH.sol";
99

10+
import {ParmigianaConstants} from "../chains/Parmigiana.sol";
1011
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";
11-
import {PecorinoConstants} from "../chains/Pecorino.sol";
1212

1313
abstract contract SignetL1 {
1414
using SafeERC20 for IERC20;
1515

1616
/// @notice Sentinel value for the native asset in order inputs/outputs
1717
address constant NATIVE_ASSET = address(0);
1818

19+
/// @notice The chain ID of the host network.
20+
uint256 immutable HOST_CHAIN_ID;
21+
1922
/// @notice The Passage address
2023
Passage internal immutable PASSAGE;
2124
/// @notice The Host Orders address
@@ -41,18 +44,21 @@ abstract contract SignetL1 {
4144
error UnsupportedChain(uint256);
4245

4346
constructor() {
44-
if (block.chainid == PecorinoConstants.HOST_CHAIN_ID) {
45-
PASSAGE = PecorinoConstants.HOST_PASSAGE;
46-
ORDERS = PecorinoConstants.HOST_ORDERS;
47-
48-
WETH = IWETH(PecorinoConstants.HOST_WETH);
49-
WBTC = IERC20(PecorinoConstants.HOST_WBTC);
50-
USDC = IERC20(PecorinoConstants.HOST_USDC);
51-
USDT = IERC20(PecorinoConstants.HOST_USDT);
52-
53-
RU_WUSD = address(PecorinoConstants.WUSD);
54-
RU_WBTC = address(PecorinoConstants.WBTC);
55-
RU_WETH = address(PecorinoConstants.WETH);
47+
uint256 chainId = block.chainid;
48+
if (chainId == ParmigianaConstants.HOST_CHAIN_ID) {
49+
HOST_CHAIN_ID = ParmigianaConstants.HOST_CHAIN_ID;
50+
51+
PASSAGE = ParmigianaConstants.HOST_PASSAGE;
52+
ORDERS = ParmigianaConstants.HOST_ORDERS;
53+
54+
WETH = IWETH(ParmigianaConstants.HOST_WETH);
55+
WBTC = IERC20(ParmigianaConstants.HOST_WBTC);
56+
USDC = IERC20(ParmigianaConstants.HOST_USDC);
57+
USDT = IERC20(ParmigianaConstants.HOST_USDT);
58+
59+
RU_WUSD = address(ParmigianaConstants.WUSD);
60+
RU_WBTC = address(ParmigianaConstants.WBTC);
61+
RU_WETH = address(ParmigianaConstants.WETH);
5662
} else {
5763
revert UnsupportedChain(block.chainid);
5864
}
@@ -82,13 +88,14 @@ abstract contract SignetL1 {
8288
/// @notice Helper to create an output struct.
8389
function makeOutput(address token, uint256 amount, address recipient)
8490
internal
85-
pure
91+
view
8692
returns (HostOrders.Output memory output)
8793
{
8894
output.token = token;
8995
output.amount = amount;
9096
output.recipient = recipient;
91-
output.chainId = PecorinoConstants.HOST_CHAIN_ID;
97+
// forge-lint: disable-next-line(unsafe-typecast)
98+
output.chainId = uint32(HOST_CHAIN_ID);
9299
}
93100

94101
/// @notice Helper to create an Output struct for usdc.
@@ -112,7 +119,7 @@ abstract contract SignetL1 {
112119
}
113120

114121
/// @notice Helper to create an Output struct for eth.
115-
function ethOutput(uint256 amount, address recipient) internal pure returns (HostOrders.Output memory output) {
122+
function ethOutput(uint256 amount, address recipient) internal view returns (HostOrders.Output memory output) {
116123
return makeOutput(NATIVE_ASSET, amount, recipient);
117124
}
118125

src/l2/Signet.sol

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
55
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
66
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
77

8-
import {PecorinoConstants} from "../chains/Pecorino.sol";
8+
import {ParmigianaConstants} from "../chains/Parmigiana.sol";
99
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";
1010

1111
contract SignetL2 {
@@ -47,22 +47,22 @@ contract SignetL2 {
4747

4848
constructor() {
4949
// Auto-configure based on the chain ID.
50-
if (block.chainid == PecorinoConstants.ROLLUP_CHAIN_ID) {
51-
HOST_CHAIN_ID = PecorinoConstants.HOST_CHAIN_ID;
50+
if (block.chainid == ParmigianaConstants.ROLLUP_CHAIN_ID) {
51+
HOST_CHAIN_ID = ParmigianaConstants.HOST_CHAIN_ID;
5252

53-
HOST_PASSAGE = address(PecorinoConstants.HOST_PASSAGE);
53+
HOST_PASSAGE = address(ParmigianaConstants.HOST_PASSAGE);
5454

55-
PASSAGE = PecorinoConstants.ROLLUP_PASSAGE;
56-
ORDERS = PecorinoConstants.ROLLUP_ORDERS;
55+
PASSAGE = ParmigianaConstants.ROLLUP_PASSAGE;
56+
ORDERS = ParmigianaConstants.ROLLUP_ORDERS;
5757

58-
WETH = PecorinoConstants.WETH;
59-
WBTC = PecorinoConstants.WBTC;
60-
WUSD = PecorinoConstants.WUSD;
58+
WETH = ParmigianaConstants.WETH;
59+
WBTC = ParmigianaConstants.WBTC;
60+
WUSD = ParmigianaConstants.WUSD;
6161

62-
HOST_USDC = PecorinoConstants.HOST_USDC;
63-
HOST_USDT = PecorinoConstants.HOST_USDT;
64-
HOST_WBTC = PecorinoConstants.HOST_WBTC;
65-
HOST_WETH = PecorinoConstants.HOST_WETH;
62+
HOST_USDC = ParmigianaConstants.HOST_USDC;
63+
HOST_USDT = ParmigianaConstants.HOST_USDT;
64+
HOST_WBTC = ParmigianaConstants.HOST_WBTC;
65+
HOST_WETH = ParmigianaConstants.HOST_WETH;
6666
} else {
6767
revert UnsupportedChain(block.chainid);
6868
}

test/Base.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ pragma solidity ^0.8.13;
33

44
import {Test} from "forge-std/Test.sol";
55

6-
import {PecorinoConstants} from "../src/chains/Pecorino.sol";
6+
import {ParmigianaConstants} from "../src/chains/Parmigiana.sol";
77

8-
contract PecorinoTest is Test {
8+
contract ParmigianaTest is Test {
99
constructor() {
10-
vm.chainId(PecorinoConstants.ROLLUP_CHAIN_ID);
10+
vm.chainId(ParmigianaConstants.ROLLUP_CHAIN_ID);
1111
}
1212
}
1313

test/SelfOwned.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ pragma solidity ^0.8.13;
33

44
import {BurnMintERC20} from "../src/vendor/BurnMintERC20.sol";
55

6-
import {PecorinoTest} from "./Base.sol";
7-
6+
import {ParmigianaTest} from "./Base.sol";
87
import {SignetL2} from "../src/l2/Signet.sol";
98
import {SelfOwned} from "../src/l2/SelfOwned.sol";
109
import {AddressAliasHelper} from "../src/vendor/AddressAliasHelper.sol";
@@ -20,7 +19,7 @@ contract SelfOwnedToken is SignetL2, BurnMintERC20 {
2019
}
2120
}
2221

23-
contract TestSelfOwned is PecorinoTest {
22+
contract TestSelfOwned is ParmigianaTest {
2423
SelfOwnedToken token;
2524

2625
SelfOwnedNothing nothing;

0 commit comments

Comments
 (0)