Skip to content

Commit 319d8a7

Browse files
committed
feat: SignetL1
1 parent c8c5f5d commit 319d8a7

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

src/apps/Morpho.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,11 @@ contract HosyMorphoBorrow is HostMorphoUser {
249249
// borrow some amount of loanToken
250250
MORPHO.borrow(loadParams(), amount, 0, onBehalf, address(this));
251251

252+
// TODO: complete implementation
252253
// User logic to use the tokens goes here.
253254
// Could send the tokens to the rollup via Passage, or do something
254255
// else :)
256+
filler;
255257

256258
return true;
257259
}

src/chains/Pecorino.sol

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

44
import {RollupOrders} from "zenith/src/orders/RollupOrders.sol";
55
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";
68
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
79

810
/// @title PecorinoConstants
@@ -16,6 +18,12 @@ library PecorinoConstants {
1618
/// @notice The Pecorino Rollup chain ID.
1719
uint32 constant ROLLUP_CHAIN_ID = 14174;
1820

21+
/// @notice The Passage contract for the Pecorino testnet host chain.
22+
Passage constant HOST_PASSAGE = Passage(payable(0x12585352AA1057443D6163B539EfD4487f023182));
23+
24+
/// @notice The HostOrders contract for the Pecorino testnet host chain.
25+
HostOrders constant HOST_ORDERS = HostOrders(0x0A4f505364De0Aa46c66b15aBae44eBa12ab0380);
26+
1927
/// @notice The Rollup Passage contract for the Pecorino testnet.
2028
RollupPassage constant PECORINO_ROLLUP_PASSAGE = RollupPassage(payable(0x0000000000007369676E65742D70617373616765));
2129

src/l1/Signet.sol

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import {HostOrders} from "zenith/src/orders/HostOrders.sol";
5+
import {Passage} from "zenith/src/passage/Passage.sol";
6+
import {IERC20} from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
7+
8+
import {PecorinoConstants} from "../chains/Pecorino.sol";
9+
10+
abstract contract SignetL1 {
11+
/// @notice Sentinal value for the native asset in order inputs/outputs
12+
address constant NATIVE_ASSET = address(0);
13+
14+
/// @notice The Passage address
15+
Passage internal immutable PASSAGE;
16+
/// @notice The Host Orders address
17+
HostOrders internal immutable ORDERS;
18+
19+
/// @notice The WETH token address.
20+
IERC20 internal immutable WETH;
21+
/// @notice The WBTC token address.
22+
IERC20 internal immutable WBTC;
23+
/// @notice The USDC token address.
24+
IERC20 internal immutable USDC;
25+
/// @notice The USDT token address.
26+
IERC20 internal immutable USDT;
27+
28+
/// @notice The Rollup WUSD token address.
29+
address internal immutable RU_WUSD;
30+
/// @notice The Rollup WBTC token address.
31+
address internal immutable RU_WBTC;
32+
/// @notice The Rollup WETH token address.
33+
address internal immutable RU_WETH;
34+
35+
/// @notice Error for unsupported chain IDs.
36+
error UnsupportedChain(uint256);
37+
38+
constructor() {
39+
if (block.chainid == PecorinoConstants.HOST_CHAIN_ID) {
40+
PASSAGE = PecorinoConstants.HOST_PASSAGE;
41+
ORDERS = PecorinoConstants.HOST_ORDERS;
42+
43+
WETH = IERC20(PecorinoConstants.HOST_WETH);
44+
WBTC = IERC20(PecorinoConstants.HOST_WBTC);
45+
USDC = IERC20(PecorinoConstants.HOST_USDC);
46+
USDT = IERC20(PecorinoConstants.HOST_USDT);
47+
48+
RU_WUSD = address(PecorinoConstants.WUSD);
49+
RU_WBTC = address(PecorinoConstants.WBTC);
50+
RU_WETH = address(PecorinoConstants.WETH);
51+
} else {
52+
revert UnsupportedChain(block.chainid);
53+
}
54+
}
55+
}

src/l2/Signet.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ contract SignetL2 {
5555
HOST_WBTC = PecorinoConstants.HOST_WBTC;
5656
HOST_WETH = PecorinoConstants.HOST_WETH;
5757
} else {
58-
revert("Unsupported chain");
58+
revert UnsupportedChain(block.chainid);
5959
}
6060
}
6161

0 commit comments

Comments
 (0)