When Upgrading a Smart Contract, Do We Need to Copy-Paste The Previous Code?

Hey guys,

I deployed an upgradeable ERC20 smart contract to testnet for educational purposes. Now that I want to make some upgrades to the smart contract, do I have to copy-paste the code from the previous smart contract or can I extend the new smart contract with the old smart contract, for example:

contract TokenV2 is TokenV1 {
    // Updates go here.. 

You can extend by inheriting from the old version. This is actually a very smart way to ensure storage compatibility.

1 Like

Thank you for the response! I sincerely appreciate it.