-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: xorsal <[email protected]> Co-authored-by: Gas One Cent <[email protected]>
- Loading branch information
1 parent
96d1084
commit 0e46031
Showing
21 changed files
with
1,282 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import {IAccessController} from '../interfaces/IAccessController.sol'; | ||
import {IAccessModule} from '../interfaces/modules/access/IAccessModule.sol'; | ||
|
||
abstract contract CommonAccessController is IAccessController { | ||
/** | ||
* @notice Check whether the caller is authorized for the given parameters. | ||
* @param _accessModule The access module | ||
* @param _typehash The typehash | ||
* @param _typehashParams The params passed to the typehash | ||
* @param _accessControl The access control struct | ||
*/ | ||
function _hasAccess( | ||
address _accessModule, | ||
bytes32 _typehash, | ||
bytes memory _typehashParams, | ||
AccessControl memory _accessControl | ||
) internal { | ||
bool _granted = IAccessModule(_accessModule).hasAccess( | ||
abi.encode( | ||
IAccessModule.AccessControlParameters({ | ||
sender: msg.sender, | ||
accessControl: _accessControl, | ||
typehash: _typehash, | ||
typehashParams: _typehashParams | ||
}) | ||
) | ||
); | ||
|
||
if (!_granted) revert AccessController_NoAccess(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.