I have deployed a contract on the Sepolia network using a transparent proxy. However, when attempting to upgrade the contract, the transaction is reverting. I would appreciate any assistance or solutions to resolve this issue, and I am performing this on the foundry
Here's the code:
VaultConfig vaultConfigImpl = new VaultConfig();
TransparentUpgradeableProxy vaultConfigProxy =
new TransparentUpgradeableProxy(address(vaultConfigImpl), address(proxyAdmin), "");
vaultConfig = VaultConfig(vaultConfigProxy);
vaultConfig.initialize(deployer);
I am assuming, that you are using version 5 of Openzeppelin.
If yes, then you don't need to deploy a separate proxyAdmin contract.
The transparentUpgradeableProxy deploys a proxyAdmin from it's constructor itself. So instead of deploying proxyAdmin and passing it's address to proxy's constructor. You should pass your EOA address, which was supposed to be the owner of proxyAdmin.
Thanks!, can you help with this query as well, Does this mean that each time I deploy a new transparent proxy contract, a new ProxyAdmin contract will also be created? I want one proxy admin for all of my contracts
The admin address is stored twice, first one is the immutable varible in the proxy contract itself, and the second one is for ERC1967 compatibility, which is stored in a specific storage slot.
Although this specific slot can be updated from the implementation, but this won't actually change the admin.