Deploy custom proxy with voting logic for upgrades?

Hi,

I need to have a custom Proxy contract deployed and not the default one that ships with the plugin.

Below is my use case:

  • i would like to add voting logic to the main proxy contract where holders vote if new implementation should be used (they’re given an address to the new implementation, to check the code themselves)
  • if and only if the vote passes, function upgradeTo is allowed to switch the existing implementation contract with the new one

By default one can upgrade to a new implementation through a ProxyAdmin contract whenever they like, which is not safe for the users. I want to add functionality to the main Proxy contract where token holders first approve the switch to the new implementation contract.

So how would I go about that problem?

Also another thing is, I would like to upgrade by setting the address of an already deployed contract (since users need to have access to it for reviewing the code before voting).

Can this somehow be done by integrating the upgrades plugin or do I need to write everything from scratch?

Hope I made myself clear enough :wink:

1 Like

Yeah, just like you know, there is a default one can upgrade contract, if you want to add a feature: voting, you can use governance contract to control the ProxyAdmin contract, so user can vote in the voting contract.

I suggest looking at the following Step by Step Tutorials:

2 Likes

Hi @kesopeso,

Welcome to the community :wave:

As per @Skyge’s recommendation, rather than modifying the proxy, you could use governance to control the upgrade. The Step by Step tutorials show using a multi-sig.

You may also want to look at OpenZeppelin Defender: https://docs.openzeppelin.com/defender/admin

Hi @kesopeso,

Did you need any more information?

Ah yes… that makes sense. Just leave the default setup and change the admin of ProxyAdmin to governance contract. Thx for the info, I think I have it figured out. You guys did an awesome job with upgradable contracts tho :slight_smile:

1 Like