@@ -38,10 +38,10 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
38
38
EVENTS
39
39
//////////////////////////////////////////////////////////////*/
40
40
41
- /// @notice Emitted when an module is installed.
41
+ /// @notice Emitted when a module is installed.
42
42
event ModuleInstalled (address caller , address implementation , address installedModule );
43
43
44
- /// @notice Emitted when an module is uninstalled.
44
+ /// @notice Emitted when a module is uninstalled.
45
45
event ModuleUninstalled (address caller , address implementation , address installedModule );
46
46
47
47
/*//////////////////////////////////////////////////////////////
@@ -125,7 +125,7 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
125
125
EXTERNAL FUNCTIONS
126
126
//////////////////////////////////////////////////////////////*/
127
127
128
- /// @notice Installs an module contract.
128
+ /// @notice Installs a module contract.
129
129
function installModule (address _module , bytes calldata _data )
130
130
external
131
131
payable
@@ -135,7 +135,7 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
135
135
_installModule (_module, _data);
136
136
}
137
137
138
- /// @notice Uninstalls an module contract.
138
+ /// @notice Uninstalls a module contract.
139
139
function uninstallModule (address _module , bytes calldata _data )
140
140
external
141
141
payable
@@ -171,7 +171,7 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
171
171
return false ;
172
172
}
173
173
174
- /// @dev Installs an module contract.
174
+ /// @dev Installs a module contract.
175
175
function _installModule (address _module , bytes memory _data ) internal {
176
176
if (! modules.add (_module)) {
177
177
revert ModuleAlreadyInstalled ();
@@ -253,7 +253,7 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
253
253
emit ModuleInstalled (msg .sender , _module, _module);
254
254
}
255
255
256
- /// @notice Uninstalls an module contract.
256
+ /// @notice Uninstalls a module contract.
257
257
function _uninstallModule (address _module , bytes memory _data ) internal {
258
258
// Check: remove and check if the module is installed
259
259
if (! modules.remove (_module)) {
@@ -288,7 +288,7 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
288
288
emit ModuleUninstalled (msg .sender , _module, _module);
289
289
}
290
290
291
- /// @dev Calls an module callback function and checks whether it is optional or required.
291
+ /// @dev Calls a module callback function and checks whether it is optional or required.
292
292
function _executeCallbackFunction (bytes4 _selector , bytes memory _abiEncodedCalldata )
293
293
internal
294
294
nonReentrant
@@ -301,29 +301,28 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
301
301
revert CallbackFunctionNotSupported ();
302
302
}
303
303
304
- // Get callback mode -- required or not required.
305
- SupportedCallbackFunction[] memory functions = getSupportedCallbackFunctions ();
306
- uint256 len = functions.length ;
307
-
308
- CallbackMode callbackMode;
309
- for (uint256 i = 0 ; i < len; i++ ) {
310
- if (functions[i].selector == _selector) {
311
- callbackMode = functions[i].mode;
312
- break ;
313
- }
314
- }
315
-
316
304
if (callbackFunction.implementation != address (0 )) {
317
305
(success, returndata) = callbackFunction.implementation.delegatecall (_abiEncodedCalldata);
318
306
if (! success) {
319
307
_revert (returndata, CallbackExecutionReverted.selector );
320
308
}
321
- } else if (callbackMode == CallbackMode.REQUIRED) {
322
- revert CallbackFunctionRequired ();
309
+ } else {
310
+ // Get callback mode -- required or not required.
311
+ SupportedCallbackFunction[] memory functions = getSupportedCallbackFunctions ();
312
+ uint256 len = functions.length ;
313
+
314
+ for (uint256 i = 0 ; i < len; i++ ) {
315
+ if (functions[i].selector == _selector) {
316
+ if (functions[i].mode == CallbackMode.REQUIRED) {
317
+ revert CallbackFunctionRequired ();
318
+ }
319
+ break ;
320
+ }
321
+ }
323
322
}
324
323
}
325
324
326
- /// @dev Calls an module callback function and checks whether it is optional or required.
325
+ /// @dev Calls a module callback function and checks whether it is optional or required.
327
326
function _executeCallbackFunctionView (bytes4 _selector , bytes memory _abiEncodedCalldata )
328
327
internal
329
328
view
@@ -336,25 +335,24 @@ abstract contract Core is ICore, OwnableRoles, ReentrancyGuard {
336
335
revert CallbackFunctionNotSupported ();
337
336
}
338
337
339
- // Get callback mode -- required or not required.
340
- SupportedCallbackFunction[] memory functions = getSupportedCallbackFunctions ();
341
- uint256 len = functions.length ;
342
-
343
- CallbackMode callbackMode;
344
- for (uint256 i = 0 ; i < len; i++ ) {
345
- if (functions[i].selector == _selector) {
346
- callbackMode = functions[i].mode;
347
- break ;
348
- }
349
- }
350
-
351
338
if (callbackFunction.implementation != address (0 )) {
352
339
(success, returndata) = address (this ).staticcall (_abiEncodedCalldata);
353
340
if (! success) {
354
341
_revert (returndata, CallbackExecutionReverted.selector );
355
342
}
356
- } else if (callbackMode == CallbackMode.REQUIRED) {
357
- revert CallbackFunctionRequired ();
343
+ } else {
344
+ // Get callback mode -- required or not required.
345
+ SupportedCallbackFunction[] memory functions = getSupportedCallbackFunctions ();
346
+ uint256 len = functions.length ;
347
+
348
+ for (uint256 i = 0 ; i < len; i++ ) {
349
+ if (functions[i].selector == _selector) {
350
+ if (functions[i].mode == CallbackMode.REQUIRED) {
351
+ revert CallbackFunctionRequired ();
352
+ }
353
+ break ;
354
+ }
355
+ }
358
356
}
359
357
}
360
358
0 commit comments