Skip to main content

Polygon_ChildMessengerMock

Polygon_ChildMessengerMock#

Functions#

constructor(address _fxChild, address _finder) (public)
processMessageFromRoot(address sender, bytes data) (external)
sendMessageToParent(bytes data) (public)

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

The caller must be the OracleSpoke on child network. 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.
_processMessageFromRoot(uint256, address sender, bytes data) (internal)

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

The data will be received automatically from the state receiver when the state is synced between Ethereum and Polygon. This will revert if the Root chain sender is not the fxRootTunnel contract. This call will revert if setFxRoot has not been called and the sender is not set to the FxRoot contract address. FxRoot should be set to Polygon_ParentMessenger.

Parameters:#

  • sender: The sender of data from the Root chain.
  • data: ABI encoded params with which to call function on OracleHub or GovernorHub.
getOracleSpoke() → address (public)
getOracleHub() → address (public)
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
setFxRootTunnel(address _fxRootTunnel) (external)
processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes data) (external)
_sendMessageToRoot(bytes message) (internal)

Emit message that can be received on Root Tunnel

Call the internal function when need to emit message

Parameters:#

  • message: bytes message that will be sent to Root Tunnel some message examples - abi.encode(tokenId); abi.encode(tokenId, tokenMetadata); abi.encode(messageType, messageData);

Events#

MessageSentToParent(bytes data, address targetHub, address oracleSpoke)
MessageReceivedFromParent(address targetSpoke, bytes dataToSendToTarget)
MessageSent(bytes message)

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.

validateSender(address sender)