Bool Network
  • Introduction
    • What is Bool Network
    • Key features and benefits
    • Roadmap and Milestones
  • INTEROPERABILITY PROTOCOL
    • Overview
    • Architecture
    • Dynamic Hidden Committee (DHC)
      • Security trust flow
      • Lifecycle
      • Messaging Layer
    • Self Custody
      • Channels
      • Workflow
      • Escape Hatch
  • USER GUIDE
    • Beta Testnet
      • Getting Started
      • Network Information
      • Wallet Setup
      • Token Faucet
      • DHC Update
      • Node Server
        • Recommend List
        • Purchase Guide
      • Node Setup
        • DHC Node Setup
          • Local LAN Configuration for SGX
          • Run a chain via snapshot
        • Case Study
      • Node Management
        • For DHC Voter
        • For DHC Owner
  • EVM Ecosystem
    • Getting Started
      • Arbitrary Message Transmission
    • AMT Bridges
      • Network configuration
      • Create committees
      • Build a bridge
      • Bind Consumer to Anchor
      • Other operations
    • Smart Contracts
      • Primary Contracts
        • AnchorFactory
        • Messenger
        • Interfaces
          • IAnchorFactory
          • IMessenger
      • On-chain endpoint: Anchor
        • Anchor.sol
        • IAnchor.sol
      • BoolConsumerBase
        • BoolConsumerBase.sol
        • IBoolConsumerBase.sol
    • User Configurations
    • Application Examples
      • HelloWeb3.sol
    • Technical Reference
      • Chain IDs
      • Deployment Addresses
        • Devnet
        • Testnet
        • Alpha Mainnet
      • Faucet
  • Applications
    • B² Bool Bridge
      • B² Bool Bridge (Particle)
      • B² Bool Bridge (MetaMask)
    • Bool Swap
      • Pool Configuration
      • Deployment Addresses
        • Alpha Mainnet
  • Develop guide
    • Network Configuration
    • System Configuration
    • Testnet
      • Bool Chain
        • Node operators
        • Validators
      • DHC Nodes
        • Prerequisites
        • Quick Start
  • Advanced Tutorials
    • Token Bridge
  • Community and Support
    • Media Kit
    • FAQ
  • Official Links
    • GitHub
    • Twitter
    • Telegram
    • Discord
    • Youtube
    • Medium
Powered by GitBook
On this page
  • Variables
  • Message
  • MessageStatus
  • Events
  • MessageSent
  • MessageReceived
  • MessageCached
  • Functions
  • sendToBool
  • receiveFromBool
  1. EVM Ecosystem
  2. Smart Contracts
  3. Primary Contracts

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

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

Name
Type
Description

status

MessageStatus

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

PreviousAnchorFactoryNextInterfaces

Last updated 2 years ago