Why is Initialize function declared as puplic

Hello! I noticed that people very often declare visibility of initialize function as public. And in examples of your documentation I found it too. Could you explain me whether it is really important and why? It seems that it also can be external.

Thank you

Hi, welcome to the community! :wave:

Good question, cause when you use the proxy pattern, you need to initialize state manually rather than by constructor() in the proxy contract, so you should use external or public, and in the implementation contract, sometimes, you also need to call initialize in another function, so in order to have better compatibility, it will use public.

And for more details about the proxy pattern, maybe you can have a look at the documentation: Writing Upgradeable Contracts - OpenZeppelin Docs