Does Smart Contract Support Automatic Calling of `initialize()` or `constructor()` Function After Deployment?

Does a smart contract support automatically calling an initialize() or constructor()function after deployment? Specifically, I am looking to understand if the initialize() function can be executed automatically right after the contract is deployed, without requiring a manual trigger or an additional transaction.

This isn’t anything standard. If you want to do initialization you can either use configurables/storage initializers or setup your own function that’s going to be called by the owner.
That function is not a language item and doesn’t have any special behavior. That function is just a regular function.

Ideally with the coming rework of storage and configurables you shouldn’t really need these. But complex storage structures have to be manually initialized right now.

So overall, We have no constructors. Those have to be called after deployment.

1 Like