Skip to main content

FxBaseRootTunnel

FxBaseRootTunnel#

Functions#

constructor(address _checkpointManager, address _fxRoot) (internal)
setFxChildTunnel(address _fxChildTunnel) (public)
_sendMessageToChild(bytes message) (internal)

Send bytes message to Child Tunnel

Parameters:#

  • message: bytes message that will be sent to Child Tunnel some message examples - abi.encode(tokenId); abi.encode(tokenId, tokenMetadata); abi.encode(messageType, messageData);
_validateAndExtractMessage(bytes inputData) → bytes (internal)
receiveMessage(bytes inputData) (public)

receive message from L2 to L1, validated by proof

This function verifies if the transaction actually happened on child chain

Parameters:#

  • inputData: RLP encoded data of the reference tx containing following list of fields 0 - headerNumber - Checkpoint header block number containing the reference tx 1 - blockProof - Proof that the block header (in the child chain) is a leaf in the submitted merkle root 2 - blockNumber - Block number containing the reference tx on child chain 3 - blockTime - Reference tx block time 4 - txRoot - Transactions root of block 5 - receiptRoot - Receipts root of block 6 - receipt - Receipt of the reference transaction 7 - receiptProof - Merkle proof of the reference receipt 8 - branchMask - 32 bits denoting the path of receipt in merkle tree 9 - receiptLogIndex - Log Index to read from the receipt
_processMessageFromChild(bytes message) (internal)

Process message received from Child 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:#

  • message: bytes message that was sent from Child Tunnel