@@ -8,22 +8,28 @@ import {AccessControl} from "OZ/access/AccessControl.sol";
88// Other
99import {IRuleEngineOperation} from "../interfaces/IRuleEngineOperation.sol " ;
1010import {IRuleOperation} from "../interfaces/IRuleOperation.sol " ;
11- import {RuleEngineInvariantStorage } from "./RuleEngineInvariantStorage .sol " ;
11+ import {RuleEngineInvariantStorageCommon } from "./library/RuleEngineInvariantStorageCommon .sol " ;
1212/**
1313 * @title RuleEngine - Operation part
1414 */
1515abstract contract RuleEngineOperation is
1616 AccessControl ,
17- RuleEngineInvariantStorage ,
17+ RuleEngineInvariantStorageCommon ,
1818 IRuleEngineOperation
1919{
20-
21- /// @dev Array of rules
22- //address[] internal _rulesOperation;
2320 // Add the library methods
2421 using EnumerableSet for EnumerableSet.AddressSet;
2522
23+ /// @notice Generate when a rule is added
24+ event AddRuleOperation (IRuleOperation indexed rule );
25+ /// @notice Generate when a rule is removed
26+ event RemoveRuleOperation (IRuleOperation indexed rule );
27+ /// @notice Generate when all the rules are cleared
28+ event ClearRulesOperation ();
29+
30+
2631 // Declare a set state variable
32+ /// @dev Array of rules
2733 EnumerableSet.AddressSet internal _rulesOperation;
2834
2935 /*//////////////////////////////////////////////////////////////
@@ -37,7 +43,7 @@ abstract contract RuleEngineOperation is
3743 *
3844 */
3945 function setRulesOperation (
40- address [] calldata rules_
46+ IRuleOperation [] calldata rules_
4147 ) public virtual onlyRole (RULE_ENGINE_OPERATOR_ROLE) {
4248 if (rules_.length == 0 ) {
4349 revert RuleEngine_ArrayIsEmpty ();
@@ -48,7 +54,7 @@ abstract contract RuleEngineOperation is
4854 for (uint256 i = 0 ; i < rules_.length ; ++ i){
4955 _checkRule (address (rules_[i]));
5056 _rulesOperation.add (address (rules_[i]));
51- emit AddRule (rules_[i]);
57+ emit AddRuleOperation (rules_[i]);
5258 }
5359
5460 }
@@ -72,7 +78,7 @@ abstract contract RuleEngineOperation is
7278 ) public virtual onlyRole (RULE_ENGINE_OPERATOR_ROLE) {
7379 _checkRule (address (rule_));
7480 _rulesOperation.add (address (rule_));
75- emit AddRule ( address ( rule_) );
81+ emit AddRuleOperation ( rule_);
7682 }
7783
7884 /**
@@ -88,7 +94,7 @@ abstract contract RuleEngineOperation is
8894 IRuleOperation rule_
8995 ) public virtual onlyRole (RULE_ENGINE_OPERATOR_ROLE) {
9096 require (rulesOperationIsPresent (rule_), RuleEngine_RuleDoNotMatch ());
91- _removeRuleOperation (address ( rule_) );
97+ _removeRuleOperation (rule_);
9298 }
9399
94100 /* ============ View functions ============ */
@@ -139,7 +145,7 @@ abstract contract RuleEngineOperation is
139145 function _clearRulesOperation () internal virtual {
140146 // we remove the last element first since it is more optimized.
141147
142- emit ClearRules ();
148+ emit ClearRulesOperation ();
143149 _rulesOperation.clear ();
144150 }
145151
@@ -174,9 +180,9 @@ abstract contract RuleEngineOperation is
174180 *
175181 *
176182 */
177- function _removeRuleOperation (address rule_ ) internal virtual {
178- _rulesOperation.remove (rule_);
179- emit RemoveRule ( address ( rule_) );
183+ function _removeRuleOperation (IRuleOperation rule_ ) internal virtual {
184+ _rulesOperation.remove (address ( rule_) );
185+ emit RemoveRuleOperation ( rule_);
180186 }
181187
182188 function _checkRule (address rule_ ) internal {
0 commit comments