@@ -4,6 +4,7 @@ pragma solidity ^0.8.13;
44import {HostOrders} from "zenith/src/orders/HostOrders.sol " ;
55import {Passage} from "zenith/src/passage/Passage.sol " ;
66import {IERC20 } from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol " ;
7+ import {IWETH} from "../interfaces/IWETH.sol " ;
78
89import {AddressAliasHelper} from "../vendor/AddressAliasHelper.sol " ;
910import {PecorinoConstants} from "../chains/Pecorino.sol " ;
@@ -18,7 +19,7 @@ abstract contract SignetL1 {
1819 HostOrders internal immutable ORDERS;
1920
2021 /// @notice The WETH token address.
21- IERC20 internal immutable WETH;
22+ IWETH internal immutable WETH;
2223 /// @notice The WBTC token address.
2324 IERC20 internal immutable WBTC;
2425 /// @notice The USDC token address.
@@ -41,7 +42,7 @@ abstract contract SignetL1 {
4142 PASSAGE = PecorinoConstants.HOST_PASSAGE;
4243 ORDERS = PecorinoConstants.HOST_ORDERS;
4344
44- WETH = IERC20 (PecorinoConstants.HOST_WETH);
45+ WETH = IWETH (PecorinoConstants.HOST_WETH);
4546 WBTC = IERC20 (PecorinoConstants.HOST_WBTC);
4647 USDC = IERC20 (PecorinoConstants.HOST_USDC);
4748 USDT = IERC20 (PecorinoConstants.HOST_USDT);
@@ -73,6 +74,7 @@ abstract contract SignetL1 {
7374 return AddressAliasHelper.applyL1ToL2Alias (address (this ));
7475 }
7576
77+ /// @notice Helper to create an output struct.
7678 function makeOutput (address token , uint256 amount , address recipient )
7779 internal
7880 pure
@@ -84,36 +86,49 @@ abstract contract SignetL1 {
8486 output.chainId = PecorinoConstants.HOST_CHAIN_ID;
8587 }
8688
89+ /// @notice Helper to create an Output struct for usdc.
8790 function usdcOutput (uint256 amount , address recipient ) internal view returns (HostOrders.Output memory output ) {
8891 return makeOutput (address (USDC), amount, recipient);
8992 }
9093
94+ /// @notice Helper to create an Output struct for usdt.
9195 function usdtOutput (uint256 amount , address recipient ) internal view returns (HostOrders.Output memory output ) {
9296 return makeOutput (address (USDT), amount, recipient);
9397 }
9498
99+ /// @notice Helper to create an Output struct for wbtc.
95100 function wbtcOutput (uint256 amount , address recipient ) internal view returns (HostOrders.Output memory output ) {
96101 return makeOutput (address (WBTC), amount, recipient);
97102 }
98103
104+ /// @notice Helper to create an Output struct for weth.
99105 function wethOutput (uint256 amount , address recipient ) internal view returns (HostOrders.Output memory output ) {
100106 return makeOutput (address (WETH), amount, recipient);
101107 }
102108
109+ /// @notice Helper to create an Output struct for eth.
103110 function ethOutput (uint256 amount , address recipient ) internal pure returns (HostOrders.Output memory output ) {
104111 return makeOutput (NATIVE_ASSET, amount, recipient);
105112 }
106113
107- function enterSignetToken (address token , uint256 amount ) internal {
114+ /// @notice Send tokens into Signet via the Passage contract.
115+ function tokensToSignet (address token , uint256 amount ) internal {
108116 if (token == NATIVE_ASSET) {
109- enterSignetEth (amount);
117+ ethToSignet (amount);
110118 return ;
111119 }
112120 IERC20 (token).approve (address (PASSAGE), amount);
113121 PASSAGE.enterToken (selfOnL2 (), token, amount);
114122 }
115123
116- function enterSignetEth (uint256 amount ) internal {
124+ /// @notice Send ETH into Signet via the Passage contract.
125+ function ethToSignet (uint256 amount ) internal {
117126 PASSAGE.enter {value: amount}(selfOnL2 ());
118127 }
128+
129+ /// @notice Send WETH into Signet via the Passage contract.
130+ function wethToSignet (uint256 amount ) internal {
131+ WETH.withdraw (amount);
132+ ethToSignet (amount);
133+ }
119134}
0 commit comments