How to upgrade ERC20 contract when it is live on mainnet

Hi @Ronak,

Welcome to the community :wave:

Thanks for posting in the community forum.

The upgrade and your user transfers are separate transactions so don’t happen simultaneously. The important thing is to appropriately test your upgrade.

Before you upgrade you should:

  • Create and run automated tests to check the upgrade locally
  • Test the upgrade using a fork of mainnet. (see Testing real-world contract upgrades for concepts)
  • Communicate with your community on what changes you are making, why you are making the changes and when you are doing it.

:warning: Storage layout changes means that contracts can’t be upgraded from OpenZeppelin Contracts Ethereum Package v2.5 to OpenZeppelin Contracts Ethereum Package v3.0

Depending what version of OpenZeppelin CLI you are using, you can just use npx oz upgrade, though given network congestion and gas prices you may be better to break it down into push (to push the logic contract) and upgrade (to update the proxy to use the new logic contract) transactions. (At the time of writing standard was 40 Gwei: https://www.ethgasstation.info/)