Skip to main content



Sends cross chain messages from Polygon to Ethereum network.

This contract extends the FxBaseChildTunnel contract and therefore is 1-to-1 mapped with the FxBaseRootTunnel extended by the Polygon_ParentMessenger contract deployed on Polygon. This mapping ensures that the internal _processMessageFromRoot function is only callable indirectly by the Polygon_ParentMessenger.


constructor(address _fxChild, address _finder) (public)

Construct the Polygon_ChildMessenger contract.


  • _finder: Used to locate contracts for this network.
  • _fxChild: Polygon system contract deployed on Mainnet, required to construct new FxBaseRootTunnel that can send messages via native Polygon data tunnel.
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.


  • 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.


  • 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)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (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


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


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



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.


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

validateSender(address sender)