ModuleManagerBase_v1.sol
Inherits: IModuleManagerBase_v1, Initializable, ERC2771ContextUpgradeable, ERC165Upgradeable
Author: Inverter Network Adapted from Gnosis Safe
A contract to manage Inverter Network modules. It allows for adding and removing modules in a local registry for reference. Additional functionality includes the execution of calls from this contract. The transaction execution and module management is copied from Gnosis Safe's ModuleManager.
State Variables
MAX_MODULE_AMOUNT
Marks the maximum amount of Modules a {Orchestrator_v1} can have to avoid out-of-gas risk.
MODULE_UPDATE_TIMELOCK
Timelock used between initiating adding or removing a module and executing it.
moduleFactory
_modules
List of modules.
_isModule
Mapping to keep track of whether a module is used in the {Orchestrator_v1} address => isModule.
moduleAddressToTimelock
Mapping to keep track of active timelocks for updating modules module => timelock.
__gap
Storage gap for future upgrades.
Functions
supportsInterface
See {IERC165-supportsInterface}.
__ModuleManager_onlyAuthorized
Modifier to guarantee function is only callable by authorized address.
onlyModule
Modifier to guarantee that the caller is a module.
validModule
Modifier to guarantee that the given module is a valid module.
isModule_
Modifier to guarantee that the given module is a registered module.
isNotModule
Modifier to guarantee that the given module is not a registered module.
moduleLimitNotExceeded
Modifier to guarantee that the number of modules is not exceeded.
updatingModuleAlreadyStarted
Modifier to guarantee that the given module is not already being updated.
timelockExpired
Modifier to guarantee that the timelock for the given module is expired.
constructor
__ModuleManager_init
Initialization function.
Only callable during initialization.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the module factory. |
|
| The addresses of the modules used in the orchestrator. |
__ModuleManager_addModule
Adds address module
as module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to add. |
__ModuleManager_isAuthorized
Returns whether address who
is authorized to mutate module manager's state.
MUST be overridden in downstream contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The address to check. |
Returns
Name | Type | Description |
---|---|---|
|
| True if the address is authorized, false otherwise. |
isModule
Returns whether the address module
is added as module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module to check. |
Returns
Name | Type | Description |
---|---|---|
|
| True if module added, false otherwise. |
listModules
Returns the list of all modules.
Returns
Name | Type | Description |
---|---|---|
|
| List of all modules. |
modulesSize
Returns the number of modules.
Returns
Name | Type | Description |
---|---|---|
|
| The number of modules. |
_cancelModuleUpdate
Cancels an initiated update for a module.
Only callable by authorized address.
Fails if module update has not been initiated.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to remove. |
_initiateAddModuleWithTimelock
Initiates adding of a module to the {Orchestrator_v1} on a timelock.
Only callable by authorized address.
Fails of adding module exeeds max modules limit.
Fails if address invalid or address already added as module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to add. |
_initiateRemoveModuleWithTimelock
Initiates removing of a module from the {Orchestrator_v1} on a timelock.
Only callable by authorized address.
Fails if address not added as module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to remove. |
_executeAddModule
Executes adding of a module to the {Orchestrator_v1}.
Only callable by authorized address.
Fails if adding of module has not been initiated.
Fails if timelock has not been expired yet.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to add. |
_executeRemoveModule
Executes removing of a module from the {Orchestrator_v1}.
Only callable by authorized address.
Fails if removing of module has not been initiated.
Fails if timelock has not been expired yet.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to remove. |
_commitAddModule
Expects module
to be valid module address.
Expects module
to not be enabled module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to add. |
_commitRemoveModule
Expects address arguments to be consecutive in the modules list.
Expects address module
to be enabled module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to remove. |
_ensureValidModule
Ensures that the given module is a valid module.
Reverts if the module is invalid.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to check. |
_ensureNotModule
Ensures that the given module is not a registered module.
Reverts if the module is registered.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to check. |
_startModuleUpdateTimelock
Starts the timelock for the given module.
Parameters
Name | Type | Description |
---|---|---|
|
| The module address to start the timelock for. |
isTrustedForwarder
Returns wether the given address is the trusted forwarder or not.
Exposes the ERC2771 isTrusted Forwarder.
Parameters
Name | Type | Description |
---|---|---|
|
| The address to check. |
Returns
Name | Type | Description |
---|---|---|
|
| True if the address is the trusted forwarder, false otherwise. |
trustedForwarder
Returns the trusted forwarder for metatransactions.
Exposes the ERC2771 isTrusted Forwarder.
Returns
Name | Type | Description |
---|---|---|
|
| The trusted forwarder address. |
Last updated