Messenger

Variables

Message

struct Message {
    bytes32 txUniqueIdentification;
    bytes32 crossType;
    bytes32 srcAnchor;
    bytes bnExtraFeed;
    bytes32 dstAnchor;
    bytes payload;
}

A properly defined struct to pack essential cross-chain information.

Params

NameTypeDescription

txUniqueIdentification

bytes32

A globally unique identifier for each cross-chain message

crossType

bytes32

Indicate the type of a cross-chain message

srcAnchor

bytes32

The address of the source chain Anchor in bytes32

bnExtraFeed

bytes

Additional data that depends on the crossType

dstAnchor

bytes32

The address of the destination chain Anchor in bytes32

payload

bytes

Application-level data that will be forwarded to the destination consumer contract

MessageStatus

enum MessageStatus {
    DELIVERED,
    FAILED
}

Returns DELIVERED when the cross-chain message has been successfully delivered to the destination. Otherwise, FAILED is signalled, along with an event MessageCached emitted.

Events

MessageSent

event MessageSent(Message message);

Emits on the source chain with essential cross-chain information packed in a Message struct.

MessageReceived

event MessageReceived(
    bytes32 txUniqueIdentification,
    bytes32 crossType,
    bytes32 srcAnchor,
    bytes32 dstAnchor,
    MessageStatus status
);

Emits on the destination chain where the MessageStatus can be either DELIVERED or FAILED.

MessageCached

event MessageCached(bytes reason, bytes payload)

Emits when the destination transaction reverted for some reason. A bridge builder should define the error logic in their application-level contracts.

It can be combined with the corresponding MessageReceived event to recover the original message and identify the reverting reason.

Functions

sendToBool

function sendToBool(
    address payable refundAddress,
    bytes32 crossType,
    bytes memory valueFeed,
    uint32 dstChainId,
    bytes32 dstAnchor,
    bytes calldata payload
) external payable onlyRegisteredAnchor returns (bytes32 txUniqueIdentification)

Called by registered Anchors to forward cross-chain messages to BOOLNetwork.

Params

NameTypeDescription

refundAddress

address payable

The address to receive the rest of the pre-paid transaction fee

crossType

bytes32

Indicate the type of a cross-chain message

valueFeed

bytes

Additional data that depends on the crossType

dstChainId

uint32

ID of the destination chain

dstAnchor

bytes32

The address of the destination chain Anchor in bytes32

payload

bytes

Application-level data that will be forwarded to the destination consumer contract

Return Values

NameTypeDescription

txUniqueIdentification

bytes32

A globally unique identifier for each cross-chain message

receiveFromBool

function receiveFromBool(
    Message memory message, 
    bytes calldata signature
)external payable returns (MessageStatus status)

Receives cross-chain messages from BOOLNetwork.

Params

NameTypeDescription

message

Message

A Message struct consists of all the essential cross-chain information

signature

bytes

Signature from a committee which is used to verify the validity of a cross-chain message

Return Values

NameTypeDescription

status

MessageStatus

An identifier to present the final status of a cross-chain message

Last updated