Skip to content

Commit

Permalink
contracts-bedrock: create IL2ToL2CrossDomainMessenger.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
0xfuturistic committed Apr 1, 2024
1 parent e07ea99 commit 48324ff
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions packages/contracts-bedrock/src/L2/IL2ToL2CrossDomainMessenger.sol
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;
}

0 comments on commit 48324ff

Please sign in to comment.