@@ -6,10 +6,11 @@ import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/O
6
6
import { IERC1155Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol " ;
7
7
import { ERC1155HolderUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol " ;
8
8
9
- import { IL1ERC1155Gateway } from "./IL1ERC1155Gateway.sol " ;
10
- import { IL1ScrollMessenger } from "../IL1ScrollMessenger.sol " ;
11
9
import { IL2ERC1155Gateway } from "../../L2/gateways/IL2ERC1155Gateway.sol " ;
12
- import { ScrollGatewayBase, IScrollGateway } from "../../libraries/gateway/ScrollGatewayBase.sol " ;
10
+ import { IL1ScrollMessenger } from "../IL1ScrollMessenger.sol " ;
11
+ import { IL1ERC1155Gateway } from "./IL1ERC1155Gateway.sol " ;
12
+
13
+ import { ScrollGatewayBase } from "../../libraries/gateway/ScrollGatewayBase.sol " ;
13
14
14
15
/// @title L1ERC1155Gateway
15
16
/// @notice The `L1ERC1155Gateway` is used to deposit ERC1155 compatible NFT in layer 1 and
@@ -20,27 +21,37 @@ import { ScrollGatewayBase, IScrollGateway } from "../../libraries/gateway/Scrol
20
21
/// This will be changed if we have more specific scenarios.
21
22
// @todo Current implementation doesn't support calling from `L1GatewayRouter`.
22
23
contract L1ERC1155Gateway is OwnableUpgradeable , ERC1155HolderUpgradeable , ScrollGatewayBase , IL1ERC1155Gateway {
23
- /**************************************** Events ****************************************/
24
+ /**********
25
+ * Events *
26
+ **********/
24
27
25
28
/// @notice Emitted when token mapping for ERC1155 token is updated.
26
29
/// @param _l1Token The address of ERC1155 token in layer 1.
27
30
/// @param _l1Token The address of corresponding ERC1155 token in layer 2.
28
31
event UpdateTokenMapping (address _l1Token , address _l2Token );
29
32
30
- /**************************************** Variables ****************************************/
33
+ /*************
34
+ * Variables *
35
+ *************/
31
36
32
37
/// @notice Mapping from l1 token address to l2 token address for ERC1155 NFT.
33
- // solhint-disable-next-line var-name-mixedcase
34
38
mapping (address => address ) public tokenMapping;
35
39
36
- /**************************************** Constructor ****************************************/
40
+ /***************
41
+ * Constructor *
42
+ ***************/
37
43
44
+ /// @notice Initialize the storage of L1ERC1155Gateway.
45
+ /// @param _counterpart The address of L2ERC1155Gateway in L2.
46
+ /// @param _messenger The address of L1ScrollMessenger.
38
47
function initialize (address _counterpart , address _messenger ) external initializer {
39
48
OwnableUpgradeable.__Ownable_init ();
40
49
ScrollGatewayBase._initialize (_counterpart, address (0 ), _messenger);
41
50
}
42
51
43
- /**************************************** Mutate Funtions ****************************************/
52
+ /****************************
53
+ * Public Mutated Functions *
54
+ ****************************/
44
55
45
56
/// @inheritdoc IL1ERC1155Gateway
46
57
function depositERC1155 (
@@ -112,12 +123,9 @@ contract L1ERC1155Gateway is OwnableUpgradeable, ERC1155HolderUpgradeable, Scrol
112
123
emit FinalizeBatchWithdrawERC1155 (_l1Token, _l2Token, _from, _to, _tokenIds, _amounts);
113
124
}
114
125
115
- /// @inheritdoc IScrollGateway
116
- function finalizeDropMessage () external payable {
117
- // @todo finish the logic later
118
- }
119
-
120
- /**************************************** Restricted Funtions ****************************************/
126
+ /************************
127
+ * Restricted Functions *
128
+ ************************/
121
129
122
130
/// @notice Update layer 2 to layer 2 token mapping.
123
131
/// @param _l1Token The address of ERC1155 token in layer 1.
@@ -130,7 +138,9 @@ contract L1ERC1155Gateway is OwnableUpgradeable, ERC1155HolderUpgradeable, Scrol
130
138
emit UpdateTokenMapping (_l1Token, _l2Token);
131
139
}
132
140
133
- /**************************************** Internal Funtions ****************************************/
141
+ /**********************
142
+ * Internal Functions *
143
+ **********************/
134
144
135
145
/// @dev Internal function to deposit ERC1155 NFT to layer 2.
136
146
/// @param _token The address of ERC1155 NFT in layer 1.
@@ -165,7 +175,7 @@ contract L1ERC1155Gateway is OwnableUpgradeable, ERC1155HolderUpgradeable, Scrol
165
175
);
166
176
167
177
// 3. Send message to L1ScrollMessenger.
168
- IL1ScrollMessenger (messenger).sendMessage (counterpart, msg .value , _message, _gasLimit);
178
+ IL1ScrollMessenger (messenger).sendMessage { value: msg .value }(counterpart, 0 , _message, _gasLimit);
169
179
170
180
emit DepositERC1155 (_token, _l2Token, msg .sender , _to, _tokenId, _amount);
171
181
}
@@ -208,7 +218,7 @@ contract L1ERC1155Gateway is OwnableUpgradeable, ERC1155HolderUpgradeable, Scrol
208
218
);
209
219
210
220
// 3. Send message to L1ScrollMessenger.
211
- IL1ScrollMessenger (messenger).sendMessage { value: msg .value }(counterpart, msg . value , _message, _gasLimit);
221
+ IL1ScrollMessenger (messenger).sendMessage { value: msg .value }(counterpart, 0 , _message, _gasLimit);
212
222
213
223
emit BatchDepositERC1155 (_token, _l2Token, msg .sender , _to, _tokenIds, _amounts);
214
224
}
0 commit comments