Using CrossSync In Smart Contracts

Sending Messages, Tokens, and Data is very easy with CrossSync Protocol.

For Sending Messages/Call Contract on the Destination Chain

interface ICrossSyncGateway {

    struct MessagingPayload{
        address to;
        bytes data;
    }

    function sendMessage(
        uint256 _destinationChainId,
        uint256 _routeId,
        MessagingPayload calldata _payload,
        uint256 gasLimit,
        bytes calldata _routeData
    ) external payable;

}

For Receiving Messages on the Destination Chain

interface ICrossSyncReceiverImplementer {

    function receiveMessage(
        uint256 _sourceChainId,
        address _sourceAddress,
        bytes calldata _payload
    ) external payable ;          
}

To Estimate the Fee on Chain

Fee estimation is only available for Messengers Below

Gas Estimator in Contract

  • Hyperlane

  • Wormhole

  • Chainlink CCIP

To Estimate Fee on chain

    function getFee(
        uint256 _destinationChainId,
        uint256 _routeId,
        MessagingPayload calldata _payload,
        uint256 _gasLimit
    ) external view returns(uint256);

Last updated