Upgrade your smart contract using OZ CLI

Hey everyone! I published my first medium article on writing upgradeable smart contracts for starters using OZ CLI, would love to get a feedback on it as well as get corrected if I happened to make some mistakes! :smiley:

I'd like to thank @abcoathup for guiding me so thoroughly on this! Will write for programmatic upgrade next! :wink:


This is gold, thanks.


Thank you so much @Tezas ! Glad you liked it! :smiley:
If you happen to follow along… do let me know how it goes! :heart:

1 Like

Hi @asmeedhungana,

Thanks for sharing your article. :pray:
Really appreciate you writing about your experience.

I had the following feedback:

I noticed a typo, @opennzeppelin/cli should be @openzeppelin/cli

When using secrets, it is worth reminding readers not to commit to version control as there are bots waiting to sweep funds from any accounts with Ether. Same goes for API keys. It is worth adding the secrets file to .gitignore.

I prefer the term Test or Testnet Ether rather than Fake Ether. It’s real, we don’t generally asign monetary value. :smile:

In the upgrade you added a library.

We would need to be careful if we added a new base contract, to ensure it didn’t impact how variables are stored.

Thanks again, I enjoyed reading it.

1 Like

Thanks for all the corrections! I really value them a lot and will make sure to update them right away!

What shall I do about the base contract addition though? Shall I warn the users about it or…
what would you rather have me do about it?

1 Like

Hi @asmeedhungana,

You could just make a note for your readers, something like:

:warning: Changing or adding parent contracts can change the storage variables of your contract.

This is based on: https://docs.openzeppelin.com/upgrades/2.8/writing-upgradeable#modifying-your-contracts

Note that you may also be inadvertently changing the storage variables of your contract by changing its parent contracts … swapping the order in which the base contracts are declared, or introducing new base contracts, will change how the variables are actually stored … You also cannot add new variables to base contracts, if the child has any variables of its own.

1 Like

Hmm… sure! Thanks! :smiley:

1 Like

A post was split to a new topic: Add new state variable to base contract for upgradeable contracts