- Deploy the ProxyExample contract's first version.
npx hardhat compile
npx hardhat run --network mumbai .\deploy\proxyDeploy.js
- Visit the proxy address in mumbai scan and click code
- In the code tab, click 'More Options' button and select 'Is this a proxy?' in the dropdown menu.
- Click verify button in the modal showing in the new page
- You can get the implementation address of this proxy address.
- Verify the implementation contract.
npx hardhat verify <implementationAddress>
- In the modal of 4, click save button. Success!
- Write proxyUpgrade.js script. In this file, copy the proxy contract address in the proxyAddress variable.
- Deploy the upgraded contract.
npx hardhat compile
npx hardhat run --network mumbai .\deploy\proxyUpgrade.js
- Repeat the 2 ~ 7 in the How to deploy proxy contract
- In the 'Read as Proxy' and 'Write as Proxy' tab, you can see the updated functions.
If you insert in the middle of exisitng storage variables, then the storage will break.