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
  • Constants
  • PURE_MESSAGE
  • VALUE_MESSAGE
  • Functions
  • updateConsumer
  • sendToMessenger
  • receiveFromMessenger
  1. EVM Ecosystem
  2. Smart Contracts
  3. On-chain endpoint: Anchor

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

Name
Type
Description

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:

Name
Type
Description

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:

Name
Type
Description

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

Name
Type
Description

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

PreviousOn-chain endpoint: AnchorNextIAnchor.sol

Last updated 2 years ago