district0x / name-bazaar

A peer-to-peer marketplace for the exchange of names registered via the Ethereum Name Service
Eclipse Public License 1.0
86 stars 23 forks source link

Make OfferingRegistry a proxy contract #188

Closed madvas closed 3 years ago

madvas commented 3 years ago

Since ENS will be undergoing additional upgrades, it'll be useful if we put OfferingRegistry behind proxy contract, so its address stays the same even if we need to update the code. OfferingRegistry is responsible for firing all NameBazaar events, so being able to listen to just 1 address is very handy.

In our other project we use MutableForwarder.sol, which is just like regular Forwarder except its target can be changed by authorised address.

So, during deployment we'll first deploy OfferingRegistry, then we deploy MutableForwarder with its target being OfferingRegistry address. In smart_contracts.cljs, :offering-registry will be address of MutableForwarder. Also, anywhere in deployment code, where we pass OfferingRegistry address to other contracts, we should pass MutableForwarder address.

So later in future, if we need to update OfferingRegistry code, we'll deploy new OfferingRegistry and then call setTarget on existing MutableForwarder with the new address. Of course OfferingRegistry updates will need to be append-only, otherwise existing state could get messed up.