@@ -110,11 +110,8 @@ contract CrossChainRegistry is
110110 {
111111 bytes32 operatorSetKey = operatorSet.key ();
112112
113- // Check if generation reservation already exists
114- require (! _activeGenerationReservations.contains (operatorSetKey), GenerationReservationAlreadyExists ());
115-
116113 // Add to active generation reservations
117- _activeGenerationReservations.add (operatorSetKey);
114+ require ( _activeGenerationReservations.add (operatorSetKey), GenerationReservationAlreadyExists () );
118115 emit GenerationReservationMade (operatorSet);
119116
120117 // Set the operator table calculator
@@ -134,11 +131,8 @@ contract CrossChainRegistry is
134131 {
135132 bytes32 operatorSetKey = operatorSet.key ();
136133
137- // Check if generation reservation exists
138- require (_activeGenerationReservations.contains (operatorSetKey), GenerationReservationDoesNotExist ());
139-
140134 // Remove from active generation reservations
141- _activeGenerationReservations.remove (operatorSetKey);
135+ require ( _activeGenerationReservations.remove (operatorSetKey), GenerationReservationDoesNotExist () );
142136 emit GenerationReservationRemoved (operatorSet);
143137
144138 // Remove the operator table calculator
@@ -199,9 +193,7 @@ contract CrossChainRegistry is
199193 bytes32 operatorSetKey = operatorSet.key ();
200194
201195 // Check if this is the first transport destination (create reservation if needed)
202- if (! _activeTransportReservations.contains (operatorSetKey)) {
203- _activeTransportReservations.add (operatorSetKey);
204- }
196+ _activeTransportReservations.add (operatorSetKey);
205197
206198 for (uint256 i = 0 ; i < chainIDs.length ; i++ ) {
207199 uint32 chainID = chainIDs[i];
@@ -210,11 +202,9 @@ contract CrossChainRegistry is
210202 require (chainID != 0 , InvalidChainId ());
211203 // Check if chainID is whitelisted
212204 require (_whitelistedChainIDs.contains (chainID), ChainIDNotWhitelisted ());
213- // Check if already added
214- require (! _transportDestinations[operatorSetKey].contains (chainID), TransportDestinationAlreadyAdded ());
215205
216206 // Add transport destination
217- _transportDestinations[operatorSetKey].add (chainID);
207+ require ( _transportDestinations[operatorSetKey].add (chainID), TransportDestinationAlreadyAdded () );
218208
219209 emit TransportDestinationAdded (operatorSet, chainID);
220210 }
@@ -241,11 +231,9 @@ contract CrossChainRegistry is
241231
242232 // Validate chainID
243233 require (chainID != 0 , InvalidChainId ());
244- // Check if transport destination exists
245- require (_transportDestinations[operatorSetKey].contains (chainID), TransportDestinationNotFound ());
246234
247235 // Remove transport destination
248- _transportDestinations[operatorSetKey].remove (chainID);
236+ require ( _transportDestinations[operatorSetKey].remove (chainID), TransportDestinationNotFound () );
249237
250238 emit TransportDestinationRemoved (operatorSet, chainID);
251239 }
@@ -265,11 +253,9 @@ contract CrossChainRegistry is
265253
266254 // Validate chainID
267255 require (chainID != 0 , InvalidChainId ());
268- // Check if already whitelisted
269- require (! _whitelistedChainIDs.contains (chainID), ChainIDAlreadyWhitelisted ());
270256
271257 // Add to whitelist
272- _whitelistedChainIDs.add (chainID);
258+ require ( _whitelistedChainIDs.add (chainID), ChainIDAlreadyWhitelisted () );
273259
274260 emit ChainIDAddedToWhitelist (chainID);
275261 }
@@ -284,11 +270,9 @@ contract CrossChainRegistry is
284270
285271 // Validate chainID
286272 require (chainID != 0 , InvalidChainId ());
287- // Check if whitelisted
288- require (_whitelistedChainIDs.contains (chainID), ChainIDNotWhitelisted ());
289273
290274 // Remove from whitelist
291- _whitelistedChainIDs.remove (chainID);
275+ require ( _whitelistedChainIDs.remove (chainID), ChainIDNotWhitelisted () );
292276
293277 emit ChainIDRemovedFromWhitelist (chainID);
294278 }
0 commit comments