Anchor.sol

Constants

PURE_MESSAGE

bytes32 public constant PURE_MESSAGE = keccak256("PURE_MESSAGE");

VALUE_MESSAGE

bytes32 public constant VALUE_MESSAGE = keccak256("VALUE_MESSAGE");

BOOLNetwork ONLY supports PURE_MESSAGE type cross-chain messages at the current Testnet stage. VALUE_MESSAGE has not been enabled yet and hence submitting this type of message will lead to a transaction revert.

Functions

updateConsumer

function updateConsumer(
    address newConsumer
) external onlyOwner

Updates the consumer contract that is uniquely binding to the anchor. This method can only be called by the current owner.

Params

NameTypeDescription

newConsumer

address

The address of the new consumer to use this Anchor as the cross-chain endpoint

sendToMessenger

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

Calls anchor to forward the cross-chain message to the BOOLNetwork messenger on the source chain. This method can only be called by the consumer contract that is uniquely binding to the anchor.

Parameters:

NameTypeDescription

refundAddress

address

The address to receive the refund 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

address

The address of the destination chain Anchor

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

receiveFromMessenger

function receiveFromMessenger(
    bytes32 txUniqueIdentification,
    bytes32 crossType,
    bytes memory valueFeed,
    bytes32 srcAnchor,
    bytes memory payload
) external payable onlyMessenger

Called by the Messenger contract on the local chain to receive the cross-chain message from the source chain and forward it to the connected consumer contract.

Params

NameTypeDescription

txUniqueIdentification

bytes32

A globally unique identifier for each cross-chain message

crossType

bytes32

Indicate the type of a cross-chain message

valueFeed

bytes

Additional data that depends on the crossType

srcAnchor

bytes32

The address of the source chain Anchor in bytes32

payload

bytes

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

Last updated