Create a child contract and pass init params

What is the correct way to create a contract from another contract and pass initialize parameters to it? I have one project file with the parent contract and I want to call another project file in my src folder called and create the contract ChildContract and pass initialization parameters.

Am I suppose to call the child struct with the macro (sdk::create_contract!(ChildContract);?

Before digging into the solution for contract creation within the contract, are you sure you want this? Cipher has - in contrast to EVM - three contract operations to avoid contract wrappers: upload, instantiate and upgrade. The first one uploads your WASM code, the second one instantiates it and the third replaces the code of already instantiated contract with a new code and you can also pass specific upgrade/migration parameters.

Yes, in Rust, you can create a contract from another contract and pass initialization parameters to it using the sdk::create_contract! macro!

Hello, I was busy with another project for some time. The sdk::create_contract! macro doesn’t appear to have the functionality to pass initialization parameters. Can anyone provide an example of how to do this? My project needs to have a master contract that can spawn a child contract and initialize it passing a parameter.

If this functionality does not currently exist it would be great to see it implemented. If this is not possible then a work around would be to capture or predict the child contract address at time of calling. The documentation is limited and would be nice to have a confirmation of this process. I am assuming it can be calculated with the nonce of the master.