Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/chains/Parmigiana.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
import {HostOrders} from "zenith/src/orders/HostOrders.sol";
import {Passage} from "zenith/src/passage/Passage.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

/// @title ParmigianaConstants
/// @author init4
/// @notice Constants for the Parmigiana testnet.
/// @dev These constants are used to configure the SignetStd contract in its
/// constructor, if the chain ID matches the Parmigiana testnet chain ID.
library ParmigianaConstants {
/// @notice The Parmigiana host chain ID.
uint32 constant HOST_CHAIN_ID = 3151908;
/// @notice The Parmigiana Rollup chain ID.
uint32 constant ROLLUP_CHAIN_ID = 88888;

/// @notice The Passage contract for the Parmigiana testnet host chain.
Passage constant HOST_PASSAGE = Passage(payable(0x28524D2a753925Ef000C3f0F811cDf452C6256aF));

/// @notice The HostOrders contract for the Parmigiana testnet host chain.
HostOrders constant HOST_ORDERS = HostOrders(0x96f44ddc3Bc8892371305531F1a6d8ca2331fE6C);

/// @notice The Rollup Passage contract for the Parmigiana testnet.
RollupPassage constant ROLLUP_PASSAGE = RollupPassage(payable(0x0000000000007369676E65742D70617373616765));

/// @notice The Rollup Orders contract for the Parmigiana testnet.
RollupOrders constant ROLLUP_ORDERS = RollupOrders(0x000000000000007369676E65742D6f7264657273);

/// USDC token for the Parmigiana testnet host chain.
address constant HOST_USDC = 0x65Fb255585458De1F9A246b476aa8d5C5516F6fd;
/// USDT token for the Parmigiana testnet host chain.
address constant HOST_USDT = 0xb9Df1b911B6cf6935b2a918Ba03dF2372E94e267;
/// WBTC token for the Parmigiana testnet host chain.
address constant HOST_WBTC = 0xfb29F7d7a4CE607D6038d44150315e5F69BEa08A;
/// WETH token for the Parmigiana testnet host chain.
address constant HOST_WETH = 0xD1278f17e86071f1E658B656084c65b7FD3c90eF;

/// @notice WETH token address for the Parmigiana testnet.
IERC20 constant WETH = IERC20(0x0000000000000000007369676e65742d77657468);
/// @notice WBTC token address for the Parmigiana testnet.
IERC20 constant WBTC = IERC20(0x0000000000000000007369676e65742D77627463);
/// @notice WUSD token address for the Parmigiana testnet.
IERC20 constant WUSD = IERC20(0x0000000000000000007369676e65742D77757364);
}
48 changes: 0 additions & 48 deletions src/chains/Pecorino.sol

This file was deleted.

39 changes: 23 additions & 16 deletions src/l1/Signet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {IWETH} from "../interfaces/IWETH.sol";

import {ParmigianaConstants} from "../chains/Parmigiana.sol";
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";
import {PecorinoConstants} from "../chains/Pecorino.sol";

abstract contract SignetL1 {
using SafeERC20 for IERC20;

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

/// @notice The chain ID of the host network.
uint256 immutable HOST_CHAIN_ID;

/// @notice The Passage address
Passage internal immutable PASSAGE;
/// @notice The Host Orders address
Expand All @@ -41,18 +44,21 @@ abstract contract SignetL1 {
error UnsupportedChain(uint256);

constructor() {
if (block.chainid == PecorinoConstants.HOST_CHAIN_ID) {
PASSAGE = PecorinoConstants.HOST_PASSAGE;
ORDERS = PecorinoConstants.HOST_ORDERS;

WETH = IWETH(PecorinoConstants.HOST_WETH);
WBTC = IERC20(PecorinoConstants.HOST_WBTC);
USDC = IERC20(PecorinoConstants.HOST_USDC);
USDT = IERC20(PecorinoConstants.HOST_USDT);

RU_WUSD = address(PecorinoConstants.WUSD);
RU_WBTC = address(PecorinoConstants.WBTC);
RU_WETH = address(PecorinoConstants.WETH);
uint256 chainId = block.chainid;
if (chainId == ParmigianaConstants.HOST_CHAIN_ID) {
HOST_CHAIN_ID = ParmigianaConstants.HOST_CHAIN_ID;

PASSAGE = ParmigianaConstants.HOST_PASSAGE;
ORDERS = ParmigianaConstants.HOST_ORDERS;

WETH = IWETH(ParmigianaConstants.HOST_WETH);
WBTC = IERC20(ParmigianaConstants.HOST_WBTC);
USDC = IERC20(ParmigianaConstants.HOST_USDC);
USDT = IERC20(ParmigianaConstants.HOST_USDT);

RU_WUSD = address(ParmigianaConstants.WUSD);
RU_WBTC = address(ParmigianaConstants.WBTC);
RU_WETH = address(ParmigianaConstants.WETH);
} else {
revert UnsupportedChain(block.chainid);
}
Expand Down Expand Up @@ -82,13 +88,14 @@ abstract contract SignetL1 {
/// @notice Helper to create an output struct.
function makeOutput(address token, uint256 amount, address recipient)
internal
pure
view
returns (HostOrders.Output memory output)
{
output.token = token;
output.amount = amount;
output.recipient = recipient;
output.chainId = PecorinoConstants.HOST_CHAIN_ID;
// forge-lint: disable-next-line(unsafe-typecast)
output.chainId = uint32(HOST_CHAIN_ID);
}

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

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

Expand Down
26 changes: 13 additions & 13 deletions src/l2/Signet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
import {RollupPassage} from "zenith/src/passage/RollupPassage.sol";
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

import {PecorinoConstants} from "../chains/Pecorino.sol";
import {ParmigianaConstants} from "../chains/Parmigiana.sol";
import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol";

contract SignetL2 {
Expand Down Expand Up @@ -47,22 +47,22 @@ contract SignetL2 {

constructor() {
// Auto-configure based on the chain ID.
if (block.chainid == PecorinoConstants.ROLLUP_CHAIN_ID) {
HOST_CHAIN_ID = PecorinoConstants.HOST_CHAIN_ID;
if (block.chainid == ParmigianaConstants.ROLLUP_CHAIN_ID) {
HOST_CHAIN_ID = ParmigianaConstants.HOST_CHAIN_ID;

HOST_PASSAGE = address(PecorinoConstants.HOST_PASSAGE);
HOST_PASSAGE = address(ParmigianaConstants.HOST_PASSAGE);

PASSAGE = PecorinoConstants.ROLLUP_PASSAGE;
ORDERS = PecorinoConstants.ROLLUP_ORDERS;
PASSAGE = ParmigianaConstants.ROLLUP_PASSAGE;
ORDERS = ParmigianaConstants.ROLLUP_ORDERS;

WETH = PecorinoConstants.WETH;
WBTC = PecorinoConstants.WBTC;
WUSD = PecorinoConstants.WUSD;
WETH = ParmigianaConstants.WETH;
WBTC = ParmigianaConstants.WBTC;
WUSD = ParmigianaConstants.WUSD;

HOST_USDC = PecorinoConstants.HOST_USDC;
HOST_USDT = PecorinoConstants.HOST_USDT;
HOST_WBTC = PecorinoConstants.HOST_WBTC;
HOST_WETH = PecorinoConstants.HOST_WETH;
HOST_USDC = ParmigianaConstants.HOST_USDC;
HOST_USDT = ParmigianaConstants.HOST_USDT;
HOST_WBTC = ParmigianaConstants.HOST_WBTC;
HOST_WETH = ParmigianaConstants.HOST_WETH;
} else {
revert UnsupportedChain(block.chainid);
}
Expand Down
6 changes: 3 additions & 3 deletions test/Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ pragma solidity ^0.8.13;

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

import {PecorinoConstants} from "../src/chains/Pecorino.sol";
import {ParmigianaConstants} from "../src/chains/Parmigiana.sol";

contract PecorinoTest is Test {
contract ParmigianaTest is Test {
constructor() {
vm.chainId(PecorinoConstants.ROLLUP_CHAIN_ID);
vm.chainId(ParmigianaConstants.ROLLUP_CHAIN_ID);
}
}

5 changes: 2 additions & 3 deletions test/SelfOwned.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ pragma solidity ^0.8.13;

import {SimpleERC20} from "simple-erc20/SimpleERC20.sol";

import {PecorinoTest} from "./Base.sol";

import {ParmigianaTest} from "./Base.sol";
import {SignetL2} from "../src/l2/Signet.sol";
import {SelfOwned} from "../src/l2/SelfOwned.sol";
import {AddressAliasHelper} from "../src/vendor/AddressAliasHelper.sol";
Expand All @@ -19,7 +18,7 @@ contract SelfOwnedToken is SignetL2, SimpleERC20 {
}
}

contract TestSelfOwned is PecorinoTest {
contract TestSelfOwned is ParmigianaTest {
SelfOwnedToken token;

SelfOwnedNothing nothing;
Expand Down