A Factory is a smart contract acting as a repository of a model contract that others can clone and implement for their own particular use-case. A cloned contract can be initialized with custom parameters and extended with a custom Extension contract for a variety of purposes, guaranteeing that no one can modify its core.
Development of any application is made much faster and safer following this approach. Devs can focus on developing code on top of the cloned contract as needed, without having to think about developing the core or to write and redeploy it from scratch.
The entire EthereansOS ecosystem is built following the Factory approach.
Factories allow devs to easily clone specific smart contracts/services without the need to write a line of code. Cloning a contract that has already been developed, tested and used by many users is safer than re-deploying it from scratch.
This is a strong revolution compared to the current approach of coding that is based on taking a standard (e.g. the ERC20) as a starting point and modifying it to add/remove code or functionality, not ensuring that bugs or malicious operations are not present in the contracts, often resulting in users losing money. This does not even allow for a common codebase with shared standards and the evolution of the technology is not pushed forward as developers create code that is difficult for others to integrate.
The Factory approach, instead, points to the evolution of the entire development ecosystem following the principles of security, ease of code implementation and the creation of a constantly updated shared codebase, making development much less complex.
Using a Factory-based approach provides a high level of customization in a secure environment. Developers can extend the code of a contract cloned by a Factory, using an Extension smart contract. The Extension is linked to the cloned contract extending its on-top functionalities and the possibilities of interaction and external integration. Consequently, you have security because the contract core is cloned from a model but you can hook an Extension on top implementing custom logic according to your project needs.
The result is a secure cloned contract, extendable and integrable through Extensions.
The Factory-of-Factories (FoF) is a Factory deployer and aggregator and it represents the heart of the Factory-based approach.
The FoF allows: Every developer to deploy one or more Factories at the same time or at a later date Discoverability: reconstruct all existing Factories that are always saved on-chain including the reference address that deployed them Versioning: deploy a new version of a Factory having the old one always available to be used by users at any time Metadata: each Factory has its own set of metadata that FoF allows to easily reconstruct Modularity: Factories deployed by FoF represent a shared codebase composed for many different uses. You can create your own project by cloning and implementing contracts from different Factories Extendibility: each contract cloned from different Factories can be extended using Extension smart contracts so that they perfectly fit the needs of your project
Devs can implement a real business model in their Factories and in the underlying model contracts, earning fees every time their contracts are cloned and/or used.
Only the Factories deployed through the Factory-of-Factories (FoF) can implement a real fee-based business model.
The Factory maker can choose from two possible fee-based business models:
- Creation fee. This model allows the Factory maker to implement a fee for cloning the model contract, involving the burn or transfer of a certain amount of tokens.
- Usage fee. This model allows the Factory maker to implement a fee for the use of all clones of the Factory’s model contract. The usage fee can be static (a fixed amount of a specific token that users must burn or transfer using the cloned contracts), or variable (a percentage of the value a user transacts).