Updating contract variable that references another contract

Hi everyone!

I'm dealing with the current situation right now and want to check with you. Working with an UUPS smart contract where the storage layout looks like this:

address public firstVar;
uint256 public secondVar;
ContractA public contractA;

ContractA is another UUPS smart contract which I want to rename to ContractB. So the new storage layout will have the following structure:

address public firstVar;
uint256 public secondVar;
/// @custom:oz-renamed-from contractA
ContractB public contractB;

Since ContractB will have the same storage layout/methods and contractB (formerly contractA) holds only the contract address, is it safe to upgrade it?

Thanks!

Yes, it is safe to upgrade it.

1 Like