OpenFactory
Inherits: AbstractFactory, Owned
Author: cosimo.demedici.eth (https://github.com/ninfa-labs/ninfa-contracts)
Clone factory pattern contract without any access control or fee required in order to deploy a clone, as long as it originates from a whitelisted master address.
Functions
constructor
The constructor sets the factory fee and calls the constructor of the parent contract.
The constructor sets the contract's owner directly, because the Owned contract was modified to remove its constructor (where owner is normally set).
no multi-role access control was needed as the clone function is open to anyone in this derived contract implementation.
Fee information is set in the base AbstractFactory-constructor
constructor(uint256 _feeNumerator, address _feeRecipient) AbstractFactory(_feeNumerator, _feeRecipient);Parameters
_feeNumerator
uint256
The numerator of the fee fraction.
_feeRecipient
address
The address to receive the fee.
clone
Clone function to create a new instance of a contract.
Parameters
_instance
address
The address of the instance to clone.
_salt
bytes32
A random number of our choice. Generated with https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#randomhex _salt could also be dynamically calculated in order to avoid duplicate clones and for a way of finding predictable clones if salt the parameters are known.
_data
bytes
The initialization data for the clone.
Returns
clone_
address
The address of the new clone.
setMaster
setSalesFeeInfo
see AbstractFactory-salesFeeInfo
Parameters
_feeRecipient
address
The address to receive the fee.
_feeNumerator
uint256
The numerator of the fee fraction.
withdraw
A function to withdraw the balance of the contract deriving from either sales fees accessed via AbstractFactory-salesFeeInfo, or as flat fees for cloning defined in derived contracts, i.e. {PayableFactory-clone}.
Last updated