Firm Factory
Last updated
Last updated
Firm Factory manages the creation and setup of new Firm organizations. The has been built to allow a one-transaction setup after which the organization can be fully functional in the desired initial state.
For v1, Firm Factory allows creating a new organization with one instance of all the modules that Firm protocol v1 offers.
Since at the core of every Firm there’s a Safe which represents the board of directors of the company, either Firm is installed into a pre-existing Safe (via a Safe multisig transaction) or Firm Factory creates one for the user by using Safe’s own factory.
The createFirm()
entry point allows users to create a new organization from scratch with a brand new Safe and one instance of all the modules that Firm protocol v1 offers. This entry point takes in two parameters, a SafeConfig
and a FirmConfig
:
The SafeConfig
is used to configure the Safe which acts as the board of directors of the organization. It contains details such as the owners of the Safe and the number of confirmations required for Safe transactions.
The FirmConfig
is used to configure the Firm-specific modules. It contains details such as the Budget, Roles, Captable and Voting configuration of the organization (Budget and Roles are compulsory, but Captable and Voting are optional based on the withCaptableAndVoting
boolean).
The budgetConfig
parameter contains an array of AllowanceCreationInput
objects which specify the initial allowances to be created for the organization.
The rolesConfig
parameter contains an array of RoleCreationInput
objects which specify the roles to be created along with their associated grantees.
The captableConfig
parameter contains the name of the captable and an array of ClassCreationInput
and ShareIssuanceInput
objects which specify the details of the Captable classes and share issuances.
Finally, the votingConfig
parameter contains details about the voting settings for the organization.
The setupFirm()
entry point allows existing Safes to install the modules associated with Firm protocol v1. This entry point takes in a FirmConfig
as its configuration parameter, and is used to configure the Firm-specific modules.
In order to use it, existing Safe’s must perform a delegatecall
to setupFirm()
. It is the same function which gets internally used in a new Safe when createFirm
is used
UpgradeableModuleProxyFactory
is used for keeping a versioning registry of different modules, deploying them, and initializing proxies.
The register()
function allows the owner of the system to register an implementation of a module with a specific version number. This function can only be called by the owner of the contract, and it ensures that an implementation of the same version is not registered twice.
The deployUpgradeableModule()
function allows users to deploy a proxy for a given module. This function has two overloads; one which takes in a moduleId
and version number and the other which takes in the address of the implementation contract directly. When specifying the version number, there’s a special flag type(uint256).max
which can be passed to request the latest available version the module.