-
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.
-
address module
: The module in whose access control context the role is to be checked. -
bytes32 role
: The access control role. -
address account
: The account to check the role for.
bool
: Returns true if the account account
holds the role role
in the module's module
access control context otherwise, returns false
.
function isModule(address module) external returns (bool);
Returns whether the address module
is added as module in the orchestrator contract (that extends this ModuleManager contract)
-
address module
: The module to check.
bool
: True if address module
was a valid module else false.
function listModules() external view returns (address[] memory);
Returns the list of all modules.
address[]
: the array of addresses containing all valid modules.
function modulesSize() external view returns (unit);
Returns the number of modules.
uint8
: the number of modules.
function addModule(address module) external;
Adds address module
as a module in the orchestrator contract. This function is only callable by authorized address and fails if the address is invalid or the address is already added as module.
-
address module
: The module address to add.
function removeModule(address module) external;
Removes address module
as a module from the orchestrator. This function is only callable by authorized address and fails if the address was not added as a module.
-
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
via a low-level solidity call
. This function is only callable by enabled modules.
-
address to
: The address where we need to make a call. -
bytes data
: The call data to be sent with the call.
-
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 modules.
-
bytes32 role
: The access control role. -
address account
: The account to grant the role.
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 modules.
-
bytes32 role
: The access control role. -
address account
: The account to revoke the role for.
function renounceRole(address module, bytes32 role) external;
Renounces the caller's role role
in the module's module
access control context.
-
address module
: The module in which's access control context the role should be renounced. -
bytes32 role
: The access control role.