Factory Approach

EthereansOS technology has Factories at its core.

What is a Factory?

Generally speaking, a Factory is a smart contract that allows you to clone and deploy the code of a contract model. Cloning a contract means creating a contract exactly like the model, using solidity and assembly, and initializing it with some custom data. Cloned contracts can then be customized and extended through smart contracts called Extensions.


On Ethereum nowadays there are many standards that developers can use, such as the famous ERC20/721/1155 standards. However, the coding approach is to take a standard as a starting point and modify it to add/remove code or functionality to use in your own application or protocol. Using such an approach does not guarantee the security in the development phase that applications and protocols on Ethereum should have. Developers starting from a standard and modifying it can run into bugs and criticality at the security level, intentionally or unintentionally, often resulting in users losing money. Developers, starting from a defined and working standard, can insert anything in the code and so then use a standard that does not guarantee any kind of security or protection for users. Each time developers have to re-deploy their smart contracts from scratch making development on Ethereum much more complex.

This does not even allow for a shared codebase with shared standards. This approach does not push forward the evolution of the technology as developers create code that is difficult for others to integrate.

Moreover, it can also create a problem of interoperability between applications on Ethereum, which instead is one of the great strengths of the technology. Think for example of a token that does not precisely follow the ERC20 standard and makes it difficult to integrate within other applications and requires specific and additional work by developers to integrate only that specific token. Think of an ecosystem where in order to integrate specific tokens or services you need a specific integration every time and also you cannot be sure of the integrity of the code.

.....So why use standards at all?

Factory approach

What changes by using Factories? You have a totally different approach to development and integration. Using Factories and then cloning the code of a model, you guarantee that all deployed contracts follow the same standard perfectly . This means maximum security for users because developers can't modify the contract core and risk creating bugs or security holes, and it avoids malicious behavior altogether. On the other hand, you have maximum integration between different applications because you can be sure that a token or any application built on a Factory follows a certain standard, being able to count on a shared codebase that is constantly updated thanks to the contribution of all the projects that work on EthereansOS developing highly reusable and customizable code.

Using the Factory approach also makes development by developers much faster and safer. They can concentrate on developing code on top of the cloned contract as needed, without having to think about developing the core because they can simply clone it from a Factory without having to write and redeploy the core from scratch.


Using a factory-based approach also provides a high level of customization in a secure environment. In fact, the code of a cloned contract can be customized with specific parameters chosen by the developers at the time of contract deployment and initialization, and most importantly it can be extended. The EthereansOS technology allows to use Extensions, that is one or more smart contracts linked to the cloned contract that extends the on-top functionalities and the possibilities of interaction and external integration, not being able to modify the core and therefore the basic functionalities. Consequently, you have security because the contract, and so the core, is cloned from a model but customization because you can hook an extension on top.

For example, if we take a Farming contract, by cloning the contract from the Factory, a developer will never be able to modify the core to include malicious behavior such as rug pull or similar. However, the contract can be customized with an Extension on top that is able to mint the amount of reward tokens to be sent to the Farming contract from an Organization because it has the permission to do so.

An Extension can be coded freely by the developers according to the needs of the project by being able to use the underlying secure cloned contract. Through the Extensions that can be one or more for a contract, entire applications or protocols can be built.

This approach distinguishes the whole EthereansOS stack. Factories, Guilds, Covenants and Items are developed and using the Factory approach.

Last updated