|
1 | 1 | // SPDX-License-Identifier: Apache 2
|
2 | 2 | pragma solidity >=0.8.8 <0.9.0;
|
3 | 3 |
|
4 |
| -/// @dev This contract is responsible for handling the registration of Transceivers. |
| 4 | +/// @notice This contract is responsible for handling the registration of Transceivers. |
| 5 | +/// edev This contract a few critical invariants hold when transceivers are added or removed, |
| 6 | +/// including: |
| 7 | +/// 1. if a transceiver is not registered, it should be enabled. |
| 8 | +/// 2. The value set in the bitmap of trannsceivers |
| 9 | +/// should directly correspond to the whether the transceiver is enabled |
5 | 10 | abstract contract TransceiverRegistry {
|
6 | 11 | constructor() {
|
7 | 12 | _checkTransceiversInvariants();
|
@@ -33,11 +38,33 @@ abstract contract TransceiverRegistry {
|
33 | 38 |
|
34 | 39 | uint8 constant MAX_TRANSCEIVERS = 64;
|
35 | 40 |
|
| 41 | + /// @notice Error when the caller is not the transceiver. |
| 42 | + /// @dev Selector 0xa0ae911d. |
| 43 | + /// @param caller The address of the caller. |
36 | 44 | error CallerNotTransceiver(address caller);
|
| 45 | + |
| 46 | + /// @notice Error when the transceiver is the zero address. |
| 47 | + /// @dev Selector 0x2f44bd77. |
37 | 48 | error InvalidTransceiverZeroAddress();
|
| 49 | + |
| 50 | + /// @notice Error when the transceiver is disabled. |
| 51 | + /// @dev Selector 0x1f61ba44. |
38 | 52 | error DisabledTransceiver(address transceiver);
|
| 53 | + |
| 54 | + /// @notice Error when the number of registered transceivers |
| 55 | + /// exceeeds (MAX_TRANSCEIVERS = 64). |
| 56 | + /// @dev Selector 0x891684c3. |
39 | 57 | error TooManyTransceivers();
|
| 58 | + |
| 59 | + /// @notice Error when attempting to remove a transceiver |
| 60 | + /// that is not registered. |
| 61 | + /// @dev Selector 0xd583f470. |
| 62 | + /// @param transceiver The address of the transceiver. |
40 | 63 | error NonRegisteredTransceiver(address transceiver);
|
| 64 | + |
| 65 | + /// @notice Error when attempting to enable a transceiver that is already enabled. |
| 66 | + /// @dev Selector 0x8d68f84d. |
| 67 | + /// @param transceiver The address of the transceiver. |
41 | 68 | error TransceiverAlreadyEnabled(address transceiver);
|
42 | 69 |
|
43 | 70 | modifier onlyTransceiver() {
|
|
0 commit comments