-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
contracts-bedrock: create IL2ToL2CrossDomainMessenger.sol
- Loading branch information
1 parent
e07ea99
commit 48324ff
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
packages/contracts-bedrock/src/L2/IL2ToL2CrossDomainMessenger.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
/// @title IL2ToL2CrossDomainMessenger | ||
/// @notice Interface for the L2ToL2CrossDomainMessenger contract. | ||
interface IL2ToL2CrossDomainMessenger { | ||
/// @notice Retrieves the sender of the current cross domain message. | ||
/// @return _sender Address of the sender of the current cross domain message. | ||
function crossDomainMessageSender() external view returns (address _sender); | ||
|
||
/// @notice Retrieves the source of the current cross domain message. | ||
/// @return _source Chain ID of the source of the current cross domain message. | ||
function crossDomainMessageSource() external view returns (uint256 _source); | ||
|
||
/// @notice Sends a message to some target address on a destination chain. Note that if the call | ||
/// always reverts, then the message will be unrelayable, and any ETH sent will be | ||
/// permanently locked. The same will occur if the target on the other chain is | ||
/// considered unsafe (see the _isUnsafeTarget() function). | ||
/// @param _destination Chain ID of the destination chain. | ||
/// @param _target Target contract or wallet address. | ||
/// @param _message Message to trigger the target address with. | ||
function sendMessage(uint256 _destination, address _target, bytes calldata _message) external payable; | ||
|
||
/// @notice Relays a message that was sent by the other CrossDomainMessenger contract. Can only | ||
/// be executed via cross-chain call from the other messenger OR if the message was | ||
/// already received once and is currently being replayed. | ||
/// @param _destination Chain ID of the destination chain. | ||
/// @param _nonce Nonce of the message being relayed. | ||
/// @param _sender Address of the user who sent the message. | ||
/// @param _source Chain ID of the source chain. | ||
/// @param _target Address that the message is targeted at. | ||
/// @param _message Message to send to the target. | ||
function relayMessage( | ||
uint256 _destination, | ||
uint256 _source, | ||
uint256 _nonce, | ||
address _sender, | ||
address _target, | ||
bytes calldata _message | ||
) | ||
external | ||
payable; | ||
} |