@@ -4,8 +4,6 @@ pragma solidity ^0.8.21;
44import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol " ;
55import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol " ;
66
7- import {SetHelper} from "@solarity/solidity-lib/libs/arrays/SetHelper.sol " ;
8-
97import {IAgentAccessControl} from "../interfaces/core/IAgentAccessControl.sol " ;
108
119import {IAssetF} from "../interfaces/IAssetF.sol " ;
@@ -20,7 +18,6 @@ import {IAssetF} from "../interfaces/IAssetF.sol";
2018 */
2119abstract contract AbstractModule is Initializable {
2220 using EnumerableSet for EnumerableSet.Bytes32Set;
23- using SetHelper for EnumerableSet.Bytes32Set;
2421
2522 // keccak256("tokenf.standard.abstract.module.storage")
2623 bytes32 private constant ABSTRACT_MODULE_STORAGE =
@@ -43,6 +40,8 @@ abstract contract AbstractModule is Initializable {
4340 }
4441
4542 error HandlerNotSet ();
43+ error FailedToAddHandlerTopic (bytes32 handlerTopic );
44+ error FailedToRemoveHandlerTopic (bytes32 handlerTopic );
4645
4746 function __AbstractModule_init (address assetF_ ) internal onlyInitializing {
4847 AbstractModuleStorage storage $ = _getAbstractModuleStorage ();
@@ -140,7 +139,14 @@ abstract contract AbstractModule is Initializable {
140139 ) internal virtual {
141140 AbstractModuleStorage storage $ = _getAbstractModuleStorage ();
142141
143- $.handlerTopics[contextKey_].strictAdd (handlerTopics_);
142+ uint256 length_ = handlerTopics_.length ;
143+ for (uint256 i = 0 ; i < length_; ++ i) {
144+ bytes32 handlerTopic_ = handlerTopics_[i];
145+ require (
146+ $.handlerTopics[contextKey_].add (handlerTopic_),
147+ FailedToAddHandlerTopic (handlerTopic_)
148+ );
149+ }
144150 }
145151
146152 /**
@@ -158,7 +164,14 @@ abstract contract AbstractModule is Initializable {
158164 ) internal virtual {
159165 AbstractModuleStorage storage $ = _getAbstractModuleStorage ();
160166
161- $.handlerTopics[contextKey_].strictRemove (handlerTopics_);
167+ uint256 length_ = handlerTopics_.length ;
168+ for (uint256 i = 0 ; i < length_; ++ i) {
169+ bytes32 handlerTopic_ = handlerTopics_[i];
170+ require (
171+ $.handlerTopics[contextKey_].remove (handlerTopic_),
172+ FailedToRemoveHandlerTopic (handlerTopic_)
173+ );
174+ }
162175 }
163176
164177 /**
0 commit comments