Docs
Reference
Contract documentation
bridge
IRecallableMessageSender

IRecallableMessageSender

An interface that all recallable message senders shall implement.

onMessageRecalled

function onMessageRecalled(struct IBridge.Message message) external payable

IBridge

The bridge used in conjunction with the ISignalService (opens in a new tab).

Ether is held by Bridges on L1 and by the EtherVault on L2, not by token vaults.

Message

struct Message {
  uint256 id;
  address from;
  uint256 srcChainId;
  uint256 destChainId;
  address user;
  address to;
  address refundTo;
  uint256 value;
  uint256 fee;
  uint256 gasLimit;
  bytes data;
  string memo;
}

Context

struct Context {
  bytes32 msgHash;
  address from;
  uint256 srcChainId;
}

SignalSent

event SignalSent(address sender, bytes32 msgHash)

MessageSent

event MessageSent(bytes32 msgHash, struct IBridge.Message message)

MessageRecalled

event MessageRecalled(bytes32 msgHash)

sendMessage

function sendMessage(struct IBridge.Message message) external payable returns (bytes32 msgHash)

Sends a message to the destination chain and takes custody of Ether required in this contract. All extra Ether will be refunded.

Parameters

NameTypeDescription
messagestruct IBridge.MessageThe message to be sent.

Return Values

NameTypeDescription
msgHashbytes32The hash of the sent message.

processMessage

function processMessage(struct IBridge.Message message, bytes proof) external

Processes a message received from another chain.

Parameters

NameTypeDescription
messagestruct IBridge.MessageThe message to process.
proofbytesThe proof of the cross-chain transfer.

retryMessage

function retryMessage(struct IBridge.Message message, bool isLastAttempt) external

Retries executing a message that previously failed on its destination chain.

Parameters

NameTypeDescription
messagestruct IBridge.MessageThe message to retry.
isLastAttemptboolSpecifies whether this is the last attempt to send the message.

recallMessage

function recallMessage(struct IBridge.Message message, bytes proof) external

Recalls a failed message on its source chain.

Parameters

NameTypeDescription
messagestruct IBridge.MessageThe message to be recalled.
proofbytesThe proof of message processing failure.

isMessageSent

function isMessageSent(bytes32 msgHash) external view returns (bool)

Checks if the message with the given hash has been sent on its source chain.

Parameters

NameTypeDescription
msgHashbytes32The hash of the message.

Return Values

NameTypeDescription
[0]boolReturns true if the message has been sent, false otherwise.

isMessageReceived

function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) external view returns (bool)

Checks if the message with the given hash has been received on its destination chain.

Parameters

NameTypeDescription
msgHashbytes32The hash of the message.
srcChainIduint256The source chain ID.
proofbytesThe proof of message receipt.

Return Values

NameTypeDescription
[0]boolReturns true if the message has been received, false otherwise.

isMessageFailed

function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) external view returns (bool)

Checks if a msgHash has failed on its destination chain.

Parameters

NameTypeDescription
msgHashbytes32The hash of the message.
destChainIduint256The destination chain ID.
proofbytesThe proof of message failure.

Return Values

NameTypeDescription
[0]boolReturns true if the message has failed, false otherwise.

isMessageRecalled

function isMessageRecalled(bytes32 msgHash) external view returns (bool)

Checks if a failed message has been recalled on its source chain.

Parameters

NameTypeDescription
msgHashbytes32The hash of the message.

Return Values

NameTypeDescription
[0]boolReturns true if the Ether has been released, false otherwise.

context

function context() external view returns (struct IBridge.Context context)

Returns the bridge state context.

Return Values

NameTypeDescription
contextstruct IBridge.ContextThe context of the current bridge operation.

hashMessage

function hashMessage(struct IBridge.Message message) external pure returns (bytes32)

Computes the hash of a given message.

Parameters

NameTypeDescription
messagestruct IBridge.MessageThe message to compute the hash for.

Return Values

NameTypeDescription
[0]bytes32Returns the hash of the message.