How to make an ERC-20 token and Crowdsale upgradeable?

So, here a quick details about my setup. I am using Truffle. I am using OpenZeppelin v3 for my ERC-20 token and v2.5 for my crowd sale. Apart from that, I am using Chainlink (installed via npm) to fetch some data.

I am struggling a bit on how to make my contracts upgradeable. I don’t clearly understand the concept I guess, Do I have to run everything I am doing inside the constructor in “initialize”. If someone can share an example of something like an ERC-20, that would be great.

P.S;- Sorry for so many questions in the past 2-3 days. It’s just my first full-fledged blockchain product launch and I am really nervous about it.

2 Likes

Hi there!

Yes, that's a limitation of the transparent proxy pattern and you can read the details in the Writing upgradeable contracts section of the documentation. In short, the reason for this is that the constructor code is not included in bytecode of a deployed contract hence your Proxy contract won't find that logic in its Implementation contract.

You can use OpenZeppelin Contract's evil twin: OpenZeppelin Contracts Ethereum Package, an upgrade-ready version of the former.

No problem at all! This forum has a whole Support category for that very purpose :slight_smile:

1 Like

Hi @PradhumnaPancholi,

If you are testing and deploying upgradeable contracts you can use OpenZeppelin Upgrades Plugins: https://docs.openzeppelin.com/upgrades-plugins/1.x/

There are step by step tutorials:


As for getting ready for launch:

1 Like