Multi-bridge Message Receiver

src/MultiBridgeMessageReceiver.sol

Features

  • Receive messages from a predefined source chain, through an approved set of bridge receiver adapters.

  • Enable scheduling a message for execution if a quorum of bridges relays the message

  • Update the list of trusted bridge receiver adapters

  • Update the quorum threshold for message validity

Functions

receiveMessage

function receiveMessage(MessageLibrary.Message calldata _message) external override onlyReceiverAdapter

Enables the contract to receive messages from a source chain, through a list of allowed bridge receiver adapters. A message can be delivered by a given bridge only once.

_message: A MessageLibrary.Message an object containing the message details.

scheduleMessageExecution

function scheduleMessageExecution(bytes32 _msgId, MessageLibrary.MessageExecutionParams calldata _execParams) external;

Sends a message, that has achieved a quorum and has not yet expired, to the governance timelock for eventual execution.

  • _msgId: The unique identifier of the message

  • _execParams: The parameters for message execution, including the target contract address and execution payload

updateReceiverAdapter

function updateReceiverAdapters(address[] calldata _receiverAdapters, bool[] calldata _operations) external override onlyOwner

Updates the list of approved bridge receiver adapters. This function can only be called by the owner

  • _receiverAdapters: An array of addresses of the receiver adapter contracts

  • _operations: An array of operations for each receiver adapter. True implies add, and False implies remove.

updateQuorum

function updateQuorum(uint64 _newQuorum) external onlyOwner

Updates the quorum, which is the number of independent bridges that must deliver a message for it to be considered valid. This function can only be called by the owner

  • _newQuorum: The new quorum threshold for message validation

updateQuorumAndReceiverAdapter

    function updateReceiverAdaptersAndQuorum(
        address[] calldata _receiverAdapters,
        bool[] calldata _operations,
        uint64 _newQuorum,
    ) external override onlyOwner

Atomically updates the list of approved bridge receiver adapters and the quorum for message validation. This function can only be called by the owner

  • _receiverAdapters: An array of addresses of the receiver adapter contracts

  • _operations: An array of operations for each receiver adapter. True implies add, and False implies remove.

  • _newQuorum: The new quorum threshold for message validation

updateGovernanceTimelock

function updateGovernanceTimelock(address _newGovernanceTimelock) external;

Updates the governance timelock address, which is the contract that ultimately executes valid messages.

  • _newGovernanceTimelock is the new governance timelock contract address

Events

  • BridgeMessageReceived: Emitted when a message is received from a bridge receiver adapter

  • MessageExecutionScheduled: Emitted when a message is scheduled for execution on the time lock contract on the destination chain

  • BridgeReceiverAdapterUpdated: Emitted when a receiver adapter is updated

  • QuorumUpdated: Emitted when the quorum threshold is updated

Dependencies

  • IMultiBridgeMessageReceiver: Interface for the MultiBridgeMessageReceiver contract

  • IMessageReceiverAdapter: Common interface for AMB receiver adapters that builds on EIP-5164 MessageExecutor. Read more here.

  • ExecutorAware: EIP-5164 interface for trusted executor-aware contracts. Read more here.

  • MessageLibrary: Contains the message struct definition

Last updated