I've deployed three contracts in mainnet but I must transfer the ownership of all of them. They are proxies upgradeable with UUP pattern. When I transfer the ownership of a proxy contract what do I have to call?
I'm currently calling the "transferOwnership" function. Should I call the "changeAdmin" function passing the address of the new owner? Or should only call the "transferOwnership" function and leave the rest as it is?
Depends what you want to do - change the account which can upgrade the logical contracts, or change the account which controls the logical contracts (i.e., allowed to call their limited-access functions)?
I thank you for your answer. I would like to do both
Then do both.
Keep in mind that the proxy contract admin and the logical contract admin must be two different accounts.
Thank you! I didn't remember that detail so you saved my ass
Just a thing. How can I call the upgradeAdmin function? When I try to interact with it directly from polyscan it gives me an error:
I'm calling this proxy using the address I've used to deploy these contracts
The upgrader account is not necessarily the same as the deployer account.
When you deployed the proxy contract, one of the input parameters that you passed to it (i.e., one of the input parameters in the proxy contract's constructor) should be the address of the upgrader.
In order to upgrade the logical contract, you need to use that upgrader account.
Last question regards this topic: I need to hand over the ownership of the proxy contract to another user. I'm calling the changeProxyAdmin function of hardhat. Next I'm going to call the transferOwnership of the proxy contract. Is this all correct?
In this case the owner of the contract will be the proxy admin too. Is this doable?
Don't do that, because the proxy admin would not be able to call any functions on the Transparent proxy other than admin-related functions!
Instead, you should call transferProxyAdminOwnership and transferOwnership to transfer both the ProxyAdmin contract and the proxy to the new owner.
I've got to be honest. My coworkers told me to hurry so I did what I told you before. Am I completely screwed? I've tried to make an upgrade using the new ProxyAdmin set using changeProxyAdmin and the upgrade worked.
As long as the upgrades "works" my client is happy. I've now learnt thanks to you what to do the next time
If an address is both the proxy admin and the owner, then that address can only call admin functions, not the regular contract functions. If that is a problem, you can fix it by changing the proxy admin again to another address so that the proxy admin and owner are different.