@@ -16,7 +16,12 @@ abstract contract PermissionControllerMixin {
1616 permissionController = _permissionController;
1717 }
1818
19- /// @notice Checks if the caller (msg.sender) can call on behalf of an account.
19+ /**
20+ * @notice Modifier that checks if the caller can call on behalf of an account, reverts if not permitted.
21+ * @param account The account on whose behalf the function is being called.
22+ * @dev Use this modifier when the entire function requires authorization.
23+ * @dev This is the most common pattern - prefer this over `_checkCanCall` when possible.
24+ */
2025 modifier checkCanCall (
2126 address account
2227 ) {
@@ -25,11 +30,12 @@ abstract contract PermissionControllerMixin {
2530 }
2631
2732 /**
28- * @notice Checks if the caller (msg.sender) is permitted to call the current function on behalf of the given account.
33+ * @notice Checks if the caller is permitted to call the current function on behalf of the given account.
2934 * @param account The account on whose behalf the function is being called.
30- * @dev Reverts if the caller is not permitted to call the current function on behalf of the given account.
31- * @dev This function queries the permissionController to determine if msg.sender is authorized
32- * to call the current function (identified by msg.sig) on behalf of `account`.
35+ * @dev Reverts with `InvalidPermissions()` if the caller is not permitted.
36+ * @dev Use this function instead of the modifier when:
37+ * - You need to avoid "stack too deep" errors (e.g., when combining multiple modifiers)
38+ * - You need more control over when the check occurs in your function logic
3339 */
3440 function _checkCanCall (
3541 address account
@@ -38,9 +44,16 @@ abstract contract PermissionControllerMixin {
3844 }
3945
4046 /**
41- * @notice Checks if the caller (msg.sender) is permitted to call the current function on behalf of the given account.
47+ * @notice Checks if the caller is permitted to call the current function on behalf of the given account.
4248 * @param account The account on whose behalf the function is being called.
4349 * @return allowed True if the caller is permitted, false otherwise.
50+ * @dev Unlike `_checkCanCall`, this function returns a boolean instead of reverting.
51+ * @dev Use this function when you need conditional logic based on permissions, such as:
52+ * - OR conditions: `require(_canCall(operator) || _canCall(avs), InvalidCaller());`
53+ * - If-else branches: `if (_canCall(account)) { ... } else { ... }`
54+ * - Multiple authorization paths in the same function
55+ * @dev This function queries the permissionController to determine if msg.sender is authorized
56+ * to call the current function (identified by msg.sig) on behalf of `account`.
4457 */
4558 function _canCall (
4659 address account
0 commit comments