ModuleFactory_v1.sol
Inherits: IModuleFactory_v1, ERC2771ContextUpgradeable, Ownable2StepUpgradeable, ERC165Upgradeable
Author: Inverter Network
Enables the creation and registration of Inverter Modules, facilitating the deployment of module instances linked to specific beacons. Allows for configuration of modules starting state via provided deployment data.
An owned factory for deploying modules. The owner can register module metadata's to an {IInverterBeacon_v1} implementations. Note that a metadata's registered {IInverterBeacon_v1} implementation can not be changed after registration!
State Variables
reverter
Returns the address of the {InverterReverter_v1} contract.
governor
Returns the {Governor_v1} contract address.
_beacons
Mapping of metadata identifier to {IInverterBeacon_v1} instance.
_MetadataLib.identifier(metadata) => {IInverterBeacon_v1}.
_orchestratorOfProxy
Mapping of proxy address to orchestrator address.
moduleProxy => {IOrchestrator_v1}.
_deploymentNonces
Maps a users address to a nonce used for the create2-based deployment.
__gap
Storage gap for future upgrades.
Functions
supportsInterface
See {IERC165-supportsInterface}.
validMetadata
Modifier to guarantee function is only callable with valid metadata.
validBeacon
Modifier to guarantee function is only callable with valid {IInverterBeacon_v1} instance and if the owner of the beacon. is same as the {Governor_v1} of this contract.
constructor
The factories initializer function.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the {InverterReverter_v1} contract. |
|
| The address of the trusted forwarder contract. |
init
The factories initializer function.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the {Governor_v1} contract. |
|
| List of metadata that will be registered during the initialization. |
|
|
createAndInitModule
Creates a module instance identified by given metadata
and initiates it.
Parameters
Name | Type | Description |
---|---|---|
|
| The module's |
|
| The {Orchestrator_v1} instance of the module. |
|
| The configData of the module. |
|
| The configData of the workflow. |
Returns
Name | Type | Description |
---|---|---|
|
| moduleProxyAddress Returns the address of the created module proxy. |
createModuleProxy
Creates a module proxy instance identified by given metadata
.
Parameters
Name | Type | Description |
---|---|---|
|
| The module's metadata. |
|
| The {Orchestrator_v1} instance of the module. |
|
| The configData of the workflow. |
Returns
Name | Type | Description |
---|---|---|
|
| Returns the address of the created module proxy. |
getBeaconAndId
Returns the {IInverterBeacon_v1} instance registered and the id
for given metadata
.
Parameters
Name | Type | Description |
---|---|---|
|
| The module's metadata. |
Returns
Name | Type | Description |
---|---|---|
|
| beacon The module's {IInverterBeacon_v1} instance registered. |
|
| id The metadata's id. |
getOrchestratorOfProxy
Returns the {Orchestrator_v1} address of a beacon proxy.
Parameters
Name | Type | Description |
---|---|---|
|
| The beacon proxy address. |
Returns
Name | Type | Description |
---|---|---|
|
| orchestratorAddress The corresponding {Orchestrator_v1} address for the provided proxy. |
registerMetadata
Registers metadata metadata
with {IInverterBeacon_v1} implementation beacon
.
Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
|
| The module's metadata. |
|
| The module's {IInverterBeacon_v1} instance. |
_registerMetadata
Internal function to register metadata.
Parameters
Name | Type | Description |
---|---|---|
|
| The metadata to register. |
|
| The {IInverterBeacon_v1} to register the metadata to. |
_createSalt
Internal function to generate a salt for the create2-based deployment flow. This salt is the hash of (msgSender, nonce), where the nonce is an increasing number for each user.
_msgSender
Needs to be overridden, because they are imported via the Ownable2Step as well.
_msgData
Needs to be overridden, because they are imported via the Ownable2Step as well.
_contextSuffixLength
Last updated