🏭Factory

Factory Contracts

In the context of dAgora, factory contracts are smart contracts designed to deploy new instances of other contracts on-demand. Utilizing the TransparentUpgradeableProxy pattern, factory contracts enable the creation of upgradable contracts with transparent proxy functionality. This means that users can interact with the deployed contracts in a seamless and more secure manner, with the added benefit of potential future upgrades.

dAgora offers five factory contracts, each catering to specific needs and functionalities. All of these factory contracts make use of the Create2 functionality, allowing contracts to be deployed at deterministic addresses based on the inputs provided. This is made possible by importing the Create2Upgradeable utility from the OpenZeppelin Contracts Upgradeable library.

dAgora Factory Contracts

  1. Dagora ERC20 Factory: A factory contract for creating simple ERC20 token contracts. It offers a custom token supply, mint and burn capabilities, and pausable functionality. When paused, tokens cannot be transferred.

  2. Dagora Simple NFTA Factory: A factory contract for creating ERC721A NFT contracts with basic functionality, including adjustable mint price, bulk minting, customizable base URI and extension, and a pausable feature.

  3. Dagora Payment Splitter Factory: A factory contract for creating ERC721 NFT contracts with integrated payment splitting among designated payees. The contract features adjustable mint price, max supply, bulk buy limit, customizable base URI and extension, and ownership transfer. Payees and their respective shares must be specified, with the sum of shares totaling 100%. This factory contract is restricted to users with valid dAgora Memberships and requires a minimum membership tier for contract creation.

  4. Dagora NFTA Plus Factory: A factory contract designed for creating ERC721A NFT contracts with added allow list and pre-sale functionality through a Merkle root. This contract includes all features from the Simple NFTA Factory.

  5. Dagora Power NFT Factory: A factory contract for creating ERC721 NFT contracts with ERC2981 royalty features, providing a revenue stream for the original creators. This contract also includes all other features from the Simple NFTA Factory.

  6. Dagora Power Plus NFT Factory: A factory contract tailored for creating ERC721 NFT contracts with both ERC2981 royalty features and allow list/pre-sale options using a Merkle root. This contract encompasses all features from previous contracts, except for the Dagora ERC20 Factory.

TransparentUpgradeableProxy

dAgora's factory contracts use the TransparentUpgradeableProxy pattern, which is a combination of the upgradeable proxy pattern and transparent proxy pattern. This approach allows contracts to be upgradeable while ensuring that users can interact with the contract as if they were directly communicating with the implementation. This ensures a seamless user experience and enhances the security of the contracts.

Create2

The Create2 functionality enables dAgora's factory contracts to deploy new contract instances at deterministic addresses. This feature is based on the Ethereum protocol's CREATE2 opcode, which computes the contract's address using a combination of the factory contract address, a user-defined salt, and the contract creation bytecode. By using Create2, dAgora can guarantee that contract addresses are predictable, which is essential for managing and organizing the deployment of multiple contracts.

For more information on the individual factory contracts, their features, and how to use them, consult the respective documentation pages. If you have any questions or need further assistance, please don't hesitate to ask.

Last updated

Logo