L2ScrollMessenger
L2ScrollMessenger
The L2ScrollMessenger contract can: 1. send messages from layer 2 to layer 1; 2. relay messages from layer 1 layer 2; 3. drop expired message due to sequencer problems.
It should be a predeployed contract in layer 2 and should hold infinite amount of Ether (Specifically, uint256(-1)), which can be initialized in Genesis Block.
Methods
blockContainer
The contract contains the list of L1 blocks.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
counterpart
The address of counterpart ScrollMessenger contract in L1/L2.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
feeVault
The address of fee vault, collecting cross domain messaging fee.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
gasOracle
The address of L2MessageQueue.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
initialize
Parameters
| Name |
Type |
Description |
| _counterpart |
address |
undefined |
| _feeVault |
address |
undefined |
isL1MessageExecuted
Mapping from L1 message hash to a boolean value indicating if the message has been successfully executed.
Parameters
| Name |
Type |
Description |
| _0 |
bytes32 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
isL2MessageSent
Mapping from L2 message hash to sent status.
Parameters
| Name |
Type |
Description |
| _0 |
bytes32 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
l1MessageFailedTimes
Mapping from L1 message hash to the number of failure times.
Parameters
| Name |
Type |
Description |
| _0 |
bytes32 |
undefined |
Returns
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
maxFailedExecutionTimes
The maximum number of times each L1 message can fail on L2.
Returns
| Name |
Type |
Description |
| _0 |
uint256 |
undefined |
messageQueue
The address of L2MessageQueue.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
owner
Returns the address of the current owner.
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
paused
Returns true if the contract is paused, and false otherwise.
Returns
| Name |
Type |
Description |
| _0 |
bool |
undefined |
relayMessage
execute L1 => L2 message
Make sure this is only called by privileged accounts.
Parameters
| Name |
Type |
Description |
| _from |
address |
undefined |
| _to |
address |
undefined |
| _value |
uint256 |
undefined |
| _nonce |
uint256 |
undefined |
| _message |
bytes |
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.
retryMessageWithProof
Parameters
| Name |
Type |
Description |
| _from |
address |
undefined |
| _to |
address |
undefined |
| _value |
uint256 |
undefined |
| _nonce |
uint256 |
undefined |
| _message |
bytes |
undefined |
| _proof |
IL2ScrollMessenger.L1MessageProof |
undefined |
sendMessage
Send cross chain message from L1 to L2 or L2 to L1.
Parameters
| Name |
Type |
Description |
| _to |
address |
undefined |
| _value |
uint256 |
undefined |
| _message |
bytes |
undefined |
| _gasLimit |
uint256 |
undefined |
| _4 |
address |
undefined |
sendMessage
Send cross chain message from L1 to L2 or L2 to L1.
Parameters
| Name |
Type |
Description |
| _to |
address |
undefined |
| _value |
uint256 |
undefined |
| _message |
bytes |
undefined |
| _gasLimit |
uint256 |
undefined |
setPause
Pause the contract
This function can only called by contract owner.
Parameters
| Name |
Type |
Description |
| _status |
bool |
The pause status to update. |
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 |
updateFeeVault
Update fee vault contract.
This function can only called by contract owner.
Parameters
| Name |
Type |
Description |
| _newFeeVault |
address |
The address of new fee vault contract. |
updateMaxFailedExecutionTimes
Update max failed execution times.
This function can only called by contract owner.
Parameters
| Name |
Type |
Description |
| _maxFailedExecutionTimes |
uint256 |
The new max failed execution times. |
verifyMessageExecutionStatus
Check whether the message is executed in the corresponding L1 block.
Parameters
| Name |
Type |
Description |
| _blockHash |
bytes32 |
The block hash where the message should in. |
| _msgHash |
bytes32 |
The hash of the message to check. |
| _proof |
bytes |
The encoded storage proof from eth_getProof. |
Returns
| Name |
Type |
Description |
| _0 |
bool |
bool Return true is the message is executed in L1, otherwise return false. |
verifyMessageInclusionStatus
Check whether the l1 message is included in the corresponding L1 block.
Parameters
| Name |
Type |
Description |
| _blockHash |
bytes32 |
The block hash where the message should in. |
| _msgHash |
bytes32 |
The hash of the message to check. |
| _proof |
bytes |
The encoded storage proof from eth_getProof. |
Returns
| Name |
Type |
Description |
| _0 |
bool |
bool Return true is the message is included in L1, otherwise return false. |
xDomainMessageSender
See {IScrollMessenger-xDomainMessageSender}
Returns
| Name |
Type |
Description |
| _0 |
address |
undefined |
Events
FailedRelayedMessage
Emitted when a cross domain message is failed to relay.
Parameters
| Name |
Type |
Description |
messageHash indexed |
bytes32 |
undefined |
OwnershipTransferred
Parameters
| Name |
Type |
Description |
previousOwner indexed |
address |
undefined |
newOwner indexed |
address |
undefined |
Paused
Parameters
| Name |
Type |
Description |
| account |
address |
undefined |
RelayedMessage
Emitted when a cross domain message is relayed successfully.
Parameters
| Name |
Type |
Description |
messageHash indexed |
bytes32 |
undefined |
SentMessage
Emitted when a cross domain message is sent.
Parameters
| Name |
Type |
Description |
sender indexed |
address |
undefined |
target indexed |
address |
undefined |
| value |
uint256 |
undefined |
| messageNonce |
uint256 |
undefined |
| gasLimit |
uint256 |
undefined |
| message |
bytes |
undefined |
Unpaused
Parameters
| Name |
Type |
Description |
| account |
address |
undefined |
UpdateFeeVault
Emitted when owner updates fee vault contract.
Parameters
| Name |
Type |
Description |
| _oldFeeVault |
address |
undefined |
| _newFeeVault |
address |
undefined |
UpdateMaxFailedExecutionTimes
Emitted when the maximum number of times each message can fail in L2 is updated.
Parameters
| Name |
Type |
Description |
| maxFailedExecutionTimes |
uint256 |
The new maximum number of times each message can fail in L2. |