_sendCrossChain Function

An internal function to control the handling of various selectors and data.

What does this Function do?

  • It burns the batch of amounts of respective tokens with mentioned tokenIds from the current chain from the caller’s account.
  • Creates a selector of the “receiveCrossChain” (explained here) function and encodes the respective data to be sent with the “routerSend” function of CrossTalk.
  • Creates a cross-chain communication request using the “routerSend” function.
function _sendCrossChain(
uint8 _destChainID,
address _recipient,
uint256[] memory _ids,
uint256[] memory _amounts,
bytes memory _data,
uint256 _crossChainGasPrice
) internal returns (bool, bytes32) {
_burnBatch(msg.sender, _ids, _amounts);
bytes4 _selector = bytes4(
bytes memory data = abi.encode(_recipient, _ids, _amounts, _data);
(bool success, bytes32 hash) = routerSend(
return (success, hash);

Function Parameters

Chain ID of the destination chain on which the tokens are to be minted.
Address of the recipient of the tokens on the destination chain.
IDs of the tokens which are to be burnt on the current chain and minted on the destination chain to the recipient address.
Amounts of respective tokens with “_ids” to be burnt on the current chain and minted on the destination chain.
Any additional data with which the tokens will be minted.
Gas price to be used while executing the transaction on the destination chain.
If you pass a lower gas price than required, the transaction may get stuck on the bridge and you may need to replay it using the replayTransaction function.