Skip to main content

Arbitrum_ChildMessenger

Arbitrum_ChildMessenger#

Sends and receives cross chain messages between Arbitrum L2 and Ethereum L1 network.

This contract is ownable via the onlyCrossDomainAccount modifier, restricting ownership to the cross-domain parent messenger contract that lives on L1.

Functions#

constructor(address _parentMessenger) (public)

Construct the Arbitrum_ChildMessenger contract.

Parameters:#

  • _parentMessenger: The address of the L1 parent messenger. Acts as the "owner" of this contract.
setOracleSpoke(address newOracleSpoke) (public)

Changes the stored address of the Oracle spoke, deployed on L2.

The caller of this function must be the parent messenger, over the canonical bridge.

Parameters:#

  • newOracleSpoke: address of the new oracle spoke, deployed on L2.
setParentMessenger(address newParentMessenger) (public)

Changes the stored address of the parent messenger, deployed on L1.

The caller of this function must be the parent messenger, over the canonical bridge.

Parameters:#

  • newParentMessenger: address of the new parent messenger, deployed on L1.
sendMessageToParent(bytes data) (public)

Sends a message to the parent messenger via the canonical message bridge.

The caller must be the OracleSpoke on L2. No other contract is permissioned to call this function. The L1 target, the parent messenger, must implement processMessageFromChild to consume the message.

Parameters:#

  • data: data message sent to the L1 messenger. Should be an encoded function call or packed data.
processMessageFromCrossChainParent(bytes data, address target) (public)

Process a received message from the parent messenger via the canonical message bridge.

The caller must be the the parent messenger, sent over the canonical message bridge.

Parameters:#

  • data: data message sent from the L1 messenger. Should be an encoded function call or packed data.
  • target: desired recipient of data. Target must implement the processMessageFromParent function. Having this as a param enables the L1 Messenger to send messages to arbitrary addresses on the L1. This is primarily used to send messages to the OracleSpoke and GovernorSpoke on L2.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (internal)
applyL1ToL2Alias(address l1Address) → address l2Address (internal)
sendCrossDomainMessage(address user, address to, bytes data) → uint256 (internal)

Events#

SetOracleSpoke(address newOracleSpoke)
SetParentMessenger(address newParentMessenger)
MessageSentToParent(bytes data, address parentAddress, address oracleSpoke, uint256 id)
MessageReceivedFromParent(bytes data, address targetSpoke, address parentAddress)
SentCrossDomainMessage(address from, address to, uint256 id, bytes data)

Modifiers#

nonReentrant()

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and making it call a private function that does the actual state modification.

nonReentrantView()

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.

onlyFromCrossDomainAccount(address l1Counterpart)