diff --git a/packages/contracts/contracts/src/AdvancedChecker.sol b/packages/contracts/contracts/src/AdvancedChecker.sol index 3e09eff..9693ae7 100644 --- a/packages/contracts/contracts/src/AdvancedChecker.sol +++ b/packages/contracts/contracts/src/AdvancedChecker.sol @@ -17,21 +17,21 @@ struct CheckStatus { /// based on the specified check type. abstract contract AdvancedChecker is IAdvancedChecker { /// @notice Flag to determine if pre-condition checks should be skipped. - bool public skipPre; + bool public immutable SKIP_PRE; /// @notice Flag to determine if post-condition checks should be skipped. - bool public skipPost; + bool public immutable SKIP_POST; /// @notice Flag to determine if main checks can be executed multiple times. - bool public allowMultipleMain; + bool public immutable ALLOW_MULTIPLE_MAIN; /// @param _skipPre Indicates whether to skip pre-condition checks. /// @param _skipPost Indicates whether to skip post-condition checks. /// @param _allowMultipleMain Indicates whether the main check can be executed multiple times. constructor(bool _skipPre, bool _skipPost, bool _allowMultipleMain) { - skipPre = _skipPre; - skipPost = _skipPost; - allowMultipleMain = _allowMultipleMain; + SKIP_PRE = _skipPre; + SKIP_POST = _skipPost; + ALLOW_MULTIPLE_MAIN = _allowMultipleMain; } /// @notice Public method to check the validity of the provided evidence for a given address and check type. @@ -51,14 +51,14 @@ abstract contract AdvancedChecker is IAdvancedChecker { /// @param evidence The evidence associated with the check. /// @param checkType The type of check to perform (PRE, MAIN, POST). function _check(address subject, bytes memory evidence, Check checkType) internal view returns (bool checked) { - if (skipPre && checkType == Check.PRE) revert PreCheckSkipped(); - if (skipPost && checkType == Check.POST) revert PostCheckSkipped(); + if (SKIP_PRE && checkType == Check.PRE) revert PreCheckSkipped(); + if (SKIP_POST && checkType == Check.POST) revert PostCheckSkipped(); - if (!skipPre && checkType == Check.PRE) { + if (!SKIP_PRE && checkType == Check.PRE) { return _checkPre(subject, evidence); } - if (!skipPost && checkType == Check.POST) { + if (!SKIP_POST && checkType == Check.POST) { return _checkPost(subject, evidence); } diff --git a/packages/contracts/contracts/src/AdvancedPolicy.sol b/packages/contracts/contracts/src/AdvancedPolicy.sol index 1e32fb5..d8bc928 100644 --- a/packages/contracts/contracts/src/AdvancedPolicy.sol +++ b/packages/contracts/contracts/src/AdvancedPolicy.sol @@ -42,7 +42,7 @@ abstract contract AdvancedPolicy is IAdvancedPolicy, Policy { } if (checkType == Check.PRE) { - if (!ADVANCED_CHECKER.skipPost() && enforced[msg.sender][subject].pre) { + if (!ADVANCED_CHECKER.SKIP_POST() && enforced[msg.sender][subject].pre) { revert AlreadyEnforced(); } else { enforced[msg.sender][subject].pre = true; @@ -52,7 +52,7 @@ abstract contract AdvancedPolicy is IAdvancedPolicy, Policy { if (enforced[msg.sender][subject].post) { revert AlreadyEnforced(); } else { - if (!ADVANCED_CHECKER.skipPre() && !enforced[msg.sender][subject].pre) { + if (!ADVANCED_CHECKER.SKIP_PRE() && !enforced[msg.sender][subject].pre) { revert PreCheckNotEnforced(); } else { if (enforced[msg.sender][subject].main == 0) { @@ -65,12 +65,12 @@ abstract contract AdvancedPolicy is IAdvancedPolicy, Policy { } else { if ( checkType == Check.MAIN && - !ADVANCED_CHECKER.allowMultipleMain() && + !ADVANCED_CHECKER.ALLOW_MULTIPLE_MAIN() && enforced[msg.sender][subject].main > 0 ) { revert MainCheckAlreadyEnforced(); } else { - if (checkType == Check.MAIN && !ADVANCED_CHECKER.skipPre() && !enforced[msg.sender][subject].pre) { + if (checkType == Check.MAIN && !ADVANCED_CHECKER.SKIP_PRE() && !enforced[msg.sender][subject].pre) { revert PreCheckNotEnforced(); } else { enforced[msg.sender][subject].main += 1;