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.
address public immutable reverter;governor
Returns the {Governor_v1} contract address.
address public governor;_beacons
Mapping of metadata identifier to {IInverterBeacon_v1} instance.
_MetadataLib.identifier(metadata) => {IInverterBeacon_v1}.
mapping(bytes32 => IInverterBeacon_v1) private _beacons;_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
_trustedForwarder
address
The address of the trusted forwarder contract.
init
The factories initializer function.
Parameters
initialMetadataRegistration
IModule_v1.Metadata[]
List of metadata that will be registered during the initialization.
initialBeaconRegistration
IInverterBeacon_v1[]
createAndInitModule
Creates a module instance identified by given metadata and initiates it.
Parameters
metadata
IModule_v1.Metadata
The module's metadata.
configData
bytes
The configData of the module.
workflowConfig
IOrchestratorFactory_v1.WorkflowConfig
The configData of the workflow.
Returns
<none>
address
moduleProxyAddress Returns the address of the created module proxy.
createModuleProxy
Creates a module proxy instance identified by given metadata.
Parameters
metadata
IModule_v1.Metadata
The module's metadata.
workflowConfig
IOrchestratorFactory_v1.WorkflowConfig
The configData of the workflow.
Returns
<none>
address
Returns the address of the created module proxy.
getBeaconAndId
Returns the {IInverterBeacon_v1} instance registered and the id for given metadata.
Parameters
metadata
IModule_v1.Metadata
The module's metadata.
Returns
<none>
bytes32
id The metadata's id.
getOrchestratorOfProxy
Returns the {Orchestrator_v1} address of a beacon proxy.
Parameters
proxy
address
The beacon proxy address.
Returns
<none>
address
orchestratorAddress The corresponding {Orchestrator_v1} address for the provided proxy.
registerMetadata
Registers metadata metadata with {IInverterBeacon_v1} implementation beacon.
Only callable by owner.
Parameters
metadata
IModule_v1.Metadata
The module's metadata.
_registerMetadata
Internal function to register metadata.
Parameters
metadata
IModule_v1.Metadata
The metadata to register.
_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