Upgradeable and Interfaces

How do we deal with interfaces and upgradeable? Here is my use case

I have a main proxy that is interfacing my vaults contracts. They are all upgradeable, Now if I was to upgrade my vault with a new function, I would also need to upgrade my main proxy with the new interface as well.

Is that how it’s working? I’m not certain because the doc mention that I can’t change the type of what was already declared. I can reuse it or add after it. How does this apply to interfaces?

1 Like

I found the proxy forwarding feature, This process is to forward the call to the implementation. Could I use that to forward the calls to another proxy as well so I don’t have to worry about the interface?

1 Like

Hi @madeindreams,

If I understand correctly you have a main contract that calls the interface of other upgradeable contracts and you want to add new functionality to that interface.

If your main contract, how do you store the state of the vault contracts. e.g. is it a mapping of the vault interface?

1 Like

Good morning @abcoathup

When I deploy a vault I record the address and other info in a struct and also have a mapping for that struct.

import "./myVaultInterface.sol";

uint256 vaultCounter;
mapping(uint256 => _Vaults) vaults;

struct _Vaults{
  uint256 id;
  address addr;
  string name:
}

So I’m wondering how to deal with that interface when the vault get upgraded with a new function.

So I’m only mapping the address of that vault.

1 Like

Hi @madeindreams,

You should only need to upgrade your main contract if you needed to add/change functionality that you are calling through the interface of the vault.

I assume the vault struct doesn’t need to change, so you aren’t actually changing state if you upgrade your main contract.

1 Like