11// SPDX-License-Identifier: BUSL-1.1
2- pragma solidity >= 0.5.0 ;
2+ pragma solidity ^ 0.8.27 ;
33
44import {OperatorSet} from "../libraries/OperatorSetLib.sol " ;
55import "./IOperatorTableCalculator.sol " ;
66
77interface ICrossChainRegistryErrors {
88 /// @notice Thrown when the chainId is invalid
99 error InvalidChainId ();
10+
11+ /// @notice Thrown when a generation reservation already exists for the operator set
12+ error GenerationReservationAlreadyExists ();
13+
14+ /// @notice Thrown when a generation reservation does not exist for the operator set
15+ error GenerationReservationDoesNotExist ();
16+
17+ /// @notice Thrown when the operator table calculator address is invalid
18+ error InvalidOperatorTableCalculator ();
19+
20+ /// @notice Thrown when a transport destination is already added for the operator set
21+ error TransportDestinationAlreadyAdded ();
22+
23+ /// @notice Thrown when a transport destination is not found for the operator set
24+ error TransportDestinationNotFound ();
25+
26+ /// @notice Thrown when a chain ID is already whitelisted
27+ error ChainIDAlreadyWhitelisted ();
28+
29+ /// @notice Thrown when a chain ID is not whitelisted
30+ error ChainIDNotWhitelisted ();
31+
32+ /// @notice Thrown when the staleness period is zero
33+ error StalenessPeriodZero ();
34+
35+ /// @notice Thrown when the operator set is not valid
36+ error InvalidOperatorSet ();
37+
38+ /// @notice Thrown when the chainIDs array is empty
39+ error EmptyChainIDsArray ();
40+
41+ /// @notice Thrown when a at least one transport destination is required
42+ error RequireAtLeastOneTransportDestination ();
43+
44+ /// @notice Thrown when the storage is not cleared
45+ error NeedToDelete ();
1046}
1147
1248interface ICrossChainRegistryTypes {
@@ -21,34 +57,47 @@ interface ICrossChainRegistryTypes {
2157 }
2258}
2359
24- interface ICrossChainRegistryEvents {
25- /// @notice Emitted when a generation reservation is made
26- event GenerationReservationMade (OperatorSet operatorSet , IOperatorTableCalculator operatorTableCalculator );
60+ interface ICrossChainRegistryEvents is ICrossChainRegistryTypes {
61+ /// @notice Emitted when a generation reservation is created
62+ event GenerationReservationCreated (OperatorSet operatorSet );
2763
2864 /// @notice Emitted when a generation reservation is removed
29- event GenerationReservationRemoved (OperatorSet operatorSet , IOperatorTableCalculator operatorTableCalculator );
65+ event GenerationReservationRemoved (OperatorSet operatorSet );
66+
67+ /// @notice Emitted when an operatorTableCalculator is set
68+ event OperatorTableCalculatorSet (OperatorSet operatorSet , IOperatorTableCalculator operatorTableCalculator );
69+
70+ /// @notice Emitted when an operatorSetConfig is set
71+ event OperatorSetConfigSet (OperatorSet operatorSet , OperatorSetConfig config );
3072
3173 /// @notice Emitted when a transport destination is added
32- event TransportDestinationAdded (OperatorSet operatorSet , uint32 chainID );
74+ event TransportDestinationAdded (OperatorSet operatorSet , uint256 chainID );
3375
3476 /// @notice Emitted when a transport destination is removed
35- event TransportDestinationRemoved (OperatorSet operatorSet , uint32 chainID );
77+ event TransportDestinationRemoved (OperatorSet operatorSet , uint256 chainID );
3678
3779 /// @notice Emitted when a chainID is added to the whitelist
38- event ChainIDAddedToWhitelist (uint32 chainID );
80+ event ChainIDAddedToWhitelist (uint256 chainID );
3981
4082 /// @notice Emitted when a chainID is removed from the whitelist
41- event ChainIDRemovedFromWhitelist (uint32 chainID );
83+ event ChainIDRemovedFromWhitelist (uint256 chainID );
4284}
4385
44- interface ICrossChainRegistry is ICrossChainRegistryErrors , ICrossChainRegistryTypes , ICrossChainRegistryEvents {
86+ interface ICrossChainRegistry is ICrossChainRegistryErrors , ICrossChainRegistryEvents {
4587 /**
46- * @notice Initiates a generation reservation
88+ * @notice Creates a generation reservation
4789 * @param operatorSet the operatorSet to make a reservation for
4890 * @param operatorTableCalculator the address of the operatorTableCalculator
91+ * @param config the config to set for the operatorSet
92+ * @param chainIDs the chainIDs to add as transport destinations
4993 * @dev msg.sender must be UAM permissioned for operatorSet.avs
5094 */
51- function requestGenerationReservation (OperatorSet calldata operatorSet , address operatorTableCalculator ) external ;
95+ function createGenerationReservation (
96+ OperatorSet calldata operatorSet ,
97+ IOperatorTableCalculator operatorTableCalculator ,
98+ OperatorSetConfig calldata config ,
99+ uint256 [] calldata chainIDs
100+ ) external ;
52101
53102 /**
54103 * @notice Removes a generation reservation for a given operatorSet
@@ -60,80 +109,125 @@ interface ICrossChainRegistry is ICrossChainRegistryErrors, ICrossChainRegistryT
60109 ) external ;
61110
62111 /**
63- * @notice Adds a destination chain to transport to
64- * @param chainID to add transport to
112+ * @notice Sets the operatorTableCalculator for the operatorSet
113+ * @param operatorSet the operatorSet whose operatorTableCalculator is desired to be set
114+ * @param operatorTableCalculator the contract to call to calculate the operator table
65115 * @dev msg.sender must be UAM permissioned for operatorSet.avs
116+ * @dev operatorSet must have an active reservation
66117 */
67- function addTransportDestination (OperatorSet calldata operatorSet , uint32 chainID ) external ;
118+ function setOperatorTableCalculator (
119+ OperatorSet calldata operatorSet ,
120+ IOperatorTableCalculator operatorTableCalculator
121+ ) external ;
68122
69123 /**
70- * @notice Removes a destination chain to transport to
71- * @param chainID to remove transport to
124+ * @notice Sets the operatorSetConfig for a given operatorSet
125+ * @param operatorSet the operatorSet to set the operatorSetConfig for
126+ * @param config the config to set
72127 * @dev msg.sender must be UAM permissioned for operatorSet.avs
128+ * @dev operatorSet must have an active generation reservation
73129 */
74- function removeTransportDestination (OperatorSet calldata operatorSet , uint32 chainID ) external ;
130+ function setOperatorSetConfig (OperatorSet calldata operatorSet , OperatorSetConfig calldata config ) external ;
75131
76132 /**
77- * @notice Sets the operatorTableCalculator for the operatorSet
78- * @param operatorSet the operatorSet whose operatorTableCalculator is desired to be set
79- * @param calculator the contract to call to calculate the operator table
133+ * @notice Adds destination chains to transport to
134+ * @param operatorSet the operatorSet to add transport destinations for
135+ * @param chainIDs to add transport to
80136 * @dev msg.sender must be UAM permissioned for operatorSet.avs
81- * @dev operatorSet must have an active reservation
137+ * @dev Will create a transport reservation if one doesn't exist
82138 */
83- function setOperatorTableCalculator (
84- OperatorSet calldata operatorSet ,
85- IOperatorTableCalculator calculator
86- ) external ;
139+ function addTransportDestinations (OperatorSet calldata operatorSet , uint256 [] calldata chainIDs ) external ;
87140
88141 /**
89- * @notice Adds a chainID to the whitelist of chainIDs that can be transported to
90- * @param chainID the chainID to add to the whitelist
142+ * @notice Removes destination chains to transport to
143+ * @param operatorSet the operatorSet to remove transport destinations for
144+ * @param chainIDs to remove transport to
145+ * @dev msg.sender must be UAM permissioned for operatorSet.avs
146+ * @dev Will remove the transport reservation if all destinations are removed
147+ */
148+ function removeTransportDestinations (OperatorSet calldata operatorSet , uint256 [] calldata chainIDs ) external ;
149+
150+ /**
151+ * @notice Adds chainIDs to the whitelist of chainIDs that can be transported to
152+ * @param chainIDs the chainIDs to add to the whitelist
91153 * @dev msg.sender must be the owner of the CrossChainRegistry
92154 */
93- function addChainIDToWhitelist (
94- uint32 chainID
155+ function addChainIDsToWhitelist (
156+ uint256 [] calldata chainIDs
95157 ) external ;
96158
97159 /**
98- * @notice Removes a chainID from the whitelist of chainIDs that can be transported to
99- * @param chainID the chainID to remove from the whitelist
160+ * @notice Removes chainIDs from the whitelist of chainIDs that can be transported to
161+ * @param chainIDs the chainIDs to remove from the whitelist
100162 * @dev msg.sender must be the owner of the CrossChainRegistry
101163 */
102- function removeChainIDFromWhitelist (
103- uint32 chainID
164+ function removeChainIDsFromWhitelist (
165+ uint256 [] calldata chainIDs
104166 ) external ;
105167
106168 /**
107- * @notice Gets the list of chains that are supported by the CrossChainRegistry
108- * @return An array of chainIDs that are supported by the CrossChainRegistry
169+ *
170+ * VIEW FUNCTIONS
171+ *
172+ */
173+
174+ /**
175+ * @notice Gets the active generation reservations
176+ * @return An array of operatorSets with active generationReservations
109177 */
110- function getSupportedChains () external view returns (uint32 [] memory );
178+ function getActiveGenerationReservations () external view returns (OperatorSet [] memory );
111179
112180 /**
113181 * @notice Gets the operatorTableCalculator for a given operatorSet
114182 * @param operatorSet the operatorSet to get the operatorTableCalculator for
115183 * @return The operatorTableCalculator for the given operatorSet
116184 */
117185 function getOperatorTableCalculator (
118- OperatorSet calldata operatorSet
186+ OperatorSet memory operatorSet
119187 ) external view returns (IOperatorTableCalculator);
120188
121189 /**
122- * @notice Gets the active generation reservations
123- * @return An array of operatorSets with active generationReservations
124- * @return An array of the corresponding operatorTableCalculators
190+ * @notice Gets the operatorSetConfig for a given operatorSet
191+ * @param operatorSet the operatorSet to get the operatorSetConfig for
192+ * @return The operatorSetConfig for the given operatorSet
125193 */
126- function getActiveGenerationReservations ()
127- external
128- view
129- returns (OperatorSet[] memory , IOperatorTableCalculator[] memory );
194+ function getOperatorSetConfig (
195+ OperatorSet memory operatorSet
196+ ) external view returns (OperatorSetConfig memory );
197+
198+ /**
199+ * @notice Calculates the operatorTableBytes for a given operatorSet
200+ * @param operatorSet the operatorSet to calculate the operator table for
201+ * @return the encoded operatorTableBytes containing:
202+ * - operatorSet details
203+ * - curve type from KeyRegistrar
204+ * - operator set configuration
205+ * - calculated operator table from the calculator contract
206+ * @dev This function aggregates data from multiple sources for cross-chain transport
207+ */
208+ function calculateOperatorTableBytes (
209+ OperatorSet calldata operatorSet
210+ ) external view returns (bytes memory );
211+
212+ /**
213+ * @notice Gets the active transport reservations
214+ * @return An array of operatorSets with active transport reservations
215+ * @return An array of chainIDs that the operatorSet is configured to transport to
216+ */
217+ function getActiveTransportReservations () external view returns (OperatorSet[] memory , uint256 [][] memory );
130218
131219 /**
132220 * @notice Gets the transport destinations for a given operatorSet
133221 * @param operatorSet the operatorSet to get the transport destinations for
134- * @return An array of chainIDs that are transport destinations for the given operatorSet
222+ * @return An array of chainIDs that the operatorSet is configured to transport to
135223 */
136224 function getTransportDestinations (
137- OperatorSet calldata operatorSet
138- ) external view returns (uint32 [] memory );
225+ OperatorSet memory operatorSet
226+ ) external view returns (uint256 [] memory );
227+
228+ /**
229+ * @notice Gets the list of chains that are supported by the CrossChainRegistry
230+ * @return An array of chainIDs that are supported by the CrossChainRegistry
231+ */
232+ function getSupportedChains () external view returns (uint256 [] memory );
139233}
0 commit comments