-
Notifications
You must be signed in to change notification settings - Fork 15
ModuleManager
File: ModuleManager.sol
- This is a contract to manage modules that can execute transactions via this contract. Also used to manage own role-based access control mechanisms.
- The role-based access control mechanism is based on OpenZeppelin's AccessControl contract.
- Each module has it's own access control context which it is able to freely manage.
modifier __ModuleManager_onlyAuthorized
Modifier to ensure that _msgSender()
is authorized to mutate the module manager's state.
modifier onlyModule()
Modifier to ensure that the _msgSender()
is a valid module. The _msgSender()
is in the _modules
list
modifier validModule(address module)
Modifier to ensure that the address module
is a valid module. This is the same as the isModule
check plus also checking if address module
is not the same as the address(ModuleManager)
.
modifier isModule_(address module)
Modifier to ensure that the address module
is a valid module. The module
address is in the _modules
list.
modifier isNotModule(address module)
Modifier to ensure that the address module
is not a valid module.
modifier moduleLimitNotExceeded()
Modifier to ensure that the maximum permissible limit of 128 modules inside of an orchestrator is not breached.
function hasRole(address module, bytes32 role, address account) external returns (bool);
Returns whether the account account
holds the role role
in the module's module
access control context.
Parameter(s)
-
address module
-> The module in which's access control context the role is checked. -
bytes32 role
-> The access control role. -
address account
-> The account to check role for.
Return Data
bool
-> Returns true if the account account
holds the role role
in the module's module
access control context else returns false
.
function isModule(address module) external returns (bool);
Returns whether the address module
is added as module.
Parameter(s)
-
address module
-> The module to check.
Return Data
bool
-> True if address module
was a valid module else false.
function listModules() external view returns (address[] memory);
Returns the list of all modules.
Return Data
address[]
-> the array of addresses containing valid modules.
function modulesSize() external view returns (unit);
Returns the number of modules.
Return Data
uint
-> the number of modules.
Parameter(s)
-
address module
-> The address of which the previous element in the list should be found.
Return Data
-
address previousModule
-> The address of the previous module.
function addModule(address module) external;
Adds address module
as module. This function is only callable by authorized address and fails if address is invalid or address already added as module.
Parameter(s)
-
address module
-> The module address to add.
function removeModule(address module) external;
Removes address module
as module. This function is only callable by authorized address and fails if address not added as module.
Parameter(s)
-
address module
-> The module address to remove.
function executeTxFromModule(address to, bytes memory data) external returns (bool, bytes memory);
Executes a call to to
with call data data
either via call. This function is only callable by enabled modules.
Parameter(s)
-
address to
-> The address where we need to make a call. -
bytes data
-> The call data to be sent with the call.
Return Data
-
bool
-> Boolean indicating whether the call succeeded. -
bytes
-> The return data of the call (in bytes).
function grantRole(bytes32 role, address account) external;
Grants role role
to account account
in caller's access control context. This function is only callable by enabled module.
Parameter(s)
-
bytes32 role
-> The access control role. -
address account
-> The account to revoke role for.
function revokeRole(bytes32 role, address account) external;
Revokes role role
from account account
in caller's access control context. This function is only callable by enabled module.
Parameter(s)
-
bytes32 role
-> The access control role. -
address account
-> The account to revoke role for.
function renounceRole(address module, bytes32 role) external;
Renounces the caller's role role
in module's module
access control context.
Parameter(s)
-
address module
-> The module in which's access control context the role should be renounced. -
bytes32 role
-> The access control role.