If you want to deploy the standard Factory contract as it is, you have to initialize it in the following way:
//host to initialize the lazyInitCapableElement levelvar host ="0x........"//plainUri and dynamicUriResolver to initialize the DynamicMetadataCapableElement levelvar plainUri ="yourUri"var dynamicUriResolver ="0x......."//modelAddress to initialize the Factory level. It is the model contract that your Factory will clonevar modelAddress ="0x......"//encode all the parametersvar data =web3.eth.abi.encodeParameters(["address"], [modelAddress]);data =web3.eth.abi.encodeParameters(["string","address","bytes"], [plainUri, dynamicUriResolver, data]);data =web3.eth.abi.encodeParameters(["address","bytes"], [host, data]);
Then, as explained in the previous page, you have to generate the Factory bytecode and pass it to the create function of the FoF:
If you want to deploy a custom Factory implementing the standard Factory contract, you have to initialize it in the following way:
//host to initialize the lazyInitCapableElement levelvar host ="0x........"//plainUri and dynamicUriResolver to initialize the DynamicMetadataCapableElement levelvar plainUri ="yourUri"var dynamicUriResolver ="0x......."//modelAddress to initialize the Factory level. It is the model contract that your Factory will clonevar modelAddress ="0x......"//your Factory custom parameters to initializevar yourCustomData1 ="test"var yourCustomData2 ="0x..."//encode all the parametersvar data =web3.eth.abi.encodeParameters(["string","address"], [yourCustomData1,yourCustomData2]);data =web3.eth.abi.encodeParameters(["address","bytes"], [modelAddress, data]);data =web3.eth.abi.encodeParameters(["string","address","bytes"], [plainUri, dynamicUriResolver, data]);data =web3.eth.abi.encodeParameters(["address","bytes"], [host, data]);
Then, as shown above, you have to generate the Factory bytecode and pass it to the create function of the FoF.
Initialize your Factory with a business model
If you want to deploy a custom Factory with a fee-based business model, the initialization depends on the parameters to initialize in your Factory.
Here is shown as an example a Factory that implements the EthereansFactory abstract utility contract (more info here):
//host to initialize the lazyInitCapableElement levelvar host ="0x........"//plainUri and dynamicUriResolver to initialize the DynamicMetadataCapableElement levelvar plainUri ="yourUri"var dynamicUriResolver ="0x......."//modelAddress to initialize the Factory level. It is the model contract that your Factory will clonevar modelAddress ="0x......"// fee-business model parametersvar feePercentageForTransactedvar feeReceivervar tokenToTransferOrBurnAddressInCreationvar transferOrBurnAmountInCreationvar transferOrBurnReceiverInCreationvar tokenToTransferOrBurnAddressInApplicationvar transferOrBurnAmountInApplicationvar transferOrBurnReceiverInApplication//your Factory custom parameters to initializevar yourCustomData1 ="test"var yourCustomData2 ="0x..."var data =web3.eth.abi.encodeParameters(["string","uint256"], [yourCustomData1, yourCustomData2]);data = web3.eth.abi.encodeParameters(["uint256", "address", "address", "uint256", "address", "address", "uint256", "address", "byes"], [feePercentageForTransacted, feeReceiver, tokenToTransferOrBurnAddressInCreation, transferOrBurnAmountInCreation, transferOrBurnReceiverInCreation, tokenToTransferOrBurnAddressInApplication, transferOrBurnAmountInApplication, transferOrBurnReceiverInApplication, data]);
data =web3.eth.abi.encodeParameters(["address","bytes"], [YourModelAddress, data]);data =web3.eth.abi.encodeParameters(["string","address","bytes"], [YourUri, dynamicUriResolverAddress, data]);data =web3.eth.abi.encodeParameters(["address","bytes"], [hostAddress, data]);var Factory =awaitcompile('.../.../impl/ExampleFactory');var FactoryBytecode =newweb3.eth.Contract(Factory.abi).deploy({data :Factory.bin, arguments : [data]}).encodeABI();
Here you can find the explanation of the fee business model parameters.
Then, as explained in the previous page, you have to generate the Factory bytecode and pass it to the create function of the FoF: