@@ -17,28 +17,9 @@ import {ACLEvents} from "./ACLEvents.sol";
1717 * secure while still being usable within authorized contexts.
1818 */
1919contract ACL is UUPSUpgradeableEmptyProxy , Ownable2StepUpgradeable , PausableUpgradeable , ACLEvents {
20- /// @notice Returned if the delegatee contract is already delegatee for sender & delegator addresses.
21- /// @param delegatee delegatee address.
22- /// @param contractAddress contract address.
23- error AlreadyDelegated (address delegatee , address contractAddress );
24-
25- /// @notice Returned if the sender is the delegatee address.
26- error SenderCannotBeContractAddress (address contractAddress );
27-
28- /// @notice Returned if the contractAddresses array is empty.
29- error ContractAddressesIsEmpty ();
30-
31- /// @notice Maximum length of contractAddresses array exceeded.
32- error ContractAddressesMaxLengthExceeded ();
33-
3420 /// @notice Returned if the handlesList array is empty.
3521 error HandlesListIsEmpty ();
3622
37- /// @notice Returned if the the delegatee contract is not already delegatee for sender & delegator addresses.
38- /// @param delegatee delegatee address.
39- /// @param contractAddress contract address.
40- error NotDelegatedYet (address delegatee , address contractAddress );
41-
4223 /// @notice Returned if the sender address is not allowed to pause the contract.
4324 error NotPauser (address sender );
4425
@@ -50,7 +31,6 @@ contract ACL is UUPSUpgradeableEmptyProxy, Ownable2StepUpgradeable, PausableUpgr
5031 struct ACLStorage {
5132 mapping (bytes32 handle = > mapping (address account = > bool isAllowed )) persistedAllowedPairs;
5233 mapping (bytes32 handle = > bool isAllowedForDecryption ) allowedForDecryption;
53- mapping (address account = > mapping (address delegatee = > mapping (address contractAddress = > bool isDelegate ))) delegates;
5434 }
5535
5636 /// @notice Name of the contract.
@@ -71,9 +51,6 @@ contract ACL is UUPSUpgradeableEmptyProxy, Ownable2StepUpgradeable, PausableUpgr
7151 /// @notice PauserSet contract.
7252 IPauserSet private constant PAUSER_SET = IPauserSet (pauserSetAdd);
7353
74- /// @notice maximum length of contractAddresses array during delegation.
75- uint256 private constant MAX_NUM_CONTRACT_ADDRESSES = 10 ;
76-
7754 /// Constant used for making sure the version number used in the `reinitializer` modifier is
7855 /// identical between `initializeFromEmptyProxy` and the `reinitializeVX` method
7956 uint64 private constant REINITIALIZER_VERSION = 2 ;
@@ -162,59 +139,6 @@ contract ACL is UUPSUpgradeableEmptyProxy, Ownable2StepUpgradeable, PausableUpgr
162139 }
163140 }
164141
165- /**
166- * @notice Delegates the access of handles in the context of account abstraction for issuing
167- * reencryption requests from a smart contract account.
168- * @param delegatee Delegatee address.
169- * @param contractAddresses Contract addresses.
170- */
171- function delegateAccount (address delegatee , address [] memory contractAddresses ) public virtual whenNotPaused {
172- uint256 lengthContractAddresses = contractAddresses.length ;
173- if (lengthContractAddresses == 0 ) {
174- revert ContractAddressesIsEmpty ();
175- }
176- if (lengthContractAddresses > MAX_NUM_CONTRACT_ADDRESSES) {
177- revert ContractAddressesMaxLengthExceeded ();
178- }
179-
180- ACLStorage storage $ = _getACLStorage ();
181- for (uint256 k = 0 ; k < lengthContractAddresses; k++ ) {
182- if (contractAddresses[k] == msg .sender ) {
183- revert SenderCannotBeContractAddress (contractAddresses[k]);
184- }
185- if ($.delegates[msg .sender ][delegatee][contractAddresses[k]]) {
186- revert AlreadyDelegated (delegatee, contractAddresses[k]);
187- }
188- $.delegates[msg .sender ][delegatee][contractAddresses[k]] = true ;
189- }
190-
191- emit NewDelegation (msg .sender , delegatee, contractAddresses);
192- }
193-
194- /**
195- * @notice Revokes delegated access of handles in the context of account abstraction for issuing
196- * reencryption requests from a smart contract account.
197- * @param delegatee Delegatee address.
198- * @param contractAddresses Contract addresses.
199- */
200- function revokeDelegation (address delegatee , address [] memory contractAddresses ) public virtual whenNotPaused {
201- uint256 lengthContractAddresses = contractAddresses.length ;
202- if (lengthContractAddresses == 0 ) {
203- revert ContractAddressesIsEmpty ();
204- }
205-
206- ACLStorage storage $ = _getACLStorage ();
207-
208- for (uint256 k = 0 ; k < lengthContractAddresses; k++ ) {
209- if (! $.delegates[msg .sender ][delegatee][contractAddresses[k]]) {
210- revert NotDelegatedYet (delegatee, contractAddresses[k]);
211- }
212- $.delegates[msg .sender ][delegatee][contractAddresses[k]] = false ;
213- }
214-
215- emit RevokedDelegation (msg .sender , delegatee, contractAddresses);
216- }
217-
218142 /**
219143 * @dev Triggers stopped state.
220144 * Only a pauser address can pause.
@@ -236,27 +160,6 @@ contract ACL is UUPSUpgradeableEmptyProxy, Ownable2StepUpgradeable, PausableUpgr
236160 _unpause ();
237161 }
238162
239- /**
240- * @notice Returns whether the delegatee is allowed to access the handle.
241- * @param delegatee Delegatee address.
242- * @param handle Handle.
243- * @param contractAddress Contract address.
244- * @param account Address of the account.
245- * @return isAllowed Whether the handle can be accessed.
246- */
247- function allowedOnBehalf (
248- address delegatee ,
249- bytes32 handle ,
250- address contractAddress ,
251- address account
252- ) public view virtual returns (bool ) {
253- ACLStorage storage $ = _getACLStorage ();
254- return
255- $.persistedAllowedPairs[handle][account] &&
256- $.persistedAllowedPairs[handle][contractAddress] &&
257- $.delegates[account][delegatee][contractAddress];
258- }
259-
260163 /**
261164 * @notice Checks whether the account is allowed to use the handle in the
262165 * same transaction (transient).
0 commit comments