@@ -7,7 +7,10 @@ import {SimpleERC20} from "simple-erc20/SimpleERC20.sol";
77import {SignetL2} from "../l2/Signet.sol " ;
88
99abstract contract BridgeL2 is SignetL2 , SimpleERC20 {
10+ /// @notice The address of the asset on the host chain.
1011 address immutable HOST_ASSET;
12+ /// @notice The address of the bank on the host chain. The bank holds the
13+ /// asset while tokens are bridged into the rollup.
1114 address immutable HOST_BANK;
1215
1316 constructor (
@@ -22,6 +25,7 @@ abstract contract BridgeL2 is SignetL2, SimpleERC20 {
2225 HOST_BANK = _hostBank;
2326 }
2427
28+ /// @notice Bridges assets into the rollup for a given recipient.
2529 function _bridgeIn (address recipient , uint256 amount , RollupOrders.Input[] memory inputs ) internal virtual {
2630 RollupOrders.Output[] memory outputs = new RollupOrders.Output [](1 );
2731 outputs[0 ] = makeHostOutput (HOST_ASSET, amount, HOST_BANK);
@@ -31,10 +35,16 @@ abstract contract BridgeL2 is SignetL2, SimpleERC20 {
3135 _mint (recipient, amount);
3236 }
3337
38+ /// @notice Bridges assets into the rollup for a given recipient.
3439 function bridgeIn (address recipient , uint256 amount ) public virtual {
3540 _bridgeIn (recipient, amount, new RollupOrders.Input [](0 ));
3641 }
3742
43+ /// @notice Burn asset on L2, and create an order to bridge out asset to
44+ /// L1. If the order is not filled, the asset will not be burned.
45+ ///
46+ /// This transaction should be paired with some off-chain logic that fills
47+ /// orders from the L1 bank.
3848 function _bridgeOut (address recipient , uint256 amount , RollupOrders.Input[] memory inputs ) internal virtual {
3949 RollupOrders.Output[] memory outputs = new RollupOrders.Output [](1 );
4050 outputs[0 ] = makeHostOutput (HOST_ASSET, amount, recipient);
@@ -44,6 +54,11 @@ abstract contract BridgeL2 is SignetL2, SimpleERC20 {
4454 _burn (msg .sender , amount);
4555 }
4656
57+ /// @notice Burn asset on L2, and create an order to bridge out asset to
58+ /// L1. If the order is not filled, the asset will not be burned.
59+ ///
60+ /// This transaction should be paired with some off-chain logic that fills
61+ /// orders from the L1 bank.
4762 function bridgeOut (address recipient , uint256 amount ) public virtual {
4863 _bridgeOut (recipient, amount, new RollupOrders.Input [](0 ));
4964 }
0 commit comments