ModuleFactory_v1.sol

Git Sourcearrow-up-right

Inherits: IModuleFactory_v1, ERC2771ContextUpgradeablearrow-up-right, Ownable2StepUpgradeablearrow-up-right, ERC165Upgradeablearrow-up-right

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}arrow-up-right implementations. Note that a metadata's registered {IInverterBeacon_v1}arrow-up-right implementation can not be changed after registration!

State Variables

reverter

Returns the address of the {InverterReverter_v1}arrow-up-right contract.

address public immutable reverter;

governor

Returns the {Governor_v1}arrow-up-right contract address.

address public governor;

_beacons

Mapping of metadata identifier to {IInverterBeacon_v1}arrow-up-right instance.

_MetadataLib.identifier(metadata) => {IInverterBeacon_v1}.arrow-up-right

mapping(bytes32 => IInverterBeacon_v1) private _beacons;

_orchestratorOfProxy

Mapping of proxy address to orchestrator address.

moduleProxy => {IOrchestrator_v1}arrow-up-right.

_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}arrow-up-right.

validMetadata

Modifier to guarantee function is only callable with valid metadata.

validBeacon

Modifier to guarantee function is only callable with valid {IInverterBeacon_v1}arrow-up-right instance and if the owner of the beacon. is same as the {Governor_v1}arrow-up-right of this contract.

constructor

The factories initializer function.

Parameters

Name
Type
Description

_reverter

address

The address of the {InverterReverter_v1}arrow-up-right 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}arrow-up-right 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}arrow-up-right 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}arrow-up-right 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}arrow-up-right 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}arrow-up-right instance registered.

<none>

bytes32

id The metadata's id.

getOrchestratorOfProxy

Returns the {Orchestrator_v1}arrow-up-right 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}arrow-up-right address for the provided proxy.

registerMetadata

Registers metadata metadata with {IInverterBeacon_v1}arrow-up-right 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}arrow-up-right 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}arrow-up-right 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