Writing your message sending contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IYaho {
function dispatchMessageToAdapters(
uint256 targetChainId,
uint256 threshold,
address targetAddress,
bytes memory data,
address[] memory reporters,
address[] memory adapters
) external;
}
contract SepoliaSender {
IYaho public yaho = IYaho(0x21eAB033C7D2DF6A67AeF6C5Bda9A7F151eB9f52); // Yaho address on Sepolia
uint256 public threshold;
address[] public reporters;
address[] public adapters;
constructor(address _yaho, uint256 _threshold, address[] memory _reporters, address[] memory _adapters) {
threshold = _threshold;
reporters = _reporters;
adapters = _adapters;
}
// Function to send a cross-chain message to Chiado
function sendMessageToChiado(
uint256 targetChainId,
address targetAddress,
string memory _message
) public {
bytes memory data = abi.encode(_message);
yaho.dispatchMessageToAdapters(targetChainId, threshold, targetAddress, data, reporters, adapters);
}
}Last updated
Was this helpful?