-
Notifications
You must be signed in to change notification settings - Fork 16
Factories
A factory contract is a smart contract that serves as a template for creating and deploying other smart contracts. It is a blueprint that automates the creation of new smart contracts based on specific rules and configurations.
This enables developers to create and deploy a large number of similar smart contracts in a streamlined and efficient manner, without having to manually write and deploy each contract individually.
The module factory is an owned factory (imports the Ownable2Step
contract) that is used to deploy all the inverter network modules.
Module factory handles the linking of a module's IModule.Metadata
to its IBeacon
instance contract using the _beacons
mapping.
The registered metadata is used to deploy and initialize inverter modules using the createModule
function.
Note: A metadata's registered IBeacon
implementation can not be changed after registration. You have to register a new IBeacon
implementation by changing the metadata (e.g. by increasing the version).
The orchestrator factory is an immutable factory used for deploying orchestrator contracts.
New orchestrator contracts are created using the function createOrchestrator
which creates and initializes the compulsory and optional inverter modules passed to the function.
The createOrchestrator
also supports late dependency injection to account for modules that require the deployment of other modules for their own initialization.
The BeaconProxy
contract implements a proxy that gets the implementation address for each call.
The beacon address is stored in storage slot uint256(keccak256('eip1967.proxy.beacon')) - 1
, so that it doesn’t conflict with the storage layout of the implementation behind the proxy.
IBeacon
is the interface that BeaconProxy expects of its beacon.