Skip to content

Orchestrator Factory

Rahul Saxena edited this page Aug 8, 2023 · 2 revisions

File: Orchestrator Factory

Things to Know

  1. The orchestrator factory is an immutable factory used for deploying orchestrator contracts.
  2. New orchestrator contracts are created using the function createOrchestrator which creates and initializes the compulsory and optional inverter modules passed to the function.
  3. The createOrchestrator also supports late dependency injection to account for modules that require the deployment of other modules for their own initialization.

Modifiers

1. validOrchestratorId

modifier validOrchestratorId(uint id)

Modifier to guarantee that the given id is valid (less than or equal to _orchestratorIdCounter)

Read Functions

1. target

function target() external view returns (address);

Returns the {IOrchestrator} target implementation address.

Return Data

  1. address: The Orchestrator implementation contract address. Contains the logic for all orchestrator contracts.

2. moduleFactory

function moduleFactory() external view returns (address);

Returns the {IModuleFactory} implementation address.

Return Data

  1. address: The address of the ModuleFactory that is used to deploy all the inverter modules.

3. getOrchestratorByID

function getOrchestratorByID(uint id) external view returns (address);

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

Parameters

  1. uint id: The requested orchestrator's id.

Return Data

  1. address: Returns the address of the orchestrator contract associated with the supplied id.

4. getOrchestratorIDCounter

function getOrchestratorIDCounter() external view returns (uint);

Returns the counter of the current orchestrator id

Return Data

  1. uint: Value of the _orchestratorIdCounter variable used to assign IDs to different orchestrator deployments.

5. decoder

function decoder(bytes memory data)
        public
        pure
        returns (bool requirement)

This function should have been an internal function, but is made public to enable the low-level call to abi.decode from the function _dependencyInjectionRequired. It is used to decode data of type bytes in the form of (bool, string[]) and returns the bool.

Parameters

  1. bytes data: The dependency data of types bytes of a module which contains information about whether a module requires late dependency or not and if yes, a string list of the required modules.

Return Data

  1. bool: A boolean representing whether a module requires late dependency or not.

Write Functions

1. createOrchestrator

function createOrchestrator(
        OrchestratorConfig memory orchestratorConfig,
        ModuleConfig memory fundingManagerConfig,
        ModuleConfig memory authorizerConfig,
        ModuleConfig memory paymentProcessorConfig,
        ModuleConfig[] memory moduleConfigs
    ) external returns (IOrchestrator);

Creates a new orchestrator with the caller being the orchestrator's owner.

Parameters

  1. orchestratorConfig: The orchestrator's config data.
  2. fundingManagerConfig: The config data for orchestrator's {IFundingManager} instance.
  3. authorizerConfig: The config data for the orchestrator's {IAuthorizer} instance.
  4. paymentProcessorConfig: The config data for the orchestrator's {IPaymentProcessor} instance.
  5. moduleConfigs: Variable length set of optional module's config data.

Return Data

  1. IOrchestrator: Instance of the {IOrchestrator} contract that is created after calling the createOrchestrator function.