How to allow proxy admin to call logic functions?


#1

Hi. I am working on an app that uses a factory to create proxy contracts. There is a logic “game” contract, and if a user wants to stand up their own game, a proxy is created. So, there can be many users that have their own proxy contract that all point to the logic contract. A user is the admin of the proxy so they can transfer ownership of the proxy to another user, but I also need them to access functions in the logic contract.
I am not using the CLI, I am importing the Zeppelin proxy contracts. When calling a logic function from the proxy admin address I get the
Error: VM Exception while processing transaction: revert Cannot call fallback function from the proxy admin because of the transparent proxy pattern.

Is there any way to structure this so that a proxy admin can call the logic functions?


#2

Hey @kseniya! The proxyAdmin is specifically set up so it only calls proxy management functions (ie upgrade, setAdmin) on the proxy, and no logic functions at all. This post explains a bit more about the rationale for that, but given that you are already mentioning the transparent proxy pattern, my guess is that you’re already familiar with it.

That said, if a user needs to access logic functions on the proxy contract, then the recommended way to go is for them to call directly to the proxy, and not try to go via the ProxyAdmin. So, all in all:

  • Each user (let’s say Alice) is the owner of a ProxyAdmin (PA), and has a Proxy (P ) to the single shared logic contract with the game logic (Game).
  • If Alice wants to interact with the game, she sends a tx directly to P.
  • If Alice wants to transfer her game, or upgrade it to a new version, she sends a tx with that to PA.

Let me know if this makes sense in your context!