Skip to content

Sending a Message

Concero allows you to send messages from one blockchain to another using the conceroSend function. This enables cross-chain communication for a variety of use cases such as cross-chain token transfers, governance actions, or any custom cross-chain interactions.

Function Signature

function conceroSend(
    uint24 dstChainSelector,
    bool shouldFinaliseSrc,
    address feeToken,
    ConceroTypes.EvmDstChainData memory dstChainData,
    bytes calldata message
) external payable returns (bytes32)

Parameters

ParameterTypeDescription
dstChainSelectoruint24Identifier for the destination chain
shouldFinaliseSrcboolFlag for source chain finality (must be false as it's not yet supported)
feeTokenaddressToken used to pay transaction fees (currently only native tokens are supported, so this must be address(0))
dstChainDataConceroTypes.EvmDstChainDataStructure containing destination chain execution parameters
messagebytesThe message payload to be sent to the destination chain

EvmDstChainData Structure

struct EvmDstChainData {
    address receiver;  // The contract to receive the message on the destination chain
    uint256 gasLimit;  // Gas limit for the message execution on the destination chain.
}

Return Value

TypeDescription
bytes32A unique message identifier that can be used to track the message

Usage Example

import {IConceroRouter} from "../interfaces/IConceroRouter.sol";
import {ConceroTypes} from "@concero/contracts/interfaces/ConceroTypes.sol";
import {ConceroClient} from "./ConceroClient.sol";
 
contract MessageSender {
  constructor(address conceroRouter) ConceroClient(conceroRouter) {}
 
  function sendCrossChainMessage(
      uint24 dstChainSelector,
      address receiver,
      uint256 gasLimit,
      bytes memory messageBody
  ) external payable {
 
      // 1. Quote message fee
      uint256 messageFeeNative = IConceroRouter(i_conceroRouter).getMessageFee(
        dstChainSelector,
        false, // Source chain finality not yet supported
        address(0), // Using native token for fees
        dstData
      );
 
      // 2. Prepare destination chain data
      ConceroTypes.EvmDstChainData memory dstData = ConceroTypes.EvmDstChainData({
        receiver: receiver,
        gasLimit: gasLimit
      });
 
      // 3. Send the cross-chain message
      bytes32 messageId = IConceroRouter(i_conceroRouter).conceroSend{value: messageFeeNative}(
        dstChainSelector,
        false, // Source chain finality not yet supported
        address(0), // Using native token for fees
        dstData,
        messageBody
      );
  }
}

Important Notes

  • Source chain finality is not yet supported, so shouldFinaliseSrc must be false
  • Currently only native value is supported for fee payment (ETH, MATIC, etc.)

ConceroMessageSent Event

When a message is sent, a ConceroMessageSent event is emitted with the following parameters:

event ConceroMessageSent(
    bytes32 indexed messageId,
    uint16 version,
    bool shouldFinaliseSrc,
    uint24 dstChainSelector,
    bytes dstChainData,
    address sender,
    bytes message
);