L1ERC1155Gateway
L1ERC1155Gateway
The L1ERC1155Gateway is used to deposit ERC1155 compatible NFT in layer 1 and finalize withdraw the NFTs from layer 2.
The deposited NFTs are held in this gateway. On finalizing withdraw, the corresponding NFT will be transfer to the recipient directly. This will be changed if we have more specific scenarios.
Methods
batchDepositERC1155
Deposit a list of some ERC1155 NFT to caller's account on layer 2.
Parameters
| Name |
Type |
Description |
| _token |
address |
The address of ERC1155 NFT in layer 1. |
| _tokenIds |
uint256[] |
The list of token ids to deposit. |
| _amounts |
uint256[] |
The list of corresponding number of token to deposit. |
| _gasLimit |
uint256 |
Estimated gas limit required to complete the deposit on layer 2. |
batchDepositERC1155
Deposit a list of some ERC1155 NFT to a recipient's account on layer 2.
Parameters
| Name |
Type |
Description |
| _token |
address |
The address of ERC1155 NFT in layer 1. |
| _to |
address |
The address of recipient in layer 2. |
| _tokenIds |
uint256[] |
The list of token ids to deposit. |
| _amounts |
uint256[] |
The list of corresponding number of token to deposit. |
| _gasLimit |
uint256 |
Estimated gas limit required to complete the deposit on layer 2. |
counterpart
The address of corresponding L1/L2 Gateway contract.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
depositERC1155
Deposit some ERC1155 NFT to a recipient's account on layer 2.
Parameters
| Name |
Type |
Description |
| _token |
address |
The address of ERC1155 NFT in layer 1. |
| _to |
address |
The address of recipient in layer 2. |
| _tokenId |
uint256 |
The token id to deposit. |
| _amount |
uint256 |
The amount of token to deposit. |
| _gasLimit |
uint256 |
Estimated gas limit required to complete the deposit on layer 2. |
depositERC1155
Deposit some ERC1155 NFT to caller's account on layer 2.
Parameters
| Name |
Type |
Description |
| _token |
address |
The address of ERC1155 NFT in layer 1. |
| _tokenId |
uint256 |
The token id to deposit. |
| _amount |
uint256 |
The amount of token to deposit. |
| _gasLimit |
uint256 |
Estimated gas limit required to complete the deposit on layer 2. |
finalizeBatchWithdrawERC1155
Complete ERC1155 batch withdraw from layer 2 to layer 1 and send fund to recipient's account in layer 1. The function should only be called by L1ScrollMessenger. The function should also only be called by L2ERC1155Gateway in layer 2.
Parameters
| Name |
Type |
Description |
| _l1Token |
address |
The address of corresponding layer 1 token. |
| _l2Token |
address |
The address of corresponding layer 2 token. |
| _from |
address |
The address of account who withdraw the token in layer 2. |
| _to |
address |
The address of recipient in layer 1 to receive the token. |
| _tokenIds |
uint256[] |
The list of token ids to withdraw. |
| _amounts |
uint256[] |
The list of corresponding number of token to withdraw. |
finalizeWithdrawERC1155
Complete ERC1155 withdraw from layer 2 to layer 1 and send fund to recipient's account in layer 1. The function should only be called by L1ScrollMessenger. The function should also only be called by L2ERC1155Gateway in layer 2.
Parameters
| Name |
Type |
Description |
| _l1Token |
address |
The address of corresponding layer 1 token. |
| _l2Token |
address |
The address of corresponding layer 2 token. |
| _from |
address |
The address of account who withdraw the token in layer 2. |
| _to |
address |
The address of recipient in layer 1 to receive the token. |
| _tokenId |
uint256 |
The token id to withdraw. |
| _amount |
uint256 |
The amount of token to withdraw. |
initialize
Initialize the storage of L1ERC1155Gateway.
Parameters
| Name |
Type |
Description |
| _counterpart |
address |
The address of L2ERC1155Gateway in L2. |
| _messenger |
address |
The address of L1ScrollMessenger. |
messenger
The address of corresponding L1ScrollMessenger/L2ScrollMessenger contract.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
onERC1155BatchReceived
Parameters
| Name |
Type |
Description |
| _0 |
address |
undefined |
| _1 |
address |
undefined |
| _2 |
uint256[] |
undefined |
| _3 |
uint256[] |
undefined |
| _4 |
bytes |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bytes4 |
undefined |
onERC1155Received
Parameters
| Name |
Type |
Description |
| _0 |
address |
undefined |
| _1 |
address |
undefined |
| _2 |
uint256 |
undefined |
| _3 |
uint256 |
undefined |
| _4 |
bytes |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bytes4 |
undefined |
owner
Returns the address of the current owner.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
renounceOwnership
Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.
router
The address of L1GatewayRouter/L2GatewayRouter contract.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
supportsInterface
See {IERC165-supportsInterface}.
Parameters
| Name |
Type |
Description |
| interfaceId |
bytes4 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
tokenMapping
Mapping from l1 token address to l2 token address for ERC1155 NFT.
Parameters
| Name |
Type |
Description |
| _0 |
address |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
transferOwnership
Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
Parameters
| Name |
Type |
Description |
| newOwner |
address |
undefined |
updateTokenMapping
Update layer 2 to layer 2 token mapping.
Parameters
| Name |
Type |
Description |
| _l1Token |
address |
The address of corresponding ERC1155 token in layer 2. |
| _l2Token |
address |
undefined |
Events
BatchDepositERC1155
Emitted when the ERC1155 NFT is batch deposited to gateway in layer 1.
Parameters
| Name |
Type |
Description |
_l1Token indexed |
address |
undefined |
_l2Token indexed |
address |
undefined |
_from indexed |
address |
undefined |
| _to |
address |
undefined |
| _tokenIds |
uint256[] |
undefined |
| _amounts |
uint256[] |
undefined |
DepositERC1155
Emitted when the ERC1155 NFT is deposited to gateway in layer 1.
Parameters
| Name |
Type |
Description |
_l1Token indexed |
address |
undefined |
_l2Token indexed |
address |
undefined |
_from indexed |
address |
undefined |
| _to |
address |
undefined |
| _tokenId |
uint256 |
undefined |
| _amount |
uint256 |
undefined |
FinalizeBatchWithdrawERC1155
Emitted when the ERC1155 NFT is batch transfered to recipient in layer 1.
Parameters
| Name |
Type |
Description |
_l1Token indexed |
address |
undefined |
_l2Token indexed |
address |
undefined |
_from indexed |
address |
undefined |
| _to |
address |
undefined |
| _tokenIds |
uint256[] |
undefined |
| _amounts |
uint256[] |
undefined |
FinalizeWithdrawERC1155
Emitted when the ERC1155 NFT is transfered to recipient in layer 1.
Parameters
| Name |
Type |
Description |
_l1Token indexed |
address |
undefined |
_l2Token indexed |
address |
undefined |
_from indexed |
address |
undefined |
| _to |
address |
undefined |
| _tokenId |
uint256 |
undefined |
| _amount |
uint256 |
undefined |
OwnershipTransferred
Parameters
| Name |
Type |
Description |
previousOwner indexed |
address |
undefined |
newOwner indexed |
address |
undefined |
UpdateTokenMapping
Emitted when token mapping for ERC1155 token is updated.
Parameters
| Name |
Type |
Description |
| _l1Token |
address |
The address of corresponding ERC1155 token in layer 2. |
| _l2Token |
address |
undefined |