Initializing new contract from another contract?

Is it possible to initialize a new contract from a previous contract? So can we create a new NFT contract from a factory? I know we can host.invoke_contract to call a message on another contract but was wondering if it was possible to create one in the first place?

It is not possible to create a new contract instance from a contract.

You would have to create it separately. You could then “initialize” it by calling a designated “initialize” endpoint.

1 Like

What do you mean here by “initialize”? If I created it separately it is already initialized.

And thank you for the response will need to find a counter for it :slight_smile:

I mean that initialization is whatever you define it to be. In general creating the instance does not have to mean that the smart contract is in any usable state. You could require that a special “initialize” endoint is first called before any other endpoint is enabled.

Makes sense which would change the state. May write a post in the forum explaining it for other devs coming in from Solidity and such as it may be different for them

Of course. We also have an FAQ for ethereum developers here FAQs — Concordium documentation

Perhaps you could expand on that instead? The repository with documentation is here

1 Like