OrchestratorFactory_v1.sol

Git Source

Inherits: IOrchestratorFactory_v1, ERC2771ContextUpgradeable, Ownable2StepUpgradeable, ERC165Upgradeable

Author: Inverter Network

OrchestratorFactory_v1 facilitates the deployment of {Orchestrator_v1}s and their associated modules for the Inverter Network, ensuring seamless creation and configuration of various components in a single transaction.

Utilizes {ERC2771ContextUpgradeable} for meta-transaction capabilities and {ERC165Upgradeable} for interface detection. {Orchestrator_v1}s are deployed through EIP-1167 minimal proxies for efficiency. Integrates with the module factory to instantiate necessary modules with custom configurations, supporting complex setup with interdependencies among modules.

State Variables

beacon

Returns the {IOrchestrator_v1} {IInverterBeacon_v1} address.

IInverterBeacon_v1 public override beacon;

moduleFactory

Returns the {IModuleFactory_v1} implementation address.

address public override moduleFactory;

_orchestrators

Maps the id to the {Orchestrator_v1}s.

mapping(uint => address) private _orchestrators;

_orchestratorIdCounter

The counter of the current {Orchestrator_v1} id.

Starts counting from 1.

_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}.

validOrchestratorId

Modifier to guarantee that the given id is valid.

constructor

init

The factories initializer function.

Parameters

Name
Type
Description

governor_

address

The address of the {Governor_v1} contract.

beacon_

IInverterBeacon_v1

The address of the {IInverterBeacon_v1} containing the {Orchestrator_v1} implementation.

moduleFactory_

address

The address of the {ModuleFactory_v1} contract.

createOrchestrator

Creates a new {Orchestrator_v1}.

Parameters

Name
Type
Description

workflowConfig

WorkflowConfig

The workflow's config data.

fundingManagerConfig

ModuleConfig

The config data for the orchestrator's {IFundingManager_v1} instance.

authorizerConfig

ModuleConfig

The config data for the {Orchestrator_v1}'s {IAuthorizer_v1} instance.

paymentProcessorConfig

ModuleConfig

The config data for the orchestrator's {IPaymentProcessor_v1} instance.

moduleConfigs

ModuleConfig[]

Variable length set of optional module's config data.

Returns

Name
Type
Description

<none>

IOrchestrator_v1

CreatedOrchestrator Returns the created orchestrator instance

getOrchestratorByID

Returns the {IOrchestrator_v1} address that corresponds to the given id.

Parameters

Name
Type
Description

id

uint256

The requested orchestrator's id.

Returns

Name
Type
Description

<none>

address

orchestratorAddress The address of the corresponding {Orchestrator_v1}.

getOrchestratorIDCounter

Returns the counter of the current {Orchestrator_v1} id.

Returns

Name
Type
Description

<none>

uint256

id The id of the next created {Orchestrator_v1}.

_createModuleProxies

Creates the modules based on their `moduleConfigs`.

Parameters

Name
Type
Description

moduleConfigs

ModuleConfig[]

The config data of the modules that will be created with this function call.

orchestratorProxy

address

The address of the {Orchestrator_v1} Proxy that will be linked to the modules.

workflowConfig

WorkflowConfig

The workflow's config data.

_initModules

Internal function to initialize the modules.

Parameters

Name
Type
Description

modules

address[]

The modules to initialize.

moduleConfigs

ModuleConfig[]

The config data of the modules that will be initialized.

proxy

address

The address of the {Orchestrator_v1} Proxy that will be linked to the modules.

_createSalt

Internal function to generate 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