forked from scroll-tech/scroll-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IL2ERC721Gateway.sol
148 lines (135 loc) · 5.96 KB
/
IL2ERC721Gateway.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/// @title The interface for the ERC721 cross chain gateway on layer 2.
interface IL2ERC721Gateway {
/**********
* Events *
**********/
/// @notice Emitted when the ERC721 NFT is transferred to recipient on layer 2.
/// @param l1Token The address of ERC721 NFT on layer 1.
/// @param l2Token The address of ERC721 NFT on layer 2.
/// @param from The address of sender on layer 1.
/// @param to The address of recipient on layer 2.
/// @param tokenId The token id of the ERC721 NFT deposited on layer 1.
event FinalizeDepositERC721(
address indexed l1Token,
address indexed l2Token,
address indexed from,
address to,
uint256 tokenId
);
/// @notice Emitted when the ERC721 NFT is batch transferred to recipient on layer 2.
/// @param l1Token The address of ERC721 NFT on layer 1.
/// @param l2Token The address of ERC721 NFT on layer 2.
/// @param from The address of sender on layer 1.
/// @param to The address of recipient on layer 2.
/// @param tokenIds The list of token ids of the ERC721 NFT deposited on layer 1.
event FinalizeBatchDepositERC721(
address indexed l1Token,
address indexed l2Token,
address indexed from,
address to,
uint256[] tokenIds
);
/// @notice Emitted when the ERC721 NFT is transferred to gateway on layer 2.
/// @param l1Token The address of ERC721 NFT on layer 1.
/// @param l2Token The address of ERC721 NFT on layer 2.
/// @param from The address of sender on layer 2.
/// @param to The address of recipient on layer 1.
/// @param tokenId The token id of the ERC721 NFT to withdraw on layer 2.
event WithdrawERC721(
address indexed l1Token,
address indexed l2Token,
address indexed from,
address to,
uint256 tokenId
);
/// @notice Emitted when the ERC721 NFT is batch transferred to gateway on layer 2.
/// @param l1Token The address of ERC721 NFT on layer 1.
/// @param l2Token The address of ERC721 NFT on layer 2.
/// @param from The address of sender on layer 2.
/// @param to The address of recipient on layer 1.
/// @param tokenIds The list of token ids of the ERC721 NFT to withdraw on layer 2.
event BatchWithdrawERC721(
address indexed l1Token,
address indexed l2Token,
address indexed from,
address to,
uint256[] tokenIds
);
/*****************************
* Public Mutating Functions *
*****************************/
/// @notice Withdraw some ERC721 NFT to caller's account on layer 1.
/// @param token The address of ERC721 NFT on layer 2.
/// @param tokenId The token id to withdraw.
/// @param gasLimit Unused, but included for potential forward compatibility considerations.
function withdrawERC721(
address token,
uint256 tokenId,
uint256 gasLimit
) external payable;
/// @notice Withdraw some ERC721 NFT to caller's account on layer 1.
/// @param token The address of ERC721 NFT on layer 2.
/// @param to The address of recipient on layer 1.
/// @param tokenId The token id to withdraw.
/// @param gasLimit Unused, but included for potential forward compatibility considerations.
function withdrawERC721(
address token,
address to,
uint256 tokenId,
uint256 gasLimit
) external payable;
/// @notice Batch withdraw a list of ERC721 NFT to caller's account on layer 1.
/// @param token The address of ERC721 NFT on layer 2.
/// @param tokenIds The list of token ids to withdraw.
/// @param gasLimit Unused, but included for potential forward compatibility considerations.
function batchWithdrawERC721(
address token,
uint256[] memory tokenIds,
uint256 gasLimit
) external payable;
/// @notice Batch withdraw a list of ERC721 NFT to caller's account on layer 1.
/// @param token The address of ERC721 NFT on layer 2.
/// @param to The address of recipient on layer 1.
/// @param tokenIds The list of token ids to withdraw.
/// @param gasLimit Unused, but included for potential forward compatibility considerations.
function batchWithdrawERC721(
address token,
address to,
uint256[] memory tokenIds,
uint256 gasLimit
) external payable;
/// @notice Complete ERC721 deposit from layer 1 to layer 2 and send NFT to recipient's account on layer 2.
/// @dev Requirements:
/// - The function should only be called by L2ScrollMessenger.
/// - The function should also only be called by L1ERC721Gateway on layer 1.
/// @param l1Token The address of corresponding layer 1 token.
/// @param l2Token The address of corresponding layer 2 token.
/// @param from The address of account who withdraw the token on layer 1.
/// @param to The address of recipient on layer 2 to receive the token.
/// @param tokenId The token id to withdraw.
function finalizeDepositERC721(
address l1Token,
address l2Token,
address from,
address to,
uint256 tokenId
) external;
/// @notice Complete ERC721 deposit from layer 1 to layer 2 and send NFT to recipient's account on layer 2.
/// @dev Requirements:
/// - The function should only be called by L2ScrollMessenger.
/// - The function should also only be called by L1ERC721Gateway on layer 1.
/// @param l1Token The address of corresponding layer 1 token.
/// @param l2Token The address of corresponding layer 2 token.
/// @param from The address of account who withdraw the token on layer 1.
/// @param to The address of recipient on layer 2 to receive the token.
/// @param tokenIds The list of token ids to withdraw.
function finalizeBatchDepositERC721(
address l1Token,
address l2Token,
address from,
address to,
uint256[] calldata tokenIds
) external;
}