Closed miohtama closed 4 years ago
Hi @miohtama! Thanks for the suggestion, it is really appreciated.
The project owner should review your suggestion during the next week.
Please wait until we have discussed this idea before writing any code or submitting a Pull Request, so we can go through the design beforehand. We don’t want you to waste your time!
Hi @miohtama! Thank you for bringing this up. We completely agree that the use of global state here is really bad, and it's one of the things we want to improve for the next releases. I'm closing this issue in favor of https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1308. Make sure to subscribe to that one for any updates.
Proxy helper class wraps the management of Proxy contract.
This helper class refers to
ZWeb3
which has globals variables includingZWeb3.web3
. ThisZWeb3.web3
is used inProxy.admin()
.The usage of globals makes harder to reuse this class, e.g. in testing. One has to manually set globals first, before calling
Proxy.admin()
.A cleaner solution, both usage and API wise, is that one can pass Web3 instance to the Proxy helper class constructor.
Here is a demostration of the problem from a Jest testing code