Skip to main content

FxBaseChildTunnel

FxBaseChildTunnel#

Mock child tunnel contract to receive and send message from L2

Functions#

constructor(address _fxChild) (internal)
setFxRootTunnel(address _fxRootTunnel) (public)
processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes data) (public)
_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);
_processMessageFromRoot(uint256 stateId, address sender, bytes message) (internal)

Process message received from Root Tunnel

function needs to be implemented to handle message as per requirement This is called by onStateReceive function. Since it is called via a system call, any event will not be emitted during its execution.

Parameters:#

  • stateId: unique state id
  • sender: root message sender
  • message: bytes message that was sent from Root Tunnel

Events#

MessageSent(bytes message)

Modifiers#

validateSender(address sender)