Proxy contract modification restriction

We are using OpenZeppelin's library for our proxy pattern.
Just want to double-check on the restriction on the new version of the contract.
It is mensioned here that
https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#modifying-your-contracts
we cannot change the order in which the contract state variables are declared, nor their type.

How about functions? Can we change a function's signare?
How about imports? Can we add more library / interfaces?

This type of proxy uses the DELEGATECALL EVM instruction to call the proxy. This instruction is used to call a contract method in the "context" (local storage, address and balance) of the caller contract.

This is the reason state variable cannot change, only be appended to. The Solidity compiler assigns storage slots to variables in the order it finds them.

Adding more contract code just means that the proxy delegates to a different address (of the new version).

1 Like

Yes you can do both of these things.