Admin Functions
Access Control
The Message Controller contract uses OpenZeppelin’s AccessControl module. To grant, revoke, or check roles for an address, use the standard functions available in the AccessControl contract.
The following roles are available:
| Role | keccak256 hash | Description |
|---|---|---|
| DEFAULT_ADMIN_ROLE | 0x0000000000000000000000000000000000000000000000000000000000000000 | Full access to all admin functions |
| MESSAGE_ORIGINATOR_ROLE | 0x343f885b34563a3091a1ab8d7f8c30d813397ffdf0870abda8bd119df0cc679c | Can call sendMessage() |
| MESSAGE_RESENDER_ROLE | 0x7992c340206b4656f211126bf5358a5ace076bc513ca5e5dac42e3ae8628bb42 | Can call resendMessage() |
| PAUSE_ROLE | 0x139c2898040ef16910dc9f44dc697df79363da767d8bc92f2e310312b816e46d | Can pause message sending, resending and execution functions |
Admin functions
The following functions can only be called by accounts with the DEFAULT_ADMIN_ROLE:
setLocalAdapter
Sets the local bridge adapters that can relay messages to the Controller contract.
INFO
Note: If a Registry is configured, the local adapters set here will be ignored.
function setLocalAdapter(address[] memory adapters, bool[] memory enabled) public;| Name | Type | Description |
|---|---|---|
adapters | address[] | An array of adapter addresses to enable/disable |
enabled | bool[] | An array of boolean values to enable or disable the corresponding adapters in adapters. Both arrays must have the same length |
setLocalRegistry
Sets the address of the local Registry contract.
INFO
This setting overrides any local adapter configuration.
function setLocalRegistry(address _localRegistry) public;| Name | Type | Description |
|---|---|---|
localRegistry | address | The address of the new local registry to set |
setMessageOriginators
Defines the addresses allowed to send messages to other chains. Granting or revoking the MESSAGE_ORIGINATOR_ROLE via this function will also grant or revoke the MESSAGE_RESENDER_ROLE.
INFO
If you want to manage these roles independently, use grantRole(...) and revokeRole(...) directly.
function setMessageOriginators(address[] memory originators, bool[] memory enabled) public
Input Params:
| Name | Type | Description |
|---|---|---|
originators | address[] | An array of message originator addresses to enable/disable |
enabled | bool[] | An array of boolean values to enable or disable the corresponding originators. Both arrays must have the same length |
setControllerForChain
Sets the controller contract addresses for the specified chain IDs. To disable a controller for a specific chain, pass address(0) .
function setMessageOriginators(address[] memory originators, bool[] memory enabled) publicInput params:
| Name | Type | Description |
|---|---|---|
chainId | uint256[] | An array of chain id to set controllers for |
controller | address[] | An array of controller addresses to set for the corresponding chainIds. Both arrays must have the same length. |
setVetoer
Sets the address of the Vetoer — an account that can cancel the execution of a message. Set to address(0) to disable veto functionality.
function setVetoer(address _vetoer) public;Input params
| Name | Type | Description |
|---|---|---|
_vetoer | address | The address of the vetoer |
setTimelockDelay
Sets the timelock delay (in seconds) before a message can be executed. Set to 0 to disable the timelock feature entirely
function setTimelockDelay(uint256 _timelockDelay) public;
Input params:
| Name | Type | Description |
|---|---|---|
_timelockDelay | uint256 | The timelock delay in seconds |
Pause functions
The following functions can only be called by accounts with the PAUSE_ROLE:
pause
Pauses the contract. This disables the following functions:execute(), sendMessage()and resendMessage() .
function pause() public;unpause
Unpauses the contract, re-enabling the functions listed above.
function unpause() public;
