Make the Contracts Upgradeable
Closed this issue · 5 comments
openzepellin/contracts
to openzepellin/contracts-upgradeable
Read: https://docs.openzeppelin.com/contracts/4.x/upgradeable
Also read: https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable
All the stuff above should be skipped and just read https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/
We are using EIP1167 Minimal Proxies to deploy new funds/robocops because funds/robocops are too big for
- Spurious Dragon (both can't fit into BarrenWuffet) and,
- gas costs would be too high for
createFund()
However, minimal proxies can't be used with either ERC173 (supported by default out of hardhat-deploy
's Hot Contract Upgrade), UUPS (not supported by hardhat-deploy
, current OZ recommendation) or, transparent proxies (also supported by hardhat-deploy
). This is because of this simple reason (that I missed somehow): https://forum.openzeppelin.com/t/using-eip1167-with-upgradability/3217
However, as we need both ProxyDeployments of Fund/Robocop AND upgradability, the only other option is to use Beacon pattern as described here: https://blog.openzeppelin.com/the-state-of-smart-contract-upgrades/#beacons. This would mean:
- giving up
hardhat-deploy
's contract upgrade simplification tools, - writing 2 more smart contracts and updating the deployment workflow
- and manually keeping track of upgrades (and writing upgrade scripts - which is slightly eased by
hardhat-upgrades
potentially, though whetherhardhat-deploy
plays well with it is yet to be seen).
Despite the 3 downsides given above, I don't think we have any other choice.
Onwards!