1
1
// SPDX-License-Identifier: BUSL-1.1
2
- pragma solidity >= 0.5.0 ;
2
+ pragma solidity ^ 0.8.27 ;
3
3
4
4
import {OperatorSet} from "../libraries/OperatorSetLib.sol " ;
5
5
import "./IOperatorTableCalculator.sol " ;
6
6
7
7
interface ICrossChainRegistryErrors {
8
8
/// @notice Thrown when the chainId is invalid
9
9
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 ();
10
46
}
11
47
12
48
interface ICrossChainRegistryTypes {
@@ -21,34 +57,47 @@ interface ICrossChainRegistryTypes {
21
57
}
22
58
}
23
59
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 );
27
63
28
64
/// @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 );
30
72
31
73
/// @notice Emitted when a transport destination is added
32
- event TransportDestinationAdded (OperatorSet operatorSet , uint32 chainID );
74
+ event TransportDestinationAdded (OperatorSet operatorSet , uint256 chainID );
33
75
34
76
/// @notice Emitted when a transport destination is removed
35
- event TransportDestinationRemoved (OperatorSet operatorSet , uint32 chainID );
77
+ event TransportDestinationRemoved (OperatorSet operatorSet , uint256 chainID );
36
78
37
79
/// @notice Emitted when a chainID is added to the whitelist
38
- event ChainIDAddedToWhitelist (uint32 chainID );
80
+ event ChainIDAddedToWhitelist (uint256 chainID );
39
81
40
82
/// @notice Emitted when a chainID is removed from the whitelist
41
- event ChainIDRemovedFromWhitelist (uint32 chainID );
83
+ event ChainIDRemovedFromWhitelist (uint256 chainID );
42
84
}
43
85
44
- interface ICrossChainRegistry is ICrossChainRegistryErrors , ICrossChainRegistryTypes , ICrossChainRegistryEvents {
86
+ interface ICrossChainRegistry is ICrossChainRegistryErrors , ICrossChainRegistryEvents {
45
87
/**
46
- * @notice Initiates a generation reservation
88
+ * @notice Creates a generation reservation
47
89
* @param operatorSet the operatorSet to make a reservation for
48
90
* @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
49
93
* @dev msg.sender must be UAM permissioned for operatorSet.avs
50
94
*/
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 ;
52
101
53
102
/**
54
103
* @notice Removes a generation reservation for a given operatorSet
@@ -60,80 +109,125 @@ interface ICrossChainRegistry is ICrossChainRegistryErrors, ICrossChainRegistryT
60
109
) external ;
61
110
62
111
/**
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
65
115
* @dev msg.sender must be UAM permissioned for operatorSet.avs
116
+ * @dev operatorSet must have an active reservation
66
117
*/
67
- function addTransportDestination (OperatorSet calldata operatorSet , uint32 chainID ) external ;
118
+ function setOperatorTableCalculator (
119
+ OperatorSet calldata operatorSet ,
120
+ IOperatorTableCalculator operatorTableCalculator
121
+ ) external ;
68
122
69
123
/**
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
72
127
* @dev msg.sender must be UAM permissioned for operatorSet.avs
128
+ * @dev operatorSet must have an active generation reservation
73
129
*/
74
- function removeTransportDestination (OperatorSet calldata operatorSet , uint32 chainID ) external ;
130
+ function setOperatorSetConfig (OperatorSet calldata operatorSet , OperatorSetConfig calldata config ) external ;
75
131
76
132
/**
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
80
136
* @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
82
138
*/
83
- function setOperatorTableCalculator (
84
- OperatorSet calldata operatorSet ,
85
- IOperatorTableCalculator calculator
86
- ) external ;
139
+ function addTransportDestinations (OperatorSet calldata operatorSet , uint256 [] calldata chainIDs ) external ;
87
140
88
141
/**
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
91
153
* @dev msg.sender must be the owner of the CrossChainRegistry
92
154
*/
93
- function addChainIDToWhitelist (
94
- uint32 chainID
155
+ function addChainIDsToWhitelist (
156
+ uint256 [] calldata chainIDs
95
157
) external ;
96
158
97
159
/**
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
100
162
* @dev msg.sender must be the owner of the CrossChainRegistry
101
163
*/
102
- function removeChainIDFromWhitelist (
103
- uint32 chainID
164
+ function removeChainIDsFromWhitelist (
165
+ uint256 [] calldata chainIDs
104
166
) external ;
105
167
106
168
/**
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
109
177
*/
110
- function getSupportedChains () external view returns (uint32 [] memory );
178
+ function getActiveGenerationReservations () external view returns (OperatorSet [] memory );
111
179
112
180
/**
113
181
* @notice Gets the operatorTableCalculator for a given operatorSet
114
182
* @param operatorSet the operatorSet to get the operatorTableCalculator for
115
183
* @return The operatorTableCalculator for the given operatorSet
116
184
*/
117
185
function getOperatorTableCalculator (
118
- OperatorSet calldata operatorSet
186
+ OperatorSet memory operatorSet
119
187
) external view returns (IOperatorTableCalculator);
120
188
121
189
/**
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
125
193
*/
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 );
130
218
131
219
/**
132
220
* @notice Gets the transport destinations for a given operatorSet
133
221
* @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
135
223
*/
136
224
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 );
139
233
}
0 commit comments