|
|
@ -59,16 +59,41 @@ contract Mailbox is |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @notice Emitted when a new message is dispatched via Hyperlane |
|
|
|
* @notice Emitted when a new message is dispatched via Hyperlane |
|
|
|
* @param messageId The unique message identifier |
|
|
|
* @param sender The address that dispatched the message |
|
|
|
|
|
|
|
* @param destination The destination domain of the message |
|
|
|
|
|
|
|
* @param recipient The message recipient address on `destination` |
|
|
|
* @param message Raw bytes of message |
|
|
|
* @param message Raw bytes of message |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
event Dispatch(bytes32 indexed messageId, bytes message); |
|
|
|
event Dispatch( |
|
|
|
|
|
|
|
address indexed sender, |
|
|
|
|
|
|
|
uint32 indexed destination, |
|
|
|
|
|
|
|
bytes32 indexed recipient, |
|
|
|
|
|
|
|
bytes message |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @notice Emitted when a Hyperlane message is delivered |
|
|
|
* @notice Emitted when a new message is dispatched via Hyperlane |
|
|
|
* @param messageId The unique message identifier |
|
|
|
* @param messageId The unique message identifier |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
event Process(bytes32 indexed messageId); |
|
|
|
event DispatchId(bytes32 indexed messageId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notice Emitted when a Hyperlane message is processed |
|
|
|
|
|
|
|
* @param messageId The unique message identifier |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
event ProcessId(bytes32 indexed messageId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @notice Emitted when a Hyperlane message is delivered |
|
|
|
|
|
|
|
* @param origin The origin domain of the message |
|
|
|
|
|
|
|
* @param sender The message sender address on `origin` |
|
|
|
|
|
|
|
* @param recipient The address that handled the message |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
event Process( |
|
|
|
|
|
|
|
uint32 indexed origin, |
|
|
|
|
|
|
|
bytes32 indexed sender, |
|
|
|
|
|
|
|
address indexed recipient |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// ============ Constructor ============ |
|
|
|
// ============ Constructor ============ |
|
|
|
|
|
|
|
|
|
|
@ -122,7 +147,13 @@ contract Mailbox is |
|
|
|
// Insert the message ID into the merkle tree. |
|
|
|
// Insert the message ID into the merkle tree. |
|
|
|
bytes32 _id = _message.id(); |
|
|
|
bytes32 _id = _message.id(); |
|
|
|
tree.insert(_id); |
|
|
|
tree.insert(_id); |
|
|
|
emit Dispatch(_id, _message); |
|
|
|
emit Dispatch( |
|
|
|
|
|
|
|
msg.sender, |
|
|
|
|
|
|
|
_destinationDomain, |
|
|
|
|
|
|
|
_recipientAddress, |
|
|
|
|
|
|
|
_message |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
emit DispatchId(_id); |
|
|
|
return _id; |
|
|
|
return _id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -153,13 +184,12 @@ contract Mailbox is |
|
|
|
require(_ism.verify(_metadata, _message), "!module"); |
|
|
|
require(_ism.verify(_metadata, _message), "!module"); |
|
|
|
|
|
|
|
|
|
|
|
// Deliver the message to the recipient. |
|
|
|
// Deliver the message to the recipient. |
|
|
|
uint32 _origin = _message.origin(); |
|
|
|
uint32 origin = _message.origin(); |
|
|
|
IMessageRecipient(_message.recipientAddress()).handle( |
|
|
|
bytes32 sender = _message.sender(); |
|
|
|
_origin, |
|
|
|
address recipient = _message.recipientAddress(); |
|
|
|
_message.sender(), |
|
|
|
IMessageRecipient(recipient).handle(origin, sender, _message.body()); |
|
|
|
_message.body() |
|
|
|
emit Process(origin, sender, recipient); |
|
|
|
); |
|
|
|
emit ProcessId(_id); |
|
|
|
emit Process(_id); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ============ Public Functions ============ |
|
|
|
// ============ Public Functions ============ |
|
|
|