|
| 1 | +// SPDX-License-Identifier: BUSL-1.1 |
| 2 | +pragma solidity ^0.8.27; |
| 3 | + |
| 4 | +import "src/contracts/libraries/OperatorSetLib.sol"; |
| 5 | + |
| 6 | +interface IOperatorTableCalculator { |
| 7 | +// TODO: implement, stub for now |
| 8 | +} |
| 9 | + |
| 10 | +interface ICrossChainRegistryErrors { |
| 11 | + /// @notice Thrown when the chainId is invalid |
| 12 | + error InvalidChainId(); |
| 13 | +} |
| 14 | + |
| 15 | +interface ICrossChainRegistryTypes { |
| 16 | + /** |
| 17 | + * @notice A per-operatorSet configuration struct that is transported from the CrossChainRegistry on L1. |
| 18 | + * @param owner the permissioned owner of the OperatorSet on L2 that can call the CertificateVerifier specific setters |
| 19 | + * @param maxStalenessPeriod the maximum staleness period of the operatorSet |
| 20 | + */ |
| 21 | + struct OperatorSetConfig { |
| 22 | + address owner; |
| 23 | + uint32 maxStalenessPeriod; |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +interface ICrossChainRegistryEvents { |
| 28 | + /// @notice Emitted when a generation reservation is made |
| 29 | + event GenerationReservationMade(OperatorSet operatorSet, IOperatorTableCalculator operatorTableCalculator); |
| 30 | + |
| 31 | + /// @notice Emitted when a generation reservation is removed |
| 32 | + event GenerationReservationRemoved(OperatorSet operatorSet, IOperatorTableCalculator operatorTableCalculator); |
| 33 | + |
| 34 | + /// @notice Emitted when a transport destination is added |
| 35 | + event TransportDestinationAdded(OperatorSet operatorSet, uint32 chainID); |
| 36 | + |
| 37 | + /// @notice Emitted when a transport destination is removed |
| 38 | + event TransportDestinationRemoved(OperatorSet operatorSet, uint32 chainID); |
| 39 | + |
| 40 | + /// @notice Emitted when a chainID is added to the whitelist |
| 41 | + event ChainIDAddedToWhitelist(uint32 chainID); |
| 42 | + |
| 43 | + /// @notice Emitted when a chainID is removed from the whitelist |
| 44 | + event ChainIDRemovedFromWhitelist(uint32 chainID); |
| 45 | +} |
| 46 | + |
| 47 | +interface ICrossChainRegistry is ICrossChainRegistryErrors, ICrossChainRegistryTypes, ICrossChainRegistryEvents { |
| 48 | + /** |
| 49 | + * @notice Initiates a generation reservation |
| 50 | + * @param operatorSet the operatorSet to make a reservation for |
| 51 | + * @param operatorTableCalculator the address of the operatorTableCalculator |
| 52 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 53 | + */ |
| 54 | + function requestGenerationReservation(OperatorSet calldata operatorSet, address operatorTableCalculator) external; |
| 55 | + |
| 56 | + /** |
| 57 | + * @notice Removes a generation reservation for a given operatorSet |
| 58 | + * @param operatorSet the operatorSet to remove |
| 59 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 60 | + */ |
| 61 | + function removeGenerationReservation( |
| 62 | + OperatorSet calldata operatorSet |
| 63 | + ) external; |
| 64 | + |
| 65 | + /** |
| 66 | + * @notice Adds a destination chain to transport to |
| 67 | + * @param chainID to add transport to |
| 68 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 69 | + */ |
| 70 | + function addTransportDestination(OperatorSet calldata operatorSet, uint32 chainID) external; |
| 71 | + |
| 72 | + /** |
| 73 | + * @notice Removes a destination chain to transport to |
| 74 | + * @param chainID to remove transport to |
| 75 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 76 | + */ |
| 77 | + function removeTransportDestination(OperatorSet calldata operatorSet, uint32 chainID) external; |
| 78 | + |
| 79 | + /** |
| 80 | + * @notice Sets the operatorTableCalculator for the operatorSet |
| 81 | + * @param operatorSet the operatorSet whose operatorTableCalculator is desired to be set |
| 82 | + * @param calculator the contract to call to calculate the operator table |
| 83 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 84 | + * @dev operatorSet must have an active reservation |
| 85 | + */ |
| 86 | + function setOperatorTableCalculator( |
| 87 | + OperatorSet calldata operatorSet, |
| 88 | + IOperatorTableCalculator calculator |
| 89 | + ) external; |
| 90 | + |
| 91 | + /** |
| 92 | + * @notice Adds a chainID to the whitelist of chainIDs that can be transported to |
| 93 | + * @param chainID the chainID to add to the whitelist |
| 94 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 95 | + */ |
| 96 | + function addChainIDToWhitelist( |
| 97 | + uint32 chainID |
| 98 | + ) external; |
| 99 | + |
| 100 | + /** |
| 101 | + * @notice Removes a chainID from the whitelist of chainIDs that can be transported to |
| 102 | + * @param chainID the chainID to remove from the whitelist |
| 103 | + * @dev msg.sender must be UAM permissioned for operatorSet.avs |
| 104 | + */ |
| 105 | + function removeChainIDFromWhitelist( |
| 106 | + uint32 chainID |
| 107 | + ) external; |
| 108 | + |
| 109 | + /** |
| 110 | + * @notice Gets the operatorTableCalculator for a given operatorSet |
| 111 | + * @param operatorSet the operatorSet to get the operatorTableCalculator for |
| 112 | + * @return The operatorTableCalculator for the given operatorSet |
| 113 | + */ |
| 114 | + function getOperatorTableCalculator( |
| 115 | + OperatorSet calldata operatorSet |
| 116 | + ) external returns (IOperatorTableCalculator); |
| 117 | + |
| 118 | + /** |
| 119 | + * @notice Gets the active generation reservations |
| 120 | + * @return An array of operatorSets with active generationReservations |
| 121 | + * @return An array of the corresponding operatorTableCalculators |
| 122 | + */ |
| 123 | + function getActiveGenerationReservations() |
| 124 | + external |
| 125 | + returns (OperatorSet[] memory, IOperatorTableCalculator[] memory); |
| 126 | +} |
0 commit comments