1 reply
0 recast
0 reaction
1 reply
0 recast
0 reaction
1 reply
0 recast
0 reaction
1 reply
0 recast
0 reaction
event MessageSent(uint32 destination, address sender, string message);
event MessageReceived(address sender, string message);
constructor(address _mailbox) {
mailbox = IMailbox(_mailbox);
}
function sendMessage(uint32 destinationDomain, address recipient, string calldata message) external {
mailbox.dispatch(destinationDomain, recipient, bytes(message));
emit MessageSent(destinationDomain, msg.sender, message);
}
function handle(uint32, bytes32 sender, bytes calldata message) external {
require(msg.sender == address(mailbox), "Unauthorized sender");
lastSender = address(uint160(uint256(sender)));
lastMessage = string(message);
emit MessageReceived(lastSender, lastMessage);
}
} 1 reply
0 recast
0 reaction