This is a repository for smart contract upgrading using multisig and Open Zeppelin Defender. To get started, you will need the following:
- Defender Account. Head over Open Zeppelin to sign up
- Infura Server
- Multisignature wallet. Check out on Gnosis
- Installed dev dependencies
- Preparing .env variables (API and private keys)
Run npx hardhat run scripts/deployV1.ts --network goerli
to start. There should be three contract deployed:
- Box (implementation, copy this address for verifying)
- Proxy Admin
- Proxy Contract (copy this for V2 upgrade)
Run npx hardhat verify YOUR_BOX_V1_ADDRESS --network goerli
, you may get error message on terminal. The verification may still succeed, please recheck at etherscan.
Prior to upgrading contract, please make sure you have changed the PROXY address variable in deployV2.ts to your own proxy contract address, then run npx hardhat run scripts/deployV2.ts --network goerli
Run npx hardhat verify YOUR_BOX_V2_ADDRESS --network goerli
to verify the newly created implementation contract.
Change MULTI_SIG_ADDRESS value in transfer-ownership.ts to your own Gnosis Multisig address. Then run npx hardhat run scripts/transfer-ownership.ts --network goerli
, now the Multisig is the proxy owner.
To upgrade into V3, you need to prepare a proposal to be signed by multisig wallet. Please adjust PROXY variable address to your prior running the script. Run npx hardhat run scripts/prepareV3.ts --network goerli
it should return the BoxV3 implementation address, verify it using hardhat verify. Copy the address to make upgrade proposal in Openzeppelin Defender.
Add your Proxy Contract address to open zeppelin, then initiate the upgrade. Put the BoxV3 address as the latest implementation address. Insert title and decription and click propose.
You can sign and execute the upgrade proposal via Defender or Gnosis. Once it is signed and executed, the upgrade should be applied.