Skip to content

Commit bc207b0

Browse files
committed
add new contracts
1 parent 78d07da commit bc207b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2620
-1383
lines changed

contracts/docs/apis/L1ERC1155Gateway.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,6 @@ Complete ERC1155 batch withdraw from layer 2 to layer 1 and send fund to recipie
126126
| _tokenIds | uint256[] | The list of token ids to withdraw. |
127127
| _amounts | uint256[] | The list of corresponding number of token to withdraw. |
128128

129-
### finalizeDropMessage
130-
131-
```solidity
132-
function finalizeDropMessage() external payable
133-
```
134-
135-
136-
137-
138-
139-
140129
### finalizeWithdrawERC1155
141130

142131
```solidity
@@ -164,24 +153,24 @@ Complete ERC1155 withdraw from layer 2 to layer 1 and send fund to recipient&#39
164153
function initialize(address _counterpart, address _messenger) external nonpayable
165154
```
166155

167-
156+
Initialize the storage of L1ERC1155Gateway.
168157

169158

170159

171160
#### Parameters
172161

173162
| Name | Type | Description |
174163
|---|---|---|
175-
| _counterpart | address | undefined |
176-
| _messenger | address | undefined |
164+
| _counterpart | address | The address of L2ERC1155Gateway in L2. |
165+
| _messenger | address | The address of L1ScrollMessenger. |
177166

178167
### messenger
179168

180169
```solidity
181170
function messenger() external view returns (address)
182171
```
183172

184-
The address of L1ScrollMessenger/L2ScrollMessenger contract.
173+
The address of corresponding L1ScrollMessenger/L2ScrollMessenger contract.
185174

186175

187176

contracts/docs/apis/L1ERC721Gateway.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@ Complete ERC721 batch withdraw from layer 2 to layer 1 and send NFT to recipient
121121
| _to | address | The address of recipient in layer 1 to receive the token. |
122122
| _tokenIds | uint256[] | The list of token ids to withdraw. |
123123

124-
### finalizeDropMessage
125-
126-
```solidity
127-
function finalizeDropMessage() external payable
128-
```
129-
130-
131-
132-
133-
134-
135124
### finalizeWithdrawERC721
136125

137126
```solidity
@@ -158,24 +147,24 @@ Complete ERC721 withdraw from layer 2 to layer 1 and send NFT to recipient's
158147
function initialize(address _counterpart, address _messenger) external nonpayable
159148
```
160149

161-
150+
Initialize the storage of L1ERC721Gateway.
162151

163152

164153

165154
#### Parameters
166155

167156
| Name | Type | Description |
168157
|---|---|---|
169-
| _counterpart | address | undefined |
170-
| _messenger | address | undefined |
158+
| _counterpart | address | The address of L2ERC721Gateway in L2. |
159+
| _messenger | address | The address of L1ScrollMessenger. |
171160

172161
### messenger
173162

174163
```solidity
175164
function messenger() external view returns (address)
176165
```
177166

178-
The address of L1ScrollMessenger/L2ScrollMessenger contract.
167+
The address of corresponding L1ScrollMessenger/L2ScrollMessenger contract.
179168

180169

181170

contracts/docs/apis/L1GatewayRouter.md

Lines changed: 99 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -126,46 +126,73 @@ Deposit some token to a recipient's account on L2 and call.
126126
### depositETH
127127

128128
```solidity
129-
function depositETH(address _to, uint256 _gasLimit) external payable
129+
function depositETH(uint256 _amount, uint256 _gasLimit) external payable
130130
```
131131

132-
Deposit ETH to recipient's account in L2.
132+
Deposit ETH to caller's account in L2.
133133

134134

135135

136136
#### Parameters
137137

138138
| Name | Type | Description |
139139
|---|---|---|
140-
| _to | address | The address of recipient's account on L2. |
141-
| _gasLimit | uint256 | Gas limit required to complete the deposit on L2. |
140+
| _amount | uint256 | undefined |
141+
| _gasLimit | uint256 | undefined |
142142

143143
### depositETH
144144

145145
```solidity
146-
function depositETH(uint256 _gasLimit) external payable
146+
function depositETH(address _to, uint256 _amount, uint256 _gasLimit) external payable
147147
```
148148

149-
Deposit ETH to call's account in L2.
149+
Deposit ETH to some recipient's account in L2.
150150

151151

152152

153153
#### Parameters
154154

155155
| Name | Type | Description |
156156
|---|---|---|
157-
| _gasLimit | uint256 | Gas limit required to complete the deposit on L2. |
157+
| _to | address | undefined |
158+
| _amount | uint256 | undefined |
159+
| _gasLimit | uint256 | undefined |
160+
161+
### depositETHAndCall
162+
163+
```solidity
164+
function depositETHAndCall(address _to, uint256 _amount, bytes _data, uint256 _gasLimit) external payable
165+
```
166+
167+
Deposit ETH to some recipient's account in L2 and call the target contract.
168+
169+
170+
171+
#### Parameters
172+
173+
| Name | Type | Description |
174+
|---|---|---|
175+
| _to | address | undefined |
176+
| _amount | uint256 | undefined |
177+
| _data | bytes | undefined |
178+
| _gasLimit | uint256 | undefined |
158179

159-
### finalizeDropMessage
180+
### ethGateway
160181

161182
```solidity
162-
function finalizeDropMessage() external payable
183+
function ethGateway() external view returns (address)
163184
```
164185

186+
The address of L1ETHGateway.
165187

166188

167189

168190

191+
#### Returns
192+
193+
| Name | Type | Description |
194+
|---|---|---|
195+
| _0 | address | undefined |
169196

170197
### finalizeWithdrawERC20
171198

@@ -191,21 +218,21 @@ Complete ERC20 withdraw from L2 to L1 and send fund to recipient's account i
191218
### finalizeWithdrawETH
192219

193220
```solidity
194-
function finalizeWithdrawETH(address _from, address _to, uint256 _amount, bytes _data) external payable
221+
function finalizeWithdrawETH(address, address, uint256, bytes) external payable
195222
```
196223

197224
Complete ETH withdraw from L2 to L1 and send fund to recipient's account in L1.
198225

199-
*This function should only be called by L1ScrollMessenger. This function should also only be called by L2GatewayRouter in L2.*
226+
*This function should only be called by L1ScrollMessenger. This function should also only be called by L1ETHGateway in L2.*
200227

201228
#### Parameters
202229

203230
| Name | Type | Description |
204231
|---|---|---|
205-
| _from | address | The address of account who withdraw ETH in L2. |
206-
| _to | address | The address of recipient in L1 to receive ETH. |
207-
| _amount | uint256 | The amount of ETH to withdraw. |
208-
| _data | bytes | Optional data to forward to recipient's account. |
232+
| _0 | address | undefined |
233+
| _1 | address | undefined |
234+
| _2 | uint256 | undefined |
235+
| _3 | bytes | undefined |
209236

210237
### getERC20Gateway
211238

@@ -254,28 +281,29 @@ Return the corresponding l2 token address given l1 token address.
254281
### initialize
255282

256283
```solidity
257-
function initialize(address _defaultERC20Gateway, address _counterpart, address _messenger) external nonpayable
284+
function initialize(address _ethGateway, address _defaultERC20Gateway, address _counterpart, address _messenger) external nonpayable
258285
```
259286

260-
287+
Initialize the storage of L1GatewayRouter.
261288

262289

263290

264291
#### Parameters
265292

266293
| Name | Type | Description |
267294
|---|---|---|
268-
| _defaultERC20Gateway | address | undefined |
269-
| _counterpart | address | undefined |
270-
| _messenger | address | undefined |
295+
| _ethGateway | address | The address of L1ETHGateway contract. |
296+
| _defaultERC20Gateway | address | The address of default ERC20 Gateway contract. |
297+
| _counterpart | address | The address of L2GatewayRouter in L2. |
298+
| _messenger | address | The address of L1ScrollMessenger. |
271299

272300
### messenger
273301

274302
```solidity
275303
function messenger() external view returns (address)
276304
```
277305

278-
The address of L1ScrollMessenger/L2ScrollMessenger contract.
306+
The address of corresponding L1ScrollMessenger/L2ScrollMessenger contract.
279307

280308

281309

@@ -364,6 +392,22 @@ Update the mapping from token address to gateway address.
364392
| _tokens | address[] | The list of addresses of tokens to update. |
365393
| _gateways | address[] | The list of addresses of gateways to update. |
366394

395+
### setETHGateway
396+
397+
```solidity
398+
function setETHGateway(address _ethGateway) external nonpayable
399+
```
400+
401+
Update the address of ETH gateway contract.
402+
403+
*This function should only be called by contract owner.*
404+
405+
#### Parameters
406+
407+
| Name | Type | Description |
408+
|---|---|---|
409+
| _ethGateway | address | The address to update. |
410+
367411
### transferOwnership
368412

369413
```solidity
@@ -408,21 +452,21 @@ event DepositERC20(address indexed _l1Token, address indexed _l2Token, address i
408452
### DepositETH
409453

410454
```solidity
411-
event DepositETH(address indexed _from, address indexed _to, uint256 _amount, bytes _data)
455+
event DepositETH(address indexed from, address indexed to, uint256 amount, bytes data)
412456
```
413457

414-
458+
Emitted when someone deposit ETH from L1 to L2.
415459

416460

417461

418462
#### Parameters
419463

420464
| Name | Type | Description |
421465
|---|---|---|
422-
| _from `indexed` | address | undefined |
423-
| _to `indexed` | address | undefined |
424-
| _amount | uint256 | undefined |
425-
| _data | bytes | undefined |
466+
| from `indexed` | address | undefined |
467+
| to `indexed` | address | undefined |
468+
| amount | uint256 | undefined |
469+
| data | bytes | undefined |
426470

427471
### FinalizeWithdrawERC20
428472

@@ -448,21 +492,21 @@ event FinalizeWithdrawERC20(address indexed _l1Token, address indexed _l2Token,
448492
### FinalizeWithdrawETH
449493

450494
```solidity
451-
event FinalizeWithdrawETH(address indexed _from, address indexed _to, uint256 _amount, bytes _data)
495+
event FinalizeWithdrawETH(address indexed from, address indexed to, uint256 amount, bytes data)
452496
```
453497

454-
498+
Emitted when ETH is withdrawn from L2 to L1 and transfer to recipient.
455499

456500

457501

458502
#### Parameters
459503

460504
| Name | Type | Description |
461505
|---|---|---|
462-
| _from `indexed` | address | undefined |
463-
| _to `indexed` | address | undefined |
464-
| _amount | uint256 | undefined |
465-
| _data | bytes | undefined |
506+
| from `indexed` | address | undefined |
507+
| to `indexed` | address | undefined |
508+
| amount | uint256 | undefined |
509+
| data | bytes | undefined |
466510

467511
### OwnershipTransferred
468512

@@ -484,35 +528,51 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
484528
### SetDefaultERC20Gateway
485529

486530
```solidity
487-
event SetDefaultERC20Gateway(address indexed _defaultERC20Gateway)
531+
event SetDefaultERC20Gateway(address indexed defaultERC20Gateway)
488532
```
489533

490-
534+
Emitted when the address of default ERC20 Gateway is updated.
491535

492536

493537

494538
#### Parameters
495539

496540
| Name | Type | Description |
497541
|---|---|---|
498-
| _defaultERC20Gateway `indexed` | address | undefined |
542+
| defaultERC20Gateway `indexed` | address | The address of new default ERC20 Gateway. |
499543

500544
### SetERC20Gateway
501545

502546
```solidity
503-
event SetERC20Gateway(address indexed _token, address indexed _gateway)
547+
event SetERC20Gateway(address indexed token, address indexed gateway)
504548
```
505549

550+
Emitted when the `gateway` for `token` is updated.
551+
552+
553+
554+
#### Parameters
555+
556+
| Name | Type | Description |
557+
|---|---|---|
558+
| token `indexed` | address | The address of token updated. |
559+
| gateway `indexed` | address | The corresponding address of gateway updated. |
560+
561+
### SetETHGateway
562+
563+
```solidity
564+
event SetETHGateway(address indexed ethGateway)
565+
```
506566

567+
Emitted when the address of ETH Gateway is updated.
507568

508569

509570

510571
#### Parameters
511572

512573
| Name | Type | Description |
513574
|---|---|---|
514-
| _token `indexed` | address | undefined |
515-
| _gateway `indexed` | address | undefined |
575+
| ethGateway `indexed` | address | The address of new ETH Gateway. |
516576

517577

518578

0 commit comments

Comments
 (0)