For the complete documentation index, see llms.txt. This page is also available as Markdown.

ModuleFactory_v1.sol

Git Source

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

Name
Type
Description

_reverter

address

The address of the {InverterReverter_v1} contract.

_trustedForwarder

address

The address of the trusted forwarder contract.

init

The factories initializer function.

Parameters

Name
Type
Description

_governor

address

The address of the {Governor_v1} contract.

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

Name
Type
Description

metadata

IModule_v1.Metadata

The module's metadata.

orchestrator

IOrchestrator_v1

The {Orchestrator_v1} instance of the module.

configData

bytes

The configData of the module.

workflowConfig

IOrchestratorFactory_v1.WorkflowConfig

The configData of the workflow.

Returns

Name
Type
Description

<none>

address

moduleProxyAddress Returns the address of the created module proxy.

createModuleProxy

Creates a module proxy instance identified by given metadata.

Parameters

Name
Type
Description

metadata

IModule_v1.Metadata

The module's metadata.

orchestrator

IOrchestrator_v1

The {Orchestrator_v1} instance of the module.

workflowConfig

IOrchestratorFactory_v1.WorkflowConfig

The configData of the workflow.

Returns

Name
Type
Description

<none>

address

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

metadata

IModule_v1.Metadata

The module's metadata.

Returns

Name
Type
Description

<none>

IInverterBeacon_v1

beacon The module's {IInverterBeacon_v1} instance registered.

<none>

bytes32

id The metadata's id.

getOrchestratorOfProxy

Returns the {Orchestrator_v1} address of a beacon proxy.

Parameters

Name
Type
Description

proxy

address

The beacon proxy address.

Returns

Name
Type
Description

<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

Name
Type
Description

metadata

IModule_v1.Metadata

The module's metadata.

beacon

IInverterBeacon_v1

The module's {IInverterBeacon_v1} instance.

_registerMetadata

Internal function to register metadata.

Parameters

Name
Type
Description

metadata

IModule_v1.Metadata

The metadata to register.

beacon

IInverterBeacon_v1

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