description |
---|
A description of the Outbox contract |
The Outbox contract provides an interface for applications building on Abacus to send messages to remote chains.
There is an instance of the Outbox contract on each Abacus-supported chain.
To send a message to a remote chain, applications simply call Outbox.dispatch()
specifying the message contents and destination.
Each dispatched message get inserted as a leaf into an incremental merkle tree. This data structure allows leaves to be inserted while minimizing the number of storage writes.
/**
* @notice Dispatch the message it to the destination domain & recipient
* @param _destinationDomain Domain of destination chain
* @param _recipientAddress Address of recipient on destination chain as bytes32
* @param _messageBody Raw bytes content of message
*/
function dispatch(
uint32 _destinationDomain,
bytes32 _recipientAddress,
bytes calldata _messageBody
) external;
For a message to reach its destination, it must first be included in a checkpoint. Anyone can create a new checkpoint by calling Outbox.checkpoint()
, which computes the current merkle root and writes it to storage.
Checkpoints are signed by the validator set and relayed to Inboxes, after which messages can be proved against the merkle root and forwarded to their recipient.
/**
* @notice Checkpoints the latest root and index.
* Validators are expected to sign this checkpoint so that it can be
* relayed to the Inbox contracts.
* @dev emits Checkpoint event
*/
function checkpoint() external;