> For the complete documentation index, see [llms.txt](https://gabriel-j-shapiro.gitbook.io/metalex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-reference/factories.md).

# Factories

Factories deploy cyberCORPs and their contracts.

## CyberCorpFactory

The top-level entry point.

* **Source:** [`src/CyberCorpFactory.sol`](https://github.com/MetaLex-Tech/cybercorps-contracts/blob/develop/src/CyberCorpFactory.sol)
* **Inherits:** `UUPSUpgradeable`, `BorgAuthACL`

```solidity
function deployCyberCorp(bytes32 salt, string companyName, string companyType,
    string companyJurisdiction, string companyContactDetails,
    string defaultDisputeResolution, address _companyPayable,
    CompanyOfficer _officer)
    external returns (address cyberCorp, address auth, address issuanceManager,
                      address dealManager, address roundManager);

function deployCyberCorpAndCreateOffer(/* ... */) external returns (/* corp suite + deal */);
function deployCyberCorpAndCreateRound(/* ... */) external returns (/* corp suite + roundId */);
function deployAndInitializeRoundManager(bytes32 salt, address cyberCorp) public returns (address);
```

`deployCyberCorp`:

1. Deploys a `BorgAuth` ACL via `CREATE2` and grants the officer level `200`.
2. Deploys the `IssuanceManager`, `CyberCorp`, `DealManager`, and `RoundManager` through their respective sub-factories and initialises them.
3. Grants the `IssuanceManager`, `DealManager`, and `RoundManager` BorgAuth level `99`, and the `CyberCorp` level `200`.
4. Emits `CyberCorpDeployed`.

The `deployCyberCorpAndCreate*` variants additionally create cert printers and open a deal or a round in the same transaction.

Setters (`onlyOwner`): `setStable`, `setIssuanceManagerFactory`, `setCyberCorpSingleFactory`, `setCyberAgreementFactory`, `setDealManagerFactory`, `setRoundManagerFactory`, `setLexchexAuth`.

## Sub-factories

`CyberCorpFactory` composes:

| Factory                  | Deploys                                                                                    |
| ------------------------ | ------------------------------------------------------------------------------------------ |
| `CyberCorpSingleFactory` | the `CyberCorp` proxy; holds the reference implementation that gates `CyberCorp` upgrades. |
| `IssuanceManagerFactory` | the `IssuanceManager` (and its `CyberCertPrinter` / `CyberScrip` beacons).                 |
| `DealManagerFactory`     | the `DealManager`.                                                                         |
| `RoundManagerFactory`    | the `RoundManager`.                                                                        |

The `CyberAgreementRegistry` is shared (passed in as `registryAddress`).

## Specialised factories

These build on the same primitives for specific structures:

| Factory           | Source                    | Purpose                                                                |
| ----------------- | ------------------------- | ---------------------------------------------------------------------- |
| `PumpCorpFactory` | `src/PumpCorpFactory.sol` | Deploys cyberCORPs configured for **ACE** (token-to-equity) offerings. |
| `MetaDAOFactory`  | `src/MetaDAOFactory.sol`  | Deploys MetaDAO futarchy-governed SPC structures.                      |
| `ParentCoFactory` | `src/ParentCoFactory.sol` | Deploys parent/subsidiary cyberCORP structures.                        |

> The specialised factories are documented here at a high level. Consult their source for exact constructors and deployment parameters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-reference/factories.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
